Post Reply 
newRPL: Output to a text console
01-14-2017, 03:36 PM
Post: #13
RE: newRPL: Output to a text console
Officially decided to go 2 ways:

a) Simplified console output:
--------------------------------
Plain text with simple tags between @ symbols:
Code:

"This is a sample tag @TAG@.
There's two types of tag, @TAG@ will display the content of the variable TAG.
Then @=TAG@ will EVAL variable TAG and display the result left in the stack.
This is so you can include pretty print formulas like this:
@MYEQ@ = @=MYEQ@
"

The example speaks for itself, if MYEQ contains 'X^2/2', it will render the equation in pretty print, then the equal sign and finally the result. TAG can contain any object, in particular PLOT objects and equations are of interest to document results.

b) Full-blown Apps and Forms engine:
------------------------------------------
Applications will be contained in a directory.
The directory contains a variable 'Forms' with a list of IDENTS of forms the user can enter to. This allows more than one view in an application. A key on the keyboard will go from Stack view to cycle between all the forms in the list. For example:
{ 'TriangSolver' 'ODESolver' } 'Forms' STO
Tells the system in this directory there's 2 forms, the idents are the root name of all the variables required to define the form:
'TriangSolver.Fields' will contain the text in the form of the simplified console above. The tags in the text can be interactive fields.
'TriangSolver.Enter' runs when you switch into the form
'TriangSolver.Exit' runs when you switch to a different form or the stack
... etc.
many many more events that are called from the engine, if they don't exist the system quietly does nothing.
For other forms, the same thing: 'ODESolver.Fields', etc.
Fields are also defined the same way: an arbitrary name trailed by events. For example, in the triangle solver, the side 'A' will become input field 'A' when:
'A' contains the value of the length of the side as expected
'A.Type' has the type of interactive field (an edit control, a button, a check mark, etc). Just the existence of this variable indicates this is an interactive field.
'A.Default' gets the initial default value
'A.Format' gives hints on how to format the value of A
'A.Units' gives a set of preferred units to display A into
'A.Depend' provides a list of other fields this one depends on. A change in any of those fields means the 'A.Update' event gets called.

... etc. many more field properties, each type will have its own properties.
And then a few events as well:
'A.Draw' gets called to redraw the field, contents of A are displayed if this is not defined.
'A.Action' gets called when the user selects the widget and hits Enter
'A.Update' provides a formula or a program to update the value of the field based on other actions.
... and many more events.

A simple example:
Let's say we have a formula: Y=X^2/2.
We create a variable X, and we make it a field by creating some additional variables:
X.Type=EDIT
X.Format="#.###" (display the value with 3 decimal digits)
X.Default=0
Now we create the resulting field Y by creating:
Y.Formula='X^2/2'
Y.Format="#.###"
Y.Depend= { X }

And finally our form:
'MyForm.Fields'= "This is our test form
Please enter X = @X@

Solution of Y= @Y.Formula@ = @Y@

Done!
"

Seems like a lot of work, but it's quite simple.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL: Output to a text console - Han - 01-13-2017, 03:22 PM
RE: newRPL: Output to a text console - Han - 01-13-2017, 08:12 PM
RE: newRPL: Output to a text console - Claudio L. - 01-14-2017 03:36 PM



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