fd713713bc58d44c46abc7c042da9966beceb2bd
[debian/pforth] / csrc / pf_text.h
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 ** The pForth software code is dedicated to the public domain,
12 ** and any third party may reproduce, distribute and modify
13 ** the pForth software code or any derivative works thereof
14 ** without any compensation or license.  The pForth software
15 ** code is provided on an "as is" basis without any warranty
16 ** of any kind, including, without limitation, the implied
17 ** warranties of merchantability and fitness for a particular
18 ** purpose and their equivalents under the laws of any jurisdiction.
19 **
20 ***************************************************************/
21
22 #define PF_ERR_INDEX_MASK (0xFFFF)
23 #define PF_ERR_BASE            (0x80000000)
24 #define PF_ERR_NO_MEM          (PF_ERR_BASE |  0)
25 #define PF_ERR_TOO_BIG         (PF_ERR_BASE |  2)
26 #define PF_ERR_NUM_PARAMS      (PF_ERR_BASE |  3)
27 #define PF_ERR_OPEN_FILE       (PF_ERR_BASE |  4)
28 #define PF_ERR_WRONG_FILE      (PF_ERR_BASE |  5)
29 #define PF_ERR_BAD_FILE        (PF_ERR_BASE |  6)
30 #define PF_ERR_READ_FILE       (PF_ERR_BASE |  7)
31 #define PF_ERR_WRITE_FILE      (PF_ERR_BASE |  8)
32 #define PF_ERR_CORRUPT_DIC     (PF_ERR_BASE |  9)
33 #define PF_ERR_NOT_SUPPORTED   (PF_ERR_BASE | 10)
34 #define PF_ERR_VERSION_FUTURE  (PF_ERR_BASE | 11)
35 #define PF_ERR_VERSION_PAST    (PF_ERR_BASE | 12)
36 #define PF_ERR_COLON_STACK     (PF_ERR_BASE | 13)
37 #define PF_ERR_HEADER_ROOM     (PF_ERR_BASE | 14)
38 #define PF_ERR_CODE_ROOM       (PF_ERR_BASE | 15)
39 #define PF_ERR_NO_SHELL        (PF_ERR_BASE | 16)
40 #define PF_ERR_NO_NAMES        (PF_ERR_BASE | 17)
41 #define PF_ERR_OUT_OF_RANGE    (PF_ERR_BASE | 18)
42 #define PF_ERR_ENDIAN_CONFLICT (PF_ERR_BASE | 19)
43 #define PF_ERR_FLOAT_CONFLICT  (PF_ERR_BASE | 20)
44 #define PF_ERR_CELL_SIZE_CONFLICT (PF_ERR_BASE | 21)
45 /* If you add an error code here, also add a text message in "pf_text.c". */
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51 void pfReportError( const char *FunctionName, Err ErrCode );
52 void pfReportThrow( ThrowCode code );
53
54 char  *ForthStringToC( char *dst, const char *FString, cell_t dstSize );
55 char  *CStringToForth( char *dst, const char *CString, cell_t dstSize  );
56
57 cell_t ffCompare( const char *s1, cell_t len1, const char *s2, cell_t len2 );
58 cell_t ffCompareText( const char *s1, const char *s2, cell_t len );
59 cell_t ffCompareTextCaseN( const char *s1, const char *s2, cell_t len );
60
61 void  DumpMemory( void *addr, cell_t cnt);
62 char *ConvertNumberToText( cell_t Num, cell_t Base, int32_t IfSigned, int32_t MinChars );
63 void  TypeName( const char *Name );
64
65 cell_t pfUnitTestText( void );
66
67 #ifdef __cplusplus
68 }
69 #endif
70
71 #endif /* _pforth_text_h */