CARTER@MITBATES.BITNET (Tony Carter - MIT Bates Linac) (11/04/87)
>The trick is to declare some [EXTERNAL] variables with the same name as >the condition code symbols that you defined in your message file. Close, what you really want to use is [EXTERNAL,VALUE]. This will cause the reference to get resolved properly. For example: VAR MSG_MESSAGE : [EXTERNAL,VALUE] UNSIGNED; BEGIN LIB$SIGNAL(MSG_MESSAGE); END. I know the compiler will not let you use the variable on the left hand side of an assignment statement, but I don't know if that means it is handled like a constant or if memory is allocated for it like a variable. As far as how to declare LIB$SIGNAL to get it to like your FAO args, I use: [asynchronous,external] function lib$signal (%immed SigVal : unsigned; %immed FaoCnt : integer :=%immed 0; %stdescr faoargs : [list] packed array[$l0..$u0:integer] of char):unsigned;extern; To use it, you could have: { no FAO args } LIB$SIGNAL(MSG_MESSAGE); { one string arg } LIB$SIGNAL(MSG_MESSAGE,1,'SOME STRING'); { one numeric arg (352) } LIB$SIGNAL(MSG_MESSAGE,1,%IMMED(352)); { one string arg and one numeric arg } LIB$SIGNAL(MSG_MESSAGE,2,'SOME STRING',%IMMED(352)); etc... The %IMMED(352) is necessary because I directed the compiler to pass by CLASS_S string descriptor by default. Obviously, you can insert the appropriate variables in place of the values I used in the example. Tony Carter CARTER@MITBATES (Bitnet) (617) 245-6600 MIT Bates Linac Middleton, MA
cfchiesa@bsu-cs.UUCP (Christopher F. Chiesa) (11/08/87)
Regarding use of assorted system-defined status codes in Vax Pascal,
doesn't the statement
[INHERIT ('SYS$LIBRARY:STARLET')]
at the top of the program, automatically include for you most, if not
all, the system-defined status-code values, labels, etc. ? I found this
in the Pascal Reference Manual and/or User's Guide (can never quite keep
the two straight), and it seems to work fine for most everything, EXCEPT:
* SYS$LIBRARY:STARLET (.PEN) ("environment file" - anyone know just what
THAT means?) does NOT include definitions for the numerous LIB$ routines.
Annoyingly, one seems forced to "puzzle out" on one's own the appropriate
declarations for most of these. Can anyone suggest some "general guide-
lines" for creating the appropriate declarations? Specifically, I've had
trouble getting LIB$GETJPI to return the USERNAME of the person executing
the program. Don't want to use pure $GETJPI as defined in STARLET -- too
many "mysterious" (to me) parameters and data structures needed.
Part of the problem would be solved if someone can tell me how to declare
a PROCEDURE or FUNCTION so as to allow "optional" parameters - i.e., so
that you can omit a parameter when actually calling the routine. I know
it's possible because the system-service routines defined in STARLET.PEN
allow you to omit parameters, but I haven't been able to get this to
work in my own declarations, particularly for LIB$ routines. Any informa-
tion would be greatly appreciated; I feel like it shouldn't take much to
clarify this for me - I feel that I'm just misunderstanding the effects
of an "attribute" or two somewhere.
Chris Chiesa,
Ball State University CS Dept.
Muncie, IN