-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Long name support #182
base: master
Are you sure you want to change the base?
Long name support #182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good!
Let's keep it switchable. That will make it easier to debug if there is a name size
related problem.
/* Most Forth word names are short - so 31 characters should be enough. | ||
* However if you are integrating with other systems - for example libSDL | ||
* some names are longer than 31 characters. This provides up to 63 characters | ||
* for a word names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* for a word names. | |
* for word names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could also be convinced to just make long names the default. Hmm.
* Long term this can become the default since there is no storage penalty | ||
* when not using them. | ||
*/ | ||
#define LONG_NAME_SUPPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this like the other compile time switches defined at:
https://www.softsynth.com/pforth/pf_ref.php#Compiler-Options
Let's rename it to PF_SUPPORT_LONG_NAMES
and leave it undefined for now.
Maybe we can test it on/off in GitHub Actions.
@@ -63,10 +80,19 @@ | |||
#define FTRUE (-1) | |||
#define BLANK (' ') | |||
|
|||
#define FLAG_PRECEDENCE (0x80) | |||
/* #define FLAG_PRECEDENCE (0x80) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add:
/* The IMMEDIATE flag is known as the "precedence bit" on some other Forth systems. */
This adds long word name support.
Questions:
Currently this is gated by a #define
LONG_NAME_SUPPORT
- currently enabled, but it can be build without to support old dictionaries with a build - however, maybe we should remove this and only support long names?I added two Primitive Token IDS - which expose the FLAG_SMUDGE and MASK_NAME_SIZE ... these allow the Forth files to not have magic numbers unrelated to the Forth core... I can understand why we didn't do this in the past (size), but I think the dependency is strong between the two - and the Forth code is clearer for it. However it is a design decision - so should we do this or revert this part?
I left FLAG_PRECEDENCE commented out - maybe this should be removed.
Name to long warnings/errors to be raised as a separate PR.