mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 20:33:55 +00:00
Estimated hours taken: 4 Clean up the handling of configuration macros in the runtime. runtime/mercury_conf.h.in: runtime/mercury_conf_param.h: Move the code to set configuration parameters based on the values of other configuration parameters from mercury_conf.h.in to a new file mercury_conf_param.h, because otherwise autoconf munges the code in undesirable ways (it replaces all `#undef <foo>' statements with `/* #undef <foo> */'). runtime/mercury_conf.h.in: runtime/mercury_conf_param.h: runtime/*.h: runtime/*.c: Use more meaningful names, starting with the usual `MR_' prefix, for various configuration parameters: - replace the existing configuration macros SPEED with three new macros MR_CHECK_OVERFLOW, MR_LOWLEVEL_DEBUG, and MR_DEBUG_NONDET_STACK; - rename DEBUG_GOTOS as MR_DEBUG_GOTOS, and make it implied by MR_LOWLEVEL_DEBUG; - rename DEBUG_LABELS as MR_CHOOSE_ENTRY_POINT. (But there are still many configuration parameters that don't start with `MR_', I'm afraid.) runtime/CFLAGSFILE: runtime/mercury_conf_param.h: Removed CFLAGSFILE. The documentation there was had rotted badly. I moved most of it to mercury_conf_param.h where hopefully it will stand a better chance of being kept up-to-date. I added documentation for the configuration parameters added in the last year or so. The documentation here now covers every configuration parameter that we use; please keep it that way! runtime/mercury_debug.h: Fix a bug: there was a misplaced "#endif". runtime/mercury_stack_trace.c: Fix yet another misspelling of "deterministic".
70 lines
1.7 KiB
C
70 lines
1.7 KiB
C
/*
|
|
** Copyright (C) 1993-1995, 1997-1998 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.
|
|
*/
|
|
|
|
/*
|
|
** std.h - "standard" [sic] definitions for C:
|
|
** bool, TRUE, FALSE, min(), max(), streq(), etc.
|
|
*/
|
|
|
|
#ifndef MERCURY_STD_H
|
|
#define MERCURY_STD_H
|
|
|
|
#include <stdlib.h> /* for size_t */
|
|
#include <assert.h> /* for assert() */
|
|
|
|
#ifndef reg
|
|
#define reg register
|
|
#endif
|
|
#ifndef bool
|
|
#define bool char
|
|
#endif
|
|
|
|
#ifndef max
|
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
|
#endif
|
|
#ifndef min
|
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
|
#endif
|
|
|
|
#define streq(s1, s2) (strcmp(s1, s2) == 0)
|
|
#define strdiff(s1, s2) (strcmp(s1, s2) != 0)
|
|
#define strtest(s1, s2) (strcmp(s1, s2))
|
|
#define strneq(s1, s2, n) (strncmp(s1, s2, n) == 0)
|
|
#define strndiff(s1, s2, n) (strncmp(s1, s2, n) != 0)
|
|
#define strntest(s1, s2, n) (strncmp(s1, s2, n))
|
|
|
|
#define ungetchar(c) ungetc(c, stdin)
|
|
|
|
/* XXX these should go in mercury_memory.h or mercury_heap.h */
|
|
#define make(t) ((t *) newmem(sizeof(t)))
|
|
#define make_many(t, n) ((t *) newmem((n) * sizeof(t)))
|
|
#define resize_many(t, p, n) ((t *) resizemem((p), (n) * sizeof(t)))
|
|
|
|
#ifndef TRUE
|
|
#define TRUE 1
|
|
#endif
|
|
#ifndef FALSE
|
|
#define FALSE 0
|
|
#endif
|
|
|
|
/*
|
|
** For speed, turn assertions off,
|
|
** unless low-level debugging is enabled.
|
|
*/
|
|
#ifdef MR_LOWLEVEL_DEBUG
|
|
#define MR_assert(ASSERTION) assert(ASSERTION)
|
|
#else
|
|
#define MR_assert(ASSERTION) ((void)0)
|
|
#endif
|
|
|
|
|
|
/* XXX these should go in mercury_memory.h or mercury_heap.h */
|
|
extern void *newmem(size_t);
|
|
extern void *resizemem(void *, size_t);
|
|
extern void oldmem(void *);
|
|
|
|
#endif /* not MERCURY_STD_H */
|