Fix white spaces.
[pforth] / csrc / pfcustom.c
index 1cacea2..9905348 100644 (file)
-/* @(#) pfcustom.c 98/01/26 1.3 */\r
-\r
-#ifndef PF_USER_CUSTOM\r
-\r
-/***************************************************************\r
-** Call Custom Functions for pForth\r
-**\r
-** Create a file similar to this and compile it into pForth\r
-** by setting -DPF_USER_CUSTOM="mycustom.c"\r
-**\r
-** Using this, you could, for example, call X11 from Forth.\r
-** See "pf_cglue.c" for more information.\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
-#include "pf_all.h"\r
-\r
-static cell_t CTest0( cell_t Val );\r
-static void CTest1( cell_t Val1, cell_t Val2 );\r
-\r
-/****************************************************************\r
-** Step 1: Put your own special glue routines here\r
-**     or link them in from another file or library.\r
-****************************************************************/\r
-static cell_t CTest0( cell_t Val )\r
-{\r
-       MSG_NUM_D("CTest0: Val = ", Val);\r
-       return Val+1;\r
-}\r
-\r
-static void CTest1( cell_t Val1, cell_t Val2 )\r
-{\r
-\r
-       MSG("CTest1: Val1 = "); ffDot(Val1);\r
-       MSG_NUM_D(", Val2 = ", Val2);\r
-}\r
-\r
-/****************************************************************\r
-** Step 2: Create CustomFunctionTable.\r
-**     Do not change the name of CustomFunctionTable!\r
-**     It is used by the pForth kernel.\r
-****************************************************************/\r
-\r
-#ifdef PF_NO_GLOBAL_INIT\r
-/******************\r
-** If your loader does not support global initialization, then you\r
-** must define PF_NO_GLOBAL_INIT and provide a function to fill\r
-** the table. Some embedded system loaders require this!\r
-** Do not change the name of LoadCustomFunctionTable()!\r
-** It is called by the pForth kernel.\r
-*/\r
-#define NUM_CUSTOM_FUNCTIONS  (2)\r
-CFunc0 CustomFunctionTable[NUM_CUSTOM_FUNCTIONS];\r
-\r
-Err LoadCustomFunctionTable( void )\r
-{\r
-       CustomFunctionTable[0] = CTest0;\r
-       CustomFunctionTable[1] = CTest1;\r
-       return 0;\r
-}\r
-\r
-#else\r
-/******************\r
-** If your loader supports global initialization (most do.) then just\r
-** create the table like this.\r
-*/\r
-CFunc0 CustomFunctionTable[] =\r
-{\r
-       (CFunc0) CTest0,\r
-       (CFunc0) CTest1\r
-};     \r
-#endif\r
-\r
-/****************************************************************\r
-** Step 3: Add custom functions to the dictionary.\r
-**     Do not change the name of CompileCustomFunctions!\r
-**     It is called by the pForth kernel.\r
-****************************************************************/\r
-\r
-#if (!defined(PF_NO_INIT)) && (!defined(PF_NO_SHELL))\r
-Err CompileCustomFunctions( void )\r
-{\r
-       Err err;\r
-       int i = 0;\r
-/* Compile Forth words that call your custom functions.\r
-** Make sure order of functions matches that in LoadCustomFunctionTable().\r
-** Parameters are: Name in UPPER CASE, Function, Index, Mode, NumParams\r
-*/\r
-       err = CreateGlueToC( "CTEST0", i++, C_RETURNS_VALUE, 1 );\r
-       if( err < 0 ) return err;\r
-       err = CreateGlueToC( "CTEST1", i++, C_RETURNS_VOID, 2 );\r
-       if( err < 0 ) return err;\r
-       \r
-       return 0;\r
-}\r
-#else\r
-Err CompileCustomFunctions( void ) { return 0; }\r
-#endif\r
-\r
-/****************************************************************\r
-** Step 4: Recompile using compiler option PF_USER_CUSTOM\r
-**         and link with your code.\r
-**         Then rebuild the Forth using "pforth -i system.fth"\r
-**         Test:   10 Ctest0 ( should print message then '11' )\r
-****************************************************************/\r
-\r
-#endif  /* PF_USER_CUSTOM */\r
-\r
+/* @(#) pfcustom.c 98/01/26 1.3 */
+
+#ifndef PF_USER_CUSTOM
+
+/***************************************************************
+** Call Custom Functions for pForth
+**
+** Create a file similar to this and compile it into pForth
+** by setting -DPF_USER_CUSTOM="mycustom.c"
+**
+** Using this, you could, for example, call X11 from Forth.
+** See "pf_cglue.c" for more information.
+**
+** Author: Phil Burk
+** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom
+**
+** The pForth software code is dedicated to the public domain,
+** and any third party may reproduce, distribute and modify
+** the pForth software code or any derivative works thereof
+** without any compensation or license.  The pForth software
+** code is provided on an "as is" basis without any warranty
+** of any kind, including, without limitation, the implied
+** warranties of merchantability and fitness for a particular
+** purpose and their equivalents under the laws of any jurisdiction.
+**
+***************************************************************/
+
+
+#include "pf_all.h"
+
+static cell_t CTest0( cell_t Val );
+static void CTest1( cell_t Val1, cell_t Val2 );
+
+/****************************************************************
+** Step 1: Put your own special glue routines here
+**     or link them in from another file or library.
+****************************************************************/
+static cell_t CTest0( cell_t Val )
+{
+    MSG_NUM_D("CTest0: Val = ", Val);
+    return Val+1;
+}
+
+static void CTest1( cell_t Val1, cell_t Val2 )
+{
+
+    MSG("CTest1: Val1 = "); ffDot(Val1);
+    MSG_NUM_D(", Val2 = ", Val2);
+}
+
+/****************************************************************
+** Step 2: Create CustomFunctionTable.
+**     Do not change the name of CustomFunctionTable!
+**     It is used by the pForth kernel.
+****************************************************************/
+
+#ifdef PF_NO_GLOBAL_INIT
+/******************
+** If your loader does not support global initialization, then you
+** must define PF_NO_GLOBAL_INIT and provide a function to fill
+** the table. Some embedded system loaders require this!
+** Do not change the name of LoadCustomFunctionTable()!
+** It is called by the pForth kernel.
+*/
+#define NUM_CUSTOM_FUNCTIONS  (2)
+CFunc0 CustomFunctionTable[NUM_CUSTOM_FUNCTIONS];
+
+Err LoadCustomFunctionTable( void )
+{
+    CustomFunctionTable[0] = CTest0;
+    CustomFunctionTable[1] = CTest1;
+    return 0;
+}
+
+#else
+/******************
+** If your loader supports global initialization (most do.) then just
+** create the table like this.
+*/
+CFunc0 CustomFunctionTable[] =
+{
+    (CFunc0) CTest0,
+    (CFunc0) CTest1
+};
+#endif
+
+/****************************************************************
+** Step 3: Add custom functions to the dictionary.
+**     Do not change the name of CompileCustomFunctions!
+**     It is called by the pForth kernel.
+****************************************************************/
+
+#if (!defined(PF_NO_INIT)) && (!defined(PF_NO_SHELL))
+Err CompileCustomFunctions( void )
+{
+    Err err;
+    int i = 0;
+/* Compile Forth words that call your custom functions.
+** Make sure order of functions matches that in LoadCustomFunctionTable().
+** Parameters are: Name in UPPER CASE, Function, Index, Mode, NumParams
+*/
+    err = CreateGlueToC( "CTEST0", i++, C_RETURNS_VALUE, 1 );
+    if( err < 0 ) return err;
+    err = CreateGlueToC( "CTEST1", i++, C_RETURNS_VOID, 2 );
+    if( err < 0 ) return err;
+
+    return 0;
+}
+#else
+Err CompileCustomFunctions( void ) { return 0; }
+#endif
+
+/****************************************************************
+** Step 4: Recompile using compiler option PF_USER_CUSTOM
+**         and link with your code.
+**         Then rebuild the Forth using "pforth -i system.fth"
+**         Test:   10 Ctest0 ( should print message then '11' )
+****************************************************************/
+
+#endif  /* PF_USER_CUSTOM */
+