SD: Libraries


[Prev][Next][Index][Thread]

SD: Libraries



Hi,
	I'm a little late joining this list, but now that I'm here, I think we should quit wasting time and talk about the most important compatability, and general usage topic: Library.
	First, I'd just like to make everyone familiar with the different types of Library calls.

	The first one (used by Fargo and SN -- at least I think) has a library table located somewhere in the program file.  Each entry in the table is simply a zero-terminated name of the file which contains the desired functions.  When the program executes, it scans the variable list, and searches for each of the libraries on the calculator.  If any don't exist, the shell gives an error, and says the names of the libraries needed.  The advantages to this method is that the names of the libraries are readily available, but the disadvantages are that libraries can't easily be called when running outside of a program file.  For example, if a TSR program requires libraries, they won't be loaded on the shell's internal library list, since TSR's don't execute from part of a normal program file (in Usgard they execute after being appended to the Usgard string).
	The second one (that Usgard uses) does not require any sort of library list.  Each library is given a BYTE value (I'm sure you'll agree that there'll never be more than 256 different libraries written!!).  When LIB_CALL_ is executed, Usgard checks the loaded library list, and if the needed library is not installed, it will search for the correct one.  If it is found, it will be installed, and the call will be made, otherwise it (optionally) halt the program and give an error message.  The major disadvantage to this style of libraries is that the library names aren't readily available (though we have tried to compensate for this with LIBTB -- a listing of the names of libraries).  The advantages to this are: smaller program size (no 9-char names), and ability to call libraries from *anywhere* including from other libraries.

	If we're going to make lib types compatible, then we should decide upon a library style which is most beneficial.  Our goals should be: Simplicity (for the user and the programmer) and Versatility (i.e. callable from anywhere), as well as size and speed.

It's very difficult to incorporate all of these aspects into a library system, but a suggestion for the speed aspect is to have a library-call table as part of the string, and the shell will update all library calls to *direct* calls to the library code.  But this means sacrificing a large amount of size.

	Another issue of compatibility is the functions used by the program... Different shells obviously won't have the same functions (or else they'd be the same shell!!!), so libraries will naturally work with one operating system or another.  For this reason, I question the usefulness of even making library styles the same.

	Well... anyway, please respond with your thoughts on the subject...
	Sam
-- 
Sam Davies <sdavies@mail.trilogy.net>