pad2ps - automatic PAD drawer

Japanese version
Home page
Updated on March 15, 1997

TeX is a trademark of American Mathematical Society.
PostScript is a registered trademark of Adobe Systems Incorporated.


PAD Manual enclosed in the package is available from here.

P A D manual

A Merit Award Report at 7th Isao Ohkawa Prize

pad2ps - automatic PAD drawer


  1. Overview about pad2ps
  2. Current version
  3. About pad.sty
  4. Bugs and incompleteness
  5. To do in the future


Overview about pad2ps

Pad2ps series (pad2ps, pad2tex, and pad2eps) are tools to convert a PAD source written as a text file to PostScript, LaTeX, and Encapsulated PostScript(EPS) file.

PAD, which stands for Problem Analysis Diagram, is a way to illustrate the flow or structure of programs. PAD is similar to flowchart, but they are not quite the same. The flowchart is good for charting programs written in languages like BASIC, a language with GOTO statement. To chart structured programs, like ones written in C, however, PAD is much handy than flowchart.

To draw PAD figures using this pad2ps, you first create PADEL (PAD Expression Language) file by using editor. Because the PADEL is very similar to C in syntax, most people has no trouble writting PADEL.

Here is an example.

        /* pad2ps: title = Ackermann Function */
            if(m = 0)
                return (n+1)
                if(n = 0)
                    return ack(m-1,1)
                    return ack(m-1,ack(m,n-1))
The PADEL program above is converted by pad2ps into the following PAD figure.


In addition, pad2ps can even translate the original programs sources directly into PAD figure. The current version can translate C, C++, Bourne shell, C shell, Jave, and AWK program sources to PAD figures.

This pad2ps will be useful for those peoples who want to analyze structure of someone's programs, who are in trouble of finding mistakes, and who want to make your report better.

pad2ps is a free software copyrighted by Seiichi Yoshida ( .

Current version

The latest version of pad2ps is 3.11, released on Nov. 23, 1996.

You can get the latest version of pad2ps from here.

About pad.sty

The pad2ps package contains a style file pad.sty made by Mr. Satoshi Kuramochi ( . This is required when you make a PAD figure in LaTeX with pad2tex. The LaTeX codes made by pad2tex use macros defined in pad.sty.

The version of pad.sty in the current pad2ps package is 1.1. To get more information on it in detail, please see also PAD style file for LaTeX . You can get the latest version there, too.

pad.sty is a free software copyrighted by Mr. Satoshi Kuramochi.

Bugs and incompleteness

pad2ps 3.1j has some bugs and incompleteness as follows. If you find some more else, please tell me.

  • The execute files and modules will not work properly if you "gzexe" them.

  • In case of abnormal termination (eg terminated by Segmentation Fault or by C-c), the program may fail to delete garbages (temporary files) in /tmp.

  • pad2ps cannot make a proper PAD figure if "try - catch" statement exists at the top of a PADEL function.


                try {
                    x = x / 2
                } catch (x < 1) {

  • pad2tex does not support string folding, so a long string and a deep nesting may result in unbalanced output. (the figures may stick out to right side)

  • Adjusting the vertical interval with a parameter variable vsp doesn't work when you make a PAD in LaTeX.

  • The output LaTeX code of pad2tex sometimes cannot show a proper PAD figure, for example when an "if" part is omitted in a branch command.

  • To do in the future

    Supporting other languages is our biggest problem now. It has two meanings.

    • Enable to translate Tcl/Tk, fortran, and other languages directly to PAD.
      In the next release Tcl/Tk, Pascal, Fortran, and Perl will be supported.
    • Enable to write PADEL in syntax similar to languages other than C.
      The current PADEL's syntax is similar to that of C language. So when you are making a C program, it is ease to write the overview in PADEL at first. But making a program in other languages, you have to make a PADEL at first and convert it after, or you have to make a program in the syntax of the language you use without making PADEL overview. But this will not be implemented in near future.

    In near future, pad2java, a module that outputs a Java program which draws the PAD, will be added. By using this program, you can put your PAD figures in your homepage.

    There is also a plan to support flowchart. This means, we are to create FLOWEL, a language to experss flowchart. You will create the text file under this FLOWEL syntax and named it .flow, and convert this file into PADEL by flow2pad. Finally, you will get PAD figures with pad2ps. The problem here is we also need a tool that would draw real flowchart from .flow file. The project is in progress, so stay tuned for a while.

    Seveal other plans exist, but all of these will not be implemented for a while.

    • Expanding macros in C program (unlike cpp, expand only ones that are defined in that file and keep its readability)

    • Adjusting strings which spread over two pages

    • Enabling to draw PAD with color

    • Enabling to customize shapes of PAD figures


    Copyright(C) Seiichi Yoshida ( All rights reserved.