A few Prime programming questions
|
09-28-2017, 03:29 PM
Post: #1
|
|||
|
|||
A few Prime programming questions
I'm working on implementing some of the algorithms in Curve Fitting For Programmable Calculators, but I've got some questions on how best to work on a large program.
Is there some way to provide custom help text for a function, so that you can press the Help key and see detailed info about the arguments, output, etc. as with built-in functions? How best can I allow the user to specify one of the 2-Var Stat symbolic variables (S1, S2, S3, etc.) as an argument to the function, and subsequently write changes back to that variable? Calling the function with an unquoted S1 as a parameter would obviously pass by value, so any changes made to that list (like writing back a custom fit equation) would only affect the local copy. I suppose I'm looking for some form of indirect addressing here. What's the best environment for programming on a PC? The Connectivity Kit lets you edit copies of a program directly on the Prime, but I'm not sure if there's some way to edit a local copy of the program, and transfer it to the Prime (or emulator) for testing. And is there an easy way to enter special characters, such as the Greek or math symbols? I can't find any sort of symbol palette in the Connectivity Kit. |
|||
09-29-2017, 05:24 AM
Post: #2
|
|||
|
|||
RE: A few Prime programming questions
Hello,
unfortunately, there is no way to add help to a function. This has always been in the plans, but we never had time to implement it. sorry. There is unfortunately no 'pass by reference'... However, you can pass the quoted variable name (either as string or as 'var') and then use eval or expr to get the content and expr(var+"="+val) to store a value in it. 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-29-2017, 01:34 PM
Post: #3
|
|||
|
|||
RE: A few Prime programming questions
Okay, good to know expr can be used in that fashion. Though with the string manipulation and on-the-fly compilation, I'm guessing it's best to avoid using that in performance-critical loops.
Custom help text would be really nice. It wouldn't have to be anything especially complicated; you could borrow the use of /// from XML documentation systems (e.g. .NET). ///Some help text. ///More text. ///param_name: Parameter description EXPORT MyFunction(param_name)... Then you could even scrape the parameter descriptions for display when running the program via the Program Library menu, much like specifying help text for fields with the Input function. |
|||
09-29-2017, 03:41 PM
(This post was last modified: 09-29-2017 04:12 PM by toshk.)
Post: #4
|
|||
|
|||
RE: A few Prime programming questions
Try this: Avoiding making copy of the original
Pass By Value: do not affect originals In prime programing try AVars(''S1"):=S1; at the end of subroutine; exporting S1 outside for later use; in subsequent subroutines WITHOUT using AVars("S1"):=S1'; S1'(modified). The Original S1 is left intact. To effect changes in S1; subsequent subroutines USE AVars("S1"):=S1'; == The Original is modified with S1'. Code:
Sg type on command line shows the original Sg; |
|||
10-03-2017, 01:15 AM
Post: #5
|
|||
|
|||
RE: A few Prime programming questions
(09-28-2017 03:29 PM)Dave Britten Wrote: What's the best environment for programming on a PC? The Connectivity Kit lets you edit copies of a program directly on the Prime, but I'm not sure if there's some way to edit a local copy of the program, and transfer it to the Prime (or emulator) for testing. Not a heavy duty programmer here, but you can get an HPPPL plug in for Notepad++ . It's available at hpcalc.org (http://www.hpcalc.org/details/7564) It includes highlighted reserved words and auto complete along with command details. Not sure about special characters, but there is a configurable ASCII conversion tool that you could set up. I've used it to cut and paste into the emulator for debug, then moved programs to the calculator once it's finished. Works reasonably well. Brad |
|||
10-05-2017, 09:55 AM
Post: #6
|
|||
|
|||
RE: A few Prime programming questions
While there is no pass by reference (a limitation I've also run into in the past), several of the global variables are used consistently across apps, so depending on your application, you might want to use global variables instead of passing by reference.
As for the help feature, you could capture the help key in your program so that while your program is running, if the help key is pressed, you could present your own help that way. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)