Menu

Clearing all entries on the data stack

2021-08-20
2021-08-20
  • Simon Whittam

    Simon Whittam - 2021-08-20

    In a compiled word, is there a way to clear all entries on the data stack simultaneously without using the 'drop' word ?

    Thinking of a situation where one passes multiple entries on the data stack when calling a word and exits prematurely without using all the entries on the data stack.

    Does it involve adjusting the data Stack Pointer ?

    Out of curiosity I see the words SP@ and SP! mentioned in FF quick reference guides but it's not apparent SP! is available when listing 'words sp' from the FF terminal connection.

    TIA, Simon.

     
  • Mikael Nordman

    Mikael Nordman - 2021-08-20

    Normally you would use drop. It adjusts the stack pointer.

    You could use also SP!.

    sp@ 10 -  sp!
    

    For some reason I removed it from the wordlist.
    I guess I thought it is not needed in practice by application code.

     
  • Simon Whittam

    Simon Whittam - 2021-08-20

    So SP! is not available in the current version of FF ?

    SP! is not recognised by my FF either interactively or compiled.

     
  • Mikael Nordman

    Mikael Nordman - 2021-08-20

    It is not available. I will put it back when I get back to maintaining FF.
    If you are in a hurry you can modify the FF source and recompile.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.