Files
mercury/trace/mercury_trace_readline.h
Fergus Henderson 88a513b580 Reorganize the routines for allocating and deallocating memory:
Estimated hours taken: 8

Reorganize the routines for allocating and deallocating memory:

runtime/mercury_std.h:
runtime/mercury_misc.c:
runtime/mercury_memory.h:
runtime/mercury_memory.c:
	- Put the routines in the proper place.
		Previously the declarations and definitions of the memory
		allocation/deallocation routines were spread amoungst
		all four of these files; I moved the ones in mercury_std.h
		and mercury_misc.c so that they are now all defined
		in mercury_memory.{h,c}
	- Avoid unnecessary duplication
		The following routines did exactly the same thing,
		modulo bugs(!):
			allocate_bytes()	and newmem()
			deallocate_bytes()	and oldmem()
			make()			and allocate_object()
			make_many()		and allocate_array()
	- Use appropriate names.
		I added `MR_' prefixes, and ensured that macros that are not
		function-like macros use all uppercase.  I also used a more
		consistent naming scheme.
		Previously the names used were
			(1) checked_malloc, checked_realloc
			(2a) allocate_bytes, deallocate_bytes, reallocate_bytes,
				allocate_object, allocate_array, resize_array
			(2b) newmem, oldmem, resizemem,
				make, make_many, resize_many
		The new names are
			(1) MR_malloc, MR_free, MR_realloc,
				MR_NEW, MR_NEW_ARRAY, MR_RESIZE_ARRAY
			(2) MR_GC_malloc, MR_GC_free, MR_GC_realloc,
				MR_GC_NEW, MR_GC_NEW_ARRAY, MR_GC_RESIZE_ARRAY

runtime/*.[ch]:
trace/*.[ch]:
library/array.m:
library/benchmarking.m:
library/io.m:
library/std_util.m:
extras/odbc/odbc.m:
extras/aditi/aditi.m:
	Use the new names.
1999-10-18 15:47:39 +00:00

31 lines
1.0 KiB
C

/*
** Copyright (C) 1998-1999 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
*/
/*
** mercury_trace_readline.h: simple interface functions to read a line.
**
** Main authors: fjh, zs.
*/
#include <stdio.h> /* for FILE */
/*
** Print the prompt to the `out' file, read a line from the `in' file,
** possibly using GNU readline for command-line editing, and return it
** in a MR_malloc'd buffer holding the line (without the final newline).
** If EOF occurs on a nonempty line, treat the EOF as a newline; if EOF
** occurs on an empty line, return NULL.
*/
char * MR_trace_readline(const char *prompt, FILE *in, FILE *out);
/*
** Read a line from a file, and return a pointer to a MR_malloc'd buffer
** holding the line (without the final newline). If EOF occurs on a
** nonempty line, treat the EOF as a newline; if EOF occurs on an empty
** line, return NULL. Don't use GNU readline.
*/
char * MR_trace_readline_raw(FILE *in);