bb6b2dcd |
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 | typedef unsigned long ExecToken; /* Execution Token */\r |
30 | typedef long ThrowCode;\r |
31 | \r |
32 | #ifndef int32\r |
33 | typedef long int32;\r |
34 | #endif\r |
35 | \r |
36 | #ifdef __cplusplus\r |
37 | extern "C" {\r |
38 | #endif\r |
39 | \r |
40 | /* Main entry point to pForth. */\r |
41 | int32 pfDoForth( const char *DicName, const char *SourceName, int32 IfInit );\r |
42 | \r |
43 | /* Turn off messages. */\r |
44 | void pfSetQuiet( int32 IfQuiet );\r |
45 | \r |
46 | /* Query message status. */\r |
47 | int32 pfQueryQuiet( void );\r |
48 | \r |
49 | /* Send a message using low level I/O of pForth */\r |
50 | void pfMessage( const char *CString );\r |
51 | \r |
52 | /* Create a task used to maintain context of execution. */\r |
53 | PForthTask pfCreateTask( int32 UserStackDepth, int32 ReturnStackDepth );\r |
54 | \r |
55 | /* Establish this task as the current task. */\r |
56 | void pfSetCurrentTask( PForthTask task );\r |
57 | \r |
58 | /* Delete task created by pfCreateTask */\r |
59 | void pfDeleteTask( PForthTask task );\r |
60 | \r |
61 | /* Build a dictionary with all the basic kernel words. */\r |
62 | PForthDictionary pfBuildDictionary( int32 HeaderSize, int32 CodeSize );\r |
63 | \r |
64 | /* Create an empty dictionary. */\r |
65 | PForthDictionary pfCreateDictionary( int32 HeaderSize, int32 CodeSize );\r |
66 | \r |
67 | /* Load dictionary from a file. */\r |
68 | PForthDictionary pfLoadDictionary( const char *FileName, ExecToken *EntryPointPtr );\r |
69 | \r |
70 | /* Load dictionary from static array in "pfdicdat.h". */\r |
71 | PForthDictionary pfLoadStaticDictionary( void );\r |
72 | \r |
73 | /* Delete dictionary data. */\r |
74 | void pfDeleteDictionary( PForthDictionary dict );\r |
75 | \r |
76 | /* Execute the pForth interpreter. Yes, QUIT is an odd name but it has historical meaning. */\r |
77 | ThrowCode pfQuit( void );\r |
78 | \r |
79 | /* Execute a single execution token in the current task and return 0 or an error code. */\r |
80 | int pfCatch( ExecToken XT );\r |
81 | \r |
82 | /* Include the given pForth source code file. */\r |
83 | ThrowCode pfIncludeFile( const char *FileName );\r |
84 | \r |
85 | /* Execute a Forth word by name. */\r |
86 | ThrowCode pfExecIfDefined( const char *CString );\r |
87 | \r |
88 | #ifdef __cplusplus\r |
89 | } \r |
90 | #endif\r |
91 | \r |
92 | #endif /* _pforth_h */\r |