home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sources / misc / 3788 < prev    next >
Encoding:
Text File  |  1992-07-30  |  56.0 KB  |  1,874 lines

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