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