Index: csrc/pf_core.c =================================================================== RCS file: /home/asau/repo/cvs/apforth/csrc/pf_core.c,v retrieving revision 1.12 diff -u -r1.12 pf_core.c --- csrc/pf_core.c 27 Jan 2011 12:55:05 -0000 1.12 +++ csrc/pf_core.c 9 Feb 2011 16:28:29 -0000 @@ -424,6 +424,34 @@ ioType( CString, (cell_t) pfCStringLength(CString) ); } +/* Print banner */ +static void pfPrintBanner(const char *DicFileName) +{ + MSG("PForth V"PFORTH_VERSION); + + if (IsHostLittleEndian()) MSG("-LE"); else MSG("-BE"); +#if PF_BIG_ENDIAN_DIC + MSG("/BE"); +#elif PF_LITTLE_ENDIAN_DIC + MSG("/LE"); +#endif + + if (sizeof(cell_t) == 8) { + MSG("/64"); + } else if (sizeof(cell_t) == 4) { + MSG("/32"); + } + + MSG(", built "__DATE__" "__TIME__); + + if (DicFileName != NULL) { + EMIT_CR; + } else { + MSG(" (static)"); + EMIT_CR; + } +} + /************************************************************************** ** Main entry point for pForth. */ @@ -444,63 +472,33 @@ /* Allocate Task structure. */ cftd = (pfTaskData_t*) pfCreateTask(DEFAULT_USER_DEPTH, DEFAULT_RETURN_DEPTH); - if( cftd ) - { + if (cftd != NULL) { pfSetCurrentTask( cftd ); - - if( !gVarQuiet ) - { - MSG( "PForth V"PFORTH_VERSION ); - if( IsHostLittleEndian() ) MSG("-LE"); - else MSG("-BE"); -#if PF_BIG_ENDIAN_DIC - MSG("/BE"); -#elif PF_LITTLE_ENDIAN_DIC - MSG("/LE"); -#endif - if (sizeof(cell_t) == 8) - { - MSG("/64"); - } - else if (sizeof(cell_t) == 4) - { - MSG("/32"); - } - - MSG( ", built "__DATE__" "__TIME__ ); - } + + if (!gVarQuiet) pfPrintBanner(DicFileName); if (LoadCustomFunctionTable() < 0) goto error2; /* Init custom 'C' call array. */ -#if (!defined(PF_NO_INIT)) && (!defined(PF_NO_SHELL)) - if( IfInit ) - { +#if defined(PF_NO_INIT) || defined(PF_NO_SHELL) + IfInit = 0; /* don't try to build dictionary */ +#endif + + if (IfInit) { +#if !defined(PF_NO_INIT) && !defined(PF_NO_SHELL) dic = (pfDictionary_t*) pfBuildDictionary( DEFAULT_HEADER_SIZE, DEFAULT_CODE_SIZE ); - } - else -#else - TOUCH(IfInit); #endif /* !PF_NO_INIT && !PF_NO_SHELL*/ - { - if( DicFileName ) - { - EMIT_CR; - dic = (pfDictionary_t*) pfLoadDictionary( DicFileName, &EntryPoint ); - } - else - { - MSG(" (static)"); - EMIT_CR; - dic = (pfDictionary_t*) pfLoadStaticDictionary(); - } + } else if (DicFileName != NULL) { + dic = (pfDictionary_t*) pfLoadDictionary(DicFileName, &EntryPoint); + } else { + dic = (pfDictionary_t*) pfLoadStaticDictionary(); } - if( dic == NULL ) goto error2; - - if( !gVarQuiet ) - { + + if (dic == NULL) goto error2; + + if (!gVarQuiet) { EMIT_CR; } - + Result = pfExecIfDefined("AUTO.INIT"); if( Result != 0 ) { @@ -512,9 +510,9 @@ { Result = pfCatch( EntryPoint ); } -#ifndef PF_NO_SHELL else { +#ifndef PF_NO_SHELL if( SourceName == NULL ) { Result = pfQuit(); @@ -529,8 +527,8 @@ } Result = pfIncludeFile( SourceName ); } - } #endif /* PF_NO_SHELL */ + } /* Clean up after running Forth. */ pfExecIfDefined("AUTO.TERM");