User Tools

Site Tools


cdc:nos2.source:nam5871:np_init

NP$INIT

Table Of Contents

  • [00008] PROC NP$INIT (ACN, FILENAME, OPCODE, STATIS, DATADEC, TIMEOUT, ABL,
  • [00010] NP$INIT - INITIALIZE FILE TRANSFER.
  • [00090] PROC NP$BFET
  • [00091] PROC NP$CIO
  • [00092] FUNC NP$CMAR U
  • [00093] FUNC NP$CMAF U
  • [00094] PROC NP$CMSF
  • [00095] PROC NP$CMFF
  • [00096] FUNC NP$CS63 B
  • [00097] PROC NP$ERR
  • [00098] FUNC GMEMCMM U
  • [00099] PROC NP$RTIM
  • [00100] PROC NP$S63
  • [00101] PROC NP$ZWDS
  • [00102] PROC NP$INFO
  • [00103] PROC NP$ZRBK
  • [00104] PROC NP$OSIF

Source Code

NP$INIT.txt
  1. *DECK NP$INIT
  2. *IF DEF,XFR
  3. USETEXT AIPDEF
  4. USETEXT NX$ACBF
  5. USETEXT NX$ACBX
  6. USETEXT NX$MSG
  7. USETEXT NX$CHAR
  8. PROC NP$INIT (ACN, FILENAME, OPCODE, STATIS, DATADEC, TIMEOUT, ABL,
  9. BSIZE,CWS,ICKVAL);
  10. # TITLE NP$INIT - INITIALIZE FILE TRANSFER. #
  11.  
  12. BEGIN # NP$INIT #
  13.  
  14. #
  15. ***
  16. * PROC NAME: AUTHOR DATE
  17. * NP$INIT L.T.NGUYEN 03/20/83
  18. *
  19. * NP$INIT PERFORMS THE INITIALIZATION REQUIRED PRIOR TO ACTUAL DATA
  20. * TRANSFER.
  21. *
  22. * PROC NP$INIT (ACN, FILENAME, OPCODE, STATIS, DATADEC, TIMEOUT, ABL
  23. * ,BSIZE)
  24. *
  25. * ENTRY ACN - APPLICATION CONNECTION NUMBER.
  26. * FILENAME - FILE NAME TO BE TRANSFERRED, IN DISPLAY
  27. * CODE, 7 CHARACTERS MAXIMUM.
  28. * OPCODE = 0, FILE IS TO BE READ FROM THE NETWORK.
  29. * = 1, FILE IS TO BE WRITTEN TO THE NETWORK.
  30. * STATIS - CALLING PROGRAM REPLY STATUS
  31. * WORD.
  32. * DATADEC - FORMAT OF DATA BEING TRANSFERRED -
  33. * - 0, UH
  34. * - 1, US
  35. * - 2, UU
  36. * - 3, C6
  37. * - 4, C8.
  38. * TIMEOUT - TIME IN SECONDS TO WAIT FOR A FUNCTION
  39. * RESPONSE BEFORE TIMING OUT.
  40. * ABL - APPLICATION BLOCK LIMIT.
  41. * BSIZE - BLOCK SIZE TO TRANSMIT.
  42. * CWS - CHECK MARK WINDOW SIZE.
  43. * ICKVAL - INITIAL CHECK MARK VALUE.
  44. * PRESNO - PRU OFFSET AND BIT OFFSET.
  45. *
  46. * EXIT FTTINDEX - INDEX INTO FTT TABLE. ( GLOBAL )
  47. *
  48. * PROCESS INITIALIZE VALUES IN COMMON BLOCKS COMACBX AND COMADFM.
  49. * IF ACN IS NOT WITHIN ALLOWABLE RANGE,
  50. * THEN:
  51. * CALL NP$ERR TO WRITE DAYFILE ERROR MESSAGE AND
  52. * ABORT C.P.
  53. * SET STATUS TO INDICATE ACN NOT WITHIN ALLOWABLE
  54. * RANGE.
  55. * ELSE:
  56. * IF COMACBX HAS NOT BEEN INTIALIZED,
  57. * THEN
  58. * INITIALIZE VARIOUS DATA CELLS IN COMACBX.
  59. * CALL GMEMCMM TO OBTAIN MEMORY FOR FETS, BUFFERS,
  60. * AND RHF PARAMETER BLOCK.
  61. * SET FTTTIMEOUT[FTTINDEX] = TIMEOUT.
  62. * SET FTTDIRECN[FTTINDEX] = OPCODE.
  63. * SET FTTSTATADR[FTTINDEX] = STATUS ADDRESS.
  64. * SET FTTDXPA = OK (P$ES$OK).
  65. * SET FTTERRORD = 0 (NO ERROR).
  66. * CALL BUILDFT TO BUILD FETS, ALLOCATE BUFFER, AND
  67. * BUILD RHF NETXFR REQUEST/REPLY PARAMETER BLOCK.
  68. * CALL CALLCIO TO OPEN LOCAL FILE WITHOUT RECALL.
  69. * SET FTTSTATE[FTTINDEX] = 1 TO INDICATE WAITING FOR
  70. * COMPLETION OF OPEN FILE REQUEST.
  71. *
  72. #
  73. ITEM ACN I; # APPLICATION CONNECTION NUMBER #
  74. ITEM FILENAME C(7); # FILE NAME #
  75. ITEM OPCODE I; # READ OR WRITE CODE #
  76. ITEM STATIS I; # STATUS WORD #
  77. ITEM DATADEC I; # DATA FORMAT DECLARATION #
  78. ITEM TIMEOUT I; # SECONDS TO TIME OUT #
  79. ITEM ABL I ;
  80. ITEM BSIZE U ;
  81. ITEM CWS U ;
  82. ITEM ICKVAL U ;
  83.  
  84. #
  85. **** PROC NP$INIT - XREF LIST BEGIN.
  86. #
  87.  
  88. XREF
  89. BEGIN
  90. PROC NP$BFET; # BUILT FETS #
  91. PROC NP$CIO ; # CALL CIO #
  92. FUNC NP$CMAR U; # ASSIGN GROUP NAME #
  93. FUNC NP$CMAF U;
  94. PROC NP$CMSF; # SHRINK FIXED MEMORY #
  95. PROC NP$CMFF; # FREE FIXED MEMORY #
  96. FUNC NP$CS63 B; # DETERMINE IF 63 CHAR SET #
  97. PROC NP$ERR ; # WRITE DAYFILE MESSAGE #
  98. FUNC GMEMCMM U; # GET CENTRAL MEMORY VIA CMM #
  99. PROC NP$RTIM ; # INITIALIZE FTTTIME #
  100. PROC NP$S63; # SET TRANSLATION FOR 63 SET #
  101. PROC NP$ZWDS; # CLEAR CM BLOCK #
  102. PROC NP$INFO ; # GET FILE STATUS #
  103. PROC NP$ZRBK ;
  104. PROC NP$OSIF ;
  105. END
  106.  
  107. #
  108. **** PROC NP$INIT - XREF LIST END.
  109. #
  110.  
  111. ITEM FOUND B ; # FLAG FOR LOCATING EMPTY FTT ENTRY #
  112. ITEM I ;
  113. ITEM BUFFERADR I ; # ADDRESS OF TOTAL BUFFER #
  114. ITEM BUFLENGTH I ; # TOTAL LENGTH OF BUFFER NEEDED #
  115. ITEM CODE I ; # CODE FOR CIO OPEN #
  116. ITEM CIO$WORD U ; # LENGTH OF DISK BUFFER #
  117. ITEM NET$WORD U ; # LENGTH OF NETWORKING BUFFER #
  118. ITEM FSTATUS I;
  119. CONTROL EJECT;
  120.  
  121. IF NUMFILEXFR EQ 1
  122. THEN
  123. BEGIN
  124. GROUPNAME = NP$CMAR(0); # ASSIGN GROUP NAME #
  125. END
  126.  
  127. FOUND = FALSE ;
  128. FOR I = 0 STEP 1 WHILE I LS MAXFILEXFR
  129. AND NOT FOUND
  130. DO
  131. BEGIN # LOOP THROUGH FTT ENTRIES TO FIND AN EMPTY ONE #
  132. IF FTTACN[I] EQ ACN
  133. THEN
  134.  
  135.  
  136. BEGIN # SECOND FILE ON SAME CONN. #
  137. P<STATUSWORD> = LOC(STATIS) ;
  138. STATUSWD = S$XFR$2 ; # SET STATUS FLAG #
  139. RETURN ; # THEN RETURN TO NETXFR #
  140. END
  141. ELSE
  142. IF FTTACN[I] EQ 0
  143. THEN
  144. BEGIN
  145. # REMEMBER THIS IS EMPTY ENTRY #
  146. FTTINDEX = I ;
  147. FOUND = TRUE ;
  148. END
  149.  
  150. END # LOOP TO FIND FTT ENTRY #
  151. IF NOT FOUND
  152. THEN
  153. NP$ERR("48") ; # NO EMPTY ENTRY IN FTT FOUND #
  154. # SEND DAYFILE MSG THEN ABORT C.P. #
  155.  
  156. #
  157.   READY TO BUILD FTT ENTRY.
  158. #
  159. NP$ZWDS(LOC(FTT$WD0[FTTINDEX]),FTTENTRYSIZE); # ZERO OUT ENTRY #
  160. NP$RTIM(TIME$WORD) ; # GET CURRENT TIME #
  161. FTTACN[FTTINDEX] = ACN ; # EMPTY ENTRY IN FTT, SAVE ACN #
  162. FTTSTATE[FTTINDEX] = STATX ; # INITIALIZE CURRENT STATE #
  163. *IF DEF,DEBUG,2
  164. FTTPREST[FTTINDEX] = STATX ; # INITIALIZE PREV. STATE #
  165. FTTPRETRIG[FTTINDEX] = NOCHG ; # INITIALIZE PREV. TRIG #
  166. # ASSIGNING THE STATE TABLE ORDINAL #
  167. FTTSTORD[FTTINDEX] = ASSIGNORD[DATADEC] - OPCODE ;
  168. FTTOPCODE[FTTINDEX] = OPCODE ;
  169. FTTTIME[FTTINDEX] = TIME$SEC[0] ; # SAVE THE INITIAL TIME #
  170. FTTTIMOUT[FTTINDEX] = TIMEOUT ; # SET TIME OUT TIME #
  171. FTTSTATUS[FTTINDEX] = LOC(STATIS) ; # SAVE STATUS ADDRESS #
  172. FTTUDD[FTTINDEX] = DATADEC ; # DATADECLARARION #
  173. FTTABL[FTTINDEX] = ABL ;
  174. FTTCURBLK[FTTINDEX] = ABL; # COPY ABL TO RUNNING ABL #
  175. # WINDOW #
  176. FTTOUTCWS[FTTINDEX] = 0; # ZERO OUT OUTSTANDING #
  177. # CHECKMARKS #
  178. FTTBLK$MS[FTTINDEX] = MSWINDOWSZ; # SET CHECK MARK WINDOW #
  179. # VALUE #
  180. FTTNOTRAN[FTTINDEX] = FALSE; # DEFAULT IS TRANSLATION #
  181. # NEEDED #
  182. IF MFAC[0] EQ 1 # IF MFACIL USED #
  183. THEN
  184. BEGIN
  185. FTTMFACIL[FTTINDEX] = TRUE; # SET MFACIL FLAG TO TRUE #
  186. END
  187. IF RFAC[0] EQ 1 # IF RFACIL SPECIFIED #
  188. THEN
  189. BEGIN
  190. FTTRFACIL[FTTINDEX] = TRUE; # RFACIL SPECIFIED #
  191. FTTNRETRY[FTTINDEX] = MAXRETRY; # MAXIMUM RETRY COUNT #
  192. END
  193. FACILWD[0] = 0; # CLEAR BIT MASK #
  194. FTTTBN[FTTINDEX] = 0 ; # INITIALIZE SERIAL BLOCK #
  195. FTTCWS[FTTINDEX] = CWS ;
  196. FTTOPENB[FTTINDEX] = ABL ;
  197. FTTOPENC[FTTINDEX] = CWS ;
  198. FTTICKVAL[FTTINDEX] = ICKVAL ;
  199. FTTCURPRU[FTTINDEX] = 1 ; # INITIALIZE TO ONE #
  200. IF DATADEC GQ C6
  201. THEN
  202. BEGIN # IVT CONN. NEED TO BUILD FET #
  203. #
  204. * OBTAIN MEMORY FOR LOCAL FETS (CIO AND WORKING FET ) AND
  205. * BUFFER FOR CIO AND WORKING AREAS.
  206. #
  207.  
  208. NET$WORD = (( BSIZE + TBH$HSIZE) * OCTETSIZE)/WORDLENGTH + 3;
  209. # CALCULATE SIZE OF NETWORK #
  210. IF OPCODE EQ RECEIVE # IF RECEIVER #
  211. THEN
  212. BEGIN
  213. NET$WORD = NET$WORD + TOTALHDRBLK; # ADD HDR BLOCK SIZE #
  214. FTTBSIZE[FTTINDEX] = NET$WORD; # BUFFER SIZE OF NETWORK #
  215. END
  216. ELSE
  217. BEGIN
  218. FTTBSIZE[FTTINDEX] = BSIZE + TBH$HSIZE;
  219. END
  220.  
  221.  
  222. CIO$WORD = LEN$CIOB ;
  223. BUFLENGTH = LEN$FET # LENGTH OF CIO FET #
  224. + LEN$FETW # LENGTH OF WORKING FET #
  225. + LEN$CMB # LENGTH OF CONVERSION PARAM BLK#
  226. + LEN$CIOB # LENGTH OF CIO DISK BUFFER #
  227. + NET$WORD # LENGTH OF NETWORK BUFFER #
  228. + LEN$CHK;# LENGTH OF CHECKMARK BUFFER #
  229.  
  230. BUFFERADR = NP$CMAF(BUFLENGTH,0,GROUPNAME);
  231. FTTFETADR[FTTINDEX] = BUFFERADR ; # CIO BUFFER AREA#
  232. FTTCMV$BLK[FTTINDEX] = BUFFERADR + LEN$FET + LEN$CIOB ;
  233. FTTFETW[FTTINDEX] = BUFFERADR + LEN$CMB + LEN$FET + LEN$CIOB ;
  234. FTTCKTBL[FTTINDEX] = FTTFETW[FTTINDEX] + NET$WORD + LEN$FETW;
  235. FTTCURPRU[FTTINDEX] = 0; # START WITH 0 PRU NUMBER #
  236. END # IVT CONN. NEED TO BUILD FET #
  237. ELSE
  238. BEGIN # PRU CONECTION #
  239. BUFLENGTH = LEN$FET ;
  240. CIO$WORD = 64 + 1 ; # MIM CIO BUFFER, FOR OPEN #
  241. BUFFERADR = NP$CMAF(BUFLENGTH+CIO$WORD,0,GROUPNAME);# GET BUF#
  242. # FOR FET AND IO ONLY #
  243. FTTFETADR[FTTINDEX] = BUFFERADR ;
  244. FTTFETW[FTTINDEX] = 0 ;
  245. FTTBSIZE[FTTINDEX] = BSIZE ;
  246. END # PRU CONNECTION #
  247.  
  248. NP$ZWDS(BUFFERADR,BUFLENGTH) ; # ZERO OUT ALLOCATED MEMORY #
  249. FTTBUFSIZE[FTTINDEX] = BUFLENGTH ;
  250. NP$BFET(FILENAME,CIO$WORD,NET$WORD) ;
  251. IF OPCODE EQ SEND
  252. THEN # READ FILE #
  253. BEGIN
  254. CODE = CIO$OPENR ; # CALL CIO TO OPEN READ #
  255. NP$CIO(CODE);
  256. END
  257. ELSE
  258. BEGIN
  259. CODE = CIO$OPENW ; # CALL CIO TO OPEN WRITE #
  260. NP$CIO(CODE);
  261. IF DATADEC LS C6 # IF PRU RECEIVER #
  262. THEN
  263. BEGIN
  264. CODE = CIO$WRITEF; # PREPARE EOF MARKER ON FILE #
  265. NP$CIO(CODE); # WRITEF #
  266. END
  267. END
  268.  
  269. NP$ZRBK(LOC(FILENAME),1) ; # ZERO TRAILLING BLANK #
  270. NP$INFO(FILENAME,FSTATUS) ; # GET STATUS OF FILE #
  271. IF FSTATUS NQ 0
  272. THEN
  273. BEGIN # ILLEGAL FILE TYPE FOR TRANSFERRING #
  274. STATUSWD = ILL$FTP ;
  275. FTTACN[FTTINDEX] = 0 ; # AGAIN FREE THE ENTRY IN FTT #
  276. NP$CMFF(BUFFERADR) ; # RELEASE THE ALLOCATED BUFFER #
  277. END # ILLEGAL FILE TYPE FOR TRANSFERRING #
  278.  
  279. RETURN ;
  280.  
  281. END # NP$INIT #
  282.  
  283. TERM
  284. *ENDIF
cdc/nos2.source/nam5871/np_init.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator