home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / flow / part03 < prev    next >
Encoding:
Text File  |  1992-07-30  |  55.8 KB  |  1,868 lines

  1. Newsgroups: comp.sources.misc
  2. From: julian@vscn08.cern.ch (Julian James Bunn)
  3. Subject:  v31i066:  flow - Fortran Structure Analysers, Part03/05
  4. Message-ID: <1992Jul31.052626.375@sparky.imd.sterling.com>
  5. X-Md4-Signature: a5ef322481671157c0a7209c37805036
  6. Date: Fri, 31 Jul 1992 05:26:26 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: julian@vscn08.cern.ch (Julian James Bunn)
  10. Posting-number: Volume 31, Issue 66
  11. Archive-name: flow/part03
  12. Environment: fortran, ffccc
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  19. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  20. # Contents:  floppy.f floppy.l flow.exec flowflow.ps procht.for
  21. #   protre.for rdflop.for unixflow.for
  22. # Wrapped by kent@sparky on Thu Jul 30 23:38:14 1992
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 3 (of 5)."'
  26. if test -f 'floppy.f' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'floppy.f'\"
  28. else
  29.   echo shar: Extracting \"'floppy.f'\" \(7665 characters\)
  30.   sed "s/^X//" >'floppy.f' <<'END_OF_FILE'
  31. X      PROGRAM FLOPPY
  32. XC-------------------------------------------------------------------------
  33. XC Floppy UNIX interface routine.
  34. XC Sets up various required input files for Floppy.
  35. XC 
  36. XC Julian Bunn 1990
  37. XC-------------------------------------------------------------------------
  38. X      PARAMETER (MLEN=256,MXLIN=80,maxarg=100)
  39. X      character*(mxlin) argval
  40. X      character*1 key,char
  41. X      CHARACTER*(MLEN)  CFILE,COLD,CFORT,CTEMP,CBAD,CTREE
  42. X      LOGICAL LOG,fexist,fold,fqold,tidy,tree
  43. Xc
  44. Xc get all arguments
  45. Xc
  46. X      numargs = iargc()
  47. X      if(numargs.gt.maxarg) then
  48. X         write(6,'(A)') ' Floppy --> Too many arguments '
  49. X         goto 900
  50. X      endif
  51. Xc
  52. Xc get target filename(s)
  53. Xc
  54. X      call getarg(numargs,cfile)       
  55. X      lfile = index(cfile,' ')-1
  56. X      write(6,'(A)') ' Floppy --> Target file '//cfile(:lfile)
  57. X      inquire(file=cfile(:lfile),exist=fexist)
  58. X      if(.not.fexist) then
  59. X        write(6,'(A)') ' Floppy --> Target file not found !'
  60. X        goto 900
  61. X      endif
  62. Xc
  63. X      log = .false.                          
  64. X      fold = .false.  
  65. X      tidy = .false.
  66. X      cfort = ' '
  67. X      ctree = ' '
  68. X      tree = .false.
  69. Xc
  70. X      do 400 iarg=1,numargs-1
  71. X         call getarg(iarg,argval)
  72. X         if(argval(:2).eq.'-l') log = .true.
  73. X         if(argval(:2).eq.'-o') fqold = .true.
  74. X         if(argval(:2).eq.'-o') cold = argval(3:)
  75. X  400 continue
  76. Xc
  77. X      cbad = 'scratch'
  78. X      open(7,status='scratch',err=999)
  79. X      WRITE(7,'(A)') 'LIST,GLOBAL,TYPE;'
  80. X      WRITE(7,'(A)') 'PRINT,ILLEGAL;'
  81. X      WRITE(7,'(A)') 'OPTIONS,USER;'
  82. X      if(fqold) then
  83. X        if(cold(1:1).eq.' ') cold = cfile(:lfile)//'.flopold'
  84. X        lold = index(cold,' ')-1
  85. X        inquire(file=cold(:lold),exist=fold)
  86. X        if(log) write(6,'(A)') ' Floppy --> Old file: '//cold(:lold)
  87. X        if(.not.fold) then
  88. X           write(6,'(A)') ' Floppy --> Old file not found !'
  89. X           goto 900
  90. X        endif
  91. X        cbad = cold
  92. X        open(15,file=cold,status='old',err=999)
  93. X  450   read(15,'(A)',end=451,err=999) ctemp      
  94. X        goto 450
  95. X  451   continue
  96. X      else
  97. X        cold = cfile(:lfile)//'.flopold'     
  98. X        lold = index(cold,' ')-1
  99. X        cbad = cold
  100. X        open(15,file=cold(:lold),status='unknown',err=999)
  101. X      endif
  102. Xc
  103. Xc loop over all qualifiers
  104. Xc
  105. X      icheck = 0
  106. X      do 500 iarg = 1,numargs-1
  107. X         call getarg(iarg,argval)
  108. X         larg = index(argval,' ')-1 
  109. X         key = argval(2:2)
  110. X         if(key.eq.'l') then
  111. X           log = .true.
  112. X         else if(key.eq.'n') then
  113. X           if(argval(3:3).eq.' ') then
  114. X              write(6,'(A)') ' Floppy --> Missing value for -n'
  115. X              goto 900
  116. X           endif 
  117. X           cfort = argval(3:)
  118. X           lfort = index(cfort,' ')-1 
  119. X           if(log) write(6,'(A)') ' Floppy --> Tidied Fortran: '//
  120. X     &             cfort(:lfort) 
  121. X         else if(key.eq.'o') then
  122. Xc
  123. X         else if(key.eq.'f') then
  124. X           if(log) write(6,'(A)') ' Floppy --> List source line numbers'
  125. X           write(15,'(a)') '*FULL'
  126. X         else if(key.eq.'i') then
  127. X           ctemp = argval(3:)
  128. X   50      iend = index(ctemp,',')
  129. X           if(iend.ne.0) then
  130. X             write(15,'(A)') ctemp(:iend-1)
  131. X             if(log) write(6,'(A)') 
  132. X     &         ' Floppy --> Ignore: '//ctemp(:iend-1) 
  133. X             ctemp = ctemp(iend+1:)
  134. X             goto 50
  135. X           endif
  136. X           iend = index(ctemp,' ')
  137. X           write(15,'(A)') ctemp(:iend)
  138. X           if(log) write(6,'(A)') ' Floppy --> Ignore: '//ctemp(:iend)
  139. X         else if(key.eq.'c') then
  140. X           icheck = 1
  141. X           ctemp = argval(3:)
  142. X           if(ctemp.eq.'standard') then
  143. X             write(15,'(A)') '*CHECK RULE *'
  144. X             if(log) write(6,'(A)') ' Floppy --> Check Standard rules'
  145. X           else if(ctemp.eq.' ') then
  146. X             write(15,'(A)') '*CHECK RULE *'
  147. X             if(log) write(6,'(A)') ' Floppy --> Check Standard rules'
  148. X           else if(ctemp.eq.'a') then
  149. X              write(15,'(A)') '*CHECK RULE 99'
  150. X              if(log) write(6,'(A)') ' Floppy --> Check all rules'
  151. X           else if(ctemp.eq.'n') then
  152. X             write(15,'(A)') '*CHECK RULE -99'
  153. X              if(log) write(6,'(A)') ' Floppy --> No rule checks'
  154. X           else 
  155. X             ctemp = ctemp(:index(ctemp,' ')-1)
  156. X             if(log) write(6,'(A)') ' Floppy --> Check rules: '//
  157. X     &               ctemp(:index(ctemp,' ')-1)
  158. X   51        iend = index(ctemp,',')
  159. X             if(iend.ne.0) then
  160. X               write(15,'(A)') '*CHECK RULE '//ctemp(:iend-1)
  161. X               ctemp = ctemp(iend+1:)
  162. X               goto 51
  163. X             endif
  164. X             write(15,'(A)') '*CHECK RULE '//ctemp
  165. X           endif 
  166. X         else if(key.eq.'t') then
  167. X           write(7,'(A)') 'OPTIONS,TREE;'
  168. X           ctree = cfile(:lfile)//'.floptre'
  169. X           ltree = index(ctree,' ')-1
  170. X           if(log) write(6,'(A)') 
  171. X     &             ' Floppy --> Produce file for Flow: '//ctree(:ltree)
  172. X           open(50,file=ctree(:ltree),status='new',
  173. X     &          form='unformatted',err=999)
  174. X           tree = .true.
  175. X         else if(key.eq.'j') then
  176. X           char = argval(3:3)
  177. X           if(char.eq.' ') char = '3'
  178. X           write(7,'(A)') 'OPTIONS,INDENT='//char//';'
  179. X           if(log) write(6,'(A)') ' Floppy --> Indent clauses by '//char
  180. X           tidy = .true.
  181. X         else if(key.eq.'f') then
  182. X           write(7,'(A)') 'STATEMENTS,SEPARATE;'
  183. X           if(log) write(6,'(A)') ' Floppy --> Group FORMATs at end'
  184. X           tidy = .true.
  185. X         else if(key.eq.'g') then
  186. X           write(7,'(A)') 'STATEMENTS,GOTO;'
  187. X           if(log) write(6,'(A)') ' Floppy --> Right align GOTOs'
  188. X           tidy = .true.
  189. X         else if(key.eq.'r') then
  190. X           ctemp = argval(3:)
  191. X           iend = index(ctemp,',')
  192. X           if (iend.eq.0) ctemp = ctemp(:index(ctemp,' ')-1)//',10'
  193. X           write(7,'(A)') 'STATEMENTS,FORMAT='//
  194. X     &                    ctemp(:index(ctemp,' ')-1)//';'
  195. X           if(log) write(6,'(A)') ' Floppy --> Renumber FORMATs: '//
  196. X     &             'start,step '//ctemp(:index(ctemp,' '))
  197. X           tidy = .true.
  198. X         else if(key.eq.'s') then
  199. X           ctemp = argval(3:)
  200. X           iend = index(ctemp,',')
  201. X           if (iend.eq.0) ctemp = ctemp(:index(ctemp,' ')-1)//',10'
  202. X           write(7,'(A)') 'STATEMENTS,NUMBER='//
  203. X     &                    ctemp(:index(ctemp,' ')-1)//';'
  204. X           if(log) write(6,'(A)') ' Floppy --> Renumber statements: '//
  205. X     &             'start,step '//ctemp(:index(ctemp,' '))
  206. X           tidy = .true.
  207. X         else 
  208. X           write(6,'(A)') ' Floppy --> Unrecognized qualifier '//key
  209. X         endif
  210. X  500 continue
  211. Xc
  212. X      if(tidy) then
  213. X         write(7,'(A)') 'OUTPUT,FULL,COMPRESS;'
  214. X         if(cfort(1:1).eq.' ') then
  215. X           cfort = cfile(:lfile)//'.out'
  216. X           lfort = index(cfort,' ')-1
  217. X         endif
  218. X         cbad = cfort
  219. X         open(14,file=cfort(:lfort),status='unknown',err=999)
  220. X      endif 
  221. Xc
  222. Xc default action is to check standard rules
  223. Xc
  224. X      if(icheck.eq.0.and..not.fqold) then
  225. X         write(15,'(A)') '*CHECK RULE *'
  226. X      endif
  227. X         
  228. X      write(7,'(A)') 'END;'
  229. X      if(log) write(6,'(A)') ' Floppy --> Finished parsing command' 
  230. X      rewind(7)
  231. X      rewind(15)
  232. X      cbad = cfile
  233. X      open(11,file=cfile(:lfile),status='old',err=999)
  234. X      cbad = 'scratch'
  235. X      open(99,status='scratch',err=999)
  236. Xc
  237. X      call allpro
  238. Xc
  239. X      close(11)
  240. X      if(tidy) close(14)
  241. X      if(tree) close(50)
  242. X      close(7)
  243. X      close(99)
  244. X      write(6,'(A)') ' Floppy --> has finished'
  245. X      goto 2000
  246. XC
  247. X  999 CONTINUE
  248. X      WRITE(6,'(A)') ' Floppy --> Error opening '//
  249. X     &               cbad(:index(cbad,' ')) 
  250. X  900 write(6,'(A)') ' Floppy aborted'     
  251. X 2000 CONTINUE
  252. X      END
  253. END_OF_FILE
  254.   if test 7665 -ne `wc -c <'floppy.f'`; then
  255.     echo shar: \"'floppy.f'\" unpacked with wrong size!
  256.   fi
  257.   # end of 'floppy.f'
  258. fi
  259. if test -f 'floppy.l' -a "${1}" != "-c" ; then 
  260.   echo shar: Will not clobber existing file \"'floppy.l'\"
  261. else
  262.   echo shar: Extracting \"'floppy.l'\" \(6212 characters\)
  263.   sed "s/^X//" >'floppy.l' <<'END_OF_FILE'
  264. X.TH floppy 1 "3rd May 1990"  "CERN"
  265. X.SH NAME
  266. Xfloppy \- Fortran coding convention checker and code tidier
  267. X.SH SYNOPSIS
  268. X.B floppy 
  269. X[
  270. X.B \-l
  271. X] [
  272. X.B \-c rules
  273. X] [
  274. X.B \-f
  275. X] [
  276. X.B \-o old file
  277. X] [
  278. X.B \-i names
  279. X] [
  280. X.B \-j number
  281. X] [
  282. X.B \-F
  283. X] [
  284. X.B \-G
  285. X] [
  286. X.B \-r start[,step]
  287. X] [
  288. X.B \-s start[,step]
  289. X] [
  290. X.B \-n new fortran
  291. X] [
  292. X.B \-t flow file
  293. X] [ file ]
  294. X.SH DESCRIPTION
  295. X.I Floppy
  296. Xis a tool which allows a file of Fortran 77 code to be checked against
  297. Xa set of common coding conventions. Floppy also allows the source Fortran
  298. Xto be reformatted and tidied in various ways.
  299. X.PP
  300. XNote that, before passing code through Floppy, it should have
  301. Xbeen compiled, preferably with the ANSI compiler flag, to check
  302. Xfor errors. Otherwise, the results from using Floppy are
  303. Xunpredictable. Note also that non-standard Fortran statements
  304. X(such as "include" directives or lower-case) are treated as
  305. X.B comments
  306. Xby Floppy, and thus ignored.
  307. X
  308. X.SH OPTIONS
  309. X.IP \fB\-l\fR 12
  310. XThe
  311. X.I logging
  312. Xoption causes Floppy to produce a verbose description of the selected options.
  313. X.IP \fB\-c\ rules \fR 12
  314. XThe 
  315. X.I checks
  316. Xoption indicates which rules Floppy should check. The checks may be specified as
  317. Xa series of comma-separated numbers (see below), or as one of the following:
  318. X.RS 12
  319. X.IP standard 12
  320. XThe standard set of rules will be checked (those marked * in the list below).
  321. X.IP a 12
  322. XALL rules in the available list will be checked.
  323. X.IP n 12
  324. XNO rules will be checked. (Useful when just tidying code.)
  325. X.PP
  326. XNote that, if selecting individual rule numbers, 99 is taken to mean ALL
  327. Xrules, and -99 to mean NO rules. Specifying a negative rule number excludes
  328. Xthat rule. So to check all rules except 1,5,7 and 31, you can use
  329. X.br
  330. X.RS 12
  331. X.I -c99,-1,-5,-7,-31
  332. X.RE 12
  333. X
  334. X.RE
  335. X.IP \fB\-f\fR 12
  336. XThe
  337. X.I full
  338. Xqualifier specifies
  339. Xthat all source code lines should be listed, rather than
  340. Xjust those in breach of any specified rules.
  341. X
  342. X.IP \fB\-o\ old file\fR 12
  343. XUse a previously-generated file of rule numbers, ignore names etc.
  344. XThe
  345. X.I old
  346. Xtag should be set to the file name, which is generated by 
  347. Xappending .old to the previous source Fortran file name.
  348. X
  349. X.IP \fB\-i\ names\fR 12
  350. XSpecify a list of Fortran module and variable names to be ignored
  351. Xwhen the rules are checked. Specify module names by prepending the
  352. Xname with a # sign. The list of names should be separated by commas.
  353. XNote also that the names should be uppercase, to conform with the
  354. XF77 standard. For example,
  355. X.br
  356. X.I -i#GOOBAR,FOOBAR
  357. Xwill cause subroutine GOOBAR to be ignored, and any references to the
  358. Xvariable FOOBAR.
  359. X
  360. X.PP
  361. X
  362. XThe following options apply to code tidying:
  363. X
  364. X.IP \fB\-j\ [number]\fR 12
  365. XThe
  366. X.I indent
  367. Xoption causes all DO loops and IF...THEN...ENDIF clauses to be
  368. Xindented by the specified number of spaces to the right. The default
  369. Xvalue is 3 spaces, the maximum allowed is 5.
  370. X
  371. X.IP \fB\-F\fR 12
  372. XSpecifies that all FORMAT statements be grouped together at the end
  373. Xof each module.
  374. X
  375. X.IP \fB\-G\fR 12
  376. XSpecifies that all GOTO n clauses are right adjusted to column 72.
  377. X
  378. X.IP \fB\-s\ start,[step]\fR 12
  379. XSpecify that all labelled statements be re-numbered, starting at
  380. X.I start
  381. Xand stepping by
  382. X.I step.
  383. XThe default value for
  384. X.I step
  385. Xis 10.
  386. X
  387. X.IP \fB\-r\ start,[step]\fR 12
  388. XSpecify that all FORMAT statements be re-numbered, starting at
  389. X.I start
  390. Xand stepping by
  391. X.I step.
  392. XThe default value for
  393. X.I step
  394. Xis 10.
  395. X
  396. X.IP \fB\-n\ new fortran\fR 12
  397. XCauses the new Fortran file to be called
  398. X.I new fortran.
  399. XIf this option is not given, then the new Fortran file
  400. Xwill have the name of the source Fortran, appended by
  401. X.I .out
  402. X
  403. X.IP \fB\-t\ Flow file\fR 12
  404. XThe
  405. X.I Flow
  406. Xoption specifies that a binary file be written out that
  407. Xmay afterwards be processed by the Flow program.
  408. X
  409. X.SH CODING CONVENTION LIST
  410. X
  411. XThe full list of rules is as follows:
  412. X.br
  413. X.(l
  414. X*  1   Avoid comment lines after end of module
  415. X.br
  416. X*  2   End all program modules with the END statement
  417. X.br
  418. X*  3   Declared COMMON blocks must be used in the module
  419. X.br
  420. X*  4   COMPLEX and DOUBLEPRECISION vars at end of COMMON
  421. X.br
  422. X*  5   COMMON block definitions should not change
  423. X.br
  424. X*  6   Variable names should be 6 or fewer characters long
  425. X.br
  426. X   7   Variables in COMMON should be 6 characters long
  427. X.br
  428. X   8   Variables not in COMMON should be <6 characters
  429. X.br
  430. X*  9   Integer variables should begin with I to N
  431. X.br
  432. X*  10  Variable names should not equal FORTRAN keywords
  433. X.br
  434. X*  11  Avoid comment lines before module declaration
  435. X.br
  436. X*  12  Module names should not equal intrinsic functions
  437. X.br
  438. X*  13  First statement in a module should be declaration
  439. X.br
  440. X*  14  Module should begin with at least 3 comment lines
  441. X.br
  442. X   15  Comment lines should begin with a C
  443. X.br
  444. X*  16  No comment lines between continuations
  445. X.br
  446. X*  17  Avoid non-standard variable types eg INTEGER*2
  447. X.br
  448. X*  18  Avoid multiple COMMON definitions per line
  449. X.br
  450. X*  19  Do not dimension COMMON variables outside COMMON
  451. X.br
  452. X*  20  Avoid embedded blanks in variable names
  453. X.br
  454. X*  21  Avoid embedded blanks in syntactic entities
  455. X.br
  456. X*  22  Avoid the use of PRINT statements (use WRITE)
  457. X.br
  458. X   23  Do not give the END statement a label
  459. X.br
  460. X*  24  Avoid WRITE(* construction
  461. X.br
  462. X   25  Avoid WRITE statement in a FUNCTION
  463. X.br
  464. X*  26  Avoid the use of PAUSE statements
  465. X.br
  466. X*  27  Statement labels should not begin in column 1
  467. X.br
  468. X*  28  Always preceede STOP by a descriptive WRITE
  469. X.br
  470. X*  29  Avoid the use of ENTRY in FUNCTIONS
  471. X.br
  472. X*  30  Avoid using I/O in FUNCTIONs
  473. X.br
  474. X   31  Avoid the use of the alternate RETURN statement
  475. X.br
  476. X*  32  COMMON block names should not equal variable names
  477. X.br
  478. X*  33  Avoid use of obsolete CERN library routines
  479. X.br
  480. X   34  Avoid FUNCTION names the same as intrinsics
  481. X.br
  482. X*  35  Local functions should be declared EXTERNAL
  483. X.br
  484. X*  36  Module names should all be different
  485. X.br
  486. X*  37  Avoid expressions of mixed mode eg A=B/I
  487. X.br
  488. X*  38  Length of passed CHARACTER variables should be *
  489. X.br
  490. X*  39  Order of statements should conform !
  491. X.br
  492. X*  40  Separate Statement Functions by comment lines
  493. X.br
  494. X*  41  No names in Statement Function definitions elsewhere
  495. X.br
  496. X   42  Use LLT,LGT etc to compare CHARACTER vars. in IFs
  497. X.br
  498. X   43  Variables (not COMMON, not PARAMs) <6 characters
  499. X.br
  500. X*  44  Passed arguments should be dimensioned * in module
  501. X.br
  502. X.)l
  503. X
  504. X.SH SEE ALSO
  505. X.PP
  506. Xflow(l), f77(1)
  507. END_OF_FILE
  508.   if test 6212 -ne `wc -c <'floppy.l'`; then
  509.     echo shar: \"'floppy.l'\" unpacked with wrong size!
  510.   fi
  511.   # end of 'floppy.l'
  512. fi
  513. if test -f 'flow.exec' -a "${1}" != "-c" ; then 
  514.   echo shar: Will not clobber existing file \"'flow.exec'\"
  515. else
  516.   echo shar: Extracting \"'flow.exec'\" \(6065 characters\)
  517.   sed "s/^X//" >'flow.exec' <<'END_OF_FILE'
  518. X/***********************************************************************/
  519. X/* FLOW exec                                                           */
  520. X/*                                                                     */
  521. X/* JJB July 1989                                                       */
  522. X/***********************************************************************/
  523. Xaddress 'COMMAND'
  524. Xsignal on novalue
  525. Xparse source . . execname .
  526. Xoptset = "COMMON_TABLE STRUCTURE_CHART GRAPHICS NODE"
  527. Xsngset = "QUERY EXTERNALS"
  528. XLOG = 'Y'
  529. Xerr = ' '
  530. Xdo i = 1 to words(optset)
  531. X   interpret word(optset,i) " = ' '"
  532. Xend
  533. Xdo i = 1 to words(sngset)
  534. X   interpret word(sngset,i) " = 'NO'"
  535. Xend
  536. Xinteractive = "YES"
  537. Xparse upper arg input
  538. Xparse value input with filename '(' options
  539. Xif filename = "?" then do; ADDRESS CMS 'HELP 'execname; signal EXIT; end
  540. Xerr = "Fill in the blank field(s) as required."
  541. Xcursor = "0001"
  542. Xif options ^= ' ' then do
  543. X   interactive = "NO"
  544. X   nopts = words(options)
  545. X   iopt = 0 ; err = " "
  546. X   do forever
  547. X      iopt = iopt + 1 ; if iopt > nopts then leave
  548. X      if find(sngset,word(options,iopt)) ^= 0 then do
  549. X         interpret word(options,iopt)||'="YES"'
  550. X         iterate
  551. X      end
  552. X      if iopt < nopts then do
  553. X         val2 = ' ' ; val3 = ' '
  554. X         key = word(options,iopt) ; val1 = word(options,iopt+1)
  555. X         if find(optset,key) = 0 then do
  556. X            err = "Unidentified option on command line: "key
  557. X            signal EXIT
  558. X         end
  559. X         if iopt + 1 < nopts then val2 = word(options,iopt+2)
  560. X         if iopt + 2 < nopts then val3 = word(options,iopt+3)
  561. X         if find(optset,val2) ^= 0 | find(sngset,val2) ^= 0 then do
  562. X            val2 = ' ' ; val3 = ' '
  563. X         end
  564. X         if find(optset,val3) ^= 0 | find(sngset,val3)^=0 then val3 = ' '
  565. X         interpret key "= '"val1 val2 val3"'"
  566. X         iopt = iopt + words(val1 val2 val3)
  567. X         iterate
  568. X      end
  569. X      if iopt = nopts then do
  570. X         err = 'Missing value for option 'word(options,iopt)
  571. X         signal EXIT
  572. X      end
  573. X   end
  574. Xend
  575. X/****************/
  576. X/* GENERAL MODE */
  577. X/****************/
  578. Xif interactive = "NO" then signal CHECK
  579. Xif ^'QCONSOLE'('GRAPHIC') then do
  580. X   err = 'Not a full screen device'
  581. X   signal EXIT
  582. Xend
  583. XSTART:
  584. Xdo forever
  585. X   signal off error
  586. X   'IOS3270' execname 'PANEL ;PANEL1 (CLEAR 'cursor
  587. X/* signal on error    ios3270 gives codes that aren't errors...*/
  588. X   if IOSK = 'PF03' then do; err = ' '; signal EXIT; end
  589. X   if IOSK = 'PF02' then do
  590. X      say "Enter the CMS command :"
  591. X      parse pull command
  592. X      signal off error; ADDRESS CMS command; signal on error
  593. X      say "Continue with "execname" ? [CR=YES]"
  594. X      parse upper pull answer
  595. X      if abbrev(answer,"N",1) then signal EXIT
  596. X      iterate
  597. X   end
  598. X   if IOSK = 'PF01' then do
  599. X      ADDRESS CMS 'HELP 'execname
  600. X   end
  601. X   leave
  602. Xend
  603. XCHECK:
  604. Xerr = ' '
  605. Xdo i = 1 to words(optset)
  606. X   interpret "upper "word(optset,i)
  607. Xend
  608. Xdo i = 1 to words(sngset)
  609. X   interpret "upper "word(sngset,i)
  610. Xend
  611. Xintree = filename
  612. Xif words(intree) = 2 then intree = intree "*"
  613. Xif words(intree) = 1 then intree = intree "FLOPTRE *"
  614. Xif intree ^= " " then do
  615. X   if ^'FEXIST'(intree) then do
  616. X      err = "Binary file "intree" does not exist."
  617. X      cursor = "0001"
  618. X      if interactive = "YES" then signal START
  619. X      signal EXIT
  620. X   end
  621. Xend
  622. Xif words(common_table) = 2 then common_table = common_table "A"
  623. Xif words(common_table) = 1 then common_table = common_table "COMMONS A"
  624. Xif words(structure_chart) = 2 then structure_chart = structure_chart "A"
  625. Xif words(structure_chart) = 1 then structure_chart = structure_chart "CHART A"
  626. Xif words(graphics) = 2 then graphics = graphics "A"
  627. Xif words(graphics) = 1 then do
  628. X   graphics = graphics "LISTPS A"
  629. Xend
  630. Xif node ^= ' ' & graphics = ' ' & structure_chart = ' ' then do
  631. X   err = "You must specify a file name for either graphics or text."
  632. X   cursor = "0004"
  633. X   if interactive = "YES" then signal START
  634. X   signal EXIT
  635. Xend
  636. Xif graphics = ' ' & query = 'NO' & structure_chart = ' ',
  637. X   & common_table = ' ' then do
  638. X   err = "There is nothing for FLOW to do !"
  639. X   cursor = "0001"
  640. X   if interactive = "YES" then signal START
  641. X   signal EXIT
  642. Xend
  643. X'CLRSCRN'
  644. X/* Now assign the FILEDEFs */
  645. X'MAKEBUF'
  646. Xbufno = rc
  647. X'SENTRIES'
  648. Xentries = rc
  649. X'QFILEDEF ( STACK'
  650. Xpull dummy
  651. Xnum_fdefs = 0
  652. Xdo queued()-entries
  653. X   num_fdefs = num_fdefs + 1
  654. X   pull fdef.num_fdefs
  655. Xend
  656. X'DROPBUF 'bufno
  657. Xcontrol = ' '
  658. Xsay "FLOW: Input binary file "intree
  659. X'FILEDEF 50 DISK 'intree' (LRECL 8000 RECFM VS'
  660. Xif common_table ^= " " then do
  661. X   say "      COMMON block usage table "common_table
  662. X   'FILEDEF 60 DISK 'common_table' (LRECL 132 RECFM F'
  663. X   control = control||' common'
  664. Xend
  665. Xif structure_chart ^= " " then do
  666. X   say "      Text version of chart will be "structure_chart
  667. X   'FILEDEF 61 DISK 'structure_chart' (LRECL 132 RECFM F'
  668. X   control = control||' chart'
  669. Xend
  670. Xif graphics ^= ' ' then do
  671. X   say "      Graphics version of chart will be "graphics
  672. X   'FILEDEF 96 DISK 'graphics' (LRECL 80 RECFM F'
  673. X   control = control||' graphics'
  674. Xend
  675. Xif externals ^= 'NO' then do
  676. X   say "      External routine names will be displayed"
  677. X   control = control||' externals'
  678. Xend
  679. Xif query ^= 'NO' then do
  680. X   say "      You will explore the tree interactively"
  681. X   control = control||' query'
  682. Xend
  683. Xif node ^= ' ' then,
  684. X   say "      The tree will start at node "node
  685. Xelse node = '$$$$'
  686. Xcontrol = control||' node '||node
  687. Xif 'FEXIST'('FLOW$TMP CONTROL A') then 'ERASE FLOW$TMP CONTROL A'
  688. X'EXECIO 1 DISKW FLOW$TMP CONTROL A 1 F (FINIS STRING 'control
  689. X'FILEDEF 1 DISK FLOW$TMP CONTROL A '
  690. Xsay 'FLOW begins .... '
  691. X'LOAD CMSFLOW (CLEAR START'
  692. X'ERASE FLOW$TMP CONTROL A'
  693. X'FILEDEF 1 CLEAR'
  694. X'FILEDEF 50 CLEAR'
  695. Xif graphics ^= ' ' then 'FILEDEF 96 CLEAR'
  696. Xif common_table ^= ' ' then 'FILEDEF 60 CLEAR'
  697. Xif structure_chart ^= ' ' then 'FILEDEF 61 CLEAR'
  698. X/* Reinstate original FILEDEFs */
  699. Xdo i = 1 to num_fdefs
  700. X   fdef.i
  701. Xend
  702. Xsay 'FLOW has finished'
  703. Xcall EXIT
  704. XNOVALUE:
  705. Xsay 'Uninitialised variable encountered on line' sigl
  706. Xcall EXIT
  707. XERROR:
  708. Xsay 'Error on line' sigl
  709. Xcall EXIT
  710. XEXIT:
  711. Xif err ^= " " then say execname ": " err
  712. Xexit
  713. END_OF_FILE
  714.   if test 6065 -ne `wc -c <'flow.exec'`; then
  715.     echo shar: \"'flow.exec'\" unpacked with wrong size!
  716.   fi
  717.   # end of 'flow.exec'
  718. fi
  719. if test -f 'flowflow.ps' -a "${1}" != "-c" ; then 
  720.   echo shar: Will not clobber existing file \"'flowflow.ps'\"
  721. else
  722.   echo shar: Extracting \"'flowflow.ps'\" \(9117 characters\)
  723.   sed "s/^X//" >'flowflow.ps' <<'END_OF_FILE'
  724. X%! PostScript output from FLOW
  725. X/inch { 72 mul } def
  726. X /xrel {    30.28572     div inch } def
  727. X /yrel {    30.28572     div inch } def
  728. X /Helvetica-Bold findfont 14 scalefont setfont
  729. X3.2 inch 7.7 inch moveto
  730. X(Flow for node FLOW) show
  731. X.1 inch setlinewidth
  732. X0.5 inch 0.5 inch moveto
  733. X7.5 inch 0.5 inch lineto
  734. X7.5 inch 7.5 inch lineto
  735. X0.5 inch 7.5 inch lineto
  736. Xclosepath
  737. Xstroke
  738. X0.5 inch 0.5 inch translate
  739. X.01 inch setlinewidth
  740. X /Helvetica-Bold findfont 8 scalefont setfont
  741. X   2.500000     xrel    2.500000     yrel moveto
  742. X   209.5000     xrel    2.500000     yrel lineto
  743. X   209.5000     xrel    209.5000     yrel lineto
  744. X   2.500000     xrel    209.5000     yrel lineto
  745. X closepath
  746. X stroke
  747. X   97.00000     xrel    180.7143     yrel moveto
  748. X   115.0000     xrel    180.7143     yrel lineto
  749. X   115.0000     xrel    187.7143     yrel lineto
  750. X   97.00000     xrel    187.7143     yrel lineto
  751. X closepath
  752. X stroke
  753. X   97.72000 xrel  184.21428 yrel moveto
  754. X (FLOW) show
  755. X   97.00000     xrel    149.4286     yrel moveto
  756. X   115.0000     xrel    149.4286     yrel lineto
  757. X   115.0000     xrel    156.4286     yrel lineto
  758. X   97.00000     xrel    156.4286     yrel lineto
  759. X closepath
  760. X stroke
  761. X   97.72000 xrel  152.92857 yrel moveto
  762. X (PRODES) show
  763. X   28.00000     xrel    118.1429     yrel moveto
  764. X   46.00000     xrel    118.1429     yrel lineto
  765. X   46.00000     xrel    125.1429     yrel lineto
  766. X   28.00000     xrel    125.1429     yrel lineto
  767. X closepath
  768. X stroke
  769. X   28.72000 xrel  121.64285 yrel moveto
  770. X (PROTRE) show
  771. X   51.00000     xrel    118.1429     yrel moveto
  772. X   69.00000     xrel    118.1429     yrel lineto
  773. X   69.00000     xrel    125.1429     yrel lineto
  774. X   51.00000     xrel    125.1429     yrel lineto
  775. X closepath
  776. X stroke
  777. X   51.72000 xrel  121.64285 yrel moveto
  778. X (PROCOM) show
  779. X   74.00000     xrel    118.1429     yrel moveto
  780. X   92.00000     xrel    118.1429     yrel lineto
  781. X   92.00000     xrel    125.1429     yrel lineto
  782. X   74.00000     xrel    125.1429     yrel lineto
  783. X closepath
  784. X stroke
  785. X   74.72000 xrel  121.64285 yrel moveto
  786. X (INIARR) show
  787. X   97.00000     xrel    118.1429     yrel moveto
  788. X   115.0000     xrel    118.1429     yrel lineto
  789. X   115.0000     xrel    125.1429     yrel lineto
  790. X   97.00000     xrel    125.1429     yrel lineto
  791. X closepath
  792. X stroke
  793. X   97.72000 xrel  121.64285 yrel moveto
  794. X (EXTERN) show
  795. X   120.0000     xrel    118.1429     yrel moveto
  796. X   138.0000     xrel    118.1429     yrel lineto
  797. X   138.0000     xrel    125.1429     yrel lineto
  798. X   120.0000     xrel    125.1429     yrel lineto
  799. X closepath
  800. X stroke
  801. X  120.72000 xrel  121.64285 yrel moveto
  802. X (PROCHT) show
  803. X   143.0000     xrel    118.1429     yrel moveto
  804. X   161.0000     xrel    118.1429     yrel lineto
  805. X   161.0000     xrel    125.1429     yrel lineto
  806. X   143.0000     xrel    125.1429     yrel lineto
  807. X closepath
  808. X stroke
  809. X  143.72000 xrel  121.64285 yrel moveto
  810. X (PROQRY) show
  811. X   28.00000     xrel    86.85714     yrel moveto
  812. X   46.00000     xrel    86.85714     yrel lineto
  813. X   46.00000     xrel    93.85714     yrel lineto
  814. X   28.00000     xrel    93.85714     yrel lineto
  815. X closepath
  816. X stroke
  817. X   28.72000 xrel   90.35714 yrel moveto
  818. X (GRCLOSE) show
  819. X   51.00000     xrel    86.85714     yrel moveto
  820. X   69.00000     xrel    86.85714     yrel lineto
  821. X   69.00000     xrel    93.85714     yrel lineto
  822. X   51.00000     xrel    93.85714     yrel lineto
  823. X closepath
  824. X stroke
  825. X   51.72000 xrel   90.35714 yrel moveto
  826. X (RDFLOP) show
  827. X   74.00000     xrel    86.85714     yrel moveto
  828. X   92.00000     xrel    86.85714     yrel lineto
  829. X   92.00000     xrel    93.85714     yrel lineto
  830. X   74.00000     xrel    93.85714     yrel lineto
  831. X closepath
  832. X stroke
  833. X   74.72000 xrel   90.35714 yrel moveto
  834. X (CHTBOX) show
  835. X   97.00000     xrel    86.85714     yrel moveto
  836. X   115.0000     xrel    86.85714     yrel lineto
  837. X   115.0000     xrel    93.85714     yrel lineto
  838. X   97.00000     xrel    93.85714     yrel lineto
  839. X closepath
  840. X stroke
  841. X   97.72000 xrel   90.35714 yrel moveto
  842. X (CASCHG) show
  843. X   120.0000     xrel    86.85714     yrel moveto
  844. X   138.0000     xrel    86.85714     yrel lineto
  845. X   138.0000     xrel    93.85714     yrel lineto
  846. X   120.0000     xrel    93.85714     yrel lineto
  847. X closepath
  848. X stroke
  849. X  120.72000 xrel   90.35714 yrel moveto
  850. X (CHTLIN) show
  851. X   143.0000     xrel    86.85714     yrel moveto
  852. X   161.0000     xrel    86.85714     yrel lineto
  853. X   161.0000     xrel    93.85714     yrel lineto
  854. X   143.0000     xrel    93.85714     yrel lineto
  855. X closepath
  856. X stroke
  857. X  143.72000 xrel   90.35714 yrel moveto
  858. X (GRINIT) show
  859. X   166.0000     xrel    86.85714     yrel moveto
  860. X   184.0000     xrel    86.85714     yrel lineto
  861. X   184.0000     xrel    93.85714     yrel lineto
  862. X   166.0000     xrel    93.85714     yrel lineto
  863. X closepath
  864. X stroke
  865. X  166.72000 xrel   90.35714 yrel moveto
  866. X (GTX) show
  867. X   97.00000     xrel    55.57143     yrel moveto
  868. X   115.0000     xrel    55.57143     yrel lineto
  869. X   115.0000     xrel    62.57143     yrel lineto
  870. X   97.00000     xrel    62.57143     yrel lineto
  871. X closepath
  872. X stroke
  873. X   97.72000 xrel   59.07143 yrel moveto
  874. X (TABENT) show
  875. X   51.00000     xrel    24.28571     yrel moveto
  876. X   69.00000     xrel    24.28571     yrel lineto
  877. X   69.00000     xrel    31.28571     yrel lineto
  878. X   51.00000     xrel    31.28571     yrel lineto
  879. X closepath
  880. X stroke
  881. X   51.72000 xrel   27.78571 yrel moveto
  882. X (SEARCH) show
  883. X   74.00000     xrel    24.28571     yrel moveto
  884. X   92.00000     xrel    24.28571     yrel lineto
  885. X   92.00000     xrel    31.28571     yrel lineto
  886. X   74.00000     xrel    31.28571     yrel lineto
  887. X closepath
  888. X stroke
  889. X   74.72000 xrel   27.78571 yrel moveto
  890. X (LENOCC) show
  891. X  106.00000 xrel  180.71428 yrel moveto
  892. X  106.00000 xrel  156.42857 yrel lineto
  893. X closepath
  894. X stroke
  895. X   99.38356 xrel  149.42857 yrel moveto
  896. X   89.61644 xrel  125.14285 yrel lineto
  897. X closepath
  898. X stroke
  899. X   99.38356 xrel  149.42857 yrel moveto
  900. X   66.61644 xrel   93.85714 yrel lineto
  901. X closepath
  902. X stroke
  903. X  106.00000 xrel  149.42857 yrel moveto
  904. X  106.00000 xrel  125.14285 yrel lineto
  905. X closepath
  906. X stroke
  907. X   97.00000 xrel  151.34161 yrel moveto
  908. X   46.00000 xrel  123.22981 yrel lineto
  909. X closepath
  910. X stroke
  911. X  112.61644 xrel  149.42857 yrel moveto
  912. X  122.38356 xrel  125.14285 yrel lineto
  913. X closepath
  914. X stroke
  915. X   97.00000 xrel  150.54814 yrel moveto
  916. X   69.00000 xrel  124.02328 yrel lineto
  917. X closepath
  918. X stroke
  919. X  115.00000 xrel  150.54814 yrel moveto
  920. X  143.00000 xrel  124.02328 yrel lineto
  921. X closepath
  922. X stroke
  923. X   39.20548 xrel  118.14285 yrel moveto
  924. X   57.79452 xrel   31.28571 yrel lineto
  925. X closepath
  926. X stroke
  927. X   41.41096 xrel  118.14285 yrel moveto
  928. X   78.58904 xrel   31.28571 yrel lineto
  929. X closepath
  930. X stroke
  931. X   41.41096 xrel  118.14285 yrel moveto
  932. X   78.58904 xrel   31.28571 yrel lineto
  933. X closepath
  934. X stroke
  935. X   41.41096 xrel  118.14285 yrel moveto
  936. X   78.58904 xrel   31.28571 yrel lineto
  937. X closepath
  938. X stroke
  939. X   41.41096 xrel  118.14285 yrel moveto
  940. X   78.58904 xrel   31.28571 yrel lineto
  941. X closepath
  942. X stroke
  943. X   41.41096 xrel  118.14285 yrel moveto
  944. X   78.58904 xrel   31.28571 yrel lineto
  945. X closepath
  946. X stroke
  947. X   62.20548 xrel  118.14285 yrel moveto
  948. X   80.79452 xrel   31.28571 yrel lineto
  949. X closepath
  950. X stroke
  951. X   62.20548 xrel  118.14285 yrel moveto
  952. X   80.79452 xrel   31.28571 yrel lineto
  953. X closepath
  954. X stroke
  955. X   97.00000 xrel  119.26242 yrel moveto
  956. X   69.00000 xrel   92.73757 yrel lineto
  957. X closepath
  958. X stroke
  959. X  122.38356 xrel  118.14285 yrel moveto
  960. X   66.61644 xrel   31.28571 yrel lineto
  961. X closepath
  962. X stroke
  963. X  135.61644 xrel  118.14285 yrel moveto
  964. X  145.38356 xrel   93.85714 yrel lineto
  965. X closepath
  966. X stroke
  967. X  120.00000 xrel  119.26242 yrel moveto
  968. X   92.00000 xrel   92.73757 yrel lineto
  969. X closepath
  970. X stroke
  971. X  122.38356 xrel  118.14285 yrel moveto
  972. X   66.61644 xrel   31.28571 yrel lineto
  973. X closepath
  974. X stroke
  975. X  120.00000 xrel  119.26242 yrel moveto
  976. X   92.00000 xrel   92.73757 yrel lineto
  977. X closepath
  978. X stroke
  979. X  138.00000 xrel  119.26242 yrel moveto
  980. X  166.00000 xrel   92.73757 yrel lineto
  981. X closepath
  982. X stroke
  983. X  122.38356 xrel  118.14285 yrel moveto
  984. X   66.61644 xrel   31.28571 yrel lineto
  985. X closepath
  986. X stroke
  987. X  129.00000 xrel  118.14285 yrel moveto
  988. X  129.00000 xrel   93.85714 yrel lineto
  989. X closepath
  990. X stroke
  991. X  120.00000 xrel  120.45264 yrel moveto
  992. X   46.00000 xrel   91.54736 yrel lineto
  993. X closepath
  994. X stroke
  995. X  143.00000 xrel  119.26242 yrel moveto
  996. X  115.00000 xrel   92.73757 yrel lineto
  997. X closepath
  998. X stroke
  999. X  143.17809 xrel  118.14285 yrel moveto
  1000. X   68.82191 xrel   31.28571 yrel lineto
  1001. X closepath
  1002. X stroke
  1003. X  143.00000 xrel  119.26242 yrel moveto
  1004. X  115.00000 xrel   92.73757 yrel lineto
  1005. X closepath
  1006. X stroke
  1007. X   43.61644 xrel   86.85714 yrel moveto
  1008. X   76.38356 xrel   31.28571 yrel lineto
  1009. X closepath
  1010. X stroke
  1011. X   69.00000 xrel   87.97671 yrel moveto
  1012. X   97.00000 xrel   61.45186 yrel lineto
  1013. X closepath
  1014. X stroke
  1015. X  102.69178 xrel   86.85714 yrel moveto
  1016. X   86.30822 xrel   31.28571 yrel lineto
  1017. X closepath
  1018. X stroke
  1019. X  143.00000 xrel   87.18323 yrel moveto
  1020. X   92.00000 xrel   30.95962 yrel lineto
  1021. X closepath
  1022. X stroke
  1023. X  166.00000 xrel   87.97671 yrel moveto
  1024. X   92.00000 xrel   30.16614 yrel lineto
  1025. X closepath
  1026. X stroke
  1027. X   99.38356 xrel   55.57143 yrel moveto
  1028. X   89.61644 xrel   31.28571 yrel lineto
  1029. X closepath
  1030. X stroke
  1031. X   97.00000 xrel   56.69099 yrel moveto
  1032. X   69.00000 xrel   30.16614 yrel lineto
  1033. X closepath
  1034. X stroke
  1035. Xshowpage grestore
  1036. END_OF_FILE
  1037.   if test 9117 -ne `wc -c <'flowflow.ps'`; then
  1038.     echo shar: \"'flowflow.ps'\" unpacked with wrong size!
  1039.   fi
  1040.   # end of 'flowflow.ps'
  1041. fi
  1042. if test -f 'procht.for' -a "${1}" != "-c" ; then 
  1043.   echo shar: Will not clobber existing file \"'procht.for'\"
  1044. else
  1045.   echo shar: Extracting \"'procht.for'\" \(7576 characters\)
  1046.   sed "s/^X//" >'procht.for' <<'END_OF_FILE'
  1047. X      SUBROUTINE PROCHT
  1048. XC! Produce the graphics SC
  1049. X      INCLUDE 'params.h'
  1050. X      INCLUDE 'jobcom.h'
  1051. X      INCLUDE 'lunits.h'
  1052. X      INCLUDE 'trecom.h'
  1053. X      INCLUDE 'tables.h'
  1054. X      INCLUDE 'hashnm.h'
  1055. X      INTEGER SEARCH
  1056. X      EXTERNAL SEARCH
  1057. X      LOGICAL OK
  1058. XC
  1059. XC
  1060. X      WRITE(LOUT,'(A)') ' '
  1061. X      WRITE(LOUT,'(A)') ' PROCHT Begins ....'
  1062. X      WRITE(LOUT,'(A)') ' '
  1063. XC
  1064. XC check for first procedure unknown
  1065. XC
  1066. X      IF(CTREE.EQ.'$$$$') THEN
  1067. X        MXCALL = 0
  1068. XC
  1069. XC find all top-level procedures. Select one with max calls
  1070. XC
  1071. X        DO 700 IP=1,NPROC
  1072. X          IF(PROCED_NCALLEDBY(IP).GT.0) GOTO 700
  1073. X          WRITE(LOUT,'(A)') ' Procedure '//PROCED_NAME(IP)//
  1074. X     &                      ' is a top-level node (no callers)'
  1075. X          IF(PROCED_NCALLS(IP).LE.MXCALL) GOTO 700   
  1076. X          MXCALL = PROCED_NCALLS(IP)
  1077. X          CTREE = PROCED_NAME(IP)
  1078. X  700   CONTINUE
  1079. X        WRITE(LOUT,'(/,A,I3,A)') ' Procedure '//CTREE//
  1080. X     &      'selected with the ',MXCALL,' procedures it calls ...'
  1081. X      ENDIF
  1082. XC
  1083. X      IF(.NOT.LEXT) WRITE(LOUT,551)
  1084. X  551 FORMAT(' EXTERNAL procedure names will not appear ',/)
  1085. XC
  1086. X      CNAM = CTREE
  1087. XC
  1088. XC find top node program
  1089. XC
  1090. X      IPNAM = SEARCH(CNAM)
  1091. X      IF(IPNAM.EQ.0) GOTO 900
  1092. X      IF(PROCED_NCALLS(IPNAM).EQ.0) GOTO 950
  1093. XC
  1094. XC initialise all places in the chart
  1095. XC
  1096. X      DO 1 I=0,NXPOS
  1097. X        DO 2 J=1,NYPOS
  1098. X          CPLACE(I,J)(:MXNAM) = ' '
  1099. X          CPLACE(-I,J) = CPLACE(I,J)
  1100. X    2   CONTINUE
  1101. X    1 CONTINUE
  1102. XC
  1103. X      MXLEV = 1
  1104. X      NLEFT = 1
  1105. X      INEXT(1) = IPNAM
  1106. X      NUMBER(ILEV) = 0
  1107. X      PROCED_LEVEL(IPNAM) = 1
  1108. XC
  1109. XC Assign levels to all procedures
  1110. XC
  1111. X   10 CONTINUE
  1112. X      IF(NLEFT.LE.0) GOTO 20
  1113. XC
  1114. XC Take the last in the list
  1115. XC
  1116. X      IPNAM = INEXT(NLEFT)
  1117. X      NLEFT = NLEFT - 1
  1118. X      ILEV = PROCED_LEVEL(IPNAM)     
  1119. X      DO 11 IC=1,PROCED_NCALLS(IPNAM)
  1120. X         IPNAM2 = PROCED_CALLS(IPNAM,IC)
  1121. X         IF(.NOT.LEXT.AND.PROCED_EXTERN(IPNAM2)) GOTO 11
  1122. X         IF(PROCED_LEVEL(IPNAM2).LE.ILEV) THEN
  1123. X            PROCED_LEVEL(IPNAM2) = ILEV + 1
  1124. X            IEXT = 0
  1125. X            IF(PROCED_EXTERN(IPNAM2)) IEXT=1
  1126. X            IF(PROCED_LEVEL(IPNAM2).GT.MXLEV) THEN
  1127. X               IF((IEXT.EQ.1.AND.LEXT).OR.IEXT.EQ.0) THEN
  1128. X                 MXLEV = PROCED_LEVEL(IPNAM2)
  1129. X               ENDIF
  1130. X            ENDIF
  1131. XC
  1132. XC before adding to list, check not already there ....
  1133. XC
  1134. X            DO 12 IL=1,NLEFT
  1135. X               IF(INEXT(IL).EQ.IPNAM2) GOTO 11
  1136. X   12       CONTINUE
  1137. X            IF(NLEFT.GE.MXLFT) GOTO 960
  1138. X            NLEFT = NLEFT + 1
  1139. X            INEXT(NLEFT) = IPNAM2
  1140. X         ENDIF
  1141. X   11 CONTINUE
  1142. X      GOTO 10            
  1143. XC
  1144. XC Start to allocate positions in the chart
  1145. XC The chart has NUMMAX x positions, and MXLEV y positions
  1146. XC
  1147. X   20 CONTINUE
  1148. X      NUMMAX = 0
  1149. X      DO 4 I=1,NYPOS
  1150. X        NUMBER(I) = 0
  1151. X    4 CONTINUE
  1152. X      DO 23 I=1,NPROC
  1153. X        IF(PROCED_LEVEL(I).LE.1) GOTO 23
  1154. X        IF(.NOT.LEXT.AND.PROCED_EXTERN(I)) GOTO 23
  1155. X        N = NUMBER(PROCED_LEVEL(I))+1
  1156. X        NUMBER(PROCED_LEVEL(I)) = N
  1157. X        IF (N.GT.NUMMAX) NUMMAX = N
  1158. X   23 CONTINUE
  1159. X      ITREE = SEARCH(CTREE)
  1160. X      DO 28 I=1,NPROC
  1161. X        PROCED_DONE(I) = .FALSE.
  1162. X   28 CONTINUE
  1163. X      NSTEP = NINT(REAL(NUMMAX+1)*0.5)
  1164. X      IF(NSTEP.GT.NXPOS) GOTO 930
  1165. X      DO 25 I=1,NPROC
  1166. X        IF(PROCED_LEVEL(I).LE.1.AND.I.NE.ITREE) GOTO 25
  1167. X        IF(PROCED_DONE(I)) GOTO 25
  1168. X        IF(.NOT.LEXT.AND.PROCED_EXTERN(I)) GOTO 25
  1169. X        ILEV = PROCED_LEVEL(I)
  1170. X        DO 26 IXP = 0,NSTEP
  1171. X          IF(CPLACE(-IXP,ILEV)(:1).EQ.' ') THEN
  1172. X            CPLACE(-IXP,ILEV) = PROCED_NAME(I)
  1173. X            IXPOS(I) = -IXP
  1174. X            PROCED_DONE(I) = .TRUE.
  1175. X            GOTO 27
  1176. X          ENDIF
  1177. X          IF(CPLACE(IXP,ILEV)(:1).EQ.' ') THEN
  1178. X            CPLACE(IXP,ILEV) = PROCED_NAME(I)
  1179. X            IXPOS(I) = IXP
  1180. X            PROCED_DONE(I) = .TRUE.
  1181. X            GOTO 27
  1182. X          ENDIF
  1183. X   26   CONTINUE
  1184. X   27   CONTINUE
  1185. X        IF(.NOT.PROCED_DONE(I)) GOTO 940
  1186. X        IF(PROCED_NCALLS(I).EQ.0) GOTO 25
  1187. X        IXPOSI = IXPOS(I)
  1188. X        DO 35 ICALLED = 1,PROCED_NCALLS(I)
  1189. X          IOTHER = PROCED_CALLS(I,ICALLED)
  1190. X          IF(PROCED_DONE(IOTHER)) GOTO 35
  1191. X          IF(.NOT.LEXT.AND.PROCED_EXTERN(IOTHER)) GOTO 35
  1192. X          ILEVO = PROCED_LEVEL(IOTHER)
  1193. X          ISTART = MAX(-NSTEP,IXPOSI - ILEVO + ILEV + 1)
  1194. X          DO 36 IPOS=ISTART,-NSTEP,-1
  1195. X            IF(CPLACE(IPOS,ILEVO)(:1).EQ.' ') THEN
  1196. X              PROCED_DONE(IOTHER) = .TRUE.
  1197. X              CPLACE(IPOS,ILEVO) = PROCED_NAME(IOTHER)
  1198. X              IXPOS(IOTHER) = IPOS
  1199. X              GOTO 35
  1200. X            ENDIF
  1201. X   36     CONTINUE
  1202. X          DO 37 IPOS=ISTART,NSTEP
  1203. X            IF(CPLACE(IPOS,ILEVO)(:1).EQ.' ') THEN
  1204. X              PROCED_DONE(IOTHER) = .TRUE.
  1205. X              CPLACE(IPOS,ILEVO) = PROCED_NAME(IOTHER)
  1206. X              IXPOS(IOTHER) = IPOS
  1207. X              GOTO 35
  1208. X            ENDIF
  1209. X   37     CONTINUE
  1210. X   35   CONTINUE
  1211. X   25 CONTINUE
  1212. XC
  1213. XC This is the end of the simple cut at chart positioning
  1214. XC
  1215. XC
  1216. XC Write a text representation of the chart as an indication only
  1217. XC
  1218. X      WRITE(LOUT,'(A)') ' The chart will look roughly like this ...'
  1219. X      WRITE(LOUT,501)
  1220. X      DO 41 IL=1,MXLEV
  1221. X         WRITE(LOUT,*) (CPLACE(IS,IL),IS=-NSTEP,NSTEP)
  1222. X   41 CONTINUE
  1223. X      WRITE(LOUT,501)
  1224. X  501 FORMAT(1X,79('-'))
  1225. XC
  1226. XC begin calculating the sizes of objects for the plot
  1227. XC
  1228. X      WRITE(LOUT,'(A)') ' PROCHT : START CREATING PLOT'
  1229. X      BOXX = 18.
  1230. X      BOXY = 7.
  1231. X      GAPX = 5.
  1232. X      GAPY = 12.
  1233. X      SIZEX = (NUMMAX+2)*BOXX + (NUMMAX+3)*GAPX
  1234. X      SIZEY = MXLEV*BOXY + (MXLEV+1)*GAPY
  1235. X      SIZEX = MAX(SIZEX,SIZEY)
  1236. X      SIZEY = SIZEX
  1237. X      GAPY = MAX(GAPY,(SIZEY-MXLEV*BOXY)/(MXLEV+1))
  1238. X      GAP = MIN(GAPX,GAPY)
  1239. XC
  1240. XC Initialise GRAPHICS
  1241. XC
  1242. X      CALL GRINIT(SIZEX,SIZEY,CTREE)
  1243. XC
  1244. XC Draw inner box around area
  1245. XC
  1246. X      CALL CHTBOX(GAP*0.5,GAP*0.5,SIZEX-GAP*0.5,SIZEY-GAP*0.5)
  1247. XC
  1248. XC Start looping over all modules to plot their positions
  1249. XC
  1250. X      DO 29 J=1,MXLEV
  1251. X        DO 31 I=-NSTEP,NSTEP
  1252. X          IF(CPLACE(I,J)(:1).EQ.' ') GOTO 31
  1253. X          IP = NSTEP+I
  1254. X          XLOW = GAPX + IP*(BOXX+GAPX)
  1255. X          YLOW = SIZEY - J*(GAPY+BOXY)
  1256. X          INUM = SEARCH(CPLACE(I,J))
  1257. X          IF(INUM.EQ.0) GOTO 31
  1258. X          XBOX(INUM) = XLOW+BOXX*0.5
  1259. X          YBOX(INUM) = YLOW+BOXY*0.5
  1260. X          CALL CHTBOX(XLOW,YLOW,XLOW+BOXX,YLOW+BOXY)
  1261. X          CALL GTX(XLOW+BOXX/25.,YLOW+BOXY*0.5,CPLACE(I,J))
  1262. X   31   CONTINUE
  1263. X   29 CONTINUE
  1264. XC
  1265. XC Now loop over all modules to plot their connections
  1266. XC
  1267. X      DO 32 J=1,MXLEV-1
  1268. X         DO 33 I=-NSTEP,NSTEP
  1269. X            IF(CPLACE(I,J)(:1).EQ.' ') GOTO 33
  1270. X            IPNAM = SEARCH(CPLACE(I,J))
  1271. X            IF(PROCED_NCALLS(IPNAM).EQ.0) GOTO 33
  1272. X            X1 = XBOX(IPNAM)
  1273. X            Y1 = YBOX(IPNAM)
  1274. X            DO 34 IC=1,PROCED_NCALLS(IPNAM)
  1275. X               IPNAM2 = PROCED_CALLS(IPNAM,IC)
  1276. X               IF(.NOT.LEXT.AND.PROCED_EXTERN(IPNAM2)) GOTO 34
  1277. X               CALL CHTLIN(X1,Y1,XBOX(IPNAM2),YBOX(IPNAM2),
  1278. X     &                     BOXX,BOXY)
  1279. X   34       CONTINUE
  1280. X   33    CONTINUE
  1281. X   32 CONTINUE
  1282. XC
  1283. XC Close the graphics package
  1284. XC
  1285. X      CALL GRCLOSE
  1286. XC
  1287. XC
  1288. XC finished all trees. home to beddy-bies
  1289. XC
  1290. X      WRITE(LOUT,'(A)') ' PROCHT Finished'
  1291. X      GOTO 999
  1292. XC
  1293. X  900 WRITE(LOUT,901) CNAM
  1294. X  901 FORMAT(1X,'PROCHT : TOPNODE ',A,' NOT FOUND IN PROCEDURE TABLE')
  1295. X      GOTO 999
  1296. X  930 WRITE(LOUT,931) 
  1297. X  931 FORMAT(1X,'PROCHT : NOT ENOUGH SPACE ON THE GRAPH')
  1298. X      GOTO 999
  1299. X  940 WRITE(LOUT,941) PROCED_NAME(I)
  1300. X  941 FORMAT(1X,'PROCHT : NO SPACE FOR ROUTINE ',A)
  1301. X      GOTO 999
  1302. X  950 WRITE(LOUT,951) CNAM
  1303. X  951 FORMAT(1X,'PROCHT : ROUTINE ',A,' CALLS NO OTHER ROUTINES!')
  1304. X      GOTO 999
  1305. X  960 WRITE(LOUT,961) MXLFT
  1306. X  961 FORMAT(1X,'PROCHT : ',I5,' STACK OVERFLOW; TREE TOO COMPLICATED!')
  1307. XC      
  1308. X  999 CONTINUE
  1309. X      END
  1310. END_OF_FILE
  1311.   if test 7576 -ne `wc -c <'procht.for'`; then
  1312.     echo shar: \"'procht.for'\" unpacked with wrong size!
  1313.   fi
  1314.   # end of 'procht.for'
  1315. fi
  1316. if test -f 'protre.for' -a "${1}" != "-c" ; then 
  1317.   echo shar: Will not clobber existing file \"'protre.for'\"
  1318. else
  1319.   echo shar: Extracting \"'protre.for'\" \(7771 characters\)
  1320.   sed "s/^X//" >'protre.for' <<'END_OF_FILE'
  1321. X      SUBROUTINE PROTRE
  1322. XC! Produce the FLOW diagram
  1323. X      INCLUDE 'params.h'
  1324. X      INCLUDE 'tables.h'
  1325. X      INCLUDE 'lunits.h'
  1326. X      INCLUDE 'trecom.h'
  1327. X      INCLUDE 'ignore.h'
  1328. XC
  1329. X      CHARACTER*(MXCHR) CLINE,CTITL(MTITL),CLINO
  1330. X      CHARACTER*(MXNAM) CNAM,CNAM2,CNAME(MLEV,MNLEV)
  1331. X      CHARACTER*(LCDOIF) CDF,CDOIF(MLEV,MNLEV)
  1332. X      CHARACTER*1 CHAR
  1333. X      CHARACTER*(MXLIN) CFORM
  1334. X      INTEGER NDONE(MLEV),NMAX(MLEV),SEARCH
  1335. X      EXTERNAL SEARCH
  1336. X      LOGICAL OK
  1337. XC
  1338. XC statement function iposl
  1339. X      IPOSL(IL) = (MXOFF+NDIS)*(IL-1) + 1
  1340. XC
  1341. X      WRITE(LOUT,'(A)') ' '
  1342. X      WRITE(LOUT,'(A)') ' PROTRE Begins ....'
  1343. X      WRITE(LOUT,'(A)') ' '
  1344. XC
  1345. X      DO 5 IC=1,MXCHR
  1346. X        CLINO(IC:IC) = ' '
  1347. X   5  CONTINUE
  1348. XC
  1349. XC check for first procedure unknown
  1350. XC
  1351. X      IF(CTREE.EQ.'$$$$') CTREE = PROCED_NAME(1)
  1352. X      NSUBNM = 1
  1353. X      CSUBNM(1) = CTREE
  1354. X      CDF       = ' '
  1355. XC
  1356. X      IOFF = NDIS+MXOFF/2-2
  1357. XC
  1358. X      WRITE(LOUTRE,550)
  1359. X  550 FORMAT(1X,20('*'),'              ProTre             ',20('*'),
  1360. X     &     /,1X,20(' '),'              ======             ',20(' '),
  1361. X     &   ///,1X,20(' '),' Meaning of Symbols:                     ',
  1362. X     &     /,1X,20(' '),' -------------------                     ',
  1363. X     &    //,1X,20(' '),' .   ==> terminal node in the tree       ',
  1364. X     &     /,1X,20(' '),' *   ==> external procedure              ',
  1365. X     &     /,1X,20(' '),' >   ==> subtree node, expanded below    ',
  1366. X     &     /,1X,20(' '),' +   ==> multiply called terminal node   ',
  1367. X     &     /,1X,20(' '),' ]   ==> procedure calling only externals',
  1368. X     &     /,1X,20('-'),'---------------------------------',20('-'),
  1369. X     &     /,1X,20(' '),' ?   ==> module is in IF clause',
  1370. X     &     /,1X,20(' '),' (   ==> module is in DO loop',
  1371. X     &    //,1X,20('*'),'*********************************',20('*'))
  1372. XC
  1373. X      IF(.NOT.LEXT) WRITE(LOUTRE,551)
  1374. X  551 FORMAT(//,1X,'EXTERNAL procedure names will not appear ',/)
  1375. X      IF(NIGNO.NE.0) THEN
  1376. X         WRITE(LOUTRE,'(A)')
  1377. X     &   ' --------------------------------------------------'
  1378. X         WRITE(LOUTRE,'(1X,I5,A)') NIGNO,' Module(s) will be ignored :'
  1379. X         WRITE(LOUTRE,'(1X,6A8)') (CIGNO(IG),IG=1,NIGNO)
  1380. X         WRITE(LOUTRE,'(A,/)')
  1381. X     &   ' --------------------------------------------------'
  1382. X      ENDIF
  1383. XC
  1384. X  300 CONTINUE
  1385. X      IF(NSUBNM.LE.0) GOTO 40
  1386. X      CNAM = CSUBNM(1)
  1387. XC
  1388. XC IGNORE SPECIFIED MODULES
  1389. XC
  1390. X      DO 301 IG=1,NIGNO
  1391. X         IF(CNAM.EQ.CIGNO(IG)) GOTO 30
  1392. X  301 CONTINUE
  1393. XC
  1394. X      WRITE(LOUTRE,500) CNAM
  1395. X  500 FORMAT(/,1X,'=============',
  1396. X     &       /,1X,'Node name ==> ',A,
  1397. X     &       /,1X,'=============',/)
  1398. XC
  1399. X      DO 10 J=1,MLEV
  1400. X         NDONE(J) = 0
  1401. X         NMAX(J)  = 0
  1402. X         DO 10 I=1,MNLEV
  1403. X            CNAME(J,I) = ' '
  1404. X   10 CONTINUE
  1405. XC
  1406. X      ILEV = 1
  1407. X      INAM = 1
  1408. X      CNAME(ILEV,INAM) = CNAM
  1409. X      CLINE = CLINO
  1410. XC
  1411. XC pseudo-recursive tree search
  1412. XC
  1413. X   20 CONTINUE
  1414. XC
  1415. X      IPNAM = SEARCH(CNAM)
  1416. X      IF(IPNAM.EQ.0) GOTO 910
  1417. XC
  1418. XC compose leading line
  1419. XC
  1420. X      CLINE(:MXCHR) = CLINO(:MXCHR)
  1421. X      LENID = LENOCC(CDF)
  1422. X      DO 55 IL=ILEV,2,-1
  1423. X        IBEG = IPOSL(IL) - IOFF
  1424. X        IF(IL.EQ.ILEV) THEN
  1425. X          CLINE(IBEG:IBEG) = '|'
  1426. X          DO 56 IP=IBEG+1,IBEG+IOFF
  1427. X            IPL=IP-IBEG
  1428. X            IF(IPL.GT.LENID) CHAR = '-'
  1429. X            IF(IPL.LE.LENID) THEN
  1430. X              CHAR = CDF(IPL:IPL)
  1431. X              IF(IP.EQ.IBEG+IOFF) CHAR = '+'
  1432. X            ENDIF
  1433. X            CLINE(IP:IP) = CHAR
  1434. X   56     CONTINUE
  1435. X          GOTO 55
  1436. X        ENDIF
  1437. X        IF(NDONE(IL-1).GE.NMAX(IL-1)) GOTO 55
  1438. X        CLINE(IBEG:IBEG) = '|'
  1439. X   55 CONTINUE
  1440. XC
  1441. X      IF(PROCED_NCALLS(IPNAM).EQ.0) THEN
  1442. XC stub
  1443. X         CHAR = '.'
  1444. X         IF(PROCED_NCALLEDBY(IPNAM).GE.1) CHAR = '+'
  1445. X         IF(PROCED_EXTERN(IPNAM)) CHAR = '*'
  1446. X         CFORM = CLINE(:IPOSL(ILEV))//CNAM//' '//CHAR
  1447. X         LCOM = LENOCC(PROCED_DESCRIP(IPNAM))
  1448. X         LFOR = LENOCC(CFORM)
  1449. X         IF(LFOR.LT.LPSTA) THEN
  1450. X           CFORM(LFOR+1:LPSTA) = ' '
  1451. X           CFORM(LPSTA:LPSTA+1) = ': '
  1452. X           IF(LCOM.NE.0) THEN
  1453. X             CFORM(LPSTA+2:MXLIN) = PROCED_DESCRIP(IPNAM)(:LCOM)
  1454. X           ELSE
  1455. X             CFORM(LPSTA+2:MXLIN) = ' '
  1456. X           ENDIF
  1457. X         ENDIF
  1458. X         WRITE(LOUTRE,'(1X,A)') CFORM
  1459. X         GOTO 45
  1460. X      ELSE IF(PROCED_NCALLS(IPNAM).GT.0) THEN
  1461. XC multiple call (general case)
  1462. X        IOK = 0
  1463. X        DO 73 IC=1,PROCED_NCALLS(IPNAM)
  1464. X           IF(.NOT.PROCED_EXTERN(PROCED_CALLS(IPNAM,IC))) IOK = 1
  1465. X   73   CONTINUE
  1466. X        IF(NDONE(ILEV).EQ.0) THEN
  1467. X          CHAR = ' '
  1468. X          IF(PROCED_NCALLEDBY(IPNAM).GT.1) THEN
  1469. XC
  1470. XC sub tree ... check if this pass is for expansion
  1471. XC
  1472. X            IFOUN = 0
  1473. X            IF(ILEV.EQ.1) THEN
  1474. X              CHAR = ' '
  1475. X              DO 66 IS=1,NSUBNM
  1476. X                IF(CNAM.EQ.CSUBNM(IS)) THEN
  1477. X                  LSUBNM(IS) = .TRUE.
  1478. X                  IFOUN = IS
  1479. X                ENDIF
  1480. X   66         CONTINUE
  1481. X            ELSE
  1482. X              CHAR = '>'
  1483. X            ENDIF
  1484. X          ENDIF
  1485. X          IF(IOK.EQ.0) CHAR = ']'
  1486. X          CFORM = CLINE(:IPOSL(ILEV))//CNAM//' '//CHAR
  1487. X          LCOM = LENOCC(PROCED_DESCRIP(IPNAM))
  1488. X          LFOR = LENOCC(CFORM)
  1489. X          IF(LFOR.LT.LPSTA) THEN
  1490. X             CFORM(LFOR+1:LPSTA) = ' '
  1491. X             CFORM(LPSTA:LPSTA+1) = ': '
  1492. X             IF(LCOM.GT.0) THEN
  1493. X                CFORM(LPSTA+2:MXLIN) = PROCED_DESCRIP(IPNAM)(:LCOM)
  1494. X             ELSE
  1495. X                CFORM(LPSTA+2:MXLIN) = ' '
  1496. X             ENDIF
  1497. X          ENDIF
  1498. X          WRITE(LOUTRE,'(1X,A)') CFORM
  1499. X          IF(PROCED_NCALLEDBY(IPNAM).GT.1.AND.IFOUN.EQ.0) THEN
  1500. XC
  1501. XC sub tree which will be expanded later. add to name list
  1502. XC (but only if not already there).
  1503. XC
  1504. X            DO 67 IS=1,NSUBNM
  1505. X               IF(CNAM.EQ.CSUBNM(IS)) GOTO 45
  1506. X   67       CONTINUE
  1507. X            IF(NSUBNM.GE.MSUBT) THEN
  1508. X               WRITE(LOUT,'(A,I6,A)') ' Max of ',MSUBT,
  1509. X     &                    ' sub-trees exceeded'
  1510. X               GOTO 45
  1511. X            ENDIF
  1512. XC
  1513. XC IGNORE EXTERNALS, IF THAT IS REQUIRED
  1514. XC
  1515. X            IF(.NOT.LEXT.AND.IOK.EQ.0) GOTO 45
  1516. X            NSUBNM = NSUBNM + 1
  1517. X            CSUBNM(NSUBNM) = CNAM
  1518. X            LSUBNM(NSUBNM) = .FALSE.
  1519. X            GOTO 45
  1520. X          ENDIF
  1521. X        ENDIF
  1522. XC
  1523. XC fill all names at this level
  1524. XC
  1525. X        IF(NDONE(ILEV).EQ.0) THEN
  1526. X          NC = 0
  1527. X          DO 36 IN=1,PROCED_NCALLS(IPNAM)
  1528. X             IPNAM2 = PROCED_CALLS(IPNAM,IN)
  1529. XC
  1530. XC IGNORE EXTERNALS IF REQUIRED
  1531. XC
  1532. X             IF(.NOT.LEXT.AND.PROCED_EXTERN(IPNAM2)) GOTO 36
  1533. X             NC = NC + 1
  1534. X             CNAME(ILEV,NC) = PROCED_NAME(IPNAM2)
  1535. X             CDOIF(ILEV,NC)(:LCDOIF) = PROCED_DOIF(IPNAM,IN)(:LCDOIF)
  1536. X   36     CONTINUE
  1537. X          NMAX(ILEV) = NC 
  1538. X        ENDIF
  1539. X        GOTO 46
  1540. X      ENDIF
  1541. X   45 CONTINUE
  1542. XC
  1543. XC end of level. move up one
  1544. XC
  1545. X      ILEV = ILEV - 1
  1546. X      IF(ILEV.EQ.0) GOTO 30
  1547. X   46 CONTINUE
  1548. X      IF(NDONE(ILEV).GE.NMAX(ILEV)) THEN
  1549. X        NDONE(ILEV) = 0
  1550. X        GOTO 45
  1551. X      ENDIF
  1552. X      CNAM = CNAME(ILEV,NDONE(ILEV)+1)
  1553. X      CDF(:LCDOIF)  = CDOIF(ILEV,NDONE(ILEV)+1)(:LCDOIF)
  1554. X      NDONE(ILEV) = NDONE(ILEV) + 1
  1555. X      ILEV = ILEV + 1
  1556. X      GOTO 20
  1557. X   30 CONTINUE
  1558. XC
  1559. XC end of this tree. shift names in sub-tre list and start again
  1560. XC
  1561. X        DO 72 I=1,NSUBNM-1
  1562. X          LSUBNM(I) = LSUBNM(I+1)
  1563. X          CSUBNM(I) = CSUBNM(I+1)
  1564. X  72    CONTINUE
  1565. X        NSUBNM = NSUBNM - 1
  1566. X      IPOIN = 0
  1567. X   35 IPOIN = IPOIN + 1
  1568. X      IF(IPOIN.GT.NSUBNM) GOTO 300
  1569. X      IF(LSUBNM(IPOIN)) THEN
  1570. X        DO 71 I=IPOIN,NSUBNM-1
  1571. X          LSUBNM(I) = LSUBNM(I+1)
  1572. X          CSUBNM(I) = CSUBNM(I+1)
  1573. X  71    CONTINUE
  1574. X        NSUBNM = NSUBNM - 1
  1575. X        IPOIN = IPOIN - 1
  1576. X      ENDIF
  1577. X      GOTO 35
  1578. XC
  1579. X   40 CONTINUE
  1580. XC
  1581. XC finished all trees. home to beddy-bies
  1582. XC
  1583. X      WRITE(LOUT,'(A)') ' PROTRE Finished'
  1584. X      IERROR = 0
  1585. X      GOTO 999
  1586. X  910 WRITE(LOUTRE,911) CNAM
  1587. X      WRITE(LOUT,911) CNAM
  1588. X  911 FORMAT(1X,'PROTRE --> ROUTINE:',A,' NOT FOUND IN PROCEDURE TABLE')
  1589. X      IERROR = 2
  1590. X  999 CONTINUE
  1591. X      END
  1592. END_OF_FILE
  1593.   if test 7771 -ne `wc -c <'protre.for'`; then
  1594.     echo shar: \"'protre.for'\" unpacked with wrong size!
  1595.   fi
  1596.   # end of 'protre.for'
  1597. fi
  1598. if test -f 'rdflop.for' -a "${1}" != "-c" ; then 
  1599.   echo shar: Will not clobber existing file \"'rdflop.for'\"
  1600. else
  1601.   echo shar: Extracting \"'rdflop.for'\" \(797 characters\)
  1602.   sed "s/^X//" >'rdflop.for' <<'END_OF_FILE'
  1603. X      SUBROUTINE RDFLOP(IPASS)
  1604. XC! Read the data from FLOPPY
  1605. X      INCLUDE 'params.h'
  1606. X      INCLUDE 'lunits.h'
  1607. X      INCLUDE 'floppy.h'
  1608. X      INCLUDE 'jobcom.h'
  1609. XC
  1610. X    1 CONTINUE
  1611. X      READ(LINTRE,END=2,ERR=999) NENT,(CALLER(I),I=1,NENT),
  1612. X     $ (CRABUF(I),I=1,NENT),(TYPE(I),I=1,NENT),
  1613. X     $ KALL,(CALLED(I),I=1,KALL),(CDABUF(I),I=1,KALL),
  1614. X     $ NCOM,(CNAMES(I),I=1,NCOM),
  1615. X     $ (UNUSED(I),I=1,NCOM),
  1616. X     $ CMMNT,
  1617. X     $ NARGS,(CARGNM(I),I=1,NARGS),(CARGTY(I),I=1,NARGS),
  1618. X     $ (NARGDI(I),I=1,NARGS),
  1619. X     $ (((CARGDI(III,II,I),II=1,2),III=1,NARGDI(I)),I=1,NARGS),
  1620. X     $ NKALL,(CKALLN(I),I=1,NKALL),(KALLIF(I),I=1,NKALL),
  1621. X     $ (KALLDO(I),I=1,NKALL)
  1622. X      CALL TABENT(IPASS)
  1623. X      GOTO 1
  1624. X    2 RETURN
  1625. X  999 WRITE(LOUT,'(A)') ' RDFLOP: ERROR READING INPUT BINARY FILE'
  1626. X      STOP 1
  1627. X      END
  1628. END_OF_FILE
  1629.   if test 797 -ne `wc -c <'rdflop.for'`; then
  1630.     echo shar: \"'rdflop.for'\" unpacked with wrong size!
  1631.   fi
  1632.   # end of 'rdflop.for'
  1633. fi
  1634. if test -f 'unixflow.for' -a "${1}" != "-c" ; then 
  1635.   echo shar: Will not clobber existing file \"'unixflow.for'\"
  1636. else
  1637.   echo shar: Extracting \"'unixflow.for'\" \(5683 characters\)
  1638.   sed "s/^X//" >'unixflow.for' <<'END_OF_FILE'
  1639. X      PROGRAM FLOW
  1640. XC-------------------------------------------------------------------------
  1641. XC Flow UNIX interface routine.
  1642. XC Sets up various required input files and parameters for Flow
  1643. XC 
  1644. XC Julian Bunn 1992
  1645. XC-------------------------------------------------------------------------
  1646. X      INCLUDE 'lunits.h'
  1647. X      INCLUDE 'params.h'
  1648. X      INCLUDE 'jobcom.h'
  1649. X      INCLUDE 'ignore.h'
  1650. X      INCLUDE 'trecom.h'
  1651. X      PARAMETER (MLLEN=255,maxarg=100)
  1652. X      character*(mxlin) argval
  1653. X      character*1 key,char
  1654. X      CHARACTER*(MLLEN)  cfile,clong
  1655. X      LOGICAL LOG,fexist,fold,fqold,tidy
  1656. Xc
  1657. Xc get all arguments
  1658. Xc
  1659. X      numargs = iargc()
  1660. X      if(numargs.gt.maxarg) then
  1661. X         write(6,'(A)') ' Flow --> Too many arguments '
  1662. X         goto 900
  1663. X      endif
  1664. Xc
  1665. Xc get input file from Flow
  1666. Xc
  1667. X      call getarg(numargs,cfile)       
  1668. X      lfile = index(cfile,' ')-1
  1669. X      write(6,'(A)') ' Flow --> Input Floppy file '//cfile(:lfile)
  1670. X      inquire(file=cfile(:lfile),exist=fexist)
  1671. X      if(.not.fexist) then
  1672. X        write(6,'(A)') ' Flow --> Input file not found !'
  1673. X        goto 900
  1674. X      endif
  1675. X      lintre = 50
  1676. X      open(lintre,file=cfile(:lfile),status='old',
  1677. X     &     form='unformatted',err=900)
  1678. Xc
  1679. X      log = .false.      
  1680. X      lext = .true.
  1681. X      lqery = .false.                    
  1682. X      lchrt = .false.
  1683. X      lsubs = .false.
  1684. X      lcomm = .false.
  1685. X      ltree = .false.
  1686. X      loutch = 96
  1687. X      ctree = '$$$$'
  1688. Xc
  1689. Xc Find if -l was given
  1690. Xc
  1691. X      do 400 iarg = 1,numargs-1
  1692. X         call getarg(iarg,argval)
  1693. X         larg = index(argval,' ')-1 
  1694. X         key = argval(2:2)
  1695. X         if(key.eq.'l') then
  1696. X           log = .true.
  1697. X         endif
  1698. X  400 continue
  1699. Xc
  1700. Xc loop over all qualifiers
  1701. Xc
  1702. X      icheck = 0
  1703. X      do 500 iarg = 1,numargs-1
  1704. X         call getarg(iarg,argval)
  1705. X         larg = index(argval,' ')-1 
  1706. X         key = argval(2:2)
  1707. X         if(key.eq.'l') then
  1708. X           log = .true.
  1709. X         else if(key.eq.'q') then
  1710. X           lqery = .true.
  1711. X           if(log) write(6,'(A)') ' Flow --> Queries on the tree'
  1712. X         else if(key.eq.'E') then
  1713. X           lext = .false.
  1714. X           if(log) write(6,'(A)') ' Flow --> Exclude externals'
  1715. X         else if(key.eq.'c') then
  1716. X           if(argval(3:3).eq.' ') then
  1717. X              ccomm = 'procom.dat'
  1718. X              lcmm = 10
  1719. X           else
  1720. X              ccomm = argval(3:)
  1721. X              lcmm = index(ccomm,' ')-1 
  1722. X           endif
  1723. X           inquire(file=ccomm(:lcmm),exist=fexist)
  1724. X           if(fexist) then
  1725. X              open(loutco,file=ccomm(:lcmm),status='old')
  1726. X              close(loutco,status='delete')
  1727. X           endif
  1728. X           if(log) write(6,'(A)') ' Flow --> COMMON Table: '//
  1729. X     &             ccomm(:lcmm) 
  1730. X           lcomm = .true.
  1731. X           loutco = 60
  1732. X           open(loutco,file=ccomm(:lcmm),status='new',err=900)
  1733. X         else if(key.eq.'s') then
  1734. X           if(argval(3:3).eq.' ') then
  1735. X              chart = 'protre.dat'
  1736. X              lchart = 10
  1737. X           else
  1738. X              chart = argval(3:)
  1739. X              lchart = index(chart,' ')-1 
  1740. X           endif
  1741. X           inquire(file=chart(:lchart),exist=fexist)
  1742. X           if(fexist) then
  1743. X              open(loutre,file=chart(:lchart),status='old')
  1744. X              close(loutre,status='delete')
  1745. X           endif
  1746. X           if(log) write(6,'(A)') ' Flow --> Text Structure Chart: '//
  1747. X     &             chart(:lchart) 
  1748. X           ltree = .true.
  1749. X           loutre = 61
  1750. X           open(loutre,file=chart(:lchart),status='new',err=900)
  1751. X         else if(key.eq.'i') then
  1752. X           clong = argval(3:)
  1753. X           llong = lenocc(clong)
  1754. X           if(llong.le.0) then
  1755. X              write(6,'(A)') ' Flow --> No Ignore names given'
  1756. X              goto 900
  1757. X           endif
  1758. X   60      icomma = index(clong,',')
  1759. X           if(icomma.ne.0) then
  1760. X              nigno = nigno + 1
  1761. X              cigno(nigno) = clong(:icomma-1)
  1762. X              ligno(nigno) = icomma-1
  1763. X              clong = clong(icomma+1:)
  1764. X              call caschg(cigno(nigno),cigno(nigno))
  1765. X              goto 60
  1766. X           endif
  1767. X           nigno = nigno + 1
  1768. X           ligno(nigno) = index(clong,' ')-1
  1769. X           cigno(nigno) = clong(:ligno(nigno))
  1770. X           call caschg(cigno(nigno),cigno(nigno))
  1771. X           if(log) write(6,'(A)') ' Flow --> Ignore modules:'
  1772. X           if(log) write(6,'(10x,6a8)') (cigno(i),i=1,nigno)
  1773. X         else if(key.eq.'g') then
  1774. X           if(argval(3:3).eq.' ') then
  1775. X              cgraph = 'flow.ps'
  1776. X              lgraph = 7
  1777. X           else
  1778. X              cgraph = argval(3:)
  1779. X              lgraph = index(cgraph,' ')-1 
  1780. X           endif
  1781. X           inquire(file=cgraph(:lgraph),exist=fexist)
  1782. X           if(fexist) then
  1783. X              open(loutch,file=cgraph(:lgraph),status='old')
  1784. X              close(loutch,status='delete')
  1785. X           endif
  1786. X           if(log) write(6,'(A)') ' Flow --> Graphical Chart: '//
  1787. X     &             cgraph(:lgraph) 
  1788. X           lchrt = .true.
  1789. X           loutre = 96
  1790. X           open(loutre,file=chart(:lchart),status='new',err=900)
  1791. X         else if(key.eq.'n') then
  1792. X           ctree = argval(3:)
  1793. X           ltre = lenocc(ctree)
  1794. X           if(ltre.le.0) then
  1795. X             if(log) write(6,'(A)') ' Flow --> No node name for -n'
  1796. X             goto 900
  1797. X           endif
  1798. X           call caschg(ctree,ctree)
  1799. X           if(log) write(6,'(A)') ' Flow --> Start from node: '//
  1800. X     &             ctree(:ltre)
  1801. X         else 
  1802. X           write(6,'(A)') ' Flow --> Unrecognized qualifier '//key
  1803. X           goto 900
  1804. X         endif
  1805. X  500 continue
  1806. Xc
  1807. Xc Call Flow
  1808. Xc
  1809. X      call prodes
  1810. Xc
  1811. X      if(lcomm) close(loutco)
  1812. X      if(ltree) close(loutre)
  1813. X      if(lchrt) close(loutch)
  1814. X      close(lintre)
  1815. X      goto 2000
  1816. Xc
  1817. X  900 write(6,'(A)') ' Flow aborted'     
  1818. X      stop 1
  1819. X 2000 CONTINUE
  1820. X      END
  1821. END_OF_FILE
  1822.   if test 5683 -ne `wc -c <'unixflow.for'`; then
  1823.     echo shar: \"'unixflow.for'\" unpacked with wrong size!
  1824.   fi
  1825.   # end of 'unixflow.for'
  1826. fi
  1827. echo shar: End of archive 3 \(of 5\).
  1828. cp /dev/null ark3isdone
  1829. MISSING=""
  1830. for I in 1 2 3 4 5 ; do
  1831.     if test ! -f ark${I}isdone ; then
  1832.     MISSING="${MISSING} ${I}"
  1833.     fi
  1834. done
  1835. if test "${MISSING}" = "" ; then
  1836.     echo You have unpacked all 5 archives.
  1837.     rm -f ark[1-9]isdone
  1838. else
  1839.     echo You still must unpack the following archives:
  1840.     echo "        " ${MISSING}
  1841. fi
  1842. exit 0
  1843. exit 0 # Just in case...
  1844.