Skip to content

Commit

Permalink
Add VERSION_CODE and print normal version
Browse files Browse the repository at this point in the history
This will make pForth more consistent with other packages
that use version names like "2.0.0"

Fixes #99
  • Loading branch information
philburk committed Jan 1, 2023
1 parent 3c4c695 commit ab730a3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
7 changes: 4 additions & 3 deletions csrc/pf_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,10 @@ ThrowCode pfDoForth( const char *DicFileName, const char *SourceName, cell_t IfI

if( !gVarQuiet )
{
MSG( "PForth V"PFORTH_VERSION );
if( IsHostLittleEndian() ) MSG("-LE");
else MSG("-BE");
MSG( "PForth V"PFORTH_VERSION_NAME", " );

if( IsHostLittleEndian() ) MSG("LE");
else MSG("BE");
#if PF_BIG_ENDIAN_DIC
MSG("/BE");
#elif PF_LITTLE_ENDIAN_DIC
Expand Down
7 changes: 4 additions & 3 deletions csrc/pf_guts.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
** PFORTH_VERSION changes when PForth is modified and released.
** See README file for version info.
*/
#define PFORTH_VERSION "28"
#define PFORTH_VERSION_CODE 29
#define PFORTH_VERSION_NAME "2.0.0"

/*
** PFORTH_FILE_VERSION changes when incompatible changes are made
Expand Down Expand Up @@ -290,12 +291,12 @@ enum cforth_primitive_ids
ID_FILE_RESIZE, /* RESIZE-FILE */
ID_SLEEP_P, /* (SLEEP) V2.0.0 */
ID_VAR_BYE_CODE, /* BYE-CODE */
/* If you add a word here, take away one reserved word below. */
ID_VERSION_CODE,
/* If you add a word here, take away one reserved word below. */
#ifdef PF_SUPPORT_FP
/* Only reserve space if we are adding FP so that we can detect
** unsupported primitives when loading dictionary.
*/
ID_RESERVED02,
ID_RESERVED03,
ID_RESERVED04,
ID_RESERVED05,
Expand Down
5 changes: 5 additions & 0 deletions csrc/pf_inner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,11 @@ DBUG(("XX ah,m,l = 0x%8x,%8x,%8x - qh,l = 0x%8x,%8x\n", ah,am,al, qh,ql ));
case ID_VAR_TRACE_STACK: DO_VAR(gVarTraceStack); endcase;
case ID_VAR_RETURN_CODE: DO_VAR(gVarReturnCode); endcase;

case ID_VERSION_CODE:
M_PUSH( TOS );
TOS = PFORTH_VERSION_CODE;
endcase;

case ID_WORD:
TOS = (cell_t) ffWord( (char) TOS );
endcase;
Expand Down
1 change: 1 addition & 0 deletions csrc/pfcompil.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ PForthDictionary pfBuildDictionary( cell_t HeaderSize, cell_t CodeSize )
CreateDicEntryC( ID_VAR_OUT, "OUT", 0 );
CreateDicEntryC( ID_VAR_STATE, "STATE", 0 );
CreateDicEntryC( ID_VAR_TO_IN, ">IN", 0 );
CreateDicEntryC( ID_VERSION_CODE, "VERSION_CODE", 0 );
CreateDicEntryC( ID_WORD, "WORD", 0 );
CreateDicEntryC( ID_WORD_FETCH, "W@", 0 );
CreateDicEntryC( ID_WORD_STORE, "W!", 0 );
Expand Down

0 comments on commit ab730a3

Please sign in to comment.