X-Git-Url: http://git.subgeniuskitty.com/pforth/.git/blobdiff_plain/970d32b553a44051cedd2caf34267b7b1cdbab78..1f99f95d6a7eecc05cae8fb357f9b7bf564c2725:/csrc/pf_main.c diff --git a/csrc/pf_main.c b/csrc/pf_main.c index 6b07f33..1d9fa08 100644 --- a/csrc/pf_main.c +++ b/csrc/pf_main.c @@ -1,154 +1,151 @@ -/* @(#) pf_main.c 98/01/26 1.2 */ -/*************************************************************** -** Forth based on 'C' -** -** main() routine that demonstrates how to call PForth as -** a module from 'C' based application. -** Customize this as needed for your application. -** -** 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. -** -***************************************************************/ - -#if (defined(PF_NO_STDIO) || defined(PF_EMBEDDED)) - #define NULL ((void *) 0) - #define ERR(msg) /* { printf msg; } */ -#else - #include - #define ERR(msg) { printf msg; } -#endif - -#include "pforth.h" - -#ifndef PF_DEFAULT_DICTIONARY -#define PF_DEFAULT_DICTIONARY "pforth.dic" -#endif - -#ifdef __MWERKS__ - #include - #include -#endif - -#ifndef TRUE -#define TRUE (1) -#define FALSE (0) -#endif - -static const char *gErrorMsg32Bit = "ERROR - A long is not 4 bytes. Are we running on a 64-bit machine?!\n"; - -#ifdef PF_EMBEDDED -int main( void ) -{ - char IfInit = 0; - const char *DicName = NULL; +/* @(#) pf_main.c 98/01/26 1.2 */ +/*************************************************************** +** Forth based on 'C' +** +** main() routine that demonstrates how to call PForth as +** a module from 'C' based application. +** Customize this as needed for your application. +** +** 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. +** +***************************************************************/ + +#if (defined(PF_NO_STDIO) || defined(PF_EMBEDDED)) + #define NULL ((void *) 0) + #define ERR(msg) /* { printf msg; } */ +#else + #include + #define ERR(msg) { printf msg; } +#endif + +#include "pforth.h" + +#ifndef PF_DEFAULT_DICTIONARY +#define PF_DEFAULT_DICTIONARY "pforth.dic" +#endif + +#ifdef __MWERKS__ + #include + #include +#endif + +#ifndef TRUE +#define TRUE (1) +#define FALSE (0) +#endif + +#ifdef PF_EMBEDDED +int main( void ) +{ + char IfInit = 0; + const char *DicName = NULL; const char *SourceName = NULL; - // Check to make sure we are running in 32-bit mode. - if( sizeof(long) != 4 ) - { - pfMessage(gErrorMsg32Bit); - return 1; - } - pfMessage("\npForth Embedded\n"); - return pfDoForth( DicName, SourceName, IfInit); -} -#else - -int main( int argc, char **argv ) -{ -#ifdef PF_STATIC_DIC - const char *DicName = NULL; -#else /* PF_STATIC_DIC */ - const char *DicName = PF_DEFAULT_DICTIONARY; -#endif /* !PF_STATIC_DIC */ - - const char *SourceName = NULL; - char IfInit = FALSE; - char *s; - int32 i; - int Result; - - // Check to make sure we are running in 32-bit mode. - if( sizeof(long) != 4 ) - { - ERR((gErrorMsg32Bit)); - return 1; - } - -/* For Metroworks on Mac */ -#ifdef __MWERKS__ - argc = ccommand(&argv); -#endif - -/* Parse command line. */ - for( i=1; i