[m-dev.] for review: More runtime header reorganisation
Andrew Bromage
bromage at cs.mu.OZ.AU
Tue Jul 28 11:25:30 AEST 1998
G'day all.
Fergus Henderson wrote:
> Thanks, Andrew. That looks good. I do have a couple of comments, though.
Thanks for the comments. All taken on board. New diff follows.
Cheers,
Andrew Bromage
Estimated hours taken: 0.7
Minor reorganisation for compatibility with FreeBSD headers.
The main rationale for this change (thanks Fergus) is:
- the global register declarations in mercury_regs.h must come
before any standard header files are #included,
- the "mercury_regs.h" file needs `Word', etc. from "mercury_types.h",
- hence "mercury_types.h" must not #include any standard header files;
- in addition, the `MercuryFile' type needs `FILE' from <stdio.h>,
- hence the `MercuryFile' type cannot be declared in "mercury_types.h".
MR_ArrayType doesn't suffer from this problem, but it's moved anyway for
cleanliness reasons (mercury_type_info.h was never a perfect home for it).
runtime/mercury_type_info.h:
Move MR_ArrayType into mercury_library_types.h.
runtime/mercury_types.h:
Move MercuryFile into mercury_library_types.h.
runtime/mercury_library_types.h:
New file, intended for the declaration of C types which are
really the province of the library rather than the runtime, but
which the runtime still needs.
runtime/mercury_imp.h:
Import mercury_library_types.h.
runtime/Mmakefile:
Include mercury_library_types.h in the header dependencies.
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.33
diff -u -r1.33 Mmakefile
--- Mmakefile 1998/07/22 07:52:17 1.33
+++ Mmakefile 1998/07/28 01:18:08
@@ -44,6 +44,7 @@
mercury_imp.h \
mercury_init.h \
mercury_label.h \
+ mercury_library_types.h \
mercury_memory.h \
mercury_memory_zones.h \
mercury_memory_handlers.h \
Index: mercury_imp.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_imp.h,v
retrieving revision 1.10
diff -u -r1.10 mercury_imp.h
--- mercury_imp.h 1998/07/26 08:38:35 1.10
+++ mercury_imp.h 1998/07/28 01:18:08
@@ -42,6 +42,7 @@
#include "mercury_debug.h"
#include "mercury_types.h"
+#include "mercury_library_types.h"
#include "mercury_string.h"
#include "mercury_float.h"
#include "mercury_stack_trace.h"
cvs server: mercury_library_types.h is a new entry, no comparison available
Index: mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.10
diff -u -r1.10 mercury_type_info.h
--- mercury_type_info.h 1998/07/22 07:53:32 1.10
+++ mercury_type_info.h 1998/07/28 01:18:08
@@ -767,19 +767,6 @@
/*---------------------------------------------------------------------------*/
-/*
-** definitions for accessing the representation of the
-** Mercury `array' type
-*/
-
-typedef struct {
- Integer size;
- Word elements[1]; /* really this is variable-length */
-} MR_ArrayType;
-
-#define MR_make_array(sz) ((MR_ArrayType *) make_many(Word, (sz) + 1))
-
-
Word * MR_create_type_info(Word *, Word *);
int MR_compare_type_info(Word, Word);
Word MR_collapse_equivalences(Word);
Index: mercury_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.12
diff -u -r1.12 mercury_types.h
--- mercury_types.h 1998/07/13 22:44:14 1.12
+++ mercury_types.h 1998/07/28 01:18:08
@@ -9,11 +9,17 @@
** code generated by the Mercury compiler and by the Mercury runtime.
*/
+/*
+** IMPORTANT NOTE:
+** This file must not contain any #include statements,
+** other than the #include of "mercury_conf.h",
+** for reasons explained in mercury_imp.h.
+*/
+
#ifndef MERCURY_TYPES_H
#define MERCURY_TYPES_H
#include "mercury_conf.h"
-#include <stdio.h> /* for `FILE' */
/*
** Note that we require sizeof(Word) == sizeof(Integer) == sizeof(Code*);
@@ -61,18 +67,6 @@
/* spinlocks -- see mercury_spinlock.h */
typedef Word SpinLock;
-
-/*
-** The C `MercuryFile' type is used for the Mercury `io__stream' type
-** in library/io.m.
-** Mercury files are not quite the same as C stdio FILEs,
-** because we keep track of a little bit more information.
-*/
-
-typedef struct mercury_file {
- FILE *file;
- int line_number;
-} MercuryFile;
/*
** semidet predicates indicate success or failure by leaving nonzero or zero
cvs server: Diffing machdeps
New File: mercury_library_types.h
===================================================================
/*
** Copyright (C) 1995-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.
*/
/*
** mercury_library_types.h - definitions of some basic types used by the
** Mercury library.
*/
#ifndef MERCURY_LIBRARY_TYPES_H
#define MERCURY_LIBRARY_TYPES_H
#include <stdio.h> /* for `FILE' */
/*
** The C `MercuryFile' type is used for the Mercury `io__stream' type
** in library/io.m.
** Mercury files are not quite the same as C stdio FILEs,
** because we keep track of a little bit more information.
*/
typedef struct mercury_file {
FILE *file;
int line_number;
} MercuryFile;
/*
** definitions for accessing the representation of the
** Mercury `array' type
*/
typedef struct {
Integer size;
Word elements[1]; /* really this is variable-length */
} MR_ArrayType;
#define MR_make_array(sz) ((MR_ArrayType *) make_many(Word, (sz) + 1))
#endif /* not MERCURY_LIBRARY_TYPES_H */
More information about the developers
mailing list