Avoid including csrc/pfdicdat.h (#120)
[debian/pforth] / csrc / pforth.h
1 /* @(#) pforth.h 98/01/26 1.2 */
2 #ifndef _pforth_h
3 #define _pforth_h
4
5 /***************************************************************
6 ** Include file for pForth, a portable Forth based on 'C'
7 **
8 ** This file is included in any application that uses pForth as a library.
9 **
10 ** Author: Phil Burk
11 ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom
12 **
13 ** Permission to use, copy, modify, and/or distribute this
14 ** software for any purpose with or without fee is hereby granted.
15 **
16 ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
17 ** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
18 ** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
19 ** THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
20 ** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
21 ** FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
22 ** CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
23 ** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 **
25 **
26 ***************************************************************/
27
28 /* Define stubs for data types so we can pass pointers but not touch inside. */
29 typedef void *PForthTask;
30 typedef void *PForthDictionary;
31
32 #include <stdint.h>
33 /* Integer types for Forth cells, signed and unsigned: */
34 typedef intptr_t cell_t;
35 typedef uintptr_t ucell_t;
36
37 typedef ucell_t ExecToken;              /* Execution Token */
38 typedef cell_t ThrowCode;
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /* Main entry point to pForth. */
45 ThrowCode pfDoForth( const char *DicName, const char *SourceName, cell_t IfInit );
46
47 /* Turn off messages. */
48 void  pfSetQuiet( cell_t IfQuiet );
49
50 /* Query message status. */
51 cell_t  pfQueryQuiet( void );
52
53 /* Send a message using low level I/O of pForth */
54 void  pfMessage( const char *CString );
55
56 /* Create a task used to maintain context of execution. */
57 PForthTask pfCreateTask( cell_t UserStackDepth, cell_t ReturnStackDepth );
58
59 /* Establish this task as the current task. */
60 void  pfSetCurrentTask( PForthTask task );
61
62 /* Delete task created by pfCreateTask */
63 void  pfDeleteTask( PForthTask task );
64
65 /* Build a dictionary with all the basic kernel words. */
66 PForthDictionary pfBuildDictionary( cell_t HeaderSize, cell_t CodeSize );
67
68 /* Create an empty dictionary. */
69 PForthDictionary pfCreateDictionary( cell_t HeaderSize, cell_t CodeSize );
70
71 /* Load dictionary from a file. */
72 PForthDictionary pfLoadDictionary( const char *FileName, ExecToken *EntryPointPtr );
73
74 /* Load dictionary from static array in "pfdicdat.h". */
75 PForthDictionary pfLoadStaticDictionary( void );
76
77 /* Delete dictionary data. */
78 void  pfDeleteDictionary( PForthDictionary dict );
79
80 /* Execute the pForth interpreter. Yes, QUIT is an odd name but it has historical meaning. */
81 ThrowCode pfQuit( void );
82
83 /* Execute a single execution token in the current task and return 0 or an error code. */
84 ThrowCode pfCatch( ExecToken XT );
85
86 /* Include the given pForth source code file. */
87 ThrowCode pfIncludeFile( const char *FileName );
88
89 /* Execute a Forth word by name. */
90 ThrowCode  pfExecIfDefined( const char *CString );
91
92 #ifdef __cplusplus
93 }
94 #endif
95
96 #endif  /* _pforth_h */