Externals, Functions and Procedures
Posted: Fri Feb 28, 2025 11:39 am
I have been faffing around trying to understand, within my SMSQE/SMS2/Qlib systems, Externals, Functions and Procedures.
I have written many more test programs that fail than test programs that work, in a not completely futile attempt to learn by experiment. I have, of course read the instruction manuals concerning these concepts, but can understand only about 70% of the documentation and thus cannot workout by myself what I am doing wrong.
An example of my problem is note 4, page 154 of the BASIC ref. manual:-
"Although a sub-set of a simple string (what is a complex string?) is an expression (what is an expression?) and therefore will not be altered within a function, a sub-set of a string array (my translation of DIM string) is not treated as an expression and will therefore be altered!!"
What does the above mean? In my opinion coded examples are the best way to explain the use of an instruction.
My problem is that I use the ancient programming environment of SMS2 adapted for SMSQE and so I have to navigate around references to Interpreted BASIC and programming with line numbers to create my own method of creating test programs.
I am developing a standard way of testing BASIC instructions within a moveable windowing environment as can be seen in my JPG.
The four programs use a procedure compiled as an external that generates the image (EP_Mkw that takes a string parameter that is displayed in the title box). The programs then test passing an integer, a floating point number, a string and an array to a function called F_doit.
One can see that my attempt to pass and return an integer fails and my attempt to pass and return an array produces a strange result. The two others work correctly.
What am I doing wrong?
I have written many more test programs that fail than test programs that work, in a not completely futile attempt to learn by experiment. I have, of course read the instruction manuals concerning these concepts, but can understand only about 70% of the documentation and thus cannot workout by myself what I am doing wrong.
An example of my problem is note 4, page 154 of the BASIC ref. manual:-
"Although a sub-set of a simple string (what is a complex string?) is an expression (what is an expression?) and therefore will not be altered within a function, a sub-set of a string array (my translation of DIM string) is not treated as an expression and will therefore be altered!!"
What does the above mean? In my opinion coded examples are the best way to explain the use of an instruction.
My problem is that I use the ancient programming environment of SMS2 adapted for SMSQE and so I have to navigate around references to Interpreted BASIC and programming with line numbers to create my own method of creating test programs.
I am developing a standard way of testing BASIC instructions within a moveable windowing environment as can be seen in my JPG.
The four programs use a procedure compiled as an external that generates the image (EP_Mkw that takes a string parameter that is displayed in the title box). The programs then test passing an integer, a floating point number, a string and an array to a function called F_doit.
One can see that my attempt to pass and return an integer fails and my attempt to pass and return an array produces a strange result. The two others work correctly.
What am I doing wrong?