My Source Code Diagramming Programs
http://mgrunes.com/diagram/index.html
Revised 2/14/20
Beta test update

These programs diagram source code.

They draw lines showing the start and end of routines and blocks, put a * next to jumps, an = next to commented out sections, and warn you of certain common programming errors which compilers miss, such as card format Fortran code that goes past column 72, and free format Fortran code that goes past column 132, and a few other things. They also help you figure out the structure of your own code, and make it easier to look at other people's long complicated legacy code.

These only work with ASCII input - e.g., not unicode.

Caution: Browsers don't display this source code quite right. So, load everything through this Zip archive of all diagram files instead.

diagramc: Diagrams C, C++, and similar syntax languages

diagramc.f Source code for this tool.
Procedures to run diagramc, without making you answer questions:
diagramc.sh Unix/Linux/Cygwin bash shell procedure.
diagramc.bat MS-DOS or Windows command shell procedure.
diagramc.vax VAX VMS DCL procedure.

For example:

 
    /------ I_Hate_C() {                                     |   1
    |/------- if (You_Like(C)) {                             |   2
    ||          BoyOrGirl=Bad;                               |   3
  /-||      #ifdef SMART                                     |   4
  | ||          ReEducate();                                 |   5
  \-||      #endif                                           |   6
    |+------- } else {                                       |   7
    ||          BoyOrGirl=Good;                              |   8
    |\------- }                                              |   9
    \------ }                                                |  10

diagramf: Diagrams Fortran

diagramf.f Source code for this tool.
Procedures to run diagramf, without making you answer questions, on card format code:
diagramf.sh Unix/Linux/Cygwin bash shell procedure.
diagramf.bat MS-DOS or Windows command shell procedure.
diagramf.vax VAX VMS DCL procedure.
Procedures to run diagramf, without making you answer questions, on free format code:
diagram9.sh Unix/Linux/Cygwin bash shell procedure.
diagram9.bat MS-DOS or Windows command shell procedure.
diagram9.vax VAX VMS DCL procedure.

For example:

 
    /---------------- subroutine a(x)                        |   1
    |/--------------- do i=1,5                               |   2
    ||/---------------- if(i/2*2.eq.i)then                   |   3
    |||                   x=x*i                              |   4
    ||+---------------- else                                 |   5
    |||                   x=x/i                              |   6
    ||\---------------- endif                                |   7
    |\--------------- enddo                                  |   8
    \---------------- end                                    |   9

diagramh: Diagrams HTML (Requires cleanly formatted code, no line breaks in middle of fields, with lines shorter than 5000 characters)

diagramh.f Source code for this tool.
Procedures to run diagramh, without making you answer questions:
diagramh.sh Unix/Linux/Cygwin bash shell procedure.
diagramh.bat MS-DOS or Windows command shell procedure.
diagramh.vax VAX VMS DCL procedure.

For example:

 
    /--------- <html>                                        |   1
    |                                                        |   2
    |/--------   <head>                                      |   3
    |+--------     <title>My Title</title>                   |   4
    |\--------   </head>                                     |   5
    |                                                        |   6
    |/--------   <body>                                      |   7
    |+--------     <a href="./doc.html">doc.html</a>         |   8
    |\--------   </body>                                     |   9
    |                                                        |  10
    \--------- </html>                                       |  11

diagrami: Diagrams IDL, PV-WAVE, GDL, FL

diagrami.f Source code for this tool.
Procedures to run diagrami, without making you answer questions:
diagrami.sh Unix/Linux/Cygwin bash shell procedure.
diagrami.bat MS-DOS or Windows command shell procedure.
diagrami.vax VAX VMS DCL procedure.

For example:

 
    /--------- pro Sample,a,b,c                               |   1
    |          a=indgen(15)^2                                 |   2
    |/-------- if a eq b then begin                           |   3
    ||           print,'A equals B'                           |   4
    ||           c=0                                          |   5
    |+-------- endif else begin                               |   6
    ||           print,'A does not equal B'                   |   7
    ||           c=1                                          |   8
    |\-------- endif                                          |   9
    \--------- end                                            |  10

diagramx: Diagrams XML (Requires cleanly formatted code, no line breaks in middle of fields, with lines shorter than 5000 characters)

diagramx.f Source code for this tool.
Procedures to run diagramx, without making you answer questions:
diagramx.sh Unix/Linux/Cygwin bash shell procedure.
diagramx.bat MS-DOS or Windows command shell procedure.
diagramx.vax VAX VMS DCL procedure.
 
c            <?xml version="1.0" encoding="UTF-8"?>           |   1
c /--------- <tag1>                                           |   2
c |/--------   <tag2>                                         |   3
c |+--------     "ABCD"                                       |   4
c |\--------   </tag2>                                        |   5
c |                                                           |   6
c |/--------   <tag3>                                         |   7
c |+--------     15.                                          |   8
c |\--------   </tag3>                                        |   9
c |                                                           |  10
c \--------- </tag1>                                          |  11

undiagram: Tries to derive source code from diagramed code.

undiagram.f Source code for this tool

The VAX procedures have not recently been tested.

Compilation

The programs themselves are in Fortran, which I know many people consider out of date. Fortran is freely available as f77, f90, f95, g77, g90, g95, or gfortran, on many platforms, any of which can compile this code. (But some early f77 can't handle my code.) In any event, you don't have to compile it: I placed MingW executables that also run under Cygwin and Windows in directory bin_Windows. I placed Executables that run under 64 bit Ubuntu Linux in directory bin_Ubuntu64. Both were linked statically to try to maintain future compatibility.

Nonethelss, a gfortran compilation procedure that works well under Cygwin, Mingw or Linux, and most other Unixes, is included in compile.sh.

If you like or dislike these programs, send e-mail to username grunes at domain yahoo.com. Bug reports must include sample code on which it failed.