Can we check a program from a program.
|
09-10-2017, 03:56 AM
Post: #1
|
|||
|
|||
Can we check a program from a program.
I'm writing a custom program editor and want to be able to check the code like the regular editor can. Since the function is already there to provide the functionality for the CHECK button in the existing editor, I'm wondering if there is a way for a program to access that function, to either take a program or the contents as a string and check it and return the location of the error if there is one (like the existing editor does).
Thanks -Donald |
|||
09-10-2017, 09:39 PM
Post: #2
|
|||
|
|||
RE: Can we check a program from a program.
Erwin Ried created PrimeMom a few months ago, manages to cover the detection of compilation errors like what you are looking for.
http://www.hpmuseum.org/forum/thread-7948.html Viga C | TD | FB |
|||
09-10-2017, 10:12 PM
Post: #3
|
|||
|
|||
RE: Can we check a program from a program.
That seems to be on the PC, but I want to do this on the calculator....but I'll take a look at what he does...
I know the code already exists on the prime since it's done in the existing editor....I'd hate to have to rewrite it. Thx -D |
|||
09-11-2017, 05:11 AM
Post: #4
|
|||
|
|||
RE: Can we check a program from a program.
Hello,
As far as I remember doing Programs("name"):=string will return 0 or 1 (0 means error). However, it does not return the position of the error, sorry. Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
09-11-2017, 05:17 AM
Post: #5
|
|||
|
|||
RE: Can we check a program from a program.
Carlos' suggestion is a csharp program in windows and that won't work for what I want to do.
The other suggestion....I'll have to look at that. Program("name"):=string writes the program....but even checking for an error might be good enough....I'll have to check that...Thx |
|||
09-11-2017, 05:53 AM
Post: #6
|
|||
|
|||
RE: Can we check a program from a program.
I could remove one line at a time and execute Program("name"):=string until the error goes away, to isolate the failing line. However, this won't work for multiple errors.
I think the best approach is to treat the original editor as a debugger and to have the user run that after using my editor.... That's really the best approach as long as HP doesn't give us access to the check/debug functionality. |
|||
09-11-2017, 06:36 PM
(This post was last modified: 09-11-2017 06:55 PM by Tim Wessman.)
Post: #7
|
|||
|
|||
RE: Can we check a program from a program.
How would this be for you?
On program store and successful compile, returns { } Programs("name"):="EXPORT test()\nBEGIN\n\nEND;" ----> {} On program store and failure on compile, returns { line_number_failure, character_position_failure, <reserved for future use> } Programs("name"):="EXPORT test(\nBEGIN\n\nEND;" ----> {#2:64h,#12:64h} That is the info you get in the CHECK button, note how the cursor position is placed at the end of BEGIN there which corresponds to the numbers I've given in the example. AProgram would behave similarly. TW Although I work for HP, the views and opinions I post here are my own. |
|||
09-11-2017, 08:22 PM
Post: #8
|
|||
|
|||
RE: Can we check a program from a program.
That would be great! It doesn't do this now though :-)
Thanks -Donald |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)