Fixed lots of warning and made code compatible with C89 and ANSI with -pedantic.
[pforth] / csrc / pf_guts.h
index 0e34581..80df530 100644 (file)
@@ -23,7 +23,7 @@
 ** PFORTH_VERSION changes when PForth is modified and released.\r
 ** See README file for version info.\r
 */\r
 ** PFORTH_VERSION changes when PForth is modified and released.\r
 ** See README file for version info.\r
 */\r
-#define PFORTH_VERSION "25"\r
+#define PFORTH_VERSION "27"\r
 \r
 /*\r
 ** PFORTH_FILE_VERSION changes when incompatible changes are made\r
 \r
 /*\r
 ** PFORTH_FILE_VERSION changes when incompatible changes are made\r
@@ -279,6 +279,8 @@ enum cforth_primitive_ids
        /* Added to support 64 bit operation. */\r
        ID_CELL,\r
        ID_CELLS,\r
        /* Added to support 64 bit operation. */\r
        ID_CELL,\r
        ID_CELLS,\r
+       /* DELETE-FILE */\r
+       ID_FILE_DELETE,\r
 /* If you add a word here, take away one reserved word below. */\r
 #ifdef PF_SUPPORT_FP\r
 /* Only reserve space if we are adding FP so that we can detect\r
 /* If you add a word here, take away one reserved word below. */\r
 #ifdef PF_SUPPORT_FP\r
 /* Only reserve space if we are adding FP so that we can detect\r
@@ -297,7 +299,6 @@ enum cforth_primitive_ids
        ID_RESERVED11,\r
        ID_RESERVED12,\r
        ID_RESERVED13,\r
        ID_RESERVED11,\r
        ID_RESERVED12,\r
        ID_RESERVED13,\r
-       ID_RESERVED14,\r
        ID_FP_D_TO_F,\r
        ID_FP_FSTORE,\r
        ID_FP_FTIMES,\r
        ID_FP_D_TO_F,\r
        ID_FP_FSTORE,\r
        ID_FP_FTIMES,\r
@@ -422,26 +423,20 @@ typedef struct pfDictionary_s
        ucell_t  dic_Flags;\r
 /* Headers contain pointers to names and dictionary. */\r
 \r
        ucell_t  dic_Flags;\r
 /* Headers contain pointers to names and dictionary. */\r
 \r
-       uint8_t *dic_HeaderBaseUnaligned;\r
+       ucell_t dic_HeaderBaseUnaligned;\r
 \r
 \r
-       uint8_t *dic_HeaderBase;\r
-       union\r
-       {\r
-               cell_t  *Cell;\r
-               uint8_t *Byte;\r
-       } dic_HeaderPtr;\r
-       uint8_t *dic_HeaderLimit;\r
+       ucell_t dic_HeaderBase;\r
+       ucell_t dic_HeaderPtr;\r
+       ucell_t dic_HeaderLimit;\r
 /* Code segment contains tokenized code and data. */\r
 /* Code segment contains tokenized code and data. */\r
-\r
-       uint8_t *dic_CodeBaseUnaligned;\r
-\r
-       uint8_t *dic_CodeBase;\r
+       ucell_t dic_CodeBaseUnaligned;\r
+       ucell_t dic_CodeBase;\r
        union\r
        {\r
                cell_t  *Cell;\r
                uint8_t *Byte;\r
        } dic_CodePtr;\r
        union\r
        {\r
                cell_t  *Cell;\r
                uint8_t *Byte;\r
        } dic_CodePtr;\r
-       uint8_t *dic_CodeLimit;\r
+       ucell_t dic_CodeLimit;\r
 } pfDictionary_t;\r
 \r
 /* Save state of include when nesting files. */\r
 } pfDictionary_t;\r
 \r
 /* Save state of include when nesting files. */\r
@@ -487,7 +482,7 @@ extern ExecToken     gAcceptP_XT;         /* XT of ACCEPT */
 extern cell_t         gDepthAtColon;\r
 \r
 /* Global variables. */\r
 extern cell_t         gDepthAtColon;\r
 \r
 /* Global variables. */\r
-extern char         *gVarContext;    /* Points to last name field. */\r
+extern cell_t        gVarContext;    /* Points to last name field. */\r
 extern cell_t        gVarState;      /* 1 if compiling. */\r
 extern cell_t        gVarBase;       /* Numeric Base. */\r
 extern cell_t        gVarEcho;       /* Echo input from file. */\r
 extern cell_t        gVarState;      /* 1 if compiling. */\r
 extern cell_t        gVarBase;       /* Numeric Base. */\r
 extern cell_t        gVarEcho;       /* Echo input from file. */\r
@@ -555,15 +550,15 @@ extern cell_t         gIncludeIndex;
 #define IN_DICS(addr) (IN_CODE_DIC(addr) || IN_NAME_DIC(addr))\r
 \r
 /* Address conversion */\r
 #define IN_DICS(addr) (IN_CODE_DIC(addr) || IN_NAME_DIC(addr))\r
 \r
 /* Address conversion */\r
-#define ABS_TO_NAMEREL( a ) ((cell_t)  (((uint8_t *) a) - NAME_BASE ))\r
-#define ABS_TO_CODEREL( a ) ((cell_t)  (((uint8_t *) a) - CODE_BASE ))\r
-#define NAMEREL_TO_ABS( a ) ((char *) (((cell_t) a) + NAME_BASE))\r
-#define CODEREL_TO_ABS( a ) ((cell_t *) (((cell_t) a) + CODE_BASE))\r
+#define ABS_TO_NAMEREL( a ) ((cell_t)  (((ucell_t) a) - NAME_BASE ))\r
+#define ABS_TO_CODEREL( a ) ((cell_t)  (((ucell_t) a) - CODE_BASE ))\r
+#define NAMEREL_TO_ABS( a ) ((ucell_t) (((cell_t) a) + NAME_BASE))\r
+#define CODEREL_TO_ABS( a ) ((ucell_t) (((cell_t) a) + CODE_BASE))\r
 \r
 /* The check for >0 is only needed for CLONE testing. !!! */\r
 #define IsTokenPrimitive(xt) ((xt<gNumPrimitives) && (xt>=0))\r
 \r
 \r
 /* The check for >0 is only needed for CLONE testing. !!! */\r
 #define IsTokenPrimitive(xt) ((xt<gNumPrimitives) && (xt>=0))\r
 \r
-#define FREE_VAR(v) { if (v) { pfFreeMem(v); v = NULL; } }\r
+#define FREE_VAR(v) { if (v) { pfFreeMem((void *)(v)); v = 0; } }\r
 \r
 #define DATA_STACK_DEPTH (gCurrentTask->td_StackBase - gCurrentTask->td_StackPtr)\r
 #define DROP_DATA_STACK (gCurrentTask->td_StackPtr++)\r
 \r
 #define DATA_STACK_DEPTH (gCurrentTask->td_StackBase - gCurrentTask->td_StackPtr)\r
 #define DROP_DATA_STACK (gCurrentTask->td_StackPtr++)\r