**\r
***************************************************************/\r
\r
+#include <sys/types.h>\r
+\r
#include "pf_all.h"\r
\r
-#ifdef WIN32\r
+#if defined(WIN32) && !defined(__MINGW32__)\r
#include <crtdbg.h>\r
#endif\r
\r
sdSeekFile( FileID, 0, PF_SEEK_END );\r
endposition = sdTellFile( FileID );\r
M_PUSH(endposition);\r
- // Just use a 0 if they are the same size.\r
+ /* Just use a 0 if they are the same size. */\r
offsetHi = (sizeof(off_t) > sizeof(cell_t)) ? (endposition >> (8*sizeof(cell_t))) : 0 ;\r
M_PUSH(offsetHi);\r
sdSeekFile( FileID, original, PF_SEEK_SET );\r
\r
case ID_FILE_REPOSITION: /* ( ud fid -- ior ) */ \r
{\r
+ off_t offset;\r
FileID = (FileStream *) TOS;\r
- off_t offset = M_POP;\r
- // Avoid compiler warnings on Mac.\r
+ offset = M_POP;\r
+ /* Avoid compiler warnings on Mac. */\r
offset = (sizeof(off_t) > sizeof(cell_t)) ? (offset << 8*sizeof(cell_t)) : 0 ;\r
offset += M_POP;\r
TOS = sdSeekFile( FileID, offset, PF_SEEK_SET );\r
\r
case ID_FILE_POSITION: /* ( fid -- ud ior ) */\r
{\r
+ off_t position;\r
off_t offsetHi;\r
FileID = (FileStream *) TOS;\r
- off_t position = sdTellFile( FileID );\r
+ position = sdTellFile( FileID );\r
M_PUSH(position);\r
- // Just use a 0 if they are the same size.\r
+ /* Just use a 0 if they are the same size. */\r
offsetHi = (sizeof(off_t) > sizeof(cell_t)) ? (position >> (8*sizeof(cell_t))) : 0 ;\r
M_PUSH(offsetHi);\r
TOS = (position < 0) ? -4 : 0 ; /* !!! err num */\r
case ID_RESIZE: /* ( addr1 u -- addr2 result ) */\r
{\r
cell_t *Addr1 = (cell_t *) M_POP;\r
- // Point to validator below users address.\r
+ /* Point to validator below users address. */\r
cell_t *FreePtr = Addr1 - 1;\r
if( ((ucell_t)*FreePtr) != ((ucell_t)FreePtr ^ PF_MEMORY_VALIDATOR))\r
{\r
- // 090218 - Fixed bug, was returning zero.\r
+ /* 090218 - Fixed bug, was returning zero. */\r
M_PUSH( Addr1 );\r
TOS = -3;\r
}\r
/* Copy memory including validation. */\r
pfCopyMemory( (char *) CellPtr, (char *) FreePtr, TOS + sizeof(cell_t) );\r
*CellPtr = (cell_t)(((ucell_t)CellPtr) ^ (ucell_t)PF_MEMORY_VALIDATOR);\r
- // 090218 - Fixed bug that was incrementing the address twice. Thanks Reinhold Straub.\r
- // Increment past validator to user address.\r
+ /* 090218 - Fixed bug that was incrementing the address twice. Thanks Reinhold Straub. */\r
+ /* Increment past validator to user address. */\r
M_PUSH( (cell_t) (CellPtr + 1) );\r
- TOS = 0; // Result code.\r
- // Mark old cell as dead so we can't free it twice.\r
+ TOS = 0; /* Result code. */\r
+ /* Mark old cell as dead so we can't free it twice. */\r
FreePtr[0] = 0xDeadBeef;\r
pfFreeMem((char *) FreePtr);\r
}\r
else\r
{\r
- // 090218 - Fixed bug, was returning zero.\r
+ /* 090218 - Fixed bug, was returning zero. */\r
M_PUSH( Addr1 );\r
TOS = -4; /* FIXME Fix error code. */\r
}\r
CodeSize = TOS;\r
NameSize = M_POP;\r
EntryPoint = M_POP;\r
- ForthStringToC( gScratch, (char *) M_POP );\r
+ ForthStringToC( gScratch, (char *) M_POP, sizeof(gScratch) );\r
TOS = ffSaveForth( gScratch, EntryPoint, NameSize, CodeSize );\r
}\r
endcase;\r