Post Reply 
User-defined functions in Free42
11-21-2022, 10:25 AM (This post was last modified: 11-21-2022 10:26 AM by Thomas Okken.)
Post: #45
RE: User-defined functions in Free42
(02-23-2021 07:26 PM)richmit Wrote:  First I want to say that I love the FUNC functionality! It has made my code so much better.

It would be even better if it could optionally restore other global resources like the alpha register, indexed matrix state, flags, & registers.

Indexed matrix state is already saved and restored automatically when needed; specifically, when the currently indexed matrix is hidden by LSTO, or when a local matrix is indexed.

You can use local registers simply by creating a local REGS using LSTO: size 1 NEWMAT LSTO "REGS".

As for a local alpha register and local flags: I agree those would be nice to have, and they are on my to-do list. They are a bit tricky to implement because this will require new state types on the RTN stack an new logic in RTN, and this is going to collide with some other substantial work I want to do on FUNC. So, it is in the pipeline, but don't expect it soon.

(02-24-2021 03:59 AM)richmit Wrote:  One extension that would be useful in the infinite stack mode would be to immediately RTNERR after FUNC if the stack has too few arguments for the function.

It should do that already. If not, please let me know, that would be a bug.

UPDATE: What, those questions were posted nearly two years ago? My apologies, somehow I never noticed them until now.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: User-defined functions in Free42 - Thomas Okken - 11-21-2022 10:25 AM



User(s) browsing this thread: 1 Guest(s)