[comp.sys.handhelds] 48SX questions

akcs.tasmith@hpcvbbs.UUCP (Ted A Smith) (03/17/91)

I have a few questions which some kind souls might answer:
 
1) What exactly are the restrictions on $CONFIG in USRLIB?  I've
   only found that if my $CONFIG routine takes too long the 48
   turns itself back off every time I turn it on!  The only way I
   could figure out to stop it was to ON-A-E.
 
2) Is there anyway to invoke the various rules in the equation
   writer from a program?
 
3) A feature which the 28C and 28S had, which I miss a lot on the
   48SX was using EXGET while in FORM, then recursively FORM/EXGET'ing
   the extracted subexpressions.  When I was all done I would just use
   EXSUB to wind the expression back up.  On the 48SX when you use the
   SUB function in the Equation Writer you get no position indicator
   which could be used to replace the modified subexpression back into
   the original expression!  As a substitue I use MATCH\|^ as follows
   but this is not near as natural or accurate.  Any sugestions?
 
     Stack in:                        Stack out:
        3:  Original subexpression       1:  Resultant expression
        2:  Mother expression
        1:  Modified subexpression
 
     \<< ROT SWAP 2 \->LIST MATCH\|^ DROP \>>
 
4) I use a menu structure like the following to organize access
   to my library.  The only problem I have is that I can't
   traverse my tree of menus while entering a program like you
   can with the built in menus (e.g. MTH PARTS ABS.)  I wonder if
   anyone can tell me how to achive this?
 
     { { "Phone" \<< { :HP-BB: "(503)750-4448"
                       :Edu-Calc: "(800)677-7001"
                      ... } TMENU \>> }
       { "Tools" \<< { { "Array" \<< { DELCOL ... } TMENU \>> }
                       { "Graphics" \<< { PX+ ... } TMENU \>> }
                       { "List" \<< { CAR ... } TMENU \>> }
                     } TMENU \>> }
       { "LSq"  \<< { \GSPoly \GSLog ...  } TMENU \>> }
       { "Rat"  \<< { QAdd QSub ... } TMENU \>> }
       { "Funs" \<< { \piF FixP ... } TMENU \>> }
     } MENU
 
 
5) I use the following C program to retrive the library ID from
   libs on my PC.  I have no idea if there is a saner way to do
   this:
 
      #include <io.h>
      #include <fcntl.h>
      #include <stdio.h>
      #include <stdlib.h>
 
      void cdecl main (int argc, char * argv[]) {
        char buff[512];
        int  fh = open(argv[1], O_RDONLY | O_BINARY);
        read(fh, buff, sizeof(buff));
        close(fh);
        printf("%d\n", *(unsigned *)(buff + buff[13] + 15) & 0x7ff);
        exit(0); }
 
6) I've written the following kludgy program to allow me to replace
   objects in a program:
 
%%HP: T(3)A(R)F(.);
DIR
  Install \<< @ Run this first...
    'Cmp\->'  DUP RCL ASC\-> SWAP STO
    '\->LPgm' DUP RCL ASC\-> SWAP STO
    'Install' PURGE \>>
  PRepl  @ <program> <replacies list> <replacers list> => <new program>
    \<< \-> \GaPRepl \GbPRepl
      \<< DUP TYPE
        CASE DUP 8 SAME THEN                 @ for program objects
            DROP Cmp\-> \->LIST
            \<< \GaPRepl \GbPRepl PRepl \>> Each
            OBJ\-> \->LPgm
          END DUP 5 SAME THEN                @ for lists
            DROP
            \<< \GaPRepl \GbPRepl PRepl \>> Each
          END                                @ else, for all others
            DROP \GaPRepl OVER POS
            IF DUP THEN
              SWAP DROP \GbPRepl SWAP GET
            ELSE
              DROP END END \>> \>>
  Each  @ Apply the function in level 1 to each element of the
        @   list or array in level 2
    \<< OVER { }
      IF SAME THEN
        DROP
      ELSE SWAP 1
        DO
          DUP2 GET 4 PICK EVAL PUTI -64
        UNTIL FS? END
      ROT DROP2 END \>>
  Cmp\->.ASC @ \->ASC'ed routine which unpacks programs, algebraics, ...
    "D9D20ECE8112040379C1F3040379C194040379C1B7040379C1B21303471"
  \->LPgm.ASC @ \->ASC'ed routine which repacks a program object
    "D9D2043C8154450B21305CEC"
END
 
 
  This routine runs very slow, but seems to work even if there
  are ML or Code fragments in the program object (which couldn't
  be said for doing something like: \<< \->STR replacie replacer
  REPLACE OBJ\-> \>>  Is there a saner way?
 
  If there were routines like GETI, PUTI, etc. which, besides
  working on lists and arrays, worked on programs, algebraic's,
  etc. things would be a little easier.
 
 
Thanks for your kind attention and any thoughts you may have...
 
Ted Smith