Sample crossbuild makefile
[debian/pforth] / csrc / pforth.h
1 /* @(#) pforth.h 98/01/26 1.2 */\r
2 #ifndef _pforth_h\r
3 #define _pforth_h\r
4 \r
5 /***************************************************************\r
6 ** Include file for pForth, a portable Forth based on 'C'\r
7 **\r
8 ** This file is included in any application that uses pForth as a tool.\r
9 **\r
10 ** Author: Phil Burk\r
11 ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom\r
12 **\r
13 ** The pForth software code is dedicated to the public domain,\r
14 ** and any third party may reproduce, distribute and modify\r
15 ** the pForth software code or any derivative works thereof\r
16 ** without any compensation or license.  The pForth software\r
17 ** code is provided on an "as is" basis without any warranty\r
18 ** of any kind, including, without limitation, the implied\r
19 ** warranties of merchantability and fitness for a particular\r
20 ** purpose and their equivalents under the laws of any jurisdiction.\r
21 **\r
22 **\r
23 ***************************************************************/\r
24 \r
25 /* Define stubs for data types so we can pass pointers but not touch inside. */\r
26 typedef void *PForthTask;\r
27 typedef void *PForthDictionary;\r
28 \r
29 #include <stdint.h>\r
30 /* Integer types for Forth cells, signed and unsigned: */\r
31 typedef intptr_t cell_t;\r
32 typedef uintptr_t ucell_t;\r
33 \r
34 typedef ucell_t ExecToken;              /* Execution Token */\r
35 typedef cell_t ThrowCode;\r
36 \r
37 #ifdef __cplusplus\r
38 extern "C" {\r
39 #endif\r
40 \r
41 /* Main entry point to pForth. */\r
42 cell_t pfDoForth( const char *DicName, const char *SourceName, cell_t IfInit );\r
43 \r
44 /* Turn off messages. */\r
45 void  pfSetQuiet( cell_t IfQuiet );\r
46 \r
47 /* Query message status. */\r
48 cell_t  pfQueryQuiet( void );\r
49 \r
50 /* Send a message using low level I/O of pForth */\r
51 void  pfMessage( const char *CString );\r
52 \r
53 /* Create a task used to maintain context of execution. */\r
54 PForthTask pfCreateTask( cell_t UserStackDepth, cell_t ReturnStackDepth );\r
55 \r
56 /* Establish this task as the current task. */\r
57 void  pfSetCurrentTask( PForthTask task );\r
58 \r
59 /* Delete task created by pfCreateTask */\r
60 void  pfDeleteTask( PForthTask task );\r
61 \r
62 /* Build a dictionary with all the basic kernel words. */\r
63 PForthDictionary pfBuildDictionary( cell_t HeaderSize, cell_t CodeSize );\r
64 \r
65 /* Create an empty dictionary. */\r
66 PForthDictionary pfCreateDictionary( cell_t HeaderSize, cell_t CodeSize );\r
67 \r
68 /* Load dictionary from a file. */\r
69 PForthDictionary pfLoadDictionary( const char *FileName, ExecToken *EntryPointPtr );\r
70 \r
71 /* Load dictionary from static array in "pfdicdat.h". */\r
72 PForthDictionary pfLoadStaticDictionary( void );\r
73 \r
74 /* Delete dictionary data. */\r
75 void  pfDeleteDictionary( PForthDictionary dict );\r
76 \r
77 /* Execute the pForth interpreter. Yes, QUIT is an odd name but it has historical meaning. */\r
78 ThrowCode pfQuit( void );\r
79 \r
80 /* Execute a single execution token in the current task and return 0 or an error code. */\r
81 int pfCatch( ExecToken XT );\r
82  \r
83 /* Include the given pForth source code file. */\r
84 ThrowCode pfIncludeFile( const char *FileName );\r
85 \r
86 /* Execute a Forth word by name. */\r
87 ThrowCode  pfExecIfDefined( const char *CString );\r
88 \r
89 #ifdef __cplusplus\r
90 }   \r
91 #endif\r
92 \r
93 #endif  /* _pforth_h */\r