Imported Upstream version 21
[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 tool.
9 **
10 ** Author: Phil Burk
11 ** Copyright 1994 3DO, Phil Burk, Larry Polansky, Devid Rosenboom
12 **
13 ** The pForth software code is dedicated to the public domain,
14 ** and any third party may reproduce, distribute and modify
15 ** the pForth software code or any derivative works thereof
16 ** without any compensation or license.  The pForth software
17 ** code is provided on an "as is" basis without any warranty
18 ** of any kind, including, without limitation, the implied
19 ** warranties of merchantability and fitness for a particular
20 ** purpose and their equivalents under the laws of any jurisdiction.
21 **
22 **
23 ***************************************************************/
24
25 /* Define stubs for data types so we can pass pointers but not touch inside. */
26 typedef struct cfTaskData   cfTaskData;
27 typedef struct cfDictionary cfDictionary;
28
29 typedef unsigned long ExecToken;              /* Execution Token */
30
31 #ifndef int32
32         typedef long int32;
33 #endif
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /* Main entry point to pForth. */
40 int32 pfDoForth( const char *DicName, const char *SourceName, int32 IfInit );
41
42 /* Turn off messages. */
43 void  pfSetQuiet( int32 IfQuiet );
44
45 /* Query message status. */
46 int32  pfQueryQuiet( void );
47
48 /* Send a message using low level I/O of pForth */
49 void  pfMessage( const char *CString );
50
51 /* Create a task used to maintain context of execution. */
52 cfTaskData *pfCreateTask( int32 UserStackDepth, int32 ReturnStackDepth );
53
54 /* Establish this task as the current task. */
55 void  pfSetCurrentTask( cfTaskData *cftd );
56
57 /* Delete task created by pfCreateTask */
58 void  pfDeleteTask( cfTaskData *cftd );
59
60 /* Build a dictionary with all the basic kernel words. */
61 cfDictionary *pfBuildDictionary( int32 HeaderSize, int32 CodeSize );
62
63 /* Create an empty dictionary. */
64 cfDictionary *pfCreateDictionary( int32 HeaderSize, int32 CodeSize );
65
66 /* Load dictionary from a file. */
67 cfDictionary *pfLoadDictionary( const char *FileName, ExecToken *EntryPointPtr );
68
69 /* Delete dictionary data. */
70 void  pfDeleteDictionary( cfDictionary *dic );
71
72 /* Execute the pForth interpreter. */
73 int32   pfRunForth( void );
74
75 /* Execute a single execution token in the current task. */
76 void pfExecuteToken( ExecToken XT );
77  
78 /* Include the given pForth source code file. */
79 int32   pfIncludeFile( const char *FileName );
80
81 /* Execute a Forth word by name. */
82 void   pfExecByName( const char *CString );
83
84 #ifdef __cplusplus
85 }   
86 #endif
87
88 #endif  /* _pforth_h */