|
From: sunburned.surveyor on 5 Dec 2005 14:18 What is a library for the HP48/49's, and how is it different from a program written in UserRPL? Is there an advantage to having programs in a library? How do I learn how to make a library and how to use it on the calculator? Thanks, The Sunburned Surveyor
From: fbarbaise on 5 Dec 2005 16:37 Hi, A library is actually a set of objects like a directory with the difference that libraries can't be directly edited or created (on the calculator). To create a library you need special tools that run either on PC (MAKEROM.EXE) or directly on the calculator with applications like <-LIB-> (on the HP-48) or OT49 (on the HP-49). In a library, objects can be accessed directly from the user. These visible objects are usually commands like "EQNLIB" or functions like "ISPRIME?". Non accessible objects also usully remain within a library. These hidden objects can be subroutines or temporary objects (programs, string, arrays or whatever). A library can contain a boot program, this boot program usually attaches the library. The result is that the set of visible commands or visible function can be accessible to the user. Commands and functions that belong to a library are XLIB objects. These XLIBs have a library number and a command number. For example, XLIB 227 0 is actually the EQNLIB command from the HP-49g+ with ROM 2.x. A library can contain also a message table. The commands or function from the library can refer to these messages. A librariy is one of the most complex object from the calcualtor. I hope this eplanation answers your question. Fred.
From: sunburned.surveyor on 5 Dec 2005 19:15 Thanks for the response Fred. This sounds pretty scary. Should I attempt to encapsulate my UserRPL functions in a library? What would the benfit of this be? The Sunburned Surveyor
From: Han on 5 Dec 2005 20:17 There are only a few reasons I can think of for encapsulating User-RPL programs into a library. 1. Suppose you wrote a program called 'PROG' and within this program several sub-routines are used, and these sub-routines are stored as 'SUB1' and 'SUB2'. Now, if you only want your users to use PROG and not touch SUB1 and SUB2, you cannot prevent them from doing so. Why would you want to prevent users from accessing SUB1 and SUB2? Perhaps these sub-programs were meant specifically for PROG, and they cause errors when run on their own. With a library, you can set it up so that only the commands which you want the users to have access to are indeed accessible. The subroutines can be 'hidden' away from users. 2. You have written a program which you do not wish to be viewed or modified by either you, your users, or other programs. For example, someone else may write a program that uses the variable name 'PROG' -- which happens to be the name of your program. When the other program stores a value into 'PROG', it could overwrite your own program which you've called 'PROG'. Libraries prevent editing/viewing unless you use non-built-in programs. 3. You wish to have access to these programs from any directory. Normally, you would have to store your programs in the HOME directory if you wish to have access to, say, PROG, from any subdirectory. If you have many of these programs, the HOME directory gets cluttered. Placing them into a directory means you cannot access these programs from a different directory without typing out the full path (eg: { HOME SUBDIRNAME PROGNAME } EVAL). Libraries act as extensions to the built-in commands. When you create a library, all the 'visible' commands behave like built-in commands and can then be executed anywhere. (You would have to attach them to the HOME directory, of course. It is possible to attach the library to subdirectories, but that's beyond the scope of this reply). I'm sure there are more reasons, but I can only come up with these three for now. Han sunburned.surveyor(a)gmail.com wrote: > Thanks for the response Fred. This sounds pretty scary. Should I > attempt to encapsulate my UserRPL functions in a library? What would > the benfit of this be? > > The Sunburned Surveyor
From: claptonhendrix on 6 Dec 2005 08:18
The most important reason is the memory managment of the calculator. A library will be stored in a port (0, 1, 2) since a variable will be stored in the ram memory directly. As you have 0 port with memory shared with te RAM, using it for storing a library is less convenient than using 1 port (127 kB) or 2 port (almost 900 kB). |