/ᑍ Materialize the amount of storage needed to store object info ᑍ/
MATCTX S_RECEIVER@, QTEMP@, MATCTXOPTS;
/ᑍ If no objects are in the library, then exit ᑍ/
CMPNV(B) S_BYTAVL, 96 / EQ(DONE);
/ᑍ Allocate the necessary storage (we could also have used CRTS
to allocate the storage and a SPCPTR to the space for the
large receiver variable) ᑍ/
MODASA L_RECEIVER@, S_BYTAVL;
/ᑍ Set the bytes provided field to indicate the allocated storage ᑍ/
CPYNV L_BYTPRV, S_BYTAVL;
/ᑍ Materialize the objects within the library ᑍ/
MATCTX L_RECEIVER@, QTEMP@, MATCTXOPTS;
/ᑍ Calculate how many objects were returned: ᑍ/
/ᑍ 1. Find the lower of bytes provided and bytes available ᑍ/
/ᑍ (L_BYTPRV and L_BYTAVL) as the number of objects could have ᑍ/
/ᑍ changed since the first materialize ᑍ/
/ᑍ 2. Subtract the size of the fixed MATCTX header (96) ᑍ/
/ᑍ 3. Divide the remainder by the size of each entry returned ᑍ/
CMPNV(B) L_BYTPRV, L_BYTAVL / HI(ITS_AVL);
CPYNV SIZE, L_BYTPRV;
B CONTINUE;
ITS_AVL: CPYNV SIZE, L_BYTAVL;
CONTINUE: SUBN(SB) SIZE, 96 / ZER(DONE);
DIV SIZE, SIZE, 32;
/ᑍ Address the first object returned ᑍ/
SETSPP OBJ_ENTRY@, L_ENTRY;
/ᑍ Loop through all materialized entries ᑍ/
MORE:
/ᑍ Convert the hex object type and subtype to character form ᑍ/
CVTHC OBJ_INFO_C, OBJ_INFO_X;
/ᑍ Copy the object name to the message variable ᑍ/
CPYBLA OBJ_NAME_T, OBJ_NAME;
/ᑍ Unconstrain the array bounds (at compile time) ᑍ/
OVRPGATR 1,3;
/ᑍ Send a message to caller's msg queue containing the object info ᑍ/
Chapter 7. Machine Interface Programming 7-35