Table of Contents

DMSSCN Source

References

Source Listing

DMSSCN.ASSEMBLE.txt
  1. SCN TITLE 'DMSSCN (CMS) VM/370 - RELEASE 6' 00001000
  2. SPACE 2 00002000
  3. *. 00003000
  4. * MODULE NAME - 00004000
  5. * 00005000
  6. * DMSSCN 00006000
  7. * 00007000
  8. * FUNCTION - 00008000
  9. * 00009000
  10. * TO CONVERT A COMMAND LINE INTO A SERIES OF 8-BYTE PARAMETERS 00010000
  11. * 00011000
  12. * ATTRIBUTES - 00012000
  13. * 00013000
  14. * RESIDENT, REUSEABLE, CALLED BY BALR 00014000
  15. * 00015000
  16. * ENTRY POINTS - 00016000
  17. * 00017000
  18. *| DMSSCNN - NEW PARAMETER LIST FORMAT 00018000
  19. *| DMSSCNO - OLD PARAMETER LIST FORMAT 00019000
  20. * 00020000
  21. * ENTRY CONDITIONS - 00021000
  22. * 00022000
  23. *| DMSSCNN - 00023000
  24. *| GPR 0 = LENGTH OF THE INPUT LINE 00024000
  25. *| GPR 1 = ADDRESS OF THE INPUT LINE 00025000
  26. *| GPR 14 = CALLER'S RETURN ADDRESS 00026000
  27. *| GPR 15 = ENTRY POINT ADDRESS 00027000
  28. * 00028000
  29. *| DMSSCNO - 00029000
  30. *| GPR 1 = ADDRESS OF LENGTH (4 BYTES) FOLLOWED BY INPUT LINE 00030000
  31. *| GPR 14 = CALLER'S RETURN ADDRESS 00031000
  32. *| GPR 15 = ENTRY POINT ADDRESS 00032000
  33. * 00033000
  34. * EXIT CONDITIONS - 00034000
  35. * 00035000
  36. *| NORMAL - CONDITION CODE = 0 00036000
  37. *| GPR 0 = LENGTH OF PARAMETER LIST 00037000
  38. *| GPR 1 = ADDRESS OF PARAMETER LIST 00038000
  39. *| GPR 15 = ZERO - NO ERRORS ENCOUNTERED 00039000
  40. * 00040000
  41. *| ERROR - CONDITION CODE = 2 00041000
  42. *| GPR 0 = MAXIMUM PARAMETER LIST LENGTH 00042000
  43. *| GPR 1 = ADDRESS OF PARAMETER LIST 00043000
  44. *| GPR 15 = 4 - PARAMETER LIST TRUNCATED 00044000
  45. * 00045000
  46. * CALLS TO OTHER ROUTINES - 00046000
  47. * 00047000
  48. * NONE 00048000
  49. * 00049000
  50. * EXTERNAL REFERENCES - 00050000
  51. * 00051000
  52. * NONE 00052000
  53. * 00053000
  54. * TABLES / WORKAREAS - 00054000
  55. * 00055000
  56. *| BALRSAVE - SAVE AREA FOR CALLER'S REGISTERS 0 - 15 00056000
  57. * CMNDLIST - AREA IN WHICH TO BUILD THE PARAMETER LIST 00057000
  58. * 00058000
  59. * REGISTER USAGE - 00059000
  60. * 00060000
  61. *| GPR 0 = PARAMETER LIST LENGTH 00061000
  62. *| GPR 1 = CURRENT COMMAND LINE POINTER 00062000
  63. *| GPR 2 = COMMAND LINE INCREMENT = 1 00063000
  64. *| GPR 3 = END OF COMMAND LINE POINTER 00064000
  65. *| GPR 4 = CURRENT ARGUMENT ADDRESS 00065000
  66. *| GPR 5 = PARAMETER LIST ADDRESS 00066000
  67. *| GPR 6 = PARAMETER LIST INCREMENT = 8 00067000
  68. *| GPR 7 = END OF PARAMETER LIST POINTER 00068000
  69. *| GPR 8 = ARGUMENT LENGTH 00069000
  70. *| GPR 9 = DELIMITER TYPE FLAG 00070000
  71. *| GPR 10 = NOT USED 00071000
  72. *| GPR 11 = NOT USED 00072000
  73. *| GPR 12 = PROGRAM BASE REGISTER 00073000
  74. *| GPR 13 = NOT USED 00074000
  75. *| GPR 14 = CALLER'S RETURN ADDRESS 00075000
  76. *| GPR 15 = RETURN CODE REGISTER 00076000
  77. * 00077000
  78. * NOTES - 00078000
  79. * 00079000
  80. * NONE 00080000
  81. * 00081000
  82. * OPERATION - 00082000
  83. * 00083000
  84. *| DMSSCN TRANSFORMS THE INPUT LINE FROM A STRING OF ARGUMENTS 00084000
  85. *| TO A SERIES OF 8-BYTE PARAMETERS. AN ARGUMENT IS A STRING OF 00085000
  86. *| CHARACTERS DELIMITED BY BLANKS OR A LEFT OR RIGHT PARENTHESIS. 00086000
  87. *| THE FIRST ARGUMENT BECOMES THE FIRST PARAMETER AND THE SECOND 00087000
  88. *| ARGUMENT BECOMES THE SECOND PARAMETER, ETC. EACH PARENTHESIS 00088000
  89. *| BECOMES A SEPARATE PARAMETER. ARGUMENTS THAT ARE SHORTER 00089000
  90. *| THAN 8 CHARACTERS ARE PADDED WITH BLANKS. ARGUMENTS THAT ARE 00090000
  91. *| LONGER THAN 8 CHARACTERS ARE TRUNCATED TO 8. AN 8-BYTE FENCE 00091000
  92. *| OF ALL ONE BITS IS PUT AT THE END OF THE PARAMETER LIST AS A 00092000
  93. *| DELIMITER. DMSSCN RETURNS THE ADDRESS OF THE PARAMETER LIST 00093000
  94. *| IN REGISTER 1 AND THE LENGTH OF THE LIST IN REGISTER 0. IF 00094000
  95. *| THE SPACE ALLOCATED FOR THE PARAMETER LIST (CMNDLIST) BECOMES 00095000
  96. *| FULL, DMSSCN TERMINATES THE PROCESSING OF THE INPUT LINE AND 00096000
  97. *| RETURNS TO THE CALLER WITH AN ERROR CODE OF 4. IN THIS CASE, 00097000
  98. *| REGISTER 1 STILL POINTS TO THE PARAMETER LIST AND REGISTER 0 00098000
  99. *| INDICATES THE MAXIMUM LENGTH. 00099000
  100. * 00100000
  101. EJECT 00101000
  102. * 00102000
  103. *| AN EXAMPLE IS SHOWN BELOW: 00103000
  104. *| 00104000
  105. *| INPUT LINE: 00105000
  106. *| ASSEMBLE VERYLONGNAME (LOAD NOTERM) 00106000
  107. *| 00107000
  108. *| PARAMETER LIST: 00108000
  109. *| DC CL8'ASSEMBLE' 00109000
  110. *| DC CL8'VERYLONG' 00110000
  111. *| DC CL8'( ' 00111000
  112. *| DC CL8'LOAD ' 00112000
  113. *| DC CL8'NOTERM ' 00113000
  114. *| DC CL8') ' 00114000
  115. *| DC 8X'FF' 00115000
  116. *. 00116000
  117. EJECT 00117000
  118. DMSSCN START 0 BUILD PARAMETER LIST FROM COMMAND LINE 00118000
  119. ENTRY DMSSCNO 00119000
  120. DMSSCNO DS 0H ENTRY POINT FOR OLD CALLING SEQUENCE 00120000
  121. L R0,0(,R1) GET THE INPUT LINE LENGTH 00121000
  122. LA R1,4(,R1) POINT TO THE INPUT LINE 00122000
  123. ENTRY DMSSCNN 00123000
  124. DMSSCNN DS 0H ENTRY POINT FOR NEW CALLING SEQUENCE 00124000
  125. USING NUCON,R0 00125000
  126. STM R0,R15,BALRSAVE SAVE THE CALLER'S REGISTERS 00126000
  127. BALR R12,0 SET UP THE BASE REGISTER 00127000
  128. USING *,R12 00128000
  129. SR R15,R15 ZERO THE RETURN CODE 00129000
  130. LR R3,R0 SAVE THE INPUT LINE LENGTH 00130000
  131. BCTR R1,0 GET INPUT LINE ADDRESS MINUS ONE 00131000
  132. AR R3,R1 POINT TO END OF INPUT LINE 00132000
  133. * SR R9,R9 CLEAR THE ENDING DELIMITER 00133000
  134. LA R2,1 LOAD INPUT LINE INCREMENT 00134000
  135. LA R5,CMNDLIST POINT TO START OF PARAMETER LIST AREA 00135000
  136. LA R6,8 LOAD PARAMETER LIST INCREMENT 00136000
  137. LA R7,CMNDLIST+L'CMNDLIST-16 POINT TO END OF P-LIST 00137000
  138. SCNSTART BXH R1,R2,SCNFINIS SCAN FOR THE START OF AN ARGUMENT 00138000
  139. CLI 0(R1),C' ' IS THIS CHARACTER A BLANK? P0257 00139000
  140. BE SCNSTART YES, LOOK AT THE NEXT CHARACTER 00140000
  141. CLI 0(R1),C'(' DOES ARGUMENT START WITH A LEFT PAREN ? 00141000
  142. BE SCNLPARN YES, MAKE IT A SEPARATE PARAMETER 00142000
  143. CLI 0(R1),C')' DOES ARGUMENT START WITH A RIGHT PAREN ? 00143000
  144. BE SCNRPARN YES, MAKE IT A SEPARATE PARAMETER 00144000
  145. * CLI 0(R1),C',' DOES ARGUMENT START WITH A COMMA ? 00145000
  146. * BE SCNCOMMA YES, CHECK FOR OMITTED PARAMETER 00146000
  147. LR R4,R1 SAVE ARGUMENT STARTING ADDRESS 00147000
  148. SCNLASTC BXH R1,R2,SCNASTOP SCAN FOR LAST CHARACTER OF ARGUMENT 00148000
  149. CLI 0(R1),C' ' IS THIS CHARACTER A BLANK ? 00149000
  150. BE SCNASTOP YES, MOVE PARAMETER TO LIST 00150000
  151. * CLI 0(R1),C',' DOES ARGUMENT END WITH A COMMA ? 00151000
  152. * BE SCNASTOP YES, MOVE PARAMETER TO LIST 00152000
  153. CLI 0(R1),C')' DOES ARGUMENT END WITH A RIGHT PAREN ? 00153000
  154. BE SCNASTOP YES, MOVE PARAMETER TO LIST 00154000
  155. CLI 0(R1),C'(' DOES ARGUMENT END WITH A LEFT PAREN ? 00155000
  156. BNE SCNLASTC NO, LOOK AT THE NEXT CHARACTER 00156000
  157. SCNASTOP LR R8,R1 SAVE POINTER TO END OF ARGUMENT 00157000
  158. BCTR R1,0 DECREMENT END POINTER FOR NEXT RECURP0257 00158000
  159. * SR R9,R9 CLEAR DELIMITER TYPE FLAG 00159000
  160. SR R8,R4 DETERMINE ARGUMENT LENGTH 00160000
  161. CR R8,R6 IS IT LESS THAN 8 ? 00161000
  162. BNL SCNMAXLN NO, MOVE THE MAXIMUM LENGTH 00162000
  163. MVC 0(8,R5),=CL8' ' CLEAR RECEIVING FIELD 00163000
  164. BCTR R8,0 SUBTRACT 1 FOR EX INSTRUCTION 00164000
  165. EX R8,SCNEMOVE MOVE ARGUMENT TO PARAMETER LIST 00165000
  166. BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE P0257 00166000
  167. B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00167000
  168. SCNEMOVE MVC 0(0,R5),0(R4) EXECUTED MOVE INSTRUCTION 00168000
  169. SPACE 00169000
  170. SCNMAXLN MVC 0(8,R5),0(R4) MOVE 8 CHARACTERS TO PARAMETER LIST 00170000
  171. BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE P0257 00171000
  172. B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00172000
  173. SPACE 00173000
  174. SCNLPARN MVC 0(8,R5),=CL8'(' MOVE LEFT PAREN TO PARAMETER LIST 00174000
  175. * LA R9,COMMA INDICATE COMMA TYPE DELIMITER 00175000
  176. BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE 00176000
  177. B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00177000
  178. SPACE 00178000
  179. SCNRPARN EQU * 00179000
  180. * LTR R9,R9 WAS THE LAST DELIMITER A COMMA TYPE ? 00180000
  181. * BZ SCNRCONT NO, CONTINUE RIGHT PAREN PROCESSING 00181000
  182. * MVC 0(8,R5),=CL8' ' YES, INDICATE PARAMETER OMITTED 00182000
  183. * SR R9,R9 INDICATE NON-COMMA TYPE DELIMITER 00183000
  184. * BXLE R5,R6,SCNRCONT POINT TO NEXT SLOT AND CONTINUE 00184000
  185. * B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER LIST 00185000
  186. *SCNRCONT EQU * 00186000
  187. MVC 0(8,R5),=CL8')' MOVE RIGHT PAREN TO PARAMETER LIST 00187000
  188. BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE 00188000
  189. B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00189000
  190. SPACE 00190000
  191. *SCNCOMMA LTR R9,R9 WAS LAST DELIMITER ALSO A COMMA TYPE ? 00191000
  192. * LA R9,COMMA INDICATE CURRENT DELIMITER IS A COMMA 00192000
  193. * BZ SCNSTART NO, HANDLE THE SAME AS A BLANK 00193000
  194. * MVC 0(8,R5),=CL8' ' YES, INDICATED PARAMETER OMITTED 00194000
  195. * BXLE R5,R6,SCNSTART POINT TO NEXT SLOT AND CONTINUE 00195000
  196. * B SCNERROR ERROR IF NO MORE ROOM IN PARAMETER AREA 00196000
  197. SPACE 00197000
  198. SCNERROR LA R15,4 ERROR IF NO MORE ROOM IN PARAMETER AREA 00198000
  199. SCNFINIS MVC 0(8,R5),=8X'FF' PUT A FENCE AT END OF PARAMETER LIST 00199000
  200. LA R0,8(,R5) POINT TO END OF PARAMETER LIST 00200000
  201. LA R1,CMNDLIST POINT TO START OF PARAMETER LIST 00201000
  202. SR R0,R1 COMPUTE THE PARAMETER LIST LENGTH 00202000
  203. LTR R15,R15 LOAD RETURN CODE AND SET CONDITION CODE 00203000
  204. LM R2,R14,BALRSAVE+8 RESTORE THE CALLER'S REGISTERS 00204000
  205. BR R14 RETURN TO THE CALLER 00205000
  206. SPACE 3 00206000
  207. *COMMA EQU 1 00207000
  208. LTORG 00208000
  209. EJECT 00209000
  210. NUCON 00210000
  211. REGEQU 00211000
  212. END 00212000