23 Jan 91 18:57James H. Cloos: (48sx) wrt @18ECEh and it's compatriots ;)

A few months ago I suggested that the routines at 18ECEh, 18EDFh &
18EF0h used the XLIB number of a given command to create the Too Few
Args and Invalid Args error messages.  Ie., if you hit SIN with an
empty stack, the routine at 18ECEh looks back to the 6 nybbles
imediately preceeding the start of the current program object, and
uses these to get the command's name.  You will notice that the
commands that do not use these 3 routines to do their argument
checking show error messages that do not include the commands name.

I recently determined that this is an accurate hypothesis.  This does
then explain why, when a program stored in a global variable (an ID
Object pair) uses these routines to do its arg checking, the error
messages are of the form "XLIB llll xxx Error:\nToo Few Arguments"
(where \n means a newline).  The routines look at the 6 nybbles
preceeding the program.  These are the trailing lenght count of the ID 7;
1Hand the last 2 characters of the ID.

As an example, if the last 2 characters in the ID are /x02 and /x30,
and there are 5 characters in the ID, then the 6 nybbles imediately
preceeding the start of the STO'ed object would be "200350".  If you
STO'ed a program that uses 18ECEh in such a global, the error messages
would say "TAN Error:\n etc" because TAN is XLIB number 53h in lib
number 2.

The primary use of this, though, is for the named XLIBs in our
libraries to uses these routines to check for the correct arguments,
and then call unnamed (hidden) XLIBs for the actual programs.  For
instance, a lib containing, say, CHIP might look like:
(excluding all but the XLIB entries)

8555000         (Non algebraic command, lib #555h, XLIB #0h)
D9D20           ::
ECE81           Switch on 1 argtype
D0040           #2h  (that is system binary 2; the type of CharaterStrings)
29E20555100     Call Xlib number 555h,1h
B2130           ;
CCD20           Start of a CODE object.
...             Size and bulk of a code object.

In the hash table, xlib 000 would get the name CHIP and xlib 001 would
be left unnamed.


In the hash table, xlib 000 would get the name CHIP and xlib 001 would
be left unnamed.

You will notice that only named xlib's get the prefix which 18ECEh etc
look for.  If the first nybble is Ah rather than 8h, an algebraic
command is indicated.  Some more information will show up in those
cases between the Ah and the lib number.  I've not yet decoded it.
(Which means that we only have left to decode this info, linked
arrays, and External types 1 thru 4.  (Library Data is aka External
type 0.)

Enjoy.

-JimC
--
James H. Cloos, Jr.             Phone:  +1 716 673-1250
cloos@ACSU.Buffalo.EDU          Snail:  PersonalZipCode:  14048-0772, USA
cloos@ub.UUCP                   Quote:  <>
