1 /* @(#) pf_main.c 98/01/26 1.2 */
\r
2 /***************************************************************
\r
3 ** Forth based on 'C'
\r
5 ** main() routine that demonstrates how to call PForth as
\r
6 ** a module from 'C' based application.
\r
7 ** Customize this as needed for your application.
\r
10 ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom
\r
12 ** The pForth software code is dedicated to the public domain,
\r
13 ** and any third party may reproduce, distribute and modify
\r
14 ** the pForth software code or any derivative works thereof
\r
15 ** without any compensation or license. The pForth software
\r
16 ** code is provided on an "as is" basis without any warranty
\r
17 ** of any kind, including, without limitation, the implied
\r
18 ** warranties of merchantability and fitness for a particular
\r
19 ** purpose and their equivalents under the laws of any jurisdiction.
\r
21 ***************************************************************/
\r
23 #if (defined(PF_NO_STDIO) || defined(PF_EMBEDDED))
\r
24 #define NULL ((void *) 0)
\r
25 #define ERR(msg) /* { printf msg; } */
\r
28 #define ERR(msg) { printf msg; }
\r
33 #ifndef PF_DEFAULT_DICTIONARY
\r
34 #define PF_DEFAULT_DICTIONARY "pforth.dic"
\r
38 #include <console.h>
\r
51 const char *DicName = NULL;
\r
52 const char *SourceName = NULL;
\r
53 pfMessage("\npForth Embedded\n");
\r
54 return pfDoForth( DicName, SourceName, IfInit);
\r
58 int main( int argc, char **argv )
\r
60 #ifdef PF_STATIC_DIC
\r
61 const char *DicName = NULL;
\r
62 #else /* PF_STATIC_DIC */
\r
63 const char *DicName = PF_DEFAULT_DICTIONARY;
\r
64 #endif /* !PF_STATIC_DIC */
\r
66 const char *SourceName = NULL;
\r
67 char IfInit = FALSE;
\r
72 /* For Metroworks on Mac */
\r
74 argc = ccommand(&argv);
\r
77 /* Parse command line. */
\r
78 for( i=1; i<argc; i++ )
\r
99 if( *s != '\0' ) DicName = s;
\r
100 // Allow space after -d (Thanks Aleksej Saushev)
\r
101 // Make sure there is another argument.
\r
102 else if( (i+1) < argc )
\r
104 DicName = argv[++i];
\r
106 if (DicName == NULL || *DicName == '\0')
\r
108 DicName = PF_DEFAULT_DICTIONARY;
\r
113 ERR(("Unrecognized option!\n"));
\r
114 ERR(("pforth {-i} {-q} {-dfilename.dic} {sourcefilename}\n"));
\r
126 #ifdef PF_INIT_MODE
\r
131 Result = pfDoForth( DicName, SourceName, IfInit);
\r
137 #endif /* PF_EMBEDDED */
\r