* Fixed va_args for the z80
[fw/sdcc] / src / port.h
index e23528f807d7211055763cee79b82415f9d8ddef..9bf97e4959a0c5cee4144d69ac46274149e7a780 100644 (file)
@@ -5,9 +5,33 @@
 #ifndef PORT_INCLUDE
 #define PORT_INCLUDE
 
+#define TARGET_ID_MCS51    1
+#define TARGET_ID_GBZ80    2
+#define TARGET_ID_Z80      3
+#define TARGET_ID_AVR      4
+#define TARGET_ID_DS390    5
+#define TARGET_ID_PIC      6
+#define TARGET_ID_I186     7
+#define TARGET_ID_TLCS900H 8
+#define TARGET_ID_XA51     9
+
+/* Macro to test the target we are compiling for.
+   Can only be used after SDCCmain has defined the port
+*/
+#define TARGET_IS_MCS51 (port->id==TARGET_ID_MCS51)
+#define TARGET_IS_GBZ80 (port->id==TARGET_ID_GBZ80)
+#define TARGET_IS_Z80 (port->id==TARGET_ID_Z80)
+#define TARGET_IS_AVR (port->id==TARGET_ID_AVR)
+#define TARGET_IS_DS390 (port->id==TARGET_ID_DS390)
+#define TARGET_IS_PIC   (port->id==TARGET_ID_PIC)
+#define TARGET_IS_I186 (port->id==TARGET_ID_I186)
+#define TARGET_IS_TCLS900H (port->id==TARGET_ID_TCLS900H)
+
 /* Processor specific names */
 typedef struct
   {
+/** Unique id for this target */
+    const int id;
 /** Target name used for -m */
     const char *target;
 
@@ -16,7 +40,7 @@ typedef struct
 
     struct
       {
-       /** TRUE if all types of glue functions should be inseted into
+       /** TRUE if all types of glue functions should be inserted into
            the file that also defines main.
            We dont want this in cases like the z80 where the startup
            code is provided by a seperate module.
@@ -39,6 +63,8 @@ typedef struct
        const char *plain_opts;
        /* print externs as global */
        int externGlobal;
+       /* assembler file extension */
+       const char *file_ext;
       }
     assembler;
 
@@ -122,7 +148,7 @@ typedef struct
        /** One more than the smallest 
            mul/div operation the processor can do nativley 
            Eg if the processor has an 8 bit mul, nativebelow is 2 */
-       int native_below;
+       unsigned native_below;
        /** The mul/div/mod functions will be made to use regparams
            for sizeof(param) < log2(force_reg)
            i.e. Use 2 for WORD and BYTE, 0 for none. */
@@ -134,7 +160,7 @@ typedef struct
     const char *fun_prefix;
 
     /** Called once the processor target has been selected.
-       First chance to initalise and set any port specific varibles.
+       First chance to initalise and set any port specific variables.
        'port' is set before calling this.  May be NULL.
     */
     void (*init) (void);
@@ -175,6 +201,10 @@ typedef struct
     */
     int (*process_pragma) (const char *sz);
 
+    /** Mangles a support function name to reflect the calling model. 
+     */
+    char *(*getMangledFunctionName) (char *szOrginial);
+
     /** If TRUE, then tprintf and !dw will be used for some initalisers
      */
     bool use_dw_for_init;
@@ -211,7 +241,7 @@ extern PORT avr_port;
 extern PORT ds390_port;
 #endif
 #if !OPT_DISABLE_PIC
-extern PORT pic14_port;
+extern PORT pic_port;
 #endif
 #if !OPT_DISABLE_I186
 extern PORT i186_port;
@@ -220,14 +250,4 @@ extern PORT i186_port;
 extern PORT tlcs900h_port;
 #endif
 
-/* Test to see if we are current compiling in what? port. */
-#define IS_MCS51_PORT (port == &mcs51_port)
-#define IS_GBZ80_PORT (port == &gbz80_port)
-#define IS_Z80_PORT (port == &z80_port)
-#define IS_AVR_PORT (port == &avr_port)
-#define IS_DS390_PORT (port == &ds390_port)
-#define IS_PIC14_PORT (port == &pic14_port)
-#define IS_I186_PORT (port == &i186_port)
-#define IS_TCLS900H_PORT (port == &tlcs900h_port)
-
-#endif PORT_INCLUDE
+#endif /* PORT_INCLUDE*/