Remove all references to the GC library, replacing GC_malloc
[fw/sdcc] / src / SDCCglobl.h
index 8be1ab06afcd6da688d1a15330c44881f40d11e4..96f760dbabc778b48a61b3fdfdf62646e706b05d 100644 (file)
@@ -1,4 +1,4 @@
-/* SDCCglobl.h - global macros etc required by all files */
+;/* SDCCglobl.h - global macros etc required by all files */
 #ifndef SDCCGLOBL_H
 #define SDCCGLOBL_H
 #include <memory.h>
@@ -6,28 +6,27 @@
 #include <stdlib.h>
 #include <setjmp.h>
 #include <stdio.h>
-#include "sdccconf.h"
+
+#if defined(_MSC_VER)
+#      include "sdcc_vc.h"
+#else
+#      include "sdccconf.h"
+#endif // _MSC_VER
+
 #include "SDCCerr.h"
 
+#if defined(_MSC_VER)
+#      define NATIVE_WIN32             1
+#endif
+
 #ifdef __BORLANDC__
 #define NATIVE_WIN32           1
 #endif
+
 #ifdef __MINGW32__
 #define NATIVE_WIN32           1
 #endif
 
-#ifdef _NO_GC
-
-#define GC_malloc malloc
-#define GC_free free
-#define GC_realloc realloc
-#define GC_malloc_atomic malloc
-#else
-
-#include "./gc/gc.h" 
-
-#endif
-
 #define SPACE ' '
 #define ZERO  0
 
@@ -89,9 +88,16 @@ typedef int bool;
     type *type##FreeStack [size]  ; \
     int   type##StackPtr = 0      ;
 
-#define ALLOCTYPE(type,size) if (!(type##Pool = GC_malloc(size*sizeof(type))))   \
+#define  ALLOC(x,sz) if (!(x = calloc(1, sz)))      \
+         {                                          \
+            werror(E_OUT_OF_MEM,__FILE__,(long) sz);\
+            exit (1);                               \
+         }
+
+
+#define ALLOCTYPE(type,size) if (!(type##Pool = calloc(1, size*sizeof(type))))\
          {                                                            \
-            werror(E_OUT_OF_MEM,__FILE__,(long) size);                          \
+            werror(E_OUT_OF_MEM,__FILE__,(long) size);               \
             exit (1);                                                \
          }
 
@@ -106,17 +112,6 @@ typedef int bool;
 #define EMPTY(x)       (x##StackPtr == 0 ? 1 : 0)
 #endif
 
-#define  ALLOC(x,sz) if (!(x = GC_malloc(sz)))      \
-         {                                          \
-            werror(E_OUT_OF_MEM,__FILE__,(long) sz);\
-            exit (1);                               \
-         }
-
-#define ALLOC_ATOMIC(x,sz)   if (!(x = GC_malloc_atomic(sz)))   \
-         {                                               \
-            werror(E_OUT_OF_MEM,__FILE__,(long) sz);     \
-            exit (1);                                    \
-         }
 
 #define COPYTYPE(start,end,from) (end = getSpec (start = from))
 
@@ -170,14 +165,21 @@ struct optimize {
     unsigned    noLoopReverse :1;
 } ;
 
-/* Values for options.model. */
-#define MODEL_SMALL    0
-#define MODEL_LARGE    1
-#define MODEL_FLAT24   2
+/** Build model.
+    Used in options.model.A bit each as port.supported_models is an OR
+    of these. 
+*/
+enum {
+    MODEL_SMALL              = 1,
+    MODEL_COMPACT     = 2,
+    MODEL_MEDIUM      = 4,
+    MODEL_LARGE              = 8,
+    MODEL_FLAT24      = 16
+};
 
 /* other command line options */
 struct options {
-    int model  : 3     ; /* see MODEL_* defines above */
+    int model;          /* see MODEL_* defines above */
     int stackAuto : 3  ; /* Stack Automatic  */
     int useXstack : 3  ; /* use Xternal Stack */
     int stack10bit : 3;  /* use 10 bit stack (flat24 model only) */
@@ -206,6 +208,10 @@ struct options {
     int c1mode   : 1  ; /* Act like c1 - no pre-proc, asm or link */
     char *peep_file    ; /* additional rules for peep hole */
     char *out_name     ; /* Asm output name for c1 mode */
+    int nostdlib  : 1  ; /* Don't use standard lib files */
+    int nostdinc  : 1  ; /* Don't use standard include files */
+    int verbose   : 1  ; /* Show what the compiler is doing */
+    int ANSIint   : 1  ;  /* Use ANSI integer promotion rules in expressions. */
 
     char *calleeSaves[128]; /* list of functions using callee save */
     char *excludeRegs[32] ; /* registers excluded from saving */
@@ -241,6 +247,17 @@ extern int      currBlockno;     /* sequentail block number */
 extern struct optimize optimize ;
 extern struct options options;
 extern int maxInterrupts;
+
+/* Visible from SDCCmain.c */
+extern int nrelFiles;
+extern char *relFiles[128];
+extern char *libFiles[128] ;
+extern int nlibFiles;
+void buildCmdLine(char *into, char **args, const char **cmds, 
+                         const char *p1, const char *p2, 
+                         const char *p3, const char **list);
+int my_system (const char *cmd, char **cmd_argv);
+
 void parseWithComma (char **,char *) ;
 
 /** Creates a temporary file a'la tmpfile which avoids the bugs