Fixed a parameter allocation bug
[fw/sdcc] / src / SDCCglobl.h
index f7fa682fd50aefd8226ca5892a0973753409f728..1c417decf9669cb062d10218ae93f605244da211 100644 (file)
@@ -9,6 +9,13 @@
 #include "sdccconf.h"
 #include "SDCCerr.h"
 
+#ifdef __BORLANDC__
+#define NATIVE_WIN32           1
+#endif
+#ifdef __MINGW32__
+#define NATIVE_WIN32           1
+#endif
+
 #ifdef _NO_GC
 
 #define GC_malloc malloc
@@ -45,16 +52,16 @@ typedef int bool;
 #endif
 
 /* size's in bytes  */
-#define CHARSIZE    1
-#define SHORTSIZE   1
-#define INTSIZE     2
-#define LONGSIZE    4
-#define PTRSIZE     1
-#define FPTRSIZE    2
-#define GPTRSIZE    3
-#define BITSIZE     1
-#define FLOATSIZE   4
-#define MAXBASESIZE 4
+#define CHARSIZE    port->s.char_size
+#define SHORTSIZE   port->s.short_size
+#define INTSIZE     port->s.int_size
+#define LONGSIZE    port->s.long_size
+#define PTRSIZE     port->s.ptr_size
+#define FPTRSIZE    port->s.fptr_size
+#define GPTRSIZE    port->s.gptr_size
+#define BITSIZE     port->s.bit_size
+#define FLOATSIZE   port->s.float_size
+#define MAXBASESIZE port->s.max_base_size
 
 
 #define PRAGMA_SAVE        "SAVE"
@@ -163,11 +170,24 @@ struct optimize {
     unsigned    noLoopReverse :1;
 } ;
 
+/** 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  : 1     ; /* LARGE == 1 */
+    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) */
     int genericPtr: 1  ; /* use generic pointers */
     int regExtend : 1  ; /* don't use extended registers */
     int dump_raw  : 1  ; /* dump after intermediate code generation */
@@ -187,9 +207,12 @@ struct options {
     int nopeep    : 1  ; /* no peep hole optimization */
     int asmpeep   : 1  ; /* pass inline assembler thru peep hole */
     int debug     : 1  ; /* generate extra debug info */
+    int nodebug          : 1  ; /* Generate no debug info. */
     int stackOnData:1  ; /* stack after data segment  */
     int noregparms: 1  ; /* do not pass parameters in registers */
-    char *peep_file    ; /* additional rules for peep hole */    
+    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 */
 
     char *calleeSaves[128]; /* list of functions using callee save */
     char *excludeRegs[32] ; /* registers excluded from saving */
@@ -225,6 +248,37 @@ 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
+    in cygwin wrt c:\tmp.
+    Scans, in order: TMP, TEMP, TMPDIR, else uses tmpfile().
+*/
+FILE *tempfile(void);
+
+/** Creates a duplicate of the string 'sz' a'la strdup but using
+    libgc.
+*/
+char *gc_strdup(const char *sz);
+
+/** An assert() macro that will go out through sdcc's error
+    system.
+*/
+#define wassertl(a,s)  ((a) ? 0 : \
+        (werror (E_INTERNAL_ERROR,__FILE__,__LINE__, s), 0))
+
+#define wassert(a)    wassertl(a,"code generator internal error")
+
+
 #endif