Type ASSEMBLE
Source Lines : 1,462
Fixes Applied : 4
Most Recent Version : Tuesday, December 12, 1978
Last Fix ID : [HRC015DS]
Module
DMSLBM (MACLIB)
Function
TO GENERATE A MACRO LIBRARY, TO ADD MACROS TO AN EXISTING LIBRARY, TO DELETE OR REPLACE MEMBERS OF AN EXISTING LIBRARY, TO COMPRESS THE SPACE OCCUPIED BY AN EXISTING LIBRARY, AND TO LIST THE DICTIONARY OF AN EXISTING MACRO LIBRARY.
Attributes
DISK RESIDENT
Operation
THE OPERATION OF THE MACLIB COMMAND PROGRAM DEPENDS ON WHETHER THE CALLING PROGRAM SPECIFIES GEN, ADD, COMP, MAP, REP, OR DEL. GEN: DMSLBM CALLS THE ERASE COMMAND PROGRAM TO ERASE ANY OLD LIBRARY WITH THE SAME NAME. THEN CALL DMSBWR TO WRITE A TEMPORARY HEADER RECORD IN THE MACRO LIBRARY. THIS DUMMY RECORD WILL LATER BE REPLACED BY A MACRO DIRECTORY DESCRIPTOR RECORD. NEXT, DMSLBM INITIALIZES THE INDEX, WHICH CORRESPONDS TO THE ITEM NUMBER, TO ONE. THEN IT CALLS THE STATE FUNCTION PROGRAM TO LOCATE THE FILE STATUS TABLE FOR THE FIRST MACRO FILE - FILETYPE MUST BE MACRO OR COPY. DMSLBM NEXT CALLS DMSBRD TO READ THE FIRST RECORD IN THE FIRST MACRO FILE, CALLS DMSBWR TO WRITE IT INTO THE MACRO LIBRARY BEING CREATED, AND INCREMENTS THE INDEX. IF THE CARD IS A ./ CARD OR CMS EOF CARD IT IS NOT WRITTEN TO THE MACLIB. AFTER WRITING THE FIRST (OR ANY) RECORD, THE ACTION TAKEN BY DMSLBM DEPENDS ON THE NATURE OF THE RECORD. IF THE RECORD IS A MACRO HEADER RECORD DMSLBM SAVES THE CURRENT INDEX VALUE THEN IT STORES THE INDEX VALUE IN THE APPROPRIATE ENTRY IN THE MACRO DICTIONARY (REFER TO "TABLE/RECORD FORMATS" LATER IN THIS SECTION), READS THE NEXT RECORD, WHICH IS THE PROTOTYPE RECORD, OBTAINS THE MACRO NAME FROM THAT RECORD, MOVES THE NAME TO THE APPROPRIATE ENTRY IN THE MACRO DICTIONARY, WRITES THE PROTOTYPE RECORD INTO THE MACRO LIBRARY, INCREMENTS THE INDEX, AND READS AND PROCESSES THE NEXT RECORD. IF THE RECORD READ IS EITHER A COMMENT OR AN ELEMENT OF THE BODY OF THE MACRO, DMSLBM MERELY READS AND PROCESSES THE NEXT RECORD. IF THE RECORD IS A MACRO TRAILER RECORD (THAT IS, IT CONTAINS THE CHARACTERS MEND STARTING IN COLUMN 10, DMSLBM INCREMENTS A POINTER TO POINT TO THE NEXT ENTRY IN THE MACRO DICTIONARY, AND RETURNS TO READ AND PROCESSES THE NEXT ENTRY. DMSLBM REPEATS THIS PROCESS FOR ALL RECORDS IN THE FIRST MACRO FILE. WHEN AN END-OF-FILE IS ENCOUNTERED, IT CALLS DMSFNSA TO CLOSE THAT FILE, AND PROCESSES THE NEXT MACRO FILE SIMILARLY. WHEN ALL MACRO FILES ARE PROCESSED, DMSLBM WRITES THE MACRO DICTIONARY OUT AT THE END OF THE MACRO LIBRARY, OVERLAYS THE DUMMY RECORD AT THE START OF THE MACRO LIBRARY WITH A DICTIONARY HEADER RECORD (REFERS TO "TABLE/RECORD FORMATS"), CLOSES THE NEWLY CREATED MACRO LIBRARY, AND RETURNS TO THE CALLING PROGRAM, WHICH IS USUALLY DMSINT. NOTE: THROUGHOUT ITS PROCESSING, DMSLBM CHECKS TO ENSURE THAT THE RECORDS IN EACH MACRO DEFINITION ARE IN CORRECT SEQUENCE. IF THEY ARE NOT, IT SIGNALS THE ERROR BY MEANS OF A TERMINAL MESSAGE (ERROR CODE 32), AND RETURNS TO THE CALLING PROGRAM. ADD: DMSLBM CALLS DMSSTT TO DETERMINE IF THE MACRO LIBRARY TO WHICH THE MACROS ARE TO BE ADDED EXISTS. IF IT DOES NOT, IT SIGNALS THE ERROR AND RETURNS TO THE CALLING PROGRAM. IF THE MACRO LIBRARY EXISTS, DMSLBM CALLS DMSBRD TO READ THE DICTIONARY HEADER RECORD INTO MAIN STORAGE SO THAT IT CAN GET THE STARTING LOCATION OF THE MACRO DICTIONARY. IT THEN SETS THE READ POINTER IN THE FILE STATUS TABLE TO POINT TO THE START OF THE MACRO DICTIONARY AND REPEATEDLY CALLS DMSLBM TO READ THE MACRO DICTIONARY INTO STORAGE. DMSLBM NEXT CALLS DMSFNSA TO CLOSE THE MACRO LIBRARY. HAVING CLOSED THE LIBRARY, MACLIB CALLS DMSPNT TO SET THE WRITE POINTER TO THE START OF THE OLD MACRO DICTIONARY. NEXT, DMSLBM SETS A POINTER TO THE NEXT AVAILABLE LOCATION IN THE MACRO DICTIONARY AND THEN PROCEEDS TO ADD THE MACROS IN THE SAME MANNER AS IT DOES IF GEN IS SPECIFIED. DEL: THE SPECIFIED MACRO NAME IS DELETED FROM THE MACRO LIBRARY DICTIONARY BY MOVING ALL DICTIONARY ENTRIES BEYOND IT DOWN 12 BYTES IN THE DICTIONARY BUFFER. THE ACTUAL MACRO STATEMENTS REMAIN IN THE LIBRARY FILE UNTIL COMPACTED. THE @VA12809 LIBRARY IS ERASED IF THE LAST MEMBER IS DELETED. @VA12809 REP: THE MACRO NAME THAT IS OBTAINED FROM WITHIN THE SPECIFIED FILE (WITH A FILETYPE OF MACRO OR COPY) IS USED AS THE NAME OF THE MACRO TO BE REPLACED. THE OLD MACRO IS DELETED FROM THE LIBRARY AND THE NEW ONE ADDED TO THE END OF THE MACLIB. COMP: THE MACRO DICTIONARY IS READ INTO STORAGE, AND EACH MACRO FROM THE LIBRARY IS WRITTEN INTO A TEMPORARY FILE (MACLIB CMSUT1) FOR EACH VALID ENTRY WITHIN THE DICTIONARY. MAP: DMSLBM READS THE MACRO DICTIONARY INTO MAIN STORAGE AS IT DOES FOR ADD. NEXT, DMSLBM OBTAINS THE FIRST ENTRY IN THE DICTIONARY, MOVES THE NAME, INDEX, AND SIZE TO A BUFFER, AND CALLS THE APPROPRIATE ROUTINE (DMSCWR, DMSPIO, DMSBWR) TO OUTPUT THE CONTENTS OF THE BUFFER, AT THE TERMINAL, PRINTER OR ONTO DISK. DMSLBM REPEATS THIS FOR EACH ENTRY IN THE DICTIONARY. WHEN ALL ENTRIES ARE PROCESSED, DMSLBM RETURNS TO THE CALLING PROGRAM. TABLE/RECORD/FORMATS: THE FORMATS OF THE MACRO DICTIONARY AND THE DICTIONARY HEADER RECORD ARE DESCRIBED BELOW. MACRO DICTIONARY: IN THE MACRO DICTIONARY EACH ENTRY IS TWELVE BYTES IN LENGTH AND CONTAINS TWO FIELDS. THE NAME FIELD (EIGHT BYTES) CONTAINS THE NAME OF THE MACRO. THE INDEX FIELD (2 BYTES) INDICATES WHERE, WITHIN THE MACRO LIBRARY, THE FIRST RECORD (ITEM) IN THE MACRO IS LOCATED. THE INDEX FIELD (2 BYTES) IS EXPRESSED AS AN ITEM NUMBER. DICTIONARY HEADER RECORD: THE DICTIONARY HEADER RECORD DEFINES THE LOCATION AND SIZE OF THE MACRO DICTIONARY. IT IS AN 80-BYTE RECORD AND CONTAINS THREE MEANINGFUL FIELDS. THE FIRST FIELD (BYTES 1-6) CONTAINS THE CHARACTERS 'MACLIB'. THE SECOND FIELD (BYTES 7 AND 8) IS A POINTER TO THE START OF THE MACRO DICTIONARY. IT IS EXPRESSED AS AN ITEM NUMBER. THE THIRD FIELD (BYTES 11 AND 12) CONTAINS THE SIZE OF THE MACRO DICTIONARY (IN BYTES). ------------------------------------------ | NAME OF FIRST MACRO INDEX | ------------------------------------------ | NAME OF SECOND MACRO INDEX | ------------------------------------------ | | ------------------------------------------ | NAME OF NTH MACRO | ------------------------------------------ MACRO DICTIONARY FORMAT ------------------------------------------- | BYTES | CONTENTS | ------------------------------------------- | 1-6 | DMSLIB | | | | 7-8 | POINTER TO START OF MACRO | | | DICTIONARY | | | | | 9-10 | NOT USED | | | | | 11-12 | SIZE OF MACRO DICTIONARY | | | | | 13-80 | NOT USED | ------------------------------------------- DICTIONARY HEADER RECORD FORMAT
Calls to Other Routines
DMSERS, DMSBWR, DMSSTT, DMSBRD, DMSFNS,DMSPNT,DMSRNM,DMSERR,DMSCWR,DMSPRT