HP Forums

Full Version: Can we check a program from a program.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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
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
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
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
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.
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.
That would be great! It doesn't do this now though :-)
Thanks
-Donald
Reference URL's