Post Reply 
Dynamically changing a list in a library
07-20-2021, 08:36 PM
Post: #1
Dynamically changing a list in a library
Hi all,
For an application that I want to make, it would be convenient for me if I can modify a list that exists in a library. That is, I can add various objects to that list so that I can use them at a later time. My question is whether that is possible, and if so, how can I achieve this? I know there is a program that allows you to change the ID of a library. So I need something that allows me to add various objects to a list that is part of a library. Maybe someone can give me a hint, or even a program to achieve this goal. Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
07-21-2021, 01:24 AM
Post: #2
RE: Dynamically changing a list in a library
(07-20-2021 08:36 PM)cahlucas Wrote:  Hi all,
For an application that I want to make, it would be convenient for me if I can modify a list that exists in a library. That is, I can add various objects to that list so that I can use them at a later time. My question is whether that is possible, and if so, how can I achieve this? I know there is a program that allows you to change the ID of a library. So I need something that allows me to add various objects to a list that is part of a library. Maybe someone can give me a hint, or even a program to achieve this goal. Sincerely, Karel.

Is there a reason to not use a user variable to store the data that you anticipate would change? While it is possible to do in a library, it is not a simple task. Libraries are stored with a CRC at the end. You would have to create a copy of your library, compute the difference in size of the existing list and new list, "punch a hole" in your copied library large enough to insert the new list, recompute offsets (possibly), recompute the CRC, and then detach the old library, store the new library, and either attach the modified library (or force a warmstart). And your code would have to be in assembly. If you store your list as the very last object in your library, then recalculating the offsets would be trivial. However, if you have several such lists, then it can be a bit cumbersome. Then there is the memory cost during the moment two copies of your library exists (the old one and the new one). There is also the issue of detaching a library whose code is running in memory. To get around it, you would need to copy your assembly code to memory as a new object and run it from there to avoid any reference conflicts when detaching.

So while possible, it seems rather silly when a simple user variable seems like more than sufficient. If you don't want users accessing your list, you can use the Library Data object format. A good resource would be James Donnelly's An Introduction to HP48 System RPL and Assembly Language Programming (free PDF on hpcalc.org)

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 




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