Testing for library presence. - Hewlett Packard

This is a discussion on Testing for library presence. - Hewlett Packard ; I want to writ a program which will take advantage of some libraries that I have in stalled but can also be made to work, though perhaps not so neatly, when one or more of those libraries are not installed. ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Testing for library presence.

  1. Testing for library presence.

    I want to writ a program which will take advantage of some libraries
    that I have in stalled but can also be made to work, though perhaps not
    so neatly, when one or more of those libraries are not installed.

    The best I have been able to do is the following fragment, when the
    library is in flash memory and has number xxx:

    IFERR :2:xxx VTYPE
    THEN do_without_library
    ELSE DROP do_with_library
    END

    Can anyone do better?

  2. Re: Testing for library presence.

    Le 09 avril 2008, Virgil a écrit :
    > IFERR :2:xxx VTYPE
    > THEN do_without_library
    > ELSE DROP do_with_library
    > END


    You can use the LIBS command. That's better (may be slower, though) than
    the solution you proposed, because it checks for other ports and you can
    match against the name of the library.

    If the library uses a messages table, the fastest way is probably to
    check for them with « IFERR #XXXYY DOERR THEN ERRM "Expected error msg"
    == END » where XXX is the library ID and YY the message number. When I'm
    writing a library to be used by other programs, I always include as the
    first message something like "AAAXX" where AAA is the name of my library
    (three letters) and XX the version.


  3. Re: Testing for library presence.

    On Tue, 08 Apr 2008 23:44:32 -0500:

    [use a library, if installed, assuming UserRPL]

    Since a library may be stored in any port,
    perhaps :&:nnn VTYPE should be tested
    (this seems to error on HP49/50 "iff" library nnn is not found,
    though I don't know whether this is guaranteed foolproof,
    including against a library just stored but not yet installed);
    it also doesn't error on HP48G[X], on which you just get -1 result,
    and it's also theoretically possible to create a variable named 'nnn'
    (anything "nnn" S~N STO)

    One could also just plunge ahead and execute the first needed
    library function, by number, e.g. #LLLNNNh LIBEVAL
    (error #4 indicating that the function wasn't found).

    Or dynamically compile a "visible" command name
    e.g. "::WXYZ" STR\-> DTAG
    and test for resulting object type; this is slower, however,
    and also compiles a ROMPTR (type 14) only if library is also attached,
    which not all libs need be (nor do all have any "visible" commands, etc.)

    Note that whenever IFERR is used, flag -55 decides whether
    last-saved user command arguments are restored after an error,
    so one may need either to set or test the flag state,
    to guarantee absence of a flag-dependency bug
    (even HP has published programs neglecting that,
    including APLY in the 48G AUR, also embedded in the HP48G[X] via TEACH)

    [r->] [OFF]

  4. Re: Testing for library presence.

    In article
    ,
    Khanh-Dang wrote:

    > Le 09 avril 2008, Virgil a écrit :
    > > IFERR :2:xxx VTYPE
    > > THEN do_without_library
    > > ELSE DROP do_with_library
    > > END

    >
    > You can use the LIBS command. That's better (may be slower, though) than
    > the solution you proposed, because it checks for other ports and you can
    > match against the name of the library.
    >
    > If the library uses a messages table, the fastest way is probably to
    > check for them with « IFERR #XXXYY DOERR THEN ERRM "Expected error msg"
    > == END » where XXX is the library ID and YY the message number. When I'm
    > writing a library to be used by other programs, I always include as the
    > first message something like "AAAXX" where AAA is the name of my library
    > (three letters) and XX the version.


    Thanks.

+ Reply to Thread