Post Reply 
newRPL: [UPDATED April 27-2017] Firmware for testing available for download
11-09-2016, 09:41 PM
Post: #437
RE: newRPL: [UPDATED November-08-16] Firmware for testing available for download
(11-08-2016 08:45 PM)Han Wrote:  One of the things I would like tinker with is some of the linear algebra commands that are currently not available. I just happened to notice a few hard-coded limits in the array size (65535). Is there any reason not to use define statements so that it could easily be managed later on rather than a hard value (I suspect that perhaps memory is the limiting factor)?

No particular reason, hard-coded constants could be replaced with named constants to beautify the code. In many cases it was, there might have been a few places where this was done in a rush or something.
Now the hard coded limit on arrays is to use 1 word for both width and height, 16 bits each. Raising that limit would imply redefining the object. I don't see any need for matrices larger than that in a calculator, but if you feel is too little we are still on time to redefine it.

(11-08-2016 08:45 PM)Han Wrote:  EDIT: Some initial questions:

...

I do not see a quick way to make use of existing routines (cross-library usage). For example, if I wanted to re-use the code of MYCMD, and since it is not defined as a function, what is the proper way to call MYCMD?

There's 2 ways:
a) Move the code to a separate function and create an API in newrpl.h Since you've been looking at the matrix library, you can see its reusable code is in matrix.c, which can be used from other libraries. Some libraries have the functions in the same library .c file, others have a separate file.
b) If you are looking to execute a particular command, it's quite simple:
rplCallOperator() does it for you.
Code:

// COMPUTE THE SQUARE ROOT
rplCallOperator(CMD_SQRT);
if(Exceptions) {
   ...
}

There's 2 big limitations: One is that you can't use it for recursion, as the C stack is very limited (recursion must be done in RPL, using the return stack which can grow freely). The other is that you MUST make sure the command you call is monolithic C execution. In other words, you can't call any commands that rely on RPL code, as the RPL loop is not running.

To overcome this limitation you can use embedded RPL code that calls the command. This is the only safe way to execute commands like EVAL on a symbolic object for example. The symbolic could contain a user-defined function, which would be RCL'd and the program executed during evaluation. For this you need a fully running RPL loop.
To include RPL code there's also 2 ways:
a) The way you described, with an ugly list of macro declarations. This was used extensively on libraries, mostly because they were developed before newrpl-comp was available.
b) Add a .nrpl file to the project, and use the INCLUDE_ROMOBJECT(...) macro. This is much cleaner if you need RPL routines longer than 3 or 4 commands.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL: [UPDATED November-08-16] Firmware for testing available for download - Claudio L. - 11-09-2016 09:41 PM



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