| 1 | /* @(#) pf_save.h 96/12/18 1.8 */\r |
| 2 | #ifndef _pforth_save_h\r |
| 3 | #define _pforth_save_h\r |
| 4 | \r |
| 5 | /***************************************************************\r |
| 6 | ** Include file for PForth SaveForth\r |
| 7 | **\r |
| 8 | ** Author: Phil Burk\r |
| 9 | ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom\r |
| 10 | **\r |
| 11 | ** The pForth software code is dedicated to the public domain,\r |
| 12 | ** and any third party may reproduce, distribute and modify\r |
| 13 | ** the pForth software code or any derivative works thereof\r |
| 14 | ** without any compensation or license. The pForth software\r |
| 15 | ** code is provided on an "as is" basis without any warranty\r |
| 16 | ** of any kind, including, without limitation, the implied\r |
| 17 | ** warranties of merchantability and fitness for a particular\r |
| 18 | ** purpose and their equivalents under the laws of any jurisdiction.\r |
| 19 | **\r |
| 20 | ** 941031 rdg fix redefinition of MAKE_ID and EVENUP to be conditional\r |
| 21 | **\r |
| 22 | ***************************************************************/\r |
| 23 | \r |
| 24 | \r |
| 25 | typedef struct DictionaryInfoChunk\r |
| 26 | {\r |
| 27 | /* All fields are stored in BIG ENDIAN format for consistency in data files. */\r |
| 28 | /* All fileds must be the same size as int32 for easy endian conversion. */\r |
| 29 | int32 sd_Version;\r |
| 30 | int32 sd_RelContext; /* relative ptr to Dictionary Context */\r |
| 31 | int32 sd_RelHeaderPtr; /* relative ptr to Dictionary Header Ptr */\r |
| 32 | int32 sd_RelCodePtr; /* relative ptr to Dictionary Header Ptr */\r |
| 33 | ExecToken sd_EntryPoint; /* relative ptr to entry point or NULL */\r |
| 34 | int32 sd_UserStackSize; /* in bytes */\r |
| 35 | int32 sd_ReturnStackSize; /* in bytes */\r |
| 36 | int32 sd_NameSize; /* in bytes */\r |
| 37 | int32 sd_CodeSize; /* in bytes */\r |
| 38 | int32 sd_NumPrimitives; /* To distinguish between primitive and secondary. */\r |
| 39 | uint32 sd_Flags;\r |
| 40 | int32 sd_FloatSize; /* In bytes. Must match code. 0 means no floats. */\r |
| 41 | uint32 sd_Reserved;\r |
| 42 | } DictionaryInfoChunk;\r |
| 43 | \r |
| 44 | /* Bits in sd_Flags */\r |
| 45 | #define SD_F_BIG_ENDIAN_DIC (1<<0)\r |
| 46 | \r |
| 47 | #ifndef MAKE_ID\r |
| 48 | #define MAKE_ID(a,b,c,d) ((((uint32)a)<<24)|(((uint32)b)<<16)|(((uint32)c)<<8)|((uint32)d))\r |
| 49 | #endif\r |
| 50 | \r |
| 51 | #define ID_FORM MAKE_ID('F','O','R','M')\r |
| 52 | #define ID_P4TH MAKE_ID('P','4','T','H')\r |
| 53 | #define ID_P4DI MAKE_ID('P','4','D','I')\r |
| 54 | #define ID_P4NM MAKE_ID('P','4','N','M')\r |
| 55 | #define ID_P4CD MAKE_ID('P','4','C','D')\r |
| 56 | #define ID_BADF MAKE_ID('B','A','D','F')\r |
| 57 | \r |
| 58 | #ifndef EVENUP\r |
| 59 | #define EVENUP(n) ((n+1)&(~1))\r |
| 60 | #endif\r |
| 61 | \r |
| 62 | #ifdef __cplusplus\r |
| 63 | extern "C" {\r |
| 64 | #endif\r |
| 65 | \r |
| 66 | int32 ffSaveForth( const char *FileName, ExecToken EntryPoint, int32 NameSize, int32 CodeSize );\r |
| 67 | \r |
| 68 | /* Endian-ness tools. */\r |
| 69 | \r |
| 70 | int IsHostLittleEndian( void );\r |
| 71 | uint32 ReadLongBigEndian( const uint32 *addr );\r |
| 72 | uint16 ReadShortBigEndian( const uint16 *addr );\r |
| 73 | uint32 ReadLongLittleEndian( const uint32 *addr );\r |
| 74 | uint16 ReadShortLittleEndian( const uint16 *addr );\r |
| 75 | void WriteLongBigEndian( uint32 *addr, uint32 data );\r |
| 76 | void WriteShortBigEndian( uint16 *addr, uint16 data );\r |
| 77 | void WriteLongLittleEndian( uint32 *addr, uint32 data );\r |
| 78 | void WriteShortLittleEndian( uint16 *addr, uint16 data );\r |
| 79 | \r |
| 80 | #ifdef PF_SUPPORT_FP\r |
| 81 | void WriteFloatBigEndian( PF_FLOAT *addr, PF_FLOAT data );\r |
| 82 | PF_FLOAT ReadFloatBigEndian( const PF_FLOAT *addr );\r |
| 83 | void WriteFloatLittleEndian( PF_FLOAT *addr, PF_FLOAT data );\r |
| 84 | PF_FLOAT ReadFloatLittleEndian( const PF_FLOAT *addr );\r |
| 85 | #endif\r |
| 86 | \r |
| 87 | #ifdef __cplusplus\r |
| 88 | } \r |
| 89 | #endif\r |
| 90 | \r |
| 91 | #endif /* _pforth_save_h */\r |