| 1 | /* @(#) pf_text.h 96/12/18 1.10 */ |
| 2 | #ifndef _pforth_text_h |
| 3 | #define _pforth_text_h |
| 4 | |
| 5 | /*************************************************************** |
| 6 | ** Include file for PForth Text |
| 7 | ** |
| 8 | ** Author: Phil Burk |
| 9 | ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom |
| 10 | ** |
| 11 | ** Permission to use, copy, modify, and/or distribute this |
| 12 | ** software for any purpose with or without fee is hereby granted. |
| 13 | ** |
| 14 | ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 15 | ** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 16 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL |
| 17 | ** THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR |
| 18 | ** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING |
| 19 | ** FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF |
| 20 | ** CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 21 | ** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 22 | ** |
| 23 | ***************************************************************/ |
| 24 | |
| 25 | #define PF_ERR_INDEX_MASK (0xFFFF) |
| 26 | #define PF_ERR_BASE (0x80000000) |
| 27 | #define PF_ERR_NO_MEM (PF_ERR_BASE | 0) |
| 28 | #define PF_ERR_TOO_BIG (PF_ERR_BASE | 2) |
| 29 | #define PF_ERR_NUM_PARAMS (PF_ERR_BASE | 3) |
| 30 | #define PF_ERR_OPEN_FILE (PF_ERR_BASE | 4) |
| 31 | #define PF_ERR_WRONG_FILE (PF_ERR_BASE | 5) |
| 32 | #define PF_ERR_BAD_FILE (PF_ERR_BASE | 6) |
| 33 | #define PF_ERR_READ_FILE (PF_ERR_BASE | 7) |
| 34 | #define PF_ERR_WRITE_FILE (PF_ERR_BASE | 8) |
| 35 | #define PF_ERR_CORRUPT_DIC (PF_ERR_BASE | 9) |
| 36 | #define PF_ERR_NOT_SUPPORTED (PF_ERR_BASE | 10) |
| 37 | #define PF_ERR_VERSION_FUTURE (PF_ERR_BASE | 11) |
| 38 | #define PF_ERR_VERSION_PAST (PF_ERR_BASE | 12) |
| 39 | #define PF_ERR_COLON_STACK (PF_ERR_BASE | 13) |
| 40 | #define PF_ERR_HEADER_ROOM (PF_ERR_BASE | 14) |
| 41 | #define PF_ERR_CODE_ROOM (PF_ERR_BASE | 15) |
| 42 | #define PF_ERR_NO_SHELL (PF_ERR_BASE | 16) |
| 43 | #define PF_ERR_NO_NAMES (PF_ERR_BASE | 17) |
| 44 | #define PF_ERR_OUT_OF_RANGE (PF_ERR_BASE | 18) |
| 45 | #define PF_ERR_ENDIAN_CONFLICT (PF_ERR_BASE | 19) |
| 46 | #define PF_ERR_FLOAT_CONFLICT (PF_ERR_BASE | 20) |
| 47 | #define PF_ERR_CELL_SIZE_CONFLICT (PF_ERR_BASE | 21) |
| 48 | /* If you add an error code here, also add a text message in "pf_text.c". */ |
| 49 | |
| 50 | #ifdef __cplusplus |
| 51 | extern "C" { |
| 52 | #endif |
| 53 | |
| 54 | void pfReportError( const char *FunctionName, Err ErrCode ); |
| 55 | void pfReportThrow( ThrowCode code ); |
| 56 | |
| 57 | char *ForthStringToC( char *dst, const char *FString, cell_t dstSize ); |
| 58 | char *CStringToForth( char *dst, const char *CString, cell_t dstSize ); |
| 59 | |
| 60 | cell_t ffCompare( const char *s1, cell_t len1, const char *s2, cell_t len2 ); |
| 61 | cell_t ffCompareText( const char *s1, const char *s2, cell_t len ); |
| 62 | cell_t ffCompareTextCaseN( const char *s1, const char *s2, cell_t len ); |
| 63 | |
| 64 | void DumpMemory( void *addr, cell_t cnt); |
| 65 | char *ConvertNumberToText( cell_t Num, cell_t Base, int32_t IfSigned, int32_t MinChars ); |
| 66 | void TypeName( const char *Name ); |
| 67 | |
| 68 | cell_t pfUnitTestText( void ); |
| 69 | |
| 70 | #ifdef __cplusplus |
| 71 | } |
| 72 | #endif |
| 73 | |
| 74 | #endif /* _pforth_text_h */ |