relicense to 0BSD
[pforth] / csrc / pforth.h
index 39a1290..1080bd2 100644 (file)
@@ -1,92 +1,96 @@
-/* @(#) pforth.h 98/01/26 1.2 */\r
-#ifndef _pforth_h\r
-#define _pforth_h\r
-\r
-/***************************************************************\r
-** Include file for pForth, a portable Forth based on 'C'\r
-**\r
-** This file is included in any application that uses pForth as a tool.\r
-**\r
-** Author: Phil Burk\r
-** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom\r
-**\r
-** The pForth software code is dedicated to the public domain,\r
-** and any third party may reproduce, distribute and modify\r
-** the pForth software code or any derivative works thereof\r
-** without any compensation or license.  The pForth software\r
-** code is provided on an "as is" basis without any warranty\r
-** of any kind, including, without limitation, the implied\r
-** warranties of merchantability and fitness for a particular\r
-** purpose and their equivalents under the laws of any jurisdiction.\r
-**\r
-**\r
-***************************************************************/\r
-\r
-/* Define stubs for data types so we can pass pointers but not touch inside. */\r
-typedef void *PForthTask;\r
-typedef void *PForthDictionary;\r
-\r
-typedef unsigned long ExecToken;              /* Execution Token */\r
-typedef long          ThrowCode;\r
-\r
-#ifndef int32\r
-       typedef long int32;\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/* Main entry point to pForth. */\r
-int32 pfDoForth( const char *DicName, const char *SourceName, int32 IfInit );\r
-\r
-/* Turn off messages. */\r
-void  pfSetQuiet( int32 IfQuiet );\r
-\r
-/* Query message status. */\r
-int32  pfQueryQuiet( void );\r
-\r
-/* Send a message using low level I/O of pForth */\r
-void  pfMessage( const char *CString );\r
-\r
-/* Create a task used to maintain context of execution. */\r
-PForthTask pfCreateTask( int32 UserStackDepth, int32 ReturnStackDepth );\r
-\r
-/* Establish this task as the current task. */\r
-void  pfSetCurrentTask( PForthTask task );\r
-\r
-/* Delete task created by pfCreateTask */\r
-void  pfDeleteTask( PForthTask task );\r
-\r
-/* Build a dictionary with all the basic kernel words. */\r
-PForthDictionary pfBuildDictionary( int32 HeaderSize, int32 CodeSize );\r
-\r
-/* Create an empty dictionary. */\r
-PForthDictionary pfCreateDictionary( int32 HeaderSize, int32 CodeSize );\r
-\r
-/* Load dictionary from a file. */\r
-PForthDictionary pfLoadDictionary( const char *FileName, ExecToken *EntryPointPtr );\r
-\r
-/* Load dictionary from static array in "pfdicdat.h". */\r
-PForthDictionary pfLoadStaticDictionary( void );\r
-\r
-/* Delete dictionary data. */\r
-void  pfDeleteDictionary( PForthDictionary dict );\r
-\r
-/* Execute the pForth interpreter. Yes, QUIT is an odd name but it has historical meaning. */\r
-ThrowCode pfQuit( void );\r
-\r
-/* Execute a single execution token in the current task and return 0 or an error code. */\r
-int pfCatch( ExecToken XT );\r
\r
-/* Include the given pForth source code file. */\r
-ThrowCode pfIncludeFile( const char *FileName );\r
-\r
-/* Execute a Forth word by name. */\r
-ThrowCode  pfExecIfDefined( const char *CString );\r
-\r
-#ifdef __cplusplus\r
-}   \r
-#endif\r
-\r
-#endif  /* _pforth_h */\r
+/* @(#) pforth.h 98/01/26 1.2 */
+#ifndef _pforth_h
+#define _pforth_h
+
+/***************************************************************
+** Include file for pForth, a portable Forth based on 'C'
+**
+** This file is included in any application that uses pForth as a tool.
+**
+** Author: Phil Burk
+** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom
+**
+** Permission to use, copy, modify, and/or distribute this
+** software for any purpose with or without fee is hereby granted.
+**
+** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+** THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+** FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+** CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+**
+**
+***************************************************************/
+
+/* Define stubs for data types so we can pass pointers but not touch inside. */
+typedef void *PForthTask;
+typedef void *PForthDictionary;
+
+#include <stdint.h>
+/* Integer types for Forth cells, signed and unsigned: */
+typedef intptr_t cell_t;
+typedef uintptr_t ucell_t;
+
+typedef ucell_t ExecToken;              /* Execution Token */
+typedef cell_t ThrowCode;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Main entry point to pForth. */
+ThrowCode pfDoForth( const char *DicName, const char *SourceName, cell_t IfInit );
+
+/* Turn off messages. */
+void  pfSetQuiet( cell_t IfQuiet );
+
+/* Query message status. */
+cell_t  pfQueryQuiet( void );
+
+/* Send a message using low level I/O of pForth */
+void  pfMessage( const char *CString );
+
+/* Create a task used to maintain context of execution. */
+PForthTask pfCreateTask( cell_t UserStackDepth, cell_t ReturnStackDepth );
+
+/* Establish this task as the current task. */
+void  pfSetCurrentTask( PForthTask task );
+
+/* Delete task created by pfCreateTask */
+void  pfDeleteTask( PForthTask task );
+
+/* Build a dictionary with all the basic kernel words. */
+PForthDictionary pfBuildDictionary( cell_t HeaderSize, cell_t CodeSize );
+
+/* Create an empty dictionary. */
+PForthDictionary pfCreateDictionary( cell_t HeaderSize, cell_t CodeSize );
+
+/* Load dictionary from a file. */
+PForthDictionary pfLoadDictionary( const char *FileName, ExecToken *EntryPointPtr );
+
+/* Load dictionary from static array in "pfdicdat.h". */
+PForthDictionary pfLoadStaticDictionary( void );
+
+/* Delete dictionary data. */
+void  pfDeleteDictionary( PForthDictionary dict );
+
+/* Execute the pForth interpreter. Yes, QUIT is an odd name but it has historical meaning. */
+ThrowCode pfQuit( void );
+
+/* Execute a single execution token in the current task and return 0 or an error code. */
+ThrowCode pfCatch( ExecToken XT );
+
+/* Include the given pForth source code file. */
+ThrowCode pfIncludeFile( const char *FileName );
+
+/* Execute a Forth word by name. */
+ThrowCode  pfExecIfDefined( const char *CString );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _pforth_h */