1 /* @(#) pforth.h 98/01/26 1.2 */
\r
5 /***************************************************************
\r
6 ** Include file for pForth, a portable Forth based on 'C'
\r
8 ** This file is included in any application that uses pForth as a tool.
\r
10 ** Author: Phil Burk
\r
11 ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom
\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
23 ***************************************************************/
\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
30 /* Integer types for Forth cells, signed and unsigned: */
\r
31 typedef intptr_t cell_t;
\r
32 typedef uintptr_t ucell_t;
\r
34 typedef ucell_t ExecToken; /* Execution Token */
\r
35 typedef cell_t ThrowCode;
\r
41 /* Main entry point to pForth. */
\r
42 cell_t pfDoForth( const char *DicName, const char *SourceName, cell_t IfInit );
\r
44 /* Turn off messages. */
\r
45 void pfSetQuiet( cell_t IfQuiet );
\r
47 /* Query message status. */
\r
48 cell_t pfQueryQuiet( void );
\r
50 /* Send a message using low level I/O of pForth */
\r
51 void pfMessage( const char *CString );
\r
53 /* Create a task used to maintain context of execution. */
\r
54 PForthTask pfCreateTask( cell_t UserStackDepth, cell_t ReturnStackDepth );
\r
56 /* Establish this task as the current task. */
\r
57 void pfSetCurrentTask( PForthTask task );
\r
59 /* Delete task created by pfCreateTask */
\r
60 void pfDeleteTask( PForthTask task );
\r
62 /* Build a dictionary with all the basic kernel words. */
\r
63 PForthDictionary pfBuildDictionary( cell_t HeaderSize, cell_t CodeSize );
\r
65 /* Create an empty dictionary. */
\r
66 PForthDictionary pfCreateDictionary( cell_t HeaderSize, cell_t CodeSize );
\r
68 /* Load dictionary from a file. */
\r
69 PForthDictionary pfLoadDictionary( const char *FileName, ExecToken *EntryPointPtr );
\r
71 /* Load dictionary from static array in "pfdicdat.h". */
\r
72 PForthDictionary pfLoadStaticDictionary( void );
\r
74 /* Delete dictionary data. */
\r
75 void pfDeleteDictionary( PForthDictionary dict );
\r
77 /* Execute the pForth interpreter. Yes, QUIT is an odd name but it has historical meaning. */
\r
78 ThrowCode pfQuit( void );
\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
83 /* Include the given pForth source code file. */
\r
84 ThrowCode pfIncludeFile( const char *FileName );
\r
86 /* Execute a Forth word by name. */
\r
87 ThrowCode pfExecIfDefined( const char *CString );
\r
93 #endif /* _pforth_h */
\r