SCN TITLE 'DMSSCN (CMS) VM/370 - RELEASE 6' 00001000
SPACE 2 00002000
*. 00003000
* MODULE NAME - 00004000
* 00005000
* DMSSCN 00006000
* 00007000
* FUNCTION - 00008000
* 00009000
* TO CONVERT A COMMAND LINE INTO A SERIES OF 8-BYTE PARAMETERS 00010000
* 00011000
* ATTRIBUTES - 00012000
* 00013000
* RESIDENT, REUSEABLE, CALLED BY BALR 00014000
* 00015000
* ENTRY POINTS - 00016000
* 00017000
*| DMSSCNN - NEW PARAMETER LIST FORMAT 00018000
*| DMSSCNO - OLD PARAMETER LIST FORMAT 00019000
* 00020000
* ENTRY CONDITIONS - 00021000
* 00022000
*| DMSSCNN - 00023000
*| GPR 0 = LENGTH OF THE INPUT LINE 00024000
*| GPR 1 = ADDRESS OF THE INPUT LINE 00025000
*| GPR 14 = CALLER'S RETURN ADDRESS 00026000
*| GPR 15 = ENTRY POINT ADDRESS 00027000
* 00028000
*| DMSSCNO - 00029000
*| GPR 1 = ADDRESS OF LENGTH (4 BYTES) FOLLOWED BY INPUT LINE 00030000
*| GPR 14 = CALLER'S RETURN ADDRESS 00031000
*| GPR 15 = ENTRY POINT ADDRESS 00032000
* 00033000
* EXIT CONDITIONS - 00034000
* 00035000
*| NORMAL - CONDITION CODE = 0 00036000
*| GPR 0 = LENGTH OF PARAMETER LIST 00037000
*| GPR 1 = ADDRESS OF PARAMETER LIST 00038000
*| GPR 15 = ZERO - NO ERRORS ENCOUNTERED 00039000
* 00040000
*| ERROR - CONDITION CODE = 2 00041000
*| GPR 0 = MAXIMUM PARAMETER LIST LENGTH 00042000
*| GPR 1 = ADDRESS OF PARAMETER LIST 00043000
*| GPR 15 = 4 - PARAMETER LIST TRUNCATED 00044000
* 00045000
* CALLS TO OTHER ROUTINES - 00046000
* 00047000
* NONE 00048000
* 00049000
* EXTERNAL REFERENCES - 00050000
* 00051000
* NONE 00052000
* 00053000
* TABLES / WORKAREAS - 00054000
* 00055000
*| BALRSAVE - SAVE AREA FOR CALLER'S REGISTERS 0 - 15 00056000
* CMNDLIST - AREA IN WHICH TO BUILD THE PARAMETER LIST 00057000
* 00058000
* REGISTER USAGE - 00059000
* 00060000
*| GPR 0 = PARAMETER LIST LENGTH 00061000
*| GPR 1 = CURRENT COMMAND LINE POINTER 00062000
*| GPR 2 = COMMAND LINE INCREMENT = 1 00063000
*| GPR 3 = END OF COMMAND LINE POINTER 00064000
*| GPR 4 = CURRENT ARGUMENT ADDRESS 00065000
*| GPR 5 = PARAMETER LIST ADDRESS 00066000
*| GPR 6 = PARAMETER LIST INCREMENT = 8 00067000
*| GPR 7 = END OF PARAMETER LIST POINTER 00068000
*| GPR 8 = ARGUMENT LENGTH 00069000
*| GPR 9 = DELIMITER TYPE FLAG 00070000
*| GPR 10 = NOT USED 00071000
*| GPR 11 = NOT USED 00072000
*| GPR 12 = PROGRAM BASE REGISTER 00073000
*| GPR 13 = NOT USED 00074000
*| GPR 14 = CALLER'S RETURN ADDRESS 00075000
*| GPR 15 = RETURN CODE REGISTER 00076000
* 00077000
* NOTES - 00078000
* 00079000
* NONE 00080000
* 00081000
* OPERATION - 00082000
* 00083000
*| DMSSCN TRANSFORMS THE INPUT LINE FROM A STRING OF ARGUMENTS 00084000
*| TO A SERIES OF 8-BYTE PARAMETERS. AN ARGUMENT IS A STRING OF 00085000
*| CHARACTERS DELIMITED BY BLANKS OR A LEFT OR RIGHT PARENTHESIS. 00086000
*| THE FIRST ARGUMENT BECOMES THE FIRST PARAMETER AND THE SECOND 00087000
*| ARGUMENT BECOMES THE SECOND PARAMETER, ETC. EACH PARENTHESIS 00088000
*| BECOMES A SEPARATE PARAMETER. ARGUMENTS THAT ARE SHORTER 00089000
*| THAN 8 CHARACTERS ARE PADDED WITH BLANKS. ARGUMENTS THAT ARE 00090000
*| LONGER THAN 8 CHARACTERS ARE TRUNCATED TO 8. AN 8-BYTE FENCE 00091000
*| OF ALL ONE BITS IS PUT AT THE END OF THE PARAMETER LIST AS A 00092000
*| DELIMITER. DMSSCN RETURNS THE ADDRESS OF THE PARAMETER LIST 00093000
*| IN REGISTER 1 AND THE LENGTH OF THE LIST IN REGISTER 0. IF 00094000
*| THE SPACE ALLOCATED FOR THE PARAMETER LIST (CMNDLIST) BECOMES 00095000
*| FULL, DMSSCN TERMINATES THE PROCESSING OF THE INPUT LINE AND 00096000
*| RETURNS TO THE CALLER WITH AN ERROR CODE OF 4. IN THIS CASE, 00097000
*| REGISTER 1 STILL POINTS TO THE PARAMETER LIST AND REGISTER 0 00098000
*| INDICATES THE MAXIMUM LENGTH. 00099000
* 00100000
EJECT 00101000
* 00102000
*| AN EXAMPLE IS SHOWN BELOW: 00103000
*| 00104000
*| INPUT LINE: 00105000
*| ASSEMBLE VERYLONGNAME (LOAD NOTERM) 00106000
*| 00107000
*| PARAMETER LIST: 00108000
*| DC CL8'ASSEMBLE' 00109000
*| DC CL8'VERYLONG' 00110000
*| DC CL8'( ' 00111000
*| DC CL8'LOAD ' 00112000
*| DC CL8'NOTERM ' 00113000
*| DC CL8') ' 00114000
*| DC 8X'FF' 00115000
*. 00116000
EJECT 00117000
DMSSCN START 0 BUILD PARAMETER LIST FROM COMMAND LINE 00118000
ENTRY DMSSCNO 00119000
DMSSCNO DS 0H ENTRY POINT FOR OLD CALLING SEQUENCE 00120000
L R0,0(,R1) GET THE INPUT LINE LENGTH 00121000
LA R1,4(,R1) POINT TO THE INPUT LINE 00122000
ENTRY DMSSCNN 00123000
DMSSCNN DS 0H ENTRY POINT FOR NEW CALLING SEQUENCE 00124000
USING NUCON,R0 00125000
STM R0,R15,BALRSAVE SAVE THE CALLER'S REGISTERS 00126000
BALR R12,0 SET UP THE BASE REGISTER 00127000
USING *,R12 00128000
SR R15,R15 ZERO THE RETURN CODE 00129000
LR R3,R0 SAVE THE INPUT LINE LENGTH 00130000
BCTR R1,0 GET INPUT LINE ADDRESS MINUS ONE 00131000
AR R3,R1 POINT TO END OF INPUT LINE 00132000
* SR R9,R9 CLEAR THE ENDING DELIMITER 00133000
LA R2,1 LOAD INPUT LINE INCREMENT 00134000
LA R5,CMNDLIST POINT TO START OF PARAMETER LIST AREA 00135000
LA R6,8 LOAD PARAMETER LIST INCREMENT 00136000
LA R7,CMNDLIST+L'CMNDLIST-16 POINT TO END OF P-LIST 00137000
SCNSTART BXH R1,R2,SCNFINIS SCAN FOR THE START OF AN ARGUMENT 00138000
CLI 0(R1),C' ' IS THIS CHARACTER A BLANK? P0257 00139000
BE SCNSTART YES, LOOK AT THE NEXT CHARACTER 00140000
CLI 0(R1),C'(' DOES ARGUMENT START WITH A LEFT PAREN ? 00141000
BE SCNLPARN YES, MAKE IT A SEPARATE PARAMETER 00142000
CLI 0(R1),C')' DOES ARGUMENT START WITH A RIGHT PAREN ? 00143000
BE SCNRPARN YES, MAKE IT A SEPARATE PARAMETER 00144000
* CLI 0(R1),C',' DOES ARGUMENT START WITH A COMMA ? 00145000
* BE SCNCOMMA YES, CHECK FOR OMITTED PARAMETER 00146000
LR R4,R1 SAVE ARGUMENT STARTING ADDRESS 00147000
SCNLASTC BXH R1,R2,SCNASTOP SCAN FOR LAST CHARACTER OF ARGUMENT 00148000
CLI 0(R1),C' ' IS THIS CHARACTER A BLANK ? 00149000
BE SCNASTOP YES, MOVE PARAMETER TO LIST 00150000
* CLI 0(R1),C',' DOES ARGUMENT END WITH A COMMA ? 00151000
* BE SCNASTOP YES, MOVE PARAMETER TO LIST 00152000
CLI 0(R1),C')' DOES ARGUMENT END WITH A RIGHT PAREN ? 00153000
BE SCNASTOP YES, MOVE PARAMETER TO LIST 00154000
CLI 0(R1),C'(' DOES ARGUMENT END WITH A LEFT PAREN ? 00155000
BNE SCNLASTC NO, LOOK AT THE NEXT CHARACTER 00156000
SCNASTOP LR R8,R1 SAVE POINTER TO END OF ARGUMENT 00157000
BCTR R1,0 DECREMENT END POINTER FOR NEXT RECURP0257 00158000
* SR R9,R9 CLEAR DELIMITER TYPE FLAG 00159000
SR R8,R4 DETERMINE ARGUMENT LENGTH 00160000
CR R8,R6 IS IT LESS THAN 8 ? 00161000
BNL SCNMAXLN NO, MOVE THE MAXIMUM LENGTH 00162000
MVC 0(8,R5),=CL8' ' CLEAR RECEIVING FIELD 00163000
BCTR R8,0 SUBTRACT 1 FOR EX INSTRUCTION 00164000
EX R8,SCNEMOVE MOVE ARGUMENT TO PARAMETER LIST 00165000
BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE P0257 00166000
B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00167000
SCNEMOVE MVC 0(0,R5),0(R4) EXECUTED MOVE INSTRUCTION 00168000
SPACE 00169000
SCNMAXLN MVC 0(8,R5),0(R4) MOVE 8 CHARACTERS TO PARAMETER LIST 00170000
BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE P0257 00171000
B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00172000
SPACE 00173000
SCNLPARN MVC 0(8,R5),=CL8'(' MOVE LEFT PAREN TO PARAMETER LIST 00174000
* LA R9,COMMA INDICATE COMMA TYPE DELIMITER 00175000
BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE 00176000
B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00177000
SPACE 00178000
SCNRPARN EQU * 00179000
* LTR R9,R9 WAS THE LAST DELIMITER A COMMA TYPE ? 00180000
* BZ SCNRCONT NO, CONTINUE RIGHT PAREN PROCESSING 00181000
* MVC 0(8,R5),=CL8' ' YES, INDICATE PARAMETER OMITTED 00182000
* SR R9,R9 INDICATE NON-COMMA TYPE DELIMITER 00183000
* BXLE R5,R6,SCNRCONT POINT TO NEXT SLOT AND CONTINUE 00184000
* B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER LIST 00185000
*SCNRCONT EQU * 00186000
MVC 0(8,R5),=CL8')' MOVE RIGHT PAREN TO PARAMETER LIST 00187000
BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE 00188000
B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00189000
SPACE 00190000
*SCNCOMMA LTR R9,R9 WAS LAST DELIMITER ALSO A COMMA TYPE ? 00191000
* LA R9,COMMA INDICATE CURRENT DELIMITER IS A COMMA 00192000
* BZ SCNSTART NO, HANDLE THE SAME AS A BLANK 00193000
* MVC 0(8,R5),=CL8' ' YES, INDICATED PARAMETER OMITTED 00194000
* BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE 00195000
* B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00196000
SPACE 00197000
SCNERROR LA R15,4 ERROR IF NO MORE ROOM IN PARAMETER AREA 00198000
SCNFINIS MVC 0(8,R5),=8X'FF' PUT A FENCE AT END OF PARAMETER LIST 00199000
LA R0,8(,R5) POINT TO END OF PARAMETER LIST 00200000
LA R1,CMNDLIST POINT TO START OF PARAMETER LIST 00201000
SR R0,R1 COMPUTE THE PARAMETER LIST LENGTH 00202000
LTR R15,R15 LOAD RETURN CODE AND SET CONDITION CODE 00203000
LM R2,R14,BALRSAVE+8 RESTORE THE CALLER'S REGISTERS 00204000
BR R14 RETURN TO THE CALLER 00205000
SPACE 3 00206000
*COMMA EQU 1 00207000
LTORG 00208000
EJECT 00209000
NUCON 00210000
REGEQU 00211000
END 00212000