** Dictionary Management
***************************************************************/
-cell_t pfExecIfDefined( const char *CString )
+ThrowCode pfExecIfDefined( const char *CString )
{
- int result = 0;
+ ThrowCode result = 0;
if( NAME_BASE != (cell_t)NULL)
{
ExecToken XT;
/**************************************************************************
** Main entry point for pForth.
*/
-cell_t pfDoForth( const char *DicFileName, const char *SourceName, cell_t IfInit )
+ThrowCode pfDoForth( const char *DicFileName, const char *SourceName, cell_t IfInit )
{
pfTaskData_t *cftd;
pfDictionary_t *dic = NULL;
- cell_t Result = 0;
+ ThrowCode Result = 0;
ExecToken EntryPoint = 0;
#ifdef PF_USER_INIT
extern "C" {
#endif
-int pfCatch( ExecToken XT );
+ThrowCode pfCatch( ExecToken XT );
#ifdef __cplusplus
}
: Hi == 0 );
}
-static const char *pfSelectFileModeCreate( int fam );
-static const char *pfSelectFileModeOpen( int fam );
+static const char *pfSelectFileModeCreate(cell_t fam );
+static const char *pfSelectFileModeOpen(cell_t fam );
/**************************************************************/
-static const char *pfSelectFileModeCreate( int fam )
+static const char *pfSelectFileModeCreate( cell_t fam )
{
const char *famText = NULL;
switch( fam )
}
/**************************************************************/
-static const char *pfSelectFileModeOpen( int fam )
+static const char *pfSelectFileModeOpen( cell_t fam )
{
const char *famText = NULL;
switch( fam )
}
/**************************************************************/
-int pfCatch( ExecToken XT )
+ThrowCode pfCatch( ExecToken XT )
{
register cell_t TopOfStack; /* Cache for faster execution. */
register cell_t *DataStackPtr;
TOS = -3; /* TODO err num? */
break;
}
- offset = offsetLow;
+ offset = (file_offset_t)offsetLow;
TOS = sdSeekFile( FileID, offset, PF_SEEK_SET );
}
endcase;
char IfInit = FALSE;
char *s;
cell_t i;
- int Result;
+ ThrowCode Result;
/* For Metroworks on Mac */
#ifdef __MWERKS__
Result = pfDoForth( DicName, SourceName, IfInit);
on_error:
- return Result;
+ return (int)Result;
}
#endif /* PF_EMBEDDED */
/***************************************************************/
static int Write32ToFile( FileStream *fid, uint32_t Val )
{
- int numw;
+ size_t numw;
uint8_t pad[4];
Write32BigEndian(pad,Val);
/***************************************************************/
static int32_t Read32FromFile( FileStream *fid, uint32_t *ValPtr )
{
- int32_t numr;
+ size_t numr;
uint8_t pad[4];
numr = sdReadFile( pad, 1, sizeof(pad), fid );
if( numr != sizeof(pad) ) return -1;
uint32_t ChunkSize;
uint32_t FormSize;
uint32_t BytesLeft;
- uint32_t numr;
+ size_t numr;
int isDicBigEndian;
DBUG(("pfLoadDictionary( %s )\n", FileName ));
/* Find special words in dictionary for global XTs. */
if( (Result = FindSpecialXTs()) < 0 )
{
- pfReportError("pfLoadDictionary: FindSpecialXTs", Result);
+ pfReportError("pfLoadDictionary: FindSpecialXTs", (Err)Result);
goto error;
}
}
** Compare two strings, case sensitive.
** Return zero if they match, -1 if s1<s2, +1 is s1>s2;
*/
-cell_t ffCompare( const char *s1, cell_t len1, const char *s2, int32_t len2 )
+cell_t ffCompare( const char *s1, cell_t len1, const char *s2, cell_t len2 )
{
cell_t i, result, n, diff;
char *ForthStringToC( char *dst, const char *FString, cell_t dstSize );
char *CStringToForth( char *dst, const char *CString, cell_t dstSize );
-cell_t ffCompare( const char *s1, cell_t len1, const char *s2, int32_t len2 );
+cell_t ffCompare( const char *s1, cell_t len1, const char *s2, cell_t len2 );
cell_t ffCompareText( const char *s1, const char *s2, cell_t len );
cell_t ffCompareTextCaseN( const char *s1, const char *s2, cell_t len );
***************************************************************/
Err ffPushInputStream( FileStream *InputFile )
{
- cell_t Result = 0;
+ Err Result = 0;
IncludeFrame *inf;
/* Push current input state onto special include stack. */
#endif
/* Main entry point to pForth. */
-cell_t pfDoForth( const char *DicName, const char *SourceName, cell_t IfInit );
+ThrowCode pfDoForth( const char *DicName, const char *SourceName, cell_t IfInit );
/* Turn off messages. */
void pfSetQuiet( cell_t IfQuiet );
ThrowCode pfQuit( void );
/* Execute a single execution token in the current task and return 0 or an error code. */
-int pfCatch( ExecToken XT );
+ThrowCode pfCatch( ExecToken XT );
/* Include the given pForth source code file. */
ThrowCode pfIncludeFile( const char *FileName );