Article 13717 of alt.sources:
Path: nntpd.lkg.dec.com!lead.zk3.dec.com!pa.dec.com!decwrl!news-ext.crl.dec.com!bloom-beacon.mit.edu!news.mathworks.com!news.sprintlink.net!news-peer.sprintlink.net!uunet!in3.uu.net!news.iij.ad.jp!wnoc-tyo-news!waseda.ac.jp!cfi.waseda!wsdnws.cfi.waseda.ac.jp!seiichi
From: seiichi@muraoka.info.waseda.ac.jp (YOSHIDA Seiichi)
Newsgroups: alt.sources
Subject: pad2ps-3.1 (1/11)
Followup-To: alt.sources
Date: 03 Nov 1996 10:23:18 GMT
Organization: Centre for Infomatics, Waseda University
Lines: 3217
Distribution: world
Message-ID: <SEIICHI.96Nov3192318@muras5.muraoka.info.waseda.ac.jp>
NNTP-Posting-Host: unknown@muras5.muraoka.info.waseda.ac.jp
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Xref: nntpd.lkg.dec.com alt.sources:13717

#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1996-11-03 18:55 JST by <seiichi@emon>.
# Source directory was `/tmp'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This is part 1 of a multipart archive.                                   
# Do not concatenate these parts, unpack them in order with `/bin/sh'.     
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   8267 -rw-r--r-- pad2ps-3.1/HISTORY
#   3223 -rw-r--r-- pad2ps-3.1/INSTALL
#   7554 -rw-r--r-- pad2ps-3.1/README
#  67839 -rw-r--r-- pad2ps-3.1/doc/manual.tex
#   2165 -rw-r--r-- pad2ps-3.1/doc/ack.1.eps
#   2168 -rw-r--r-- pad2ps-3.1/doc/ack.2.eps
#   2187 -rw-r--r-- pad2ps-3.1/doc/ack.3.eps
#    470 -rw-r--r-- pad2ps-3.1/doc/ack.pad
#   2207 -rw-r--r-- pad2ps-3.1/doc/manual.index
#  16232 -rw-r--r-- pad2ps-3.1/doc/modules.eps
# 112044 -rw-r--r-- pad2ps-3.1/doc/manual.dvi
# 330177 -rw-r--r-- pad2ps-3.1/doc/manual.ps
#   1899 -rw-r--r-- pad2ps-3.1/mkpad.man
#  13322 -rw-r--r-- pad2ps-3.1/pad2ps.man
#   8570 -rw-r--r-- pad2ps-3.1/src/awk2pad/parser.c
#   5336 -rw-r--r-- pad2ps-3.1/src/awk2pad/token.c
#   1189 -rw-r--r-- pad2ps-3.1/src/awk2pad/awk2pad.h
#    850 -rw-r--r-- pad2ps-3.1/src/awk2pad/Makefile.in
#   4406 -rw-r--r-- pad2ps-3.1/src/awk2pad/awk2pad.c
#   7979 -rw-r--r-- pad2ps-3.1/src/c2pad/c2pad.c
#   2270 -rw-r--r-- pad2ps-3.1/src/c2pad/c2pad.h
#  14383 -rw-r--r-- pad2ps-3.1/src/c2pad/parser.c
#   7336 -rw-r--r-- pad2ps-3.1/src/c2pad/ifdef.c
#  10052 -rw-r--r-- pad2ps-3.1/src/c2pad/token.c
#    848 -rw-r--r-- pad2ps-3.1/src/c2pad/Makefile.in
#   9156 -rw-r--r-- pad2ps-3.1/src/csh2pad/parser.c
#   6779 -rw-r--r-- pad2ps-3.1/src/csh2pad/token.c
#   4516 -rw-r--r-- pad2ps-3.1/src/csh2pad/csh2pad.c
#   1423 -rw-r--r-- pad2ps-3.1/src/csh2pad/csh2pad.h
#    850 -rw-r--r-- pad2ps-3.1/src/csh2pad/Makefile.in
#   1550 -rw-r--r-- pad2ps-3.1/src/java2pad/java2pad.h
#  15113 -rw-r--r-- pad2ps-3.1/src/java2pad/parser.c
#   6965 -rw-r--r-- pad2ps-3.1/src/java2pad/java2pad.c
#   9059 -rw-r--r-- pad2ps-3.1/src/java2pad/token.c
#    859 -rw-r--r-- pad2ps-3.1/src/java2pad/Makefile.in
#    543 -rw-r--r-- pad2ps-3.1/src/lib/stack.c
#   1070 -rw-r--r-- pad2ps-3.1/src/lib/string.c
#   1050 -rw-r--r-- pad2ps-3.1/src/lib/lib.h
#    617 -rw-r--r-- pad2ps-3.1/src/lib/error.c
#    522 -rw-r--r-- pad2ps-3.1/src/lib/Makefile.in
#  14479 -rw-r--r-- pad2ps-3.1/src/main/main.c
#    454 -rw-r--r-- pad2ps-3.1/src/main/main.h
#    959 -rw-r--r-- pad2ps-3.1/src/main/Makefile.in
#   1372 -rw-r--r-- pad2ps-3.1/src/mkpad/Makefile.in
#   1187 -rw-r--r-- pad2ps-3.1/src/mkpad/mkpad.in
#  15165 -rw-r--r-- pad2ps-3.1/src/pad2ps/parser.y
#   8090 -rw-r--r-- pad2ps-3.1/src/pad2ps/pad2ps.h
#  11248 -rw-r--r-- pad2ps-3.1/src/pad2ps/parser.l.in
#  11023 -rw-r--r-- pad2ps-3.1/src/pad2ps/pad2ps.c
#  22399 -rw-r--r-- pad2ps-3.1/src/pad2ps/locate.c
#   8579 -rw-r--r-- pad2ps-3.1/src/pad2ps/fold.c
#   3798 -rw-r--r-- pad2ps-3.1/src/pad2ps/string.c
#    706 -rw-r--r-- pad2ps-3.1/src/pad2ps/sort.c
#  13054 -rw-r--r-- pad2ps-3.1/src/pad2ps/ps.c
#    800 -rw-r--r-- pad2ps-3.1/src/pad2ps/font.c
#   9929 -rw-r--r-- pad2ps-3.1/src/pad2ps/tex.c
#   1347 -rw-r--r-- pad2ps-3.1/src/pad2ps/Makefile.in
#   4572 -rw-r--r-- pad2ps-3.1/src/sh2pad/sh2pad.c
#   1747 -rw-r--r-- pad2ps-3.1/src/sh2pad/sh2pad.h
#  11999 -rw-r--r-- pad2ps-3.1/src/sh2pad/parser.c
#   6920 -rw-r--r-- pad2ps-3.1/src/sh2pad/token.c
#    841 -rw-r--r-- pad2ps-3.1/src/sh2pad/Makefile.in
#    861 -rw-r--r-- pad2ps-3.1/src/config.h.in
#    318 -rw-r--r-- pad2ps-3.1/src/version.h
#   2209 -rw-r--r-- pad2ps-3.1/Makefile.in
#  44297 -rwxr-xr-x pad2ps-3.1/configure
#   1283 -rw-r--r-- pad2ps-3.1/configure.diff
#   1206 -rw-r--r-- pad2ps-3.1/configure.in
#   4773 -rwxr-xr-x pad2ps-3.1/install-sh
#  18053 -rw-r--r-- pad2ps-3.1/padsty-1.1.tar.gz
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh23946; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
if test -r _sh23946/seq; then
  $echo 'Must unpack archives in sequence!'
  $echo 'Please unpack part' '`cat _sh23946/seq`' 'next!'
  exit 1
fi
# ============= pad2ps-3.1/HISTORY ==============
if test ! -d 'pad2ps-3.1'; then
  $echo 'x -' 'creating directory' 'pad2ps-3.1'
  mkdir 'pad2ps-3.1'
fi
if test -f 'pad2ps-3.1/HISTORY' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'pad2ps-3.1/HISTORY' '(file already exists)'
  rm -f _sh23946/new
else
  > _sh23946/new
  $echo 'x -' extracting 'pad2ps-3.1/HISTORY' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'pad2ps-3.1/HISTORY' &&
pad2ps 3.1  1996-11-02  by S. Yoshida (seiichi@muraoka.info.waseda.ac.jp)
X
History
--------------------------------------------------
3.1:	1996-11-02
X    - Enabled to convert Bourne shell, C shell, Java, and AWK programs.
X      (-sh, -csh, -java, -awk)
X    - Created a script mkpad that converts programs into PADEL format.
X      (original mkpad was created by Daisuke Fujii)
X    - Enabled to compile and install by only typing:
X        ./configure; make; make install
X      (using GNU autoconf)
X    - Added labeling and referencing in PADEL syntax
X      (labeling                ... label <label name>                 )
X      (labeling in short form  ... <label name>:                      )
X      (reference               ... refer ( <label name> ) { <body> }  )
X    - Added the exception handler try{ } catch( ) { } in PADEL syntax.
X    - Added support for goto - <label> in C and C++ program
X    - Enabled to observe progress of folding PAD by showing a bar graph. 
X      (fold.c)
X    - Enabled to draw a PAD figure of inline functions in C++ program
X      by declaring -inline option. (c2pad)
X    - Strengthened converting algorithem of switch statement.
X      The previous version couldn't convert statements in the following cases:
X      (when command(s) is present in between switch(){ and 1st case statement)
X      (when only blank line(s) is present in between two case statements)
X      (when nothing is present in last case or default statement)
X    - Added parameter variable slice.
X      (draw PADs from beginning of pages)
X    - Enabled to translate PADEL with ^M and ^L.
X    - Enabled to translate PADEL with return code in DOS format.
X    - Fixed the bug to enable recognition of tabs in C programs.
X    - Fixed the bug to correct handing of if-else related comments.
X      (The previous version puts comments, written after if statement, inside
X       if block)
X    - Added an option -c++.
X    - Started using lex -e or flex -8 to compile Japanese version
X    - Stopped using a variable LANG in Makefile.
X    - Started using P_tmpdir as temporary file directory if it is defined in
X      stdio.h.
X    - Separated INSTALL from README
X    - Attached pad.sty (padsty-1.1.tar.gz) created by Satoshi Kuramochi
X
3.03-fix1:	1996-02-16
X    - Fixed the bug that overwrite the original file when trying to
X      convert C program.
X
3.03:	1996-02-15
X    - Enabled to deal with function & for statement without {} block.
X    - Enabled to convert struct &  enum statement in function (c2pad).
X    - Enabled to handle C programs with label (c2pad).
X      (Output format is the same as the normal statement... yet)
X    - Enabled to write LaTeX commands directly in PADEL (pad2tex).
X      Select parameter "texmode" as follows:
X      (latex   : handle string as LaTeX command)
X      (verbatim: handle string as it is)
X    - Enabled to select the place of pad2ps module by changing the
X      environment variable PAD2PSLIB.
X    - Enabled to execute in directory without write permission.
X      (Temporary files will be created in the directory defined by the 
X      environment variable TMP or /tmp)
X    - Enable to take care of garbage (temporary files) when quitting
X      the program.  (The garbage will remain if you quit abnormally)
X    - Enable to deal with C program with ^M and ^L. (c2pad)
X      (^M and ^L in PADEL will cause error)
X    - Took care of temporary files upon quitting.
X      (The files will remain if you quit with C-c)
X    - Implemented new options.
X      (-dir  : set output directory) 
X      (-stdin: read from standard input)
X    - Fixed the bug to deal with blank lines in a block.
X    - Fixed the bug that made height unbalanced.
X    - Adjusted the height of LaTeX output (pad2tex)
X    - Fixed the bug that made newpage work unproperly when the
X      environment variable vrate is set.
X    - Changed program so that C++ mode will be activated even if the
X      suffix of the source is .C
X    - Fixed Makefile (no link while making).
X
3.02: 	1995-11-03
X    - Fixed the bug that caused parse error when there is no return
X      before { in C program.
X      (For exapmle, function header like "main(){ " caused error in
X      previous version)
X    - Changed the default install directories.
X    - Changed the function names that duplicate with unistd.h.
X      (link -> link_pad, dup -> dup_pad)
X    - Fixed Makefile
X
3.01:	1995-10-16
X    - Enabled to compile with yacc and lex.
X    - Enabled to run c2pad even if it is in a directory of PATH.
X    - Enabled to translate all C programs in this package.
X      (It means the macro  END_OF_LINE()  has been changed as 
X       END_OF_LINE();  or so.)
X    - Fixed the bug that when a switch statement had only one branch,
X      a variable 'bottom' was not set and PAD locating went wrong
X      (pad2ps).
X    - Fixed the bug that a comment in the same line with "else" was
X      not put in one line alone (c2pad).
X    - Fixed the bug that one #undef undefined all the defined symbols
X      (c2pad).
X    - Fixed the bug that '{' was not indented (c2pad).
X    - 'PAD manual' in PostScript, manual.ps, also enclosed.
X    - Chapter 'Usage' deleted from 'readme.doc'.
X    - history -> HISTORY, readme.doc -> README.
X
3.0:	1995-09-16
X    - Divided programs for its role.
X      (c2pad  -- translate C   source into PAD source. )
X      (pad2ps -- translate PAD source into PostScript. )
X    - Enabled to draw PAD in LaTeX (pad2tex).
X    - Enclosed 'pad.sty' (ver. 1.0) by Mr. Satoshi Kuramochi.
X    - Enabled to draw PAD in Encapsulated PostScript (pad2eps).
X    - Enabled to translate C++ source.
X    - Enclosed 'PAD manual' written in LaTeX.
X    - Enabled to write comment on PAD.
X      (parameter: message, comment)
X    - Rewrite programs with bison and flex (pad2ps).
X    - PAD syntax changed.
X      (if - else if - else statement is also supported.)
X      (To write comment and command in one line is not permitted.)
X      (// comment is also supported.)
X    - Output changed.
X      (Treat filename as a global title by default.)
X      (Changed the way to fold label in switch statement.)
X      (Moved down the location of page number.)
X      (Modified the font size of alphabets and numbers.)
X      (Empty line in C program is effective to make some space.)
X    - The function as a filter added again.
X    - Enabled to name output filename.
X      (Default is stdout.)
X    - Parameters changed.
X      (New parameters: figure_rate, figure_locate)
X      (newline and backline unified into vsp.)
X      (Parameter semicolon changed into -semicolon option.)
X      (Parameter c_mode abolished.)
X    - Options changed.
X      (New option: -tab, -nohelp)
X    - Remove 'manifest', 'pad2ps.html'.
X    - Stopped to use libarg.
X
2.4:	1995-06-07
X    - Enabled to evaluate #if, #ifdef or so.
X      (Define symbols with -D option.)
X      (Option to set parameters is changed to -P.)
X      (List up symbols to define with -ifdef option.)
X    - Draw switch statement in a regular form.
X    - For statement changed to be treated as a previously checked loop.
X      (It means for statement's shape and while statement's are same.)
X    - Changed the output by default.
X    - Enabled to choose a locating style of PAD with parameter 'locate'.
X    - Enabled to set PAD strings' length to fold.
X      (max_length, min_length)
X    - Parameter 'poster' added.
X    - Parameter 'padtitle' removed, 'padtitle_rate' added.
X    - Shifting bug at zooming fixed.
X    - Enabled to evaluate '\' at the end of each line.
X    - Validated -debug option only when compiled with -DDEBUG.
X    - Wrote comments in the English version, too.
X
2.3:	1995-03-01
X    - Enhanced to output PostScript even at an error "input file terminates
X      unexpectedly."
X      (It means you can see the PAD even if the C source is illegal.)
X    - Enabled to choose a page to show in 'Ghostview'.
X    - Horizontal line of an if statement had inclined sometimes, but fixed.
X    - Bug of "/*" in a comment fixed.
X    - Enabled to expand the interval between two PADs or C functions with
X      empty lines.
X    - Fixed not to treat a comment line as an empty line.
X    - New parameters 'newline' and 'backline' added.
X    - Debug mode (-debug) enforced.
X    - Enabled to treat files including ^L or ^M.
X
2.2:	1995-02-09
X    - First release as an English version.
SHAR_EOF
  $shar_touch -am 1102140796 'pad2ps-3.1/HISTORY' &&
  chmod 0644 'pad2ps-3.1/HISTORY' ||
  $echo 'restore of' 'pad2ps-3.1/HISTORY' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'pad2ps-3.1/HISTORY:' 'MD5 check failed'
5ae885d2e28cf1594147dda6d5cb0e8d  pad2ps-3.1/HISTORY
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pad2ps-3.1/HISTORY'`"
    test 8267 -eq "$shar_count" ||
    $echo 'pad2ps-3.1/HISTORY:' 'original size' '8267,' 'current size' "$shar_count!"
  fi
fi
# ============= pad2ps-3.1/INSTALL ==============
if test -f 'pad2ps-3.1/INSTALL' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'pad2ps-3.1/INSTALL' '(file already exists)'
  rm -f _sh23946/new
else
  > _sh23946/new
  $echo 'x -' extracting 'pad2ps-3.1/INSTALL' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'pad2ps-3.1/INSTALL' &&
pad2ps 3.1  1996-11-02  by S. Yoshida (seiichi@muraoka.info.waseda.ac.jp)
X
X
0. Contents
X
X	1. How to compile
X	2. Setting the install directory
X	3. Setting the compile options
X	4. Troubleshooting
X
X
1. How to compile
X
X    pad2ps is attached with a script "configure" that automatically 
X    set necessary options according to your environment.  Therefore, 
X    compiling pad2ps should be fairly easy.
X
X    First of all, extract pad2ps-3.1.tar.gz.
X
X      % gzip -dc pad2ps-3.1j.tar.gz | tar xfv -
X
X
X    Next, move into pad2ps-3.1 directory and execute configure
X    script.
X
X      % cd pad2ps-3.1/
X      % ./configure
X
X      (Some of you may have to type "sh ./configure")
X
X
X    After the configure script finishes its job, start compiling 
X    by typing:
X
X      % make
X
X    You may get a whole bunch of warnings, but you can safely ignore
X    them.
X
X
X    After the compiling is finished, make installation:
X
X      % su root
X      % make install
X
X    To install manual pages:
X
X      % make install.man
X
X
2. Setting install directory
X
X    The directory where pad2ps will be installed in automatically set
X    by "configure".  You can find the destination by checking the head
X    part of Makefile after executing "./configure".  For more details, 
X    you can type the following after executing "make":
X
X      % make -n install
X
X    You may want to change the install directory for many reasons.  To
X    do this, specify the install destination as options.  For example,
X    suppose you want to install the programs to /home/seiichi/bin, the
X    modules to /home/seiichi/lib/pad2ps, and the style files to 
X    /home/seiichi/lib/tex/inputs.  For now, we are not going to install
X    manuals.  Upon executing "configure", set the options as following:
X
X      % ./configure --bindir=/home/seiichi/bin --libdir=/home/seiichi/lib \
X             --mandir=. --stydir=/home/seiichi/lib/tex/inputs
X
X    You should then "make; make install; make install.man"
X
X
X    For more information on "configure" options, type:
X
X      % ./configure --help
X
X
3. Setting the compile options
X
X    The C compiler to be used will be automatically set by "configure". 
X    By default, compiler option is set as "-O2".  To change this
X    setting, you should list your options in MFLAGS upon executing "make".
X    For example, to use comiler "cc" and to set the compile options to
X    "-O -g -Wall", you should type in as following:
X
X      % make MFLAGS="CC=cc CFLAGS='-O -g -Wall'"
X
X
4. Troubleshooting
X
X    On some environment, it seems that "make" doesn't function properly.
X
X      * It seems that you need "GNU make" to compile pad2ps safely
X
X    One thing you can try is to use "make" in other direcotry.  For instance,
X    suppose you type in 
X
X      % which make
X
X    and find /usr/bin/make.  If this "make" doesn't work, you then type
X
X      % find / -name make -print
X
X    and you may find /usr/local/GNU/make.  You should try this one by typing:
X
X      % /usr/local/bin/GNU/make MFLAGS="MAKE=/usr/local/bin/GNU/make"
X
X    If this doesn't work, you better install GNU make.
X
X
--
Seiichi Yoshida
Muraoka Lab., Waseda University, Japan
AstroArts Inc.
seiichi@muraoka.info.waseda.ac.jp
http://www.info.waseda.ac.jp/muraoka/members/seiichi/index.html
SHAR_EOF
  $shar_touch -am 1102140896 'pad2ps-3.1/INSTALL' &&
  chmod 0644 'pad2ps-3.1/INSTALL' ||
  $echo 'restore of' 'pad2ps-3.1/INSTALL' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'pad2ps-3.1/INSTALL:' 'MD5 check failed'
3bc7ad50baa5551522b1b0b1c3fae500  pad2ps-3.1/INSTALL
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pad2ps-3.1/INSTALL'`"
    test 3223 -eq "$shar_count" ||
    $echo 'pad2ps-3.1/INSTALL:' 'original size' '3223,' 'current size' "$shar_count!"
  fi
fi
# ============= pad2ps-3.1/README ==============
if test -f 'pad2ps-3.1/README' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'pad2ps-3.1/README' '(file already exists)'
  rm -f _sh23946/new
else
  > _sh23946/new
  $echo 'x -' extracting 'pad2ps-3.1/README' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'pad2ps-3.1/README' &&
pad2ps 3.1  1996-11-02  by S. Yoshida (seiichi@muraoka.info.waseda.ac.jp)
X
X
0. Contents
X
X	1. General information about pad2ps
X	2. Compile and install
X	3. Notice
X	4. To Do
X	5. Special Thanks
X	6. Copyright
X
X
1. General information
X
X   Pad2ps, pad2tex, and pad2eps are tools to convert a PAD source written as
X   a text file to PostScript, LaTeX, and Encapsulated PostScript(EPS) file.
X
X   PAD, which stands for Problem Analysis Diagram, is a way to 
X   illustrate the flow or structure of programs.  PAD is similar to
X   flowchart, but they are not quite the same.  The flowchart is good
X   for charting programs written in languages like BASIC, a language 
X   with GOTO statement.  To chart structured programs, like ones written 
X   in C, however, PAD is much handy than flowchart.
X
X   To draw PAD figures using this pad2ps, you first create PADEL (PAD
X   Expression Language) file by using editor.  Because the PADEL is 
X   very similar to C in syntax, most people has no trouble writting 
X   PADEL. 
X
X   Pad2ps can even translate the original programs sources 
X   directly into PAD figure.  The current version can translate C, C++,
X   Bourne shell, C shell, Jave, and AWK program sources to PAD figures.
X
X   This pad2ps will be useful for those peoples who want to analyze
X   structure of someone's programs, who are in trouble of finding
X   mistakes, and who want to make your report better.
X
X   To get more information about syntax of PADEL or how to use
X   pad2ps, please read the PAD manual (manual.ps).
X
X
2. Compile and install
X
X   For information on how to compile pad2ps, please refer to INSTALL.   
X
X
3. Notice
X
X   There are a few known bugs in the current version of pad2ps
X
X     - The execute files and modules will not work properly if you 
X       "gzexe" them.
X
X     - In case of abnormal termination (eg terminated by Segmentation
X       Fault or by C-c), the program may fail to delete garbages
X       (temporary files) in /tmp.
X
X     - pad2tex does not support string folding, so a long string and a 
X       deep nesting may result in unbalanced output.  
X       (the figures may stick out to right side) 
X
X
4. To do
X
X   Supporting other languages is our biggest problem now.  It has
X   two meanings:
X
X     - Enable to translate Tcl/Tk, fortran, and other languages directly
X       to PAD
X       (In the next release Tcl/Tk, Pascal, Fortran, and Perl will be 
X        supported)
X
X     - Enable to write PADEL in syntax similar to languages other than C
X       (The current PADEL's syntax is similar to that of C
X        language. So when you are making a C program, it is ease to
X        write the overview in PADEL at first. But making a program in
X        other languages, you have to make a PADEL at first and convert 
X        it after, or you have to make a program in the syntax of the
X        language you use without making PADEL overview. But this will
X        not be implemented in near future.)
X
X    In near future, "pad2java", a module that outputs a Java program
X    which draws the PAD, will be added.  By using this program, you
X    can put your PAD figures in your homepage.
X
X    There is also a plan to support flowchart.  This means, we are to 
X    create FLOWEL, a language to experss flowchart.  You will create
X    the text file under this FLOWEL syntax and named it .flow, and convert this
X    file into PADEL by flow2pad.  Finally, you will get PAD figures with
X    pad2ps.
X    The problem here is we also need a tool that would draw real flowchart
X    from .flow file.  The project is in progress, so stay tuned for a while.
X
X
X    Seveal other plans exist, but all of these will not be implemented 
X    for a while:
X
X      - Expanding macros in C program (unlike cpp, expand only ones that
X        are defined in that file and keep its readability)
X
X      - Adjusting strings which spread over two pages
X
X      - Enabling to draw PAD with color
X
X      - Enabling to customize shapes of PAD figures
X
X
X    For the latest infomation on pad2ps, please check my homepage.
X    You can also get the latest version and the alpha version of the
X    next release from my homepage.  The WWW address is:
X
X        http://www.info.waseda.ac.jp/muraoka/members/
X                seiichi/project/pad2ps.html
X
X
5. Special Thanks
X
X    - Mr. Jun'ya Kato (kato@goto.info.waseda.ac.jp)
X
X        For telling me the way to handle Japanese and making the program
X        to handle options with libarg, and for cooperating fully in 
X        making the very first version of pad2ps.
X
X    - Mr. Tony Valsamidis (tony@cs.city.ac.uk)
X
X        For revising for FreeBSD.
X
X    - Mr. Yuji Hatakeyama (hatakeya@otsl.oki.co.jp)
X
X        For enabling to select pages in 'Ghostview' and fixing
X        the bug (PAD disappeared with psnup).
X
X    - Mr. Yusuke Kato (you@lakshmi.tdc.unisys.co.jp)
X
X        For handling ^L and fixing bugs (dealing with comments with "/*")
X
X    - Mr. Takashi Osoegawa (osoegawa@cae.daikin.co.jp)
X
X        For enlighted me with various ideas and opinions about
X        pad2ps.  And for cooperating in debugging pad2ps test version.
X
X    - Mr. Satoru Tsukada (tsukada@tcd.hitachi.co.jp)
X
X        For fixing the bug (the font size is queer with psnup).
X
X    - Mr. Daisuke Fujii (fujii@rins.ryukoku.ac.jp)
X
X        For suggesting about PAD syntax, and for making a
X        prototype of a script to support csh and awk.
X        He is a person who sets the name PADEL.
X
X    - Mr. Satoshi Kuramochi (satoshi@ueda.info.waseda.ac.jp)
X
X        For offering the style file 'pad.sty' to draw PAD in
X        LaTeX.  And for giving me ideas and opinions about pad2tex
X        and the debugging of pad2tex from the very first step.
X
X    - Mr. Kousuke Fukaya (kousuke.fukaya@brother.co.jp)
X
X        For fixing the bug (one #undef undefines all the defined
X        symbols).
X
X    - Mr. Tomoyuki Inoue (inouet@strl.nhk.or.jp)
X
X        For enabling to compile with yacc and lex.
X
X    - Mr. Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
X
X        For pointing out that the function name link() and dup()
X        are "double booked" with unistd.h 
X
X    - Mr. Koji Mikawa (mika@njk.co.jp)
X      
X        For testing pad2ps-3.03j from the very first phase, for
X        reporting various bugs, and for giving me many suggestions
X
X    - Mr. Makoto Iguchi (iguchi@goto.info.waseda.ac.jp)
X
X        For translating pad2ps-3.1j to pad2ps-3.1 (English version)
X
X    - Mr. Ryuhei Funatu (QWJ11454@niftyserve.or.jp)
X
X        For spotting the bug that when c2pad is processing if statement
X        and find the comment while searching for else statement, the 
X        comment is included in if-block.
X
X
X    And I really thank those who cooperated debugging and sent me ideas, 
X    opinions and reports of bugs.
X
X
6. Copyright
X
X    Seiichi Yoshida (g3p120@cfi.waseda.ac.jp) has a copyright of this
X    software. But this is a free software and you can use and distribute
X    this freely. I am glad if you send me a mail when you contribute it
X    to a network society or introduce it in a book.
X
X    Mr. Satoshi Kuramochi (satoshi@ueda.info.waseda.ac.jp) has a copy-
X    right of the style file pad.sty to draw PAD in LaTeX.
X
X    The configure script is first created by GNU autoconf and is revised
X    a little by me.  The install-sh is created by FSF.
X
X    TeX is a trademark of American Mathematical Society.
X    PostScript is a registered trademark of Adobe Systems Incorporated.
X
X
--
Seiichi Yoshida
Muraoka Lab., Waseda University, Japan
AstroArts Inc.
seiichi@muraoka.info.waseda.ac.jp
http://www.info.waseda.ac.jp/muraoka/members/seiichi/index.html
SHAR_EOF
  $shar_touch -am 1102234896 'pad2ps-3.1/README' &&
  chmod 0644 'pad2ps-3.1/README' ||
  $echo 'restore of' 'pad2ps-3.1/README' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'pad2ps-3.1/README:' 'MD5 check failed'
f75de2a04262b1268dd80d6e76e5e545  pad2ps-3.1/README
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pad2ps-3.1/README'`"
    test 7554 -eq "$shar_count" ||
    $echo 'pad2ps-3.1/README:' 'original size' '7554,' 'current size' "$shar_count!"
  fi
fi
# ============= pad2ps-3.1/doc/manual.tex ==============
if test ! -d 'pad2ps-3.1/doc'; then
  $echo 'x -' 'creating directory' 'pad2ps-3.1/doc'
  mkdir 'pad2ps-3.1/doc'
fi
if test -f 'pad2ps-3.1/doc/manual.tex' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'pad2ps-3.1/doc/manual.tex' '(file already exists)'
  rm -f _sh23946/new
else
  > _sh23946/new
  $echo 'x -' extracting 'pad2ps-3.1/doc/manual.tex' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'pad2ps-3.1/doc/manual.tex' &&
\documentstyle[pad,epsf,a4,twoside,titlepage]{article}
\title{{\huge\it P A D  manual} \\ ( pad2ps 3.1 )}
\author{Seiichi Yoshida (seiichi@muraoka.info.waseda.ac.jp) \\ Translator: Makoto Iguchi (iguchi@goto.info.waseda.ac.jp)}
\date{Nov. 2, 1996}
X
\makeindex
X
\setcounter{tocdepth}{3}
\fboxsep=10pt
X
\def\indexinitial#1{{\large\bf \makebox[1em]{\mbox{}} #1} \mbox{}\\}
\def\indexentry#1#2{\makebox[2em]{\mbox{}} #1 \dotfill\ #2\\}
X
\begin{document}
X
\maketitle
X
\pagestyle{empty}
X
\vspace*{\fill}
\noindent
\TeX is a trademark of American Mathematical Society. \\
PostScript is a registered trademark of Adobe Systems Incorporated. \\
X
\newpage
X
\pagenumbering{arabic}
X
\section*{Introduction}
X
{\bf Pad2ps} series are tools to draw PAD figures of programs and algorithms.
X
PAD (Problem Analysis Diagram) is a diagram used to show the flow and
the structure of a program.  PAD is similar to the flowchart, which
you are probably familiar with.
X
The flowchart is commonly known all over the world, and the reason
behind this is probably because of its easiness to draw.
The flowchart is very useful for thinking of a {\bf flow} of a program,
but it is not good at showing an algorithm, especially that of the
structured programs.
Here I show you some reasons.
The first reason is that you need to read the flowchart from the top to 
the bottom, just along the flow, to understand the flowchart.
This will be very obnoxious when trying to understand a program as a whole,
especially when you are dealing with a huge program.
The second reason is that because flowchart cannot show structures,
flowcharts of identical algorithm, drawn by several people, will be very
different, even if the algorithm consists of only one simple loop.
Similarly, it may happen that there are two flowcharts look alike,
but one is a branch and the other is a loop.
These problems may be fatal when trying to show the algorithm.
X
PAD is a chart to show a flow and a structure of an algorithm.
The main difference from flowchart is that PAD can clearly show the 
{\bf structure}, such as the repetition and the conditional branching.
To draw PAD you have to understand the algorithm fully, so it is a bit 
hard to draw PAD than drawing flowchart.  But once you have finished
drawing PAD, it should be fairly easy for other people to understand
the processes and the structures of your algorithm.
X
Therefore, the flowchart is handy for diagraming programs written in
BASIC-like languages, or languages with GOTO-like statement; as
contrary, the PAD is good for expressing programs written in
structured languages, such as C language.  In any cases when you
introduce algorithm in a book or in your report, or when you want to preserve
the chart of your program for maintenance purpose, this PAD is most
useful.
X
{\bf Pad2ps} series are tools to draw PAD based on a text file without
using any drawing tool.
The source file's syntax, named {\bf PADEL} (PAD Expression Language), is 
similar to that of C.
You can also make them draw PAD figures directly from C, C++, Bourne
shell, C shell, Java, and AWK program sources.
The output styles can be selected from  PostScript, \LaTeX, and
Encapsulated PostScript (EPS).
X
Many people had cooperated in making these {\bf pad2ps} series.
Mr. Satoshi Kuramochi has made the style file for \LaTeX {\bf pad.sty} and
let me use it in {\bf pad2ps} series. Besides he has helped me debugging
and improving {\bf pad2tex} from the beginning.
Mr. Jun'ya Kato has cooperated fully in making the very first version
of pad2ps series, to enable to handle Japanese, and so on.
Mr. Makoto Iguchi has cooperated in making the English version of
pad2ps and in translating the manuals in English.
Mr. Takashi Osoegawa, Mr. Daisuke Fujii, and Mr. Koji Mikami have
gave me many and various profitable ideas and opinions.  Some of them
are not carried out yet, but they are to be done in the future.
Besides I have received various bug information and improving ideas
from many people. I really thank them again.
X
\begin{flushright}
X  Nov. 2, 1996 \\ Seiichi Yoshida
\end{flushright}
X
\newpage
X
\pagestyle{headings}
X
\tableofcontents
X
\newpage
X
\section{Overview of {\bf pad2ps} series}
\label{chap:overview}
X
This chapter explains how to use {\bf pad2ps} series to draw PAD figures
and points out some reminders you should be aware of when  making use 
of the output files.
X
\subsection{At first, with an editor}
X
\begin{figure}
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}input\ N}} \\ %
X    \padcond{\shortstack[l]{\rule{0mm}{2ex}N\ $>$\ 1}}{%
X        \padseq{%
X            \padbox{\shortstack[l]{\rule{0mm}{2ex}sum\ =\ 0}} \\ %
X            \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 1\ ,\ N}}{%
X                \padbox{\shortstack[l]{\rule{0mm}{2ex}sum\ =\ sum\ +\ i}}%
X            } \\ %
X            \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ sum}}%
X        }%
X    }{}%
}%
}
X
\end{center}
X
\caption{Addition from 1\ to\ N\ }
\label{pad:add1-N}
X
\end{figure}
X
Because {\bf pad2ps} series are tools to draw PAD figures from a text
file, you first need to create a PAD source using an editor.
A PAD source is written following {\bf PADEL}(PAD Expression Language) syntax.
The detail about {\bf PADEL} is fully described in 
Chapter~\ref{chap:padel}, so I will give you one example for now.
The following file will produce the PAD figure in Figure~\ref{pad:add1-N}.
X
If you are familiar to C language, you probably notice the source resembles 
C syntax; To draw PAD figure with {\bf pad2ps} series, you need to create
C-like file like this one.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
Addition from 1 to N
{
X    input N
X
X    if(N > 1){
X        sum = 0
X        for(i = 1 , N){
X            sum = sum + i
X        }
X
X        print sum
X    }
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
Let's save this file as {\tt foo.pad}.
X
\subsection{Convert to PostScript}
X
At first, let's create PostScript.  To do so, you use 
{\bf pad2ps}\index{pad2ps} command:
X
\begin{center}
\verb@% pad2ps foo.pad > foo.ps@
\end{center}
X
After converting into PostScript, you can modify the output as you like.
This is accomplished by setting parameter variables.
For more information on these parameter variables, please refer to 
Chapter~\ref{chap:param}.
X
\subsection{Convert to \LaTeX}
\label{sec:pad2tex}
X
To get \LaTeX output, you use {\bf pad2tex}\index{pad2tex} command.
X
\begin{center}
\verb@% pad2tex foo.pad > foo.tex@
\end{center}
X
You can check the result by observing dvi file.
X
\begin{center}
\begin{tabular}{l}
\verb@% jlatex foo.tex@ \\
\verb@% xdvi foo.dvi@
\end{tabular}
\end{center}
X
When you are converting large C program, however, the output PAD figure
is most likely stuck out to right.  To get neat output, therefore, you 
better convert your PAD source to PostScript instead of, \LaTeX.  Converting
large PAD source to \LaTeX will force you to manually insert 
$\backslash\backslash$ in appropriate places after creating \LaTeX code, as
to adjust your output.
X
Converting to \LaTeX is probably handy when you are to draw fairly small
PAD figures that would fit in one page and when you are to put the figures
onto your paper or report written in \LaTeX.  In this case, cut the
part that is in between \verb@\begin{figure}[h]@ and
\verb@\end{figure}@ ,or the part that is in between inner
\verb@\padseq{%@ and {%\verb@}@ from {\tt foo.tex}.  Finally, insert
the part cut onto appropriate places in your paper or
report.
X
This manual is made in that way.
X
Also, set to load {\bf pad.sty}\index{pad.sty}
\footnote{made by Satoshi Kuramochi {\bf pad.sty} ver. 1.1}
in \verb@\documentstyle@ statement.
If necessary, copy other commands.  For example, interval between PAD figure 
and its frame will be very narrow if you do not copy \verb@\fboxsep=10pt@.
X
By the way, when you are creating output in \LaTeX format with {\bf pad2tex},
you can use \LaTeX commands by setting `latex' in parameter 
{\bf texmode}\index{texmode}.  For instance, the following example will 
create PAD figure in figure~\ref{pad:sqrt2}.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
/* pad2ps: texmode = latex */
X
Example with \LaTeX commands
{
X    /* pad2ps: message = Calculate $\sqrt{2}$ */
X    $ x = 1 $
X    while ( $ | x^{2} - 2 | > 0.0001 $) {
X        $ \displaystyle x = x - \frac{x^{2} - 2}{2 x} $
X    }
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
X
\begin{figure}[h]
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padmessage{\shortstack[l]{\rule{0mm}{2ex}Calculate $\sqrt{2}$}} \\ %
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}$ x = 1 $}} \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}$ | x^{2} - 2 | > 0.0001 $}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}$ \displaystyle x = x - \frac{x^{2} - 2}{2 x} $}}%
X    }%
}%
}
X
\end{center}
X
\caption{Example with \LaTeX commands}
\label{pad:sqrt2}
X
\end{figure}
X
Default width of indentation is 4 columns.  You can change this setting
with {\tt -tab}\index{-tab}option.  If you do not want indentation, set
the option as {\tt -tab 0}.
X
\subsection{Encapsulated PostScript(EPS)}
X
The case you want to translate into EPS style is mainly when you want to
draw a large PAD figure that would spread over several pages and when you
want to shrink it to put in your \LaTeX report.
X
To convert into EPS style, use {\bf pad2eps}\index{pad2eps} command.
X
\begin{center}
\verb@% pad2eps foo.pad foo@
\end{center}
X
Unlike {\bf pad2ps} or {\bf pad2tex}, you have to input a header of output
files.  If the PAD figure spreads over several pages after translated in 
PostScript with {\bf pad2ps}, EPS output produced by {\bf pad2eps} will be
several files accordingly.
The name of these file are combinations of name header, page number, and 
suffix {\tt .eps} (like {\tt foo.1.eps}, {\tt foo.2.eps}, $\cdots$).  
If you do not set the header, names of output files will be set as 
something like {\tt .1.eps}.  In this case the files will not be
listed by {\tt ls} command, so pay attention.  
Also, when you are to let {\bf pad2eps} read from stdin and specify
the name of the output file, you have to use 
{\tt -stdin}\index{-stdin} option.
X
\begin{center}
\verb@% cat foo.pad | pad2eps -stdin foo@
\end{center}
\noindent
X
To make use of the EPS outputs in your \LaTeX report, modify
\verb@\documentstyle@ statement at the top to load 
{\bf epsf.sty}\index{epsf.sty}.  Then, write as follows at the place where
you want to insert your EPS files:
X
X
\begin{center}
\verb@\epsfile{file=foo.1.eps,width=5cm,height=7cm}@
\end{center}
X
The example with EPS files embedded is figure~\ref{fig:ack} in 
chapter~\ref{param:poster}.
X
\newpage
X
\section{PADEL syntax}
\label{chap:padel}
X
This chapter explains syntax of {\bf PADEL}\index{PADEL}
(PAD Expression Language).
X
To draw PAD, you first write a PAD source file as a text file and then
convert this file with {\bf pad2ps} as described in 
chapter~\ref{chap:overview}.
The syntax of {\bf PADEL} is very similar to that of C, so mastering 
{\bf PADEL} is very easy if you know C syntax.
X
But there are some points you should pay attention.
The most important point is that return code has special meaning.
Therefore, if the following section tells you to make a new line, you should
do so.  
This complexity is created as to enable writing any string freely.  You can
use space as you like.  Especially spaces at head of lines are
ignored, enabling to let you indent as you like.
X
The usage of string is more freely than other languages.
You can use braces and parenthesis freely, and they need not to be paired.
" and ' may also be used freely, and even one " is OK.
Signs such as $\backslash$ may be used quite as same as alphabets and 
numbers.
Reason behind these loose restriction is my fundamental thought toward
{\bf pad2ps} series; that is, you should be able to use any characters
in PADEL, thereby able to print any characters in PAD figure.
X
Therefore, you can write something like:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
if( (^_^;;; )
X    m(_ _)m <=={ '"^\(-o-)
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
and still you can get PAD figure as it is.
X
\begin{center}
X
\fbox{%
\padcond{\shortstack[l]{\rule{0mm}{2ex}(\^{}\_{}\^{};;;}}{%
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}m(\_{}\ \_{})m\ $<$==\{\ '"\^{}$\backslash$($-$o$-$)}}%
}{}%
}
X
\end{center}
X
X
\subsection{Composition of PAD and PAD title}
X
The common style of writng PADEL source is like this.
This is a function to calculate factorial of $n$.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
factorial(n)
{
X    f = 1
X    for(i = 1, n)
X        f = f * i
X    return f
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
This example shows the fundamental composition of a PAD in PADEL file. 
First of all, you write a PAD title.  Then enclose commands with 
\verb@{ }@ \index{\{,\}}.  Inside \verb@{ }@ may be empty.
This style is as same as function declaration in C program.
As you can write several functions in one C program, you can write 
several PADs in one PADEL file.
X
Now I will point out some critical points.
X
First, you have to write a PAD title in one line.
And you have to make a new line at end of PAD title.
So this C-style PAD is an error.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
factorial(n){
X    f = 1
X    for(i = 1, n)
X        f = f * i
X    return f
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
You may think of this as an unnecessary limitation.  But this limitation was
necessary to enable you to use any characters, including braces, in a title
string.
I have already explained about this at beginning of this chapter, so refer
to those for more information.
X
I have said that PADEL commands are enclosed by \verb@{ }@, but to be
more exact, line ONLY with \verb@{@(left brace) expresses beginning of
PAD commands, and line ONLY with \verb@}@(right brace) means ending of 
PAD commands.
Hence, you cannot omit a newline code.
X
You can use alomost any characters in title, and they will be printed as they
are.  There are some exceptions, though.  You cannot make following titles:
X
\begin{itemize}
X  \item A title which consists of only one \verb@{@ or \verb@}@ 
X  \item A title which begins with \verb@/*@ or \verb@//@ 
\end{itemize}
\noindent
X
If you like, you can omit a PAD title.
X
\subsection{Write a statement}
X
Here is an example:
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
input x
print x*x
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}input\ x}} \\ %
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ x$*$x}}%
}%
}
X
\end{center}
X
As in this example, you just write each process as a normal statement, one 
process in one line, when you are to draw PAD of sequencially executed 
processes.  
X
Only one process per line is a rule.  You should not put a new line
in middle of a process or should not put two or more processes in one line.
X
You can use alomost any characters in a statement.  In several cases, however,
you have to obey rules and write accordingly.
These specail cases are as follows:
X
\begin{itemize}
X  \item drawing an empty box
X  \item writing a statement that begins with reserved words such as 
X        \verb@for@, \verb@while@.
X  \item writing a statement that begins with \verb@{@.
X  \item writing a statement with only one \verb@}@.
X  \item writing a statement that begins with \verb@}else@ , \verb@}while@, or
X	\verb@}catch@.
X  \item	writing a statement that is regarded as a label, such as \verb@L1:@.
X  \item writing a statement that begins with \verb@/*@ or \verb@//@. 
\end{itemize}
X
In these cases, use \verb@{@ and \verb@}@ \index{\{,\}} as follows.  In this
case you should put a part from \verb@{@ to \verb@}@ in one line.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
{        }
{ for ( i = 0, 10 ) }
{ {{{ } }
{ /* comment */ }
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}\ \ \ \ \ \ \ \ }} \\ %
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}for\ (\ i\ =\ 0,\ 10\ )}} \\ %
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}\{\{\{\ \}}} \\ %
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}/$*$\ comment\ $*$/}}%
}%
}
X
\end{center}
X
You can write any string within \verb@{@ and \verb@}@.
X
\subsection{Adjust intervals with empty lines}
X
In PADEL you can make some vertical spaces by putting some empty lines.
Empty lines will open spaces between two PADs as well as inside PAD body.
Empty lines before the first PAD, meaning those on top of file, are
exceptionally ignored.
X
Since empty lines have such meaning, it may cause an error if you put empty
lines wherever you like.
X
Making more precise adjustment is accomplished by setting a parameter variable
{\bf vsp}.
See chapter~\ref{param:vsp} for more information.
X
\subsection{Block}
X
Normally one process is drawn in one box, but sometimes you may want to 
put several processes in the same box.
I call this kind of box, with several processes in it, as a block.
X
To draw a block, enclose the commands to be put in the block with line 
ONLY with \verb@{@(left brace) and line ONLY with 
\verb@}@(right brace)\index{\{,\}}.
Here is an example.  This is an addition of two vectors.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
{
X    input a.x
X    input a.y
}
{
X    input b.x
X    input b.y
}
{
X    c.x = a.x + b.x
X    c.y = a.y + b.y
}
{
X    print c.x
X    print c.y
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padboxss{%
X        \shortstack[l]{\rule{0mm}{2ex}input\ a.x} \\ 
X        \shortstack[l]{\rule{0mm}{2ex}input\ a.y}%
X    } \\ %
X    \padboxss{%
X        \shortstack[l]{\rule{0mm}{2ex}input\ b.x} \\ 
X        \shortstack[l]{\rule{0mm}{2ex}input\ b.y}%
X    } \\ %
X    \padboxss{%
X        \shortstack[l]{\rule{0mm}{2ex}c.x\ =\ a.x\ +\ b.x} \\ 
X        \shortstack[l]{\rule{0mm}{2ex}c.y\ =\ a.y\ +\ b.y}%
X    } \\ %
X    \padboxss{%
X        \shortstack[l]{\rule{0mm}{2ex}print\ c.x} \\ 
X        \shortstack[l]{\rule{0mm}{2ex}print\ c.y}%
X    }%
}%
}
X
\end{center}
X
You can use almost any character in a block, and they will be printed as they
are.  There are some exceptions, though:
X
\begin{itemize}
X  \item a string that consists of only one \verb@{@ or \verb@}@.
X  \item a string that begins with \verb@/*@ or \verb@//@.
\end{itemize}
X
By adding an empty line in a block, you can put an empty line in output 
accordingly.
X
\subsection{Draw loop process}
X
There are two types of loop.  One is previously checked loop, or a loop that
checks condition at first and executes its inner body only if the condition is
true.  The another one is lately checked loop, or a loop that executes its 
inner loop body at first and then checks its condition, deciding whether 
the inner body is to be executed again or not.  
There is also a special type of previously checked loop that repeats its 
inner process for given number of time, thereby repeating for given constant
number.
In PADEL, you use {\bf while}\index{while} for previously check repetition, 
{\bf do $\sim$ while}\index{do $\sim$ while} for lately checked repetition, and
{\bf for}\index{for} for constant numbered repetition.
X
This example shows how these loops are used:
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
do{
X    input N
}while(N < 1)
X
for(i = 1, N){
X    input A[i]
}
X
for(i = 2, N){
X    j = i
X    while(j >= 2  &&  A[j-1] > A[j]){
X        A[j-1] <-> A[j]
X        j = j - 1
X    }
}
X
for(i = 1, N){
X    print A[i]
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padrepeat{\shortstack[l]{\rule{0mm}{2ex}N\ $<$\ 1}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}input\ N}}%
X    } \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 1,\ N}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}input\ A[i]}}%
X    } \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 2,\ N}}{%
X        \padseq{%
X            \padbox{\shortstack[l]{\rule{0mm}{2ex}j\ =\ i}} \\ %
X            \padwhile{\shortstack[l]{\rule{0mm}{2ex}j\ $>$=\ 2\ \ \&\&\ \ A[j$-$1]\ $>$\ A[j]}}{%
X                \padseq{%
X                    \padbox{\shortstack[l]{\rule{0mm}{2ex}A[j$-$1]\ $<$$-$$>$\ A[j]}} \\ %
X                    \padbox{\shortstack[l]{\rule{0mm}{2ex}j\ =\ j\ $-$\ 1}}%
X                }%
X            }%
X        }%
X    } \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 1,\ N}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ A[i]}}%
X    }%
}%
}
X
\end{center}
X
This is an algorithm to sort $N$ data and print the result.
X
First, it get number of data, $N$.  If $N$ is less than $1$, it urges to 
input a valid number.
This is an example of lately checked loop; it first executes some processes and
then checks its condition.
X
Next, it receives $n$ data.
This is written using {\bf for} since the same process is executed for constant
number of time.
After that, it compares current value with previous and if the previous is 
larger than the current, exchange them and repeat this process again.
In this case, {\bf while} is used because it is previously checked repetition.
By the way, both {\bf for} and {\bf while}are previously checked repetition 
and their PAD figures will be the same.  I strongly recommend you, though, 
to use {\bf for} for constant repetition and {\bf while} for all other 
previously checked repetition.
X
Now, I am going to tell you some tips.
X
First, you do not have to enclose repetition body with
\verb@{ }@ \index{\{,\}} if the repetition body is one command only.
X
Thus, the following example is OK:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
for(i = 1, N)
X    input A[i]
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
Of course, enclosing it with \verb@{ }@ is no problem.
Moreover, the repetition body may be empty as well:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
for(i = 1, N){
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
In this case, you should enclose the body with \verb@{ }@.
X
However, the next C-like program is an error.
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
for(i = 1, N)  input A[i]
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
This is because there are two commands, repetition command
\quad for(i = 1, N) \quad and \quad input A[i] \quad in one line.
X
Of course, the next example is also an error:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
for(i = 1, N){  input A[i]  }
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
You can insert a return coe just before \verb@{@ and just after \verb@}@
in {\bf do $\sim$ while} statement.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
do
{
X    input N
}
while(N < 1)
X
for(i = 1, N)
{
X    input A[i]
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
You cannot make a new line in other places.
X
You can add spaces as you like.
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
for  (  i = 1, N  )  {
X    input A[i]
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
You can use any characters in conditional statement.
X
\subsection{Drawing conditional branch}
X
To draw a conditional branch, use {\bf if $\sim$ else} or {\bf switch}.
Generally, {\bf if $\sim$ else} is for drawing a simple conditional branch, 
and {\bf switch} is for drawing a multiplex branch.
X
In either case, you can use any characters in conditional statement.
X
\subsubsection{Simple branch}
X
To draw a simple branch, you use {\bf if $\sim$ else}\index{if $\sim$ else}.
But notice that using 
{\bf if $\sim$ else}\index{if $\sim$ else} statement does not guarantee
that the output will be a simple branch; it may be possible that the output
becomes a multiplex branch.  For more information, refer to 
section\ref{sec:switch}.
X
The simplest conditional branch is one that has only {\bf if}.  This example 
is a program to return an absolute value.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
if(x < 0)
X    x = -x
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\begin{center}
X
\fbox{%
\padcond{\shortstack[l]{\rule{0mm}{2ex}x\ $<$\ 0}}{%
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}x\ =\ $-$x}}%
}{}%
}
X
\end{center}
X
By using {\bf else} you can write process to be executed when condition is
false.  The next example calculate a square root, and it will print an 
imaginary unit $i$ if the number is negative:
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
if(x >= 0)
X    print sqrt(x)
else{
X    print sqrt(-x)
X    print 'i'
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\begin{center}
X
\fbox{%
\padcond{\shortstack[l]{\rule{0mm}{2ex}x\ $>$=\ 0}}{%
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ sqrt(x)}}%
}{%
X    \padseq{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ sqrt($-$x)}} \\ %
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ 'i'}}%
X    }%
}%
}
X
\end{center}
X
Finally, I am going to explain valid and invalid syntax of 
{\bf if $\sim$ else} statement.
X
If true part or false part contains only one command, you do not have to
enclose it with \verb@{ }@ \index{\{,\}} as in the first example.
X
However, these are both illegal:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
if(x < 0)  x = -x
if(x < 0){  x = -x  }
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
You can omit both true part and false part.
Hence, the following example is OK:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
if(x >= 0){
}else{
X    x = -x
}
X
if(x < 0){
}else{
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
You can insert a newline code before \verb@{@ and after \verb@}@, and
you can put as many spaces as you like.
So, the next example is valid.
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
if  (  x >= 0  )
{
X    print sqrt(x)
}
else
{
X    print sqrt(-x)
X    print 'i'
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
X
\subsubsection{Multiplex branch}
\label{sec:switch}
X
To draw a multiplex branch, you normally use {\bf switch}\index{switch}
The next example returns a sign:
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
switch{
X    case x>0:
X        return 1
X    case x=0:
X        return 0
X    case x<0:
X        return -1
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\begin{center}
X
\fbox{%
\padcase{}{%
X    \shortstack[l]{\rule{0mm}{2ex}x$>$0}:%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}return\ 1}},%
X    \shortstack[l]{\rule{0mm}{2ex}x=0}:%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}return\ 0}},%
X    \shortstack[l]{\rule{0mm}{2ex}x$<$0}:%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}return\ $-$1}}%
}%
}
X
\end{center}
X
Like in this example, a multiplex branch has more than three branch 
destinations.
Each condition is written with {\bf case}\index{case}.
X
X
If you are familiar with C language, you may prefer this style:
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
switch(n%3){
X    case 0:
X        print Multiple of 3
X    case 1:
X        print Remainder is 1
X    case 2:
X        print Remainder is 2
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
This is equivalent to the following:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
switch{
X    case n%3=0:
X        print Multiple of 3
X    case n%3=1:
X        print Remainder is 1
X    case n%e=2:
X        print Remainder is 2
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
You can write several conditional expressions in order.
You can also write processes to be executed when all conditions are false with
{\bf default}\index{default}.
At that time, no character will be prited in PAD figure.
X
The following program checks a number sequence and count up how many $1$, 
single place prime numbers, and others are in the given sequence.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
{
X    one = 0
X    prime = 0
X    others = 0
}
X
for(i = 1, N){
X    switch(A[i]){
X        case 1:
X            one = one + 1
X        case 2:
X        case 3:
X        case 5:
X        case 7:
X            prime = prime + 1
X        default:
X            others = others + 1
X    }
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padboxss{%
X        \shortstack[l]{\rule{0mm}{2ex}one\ =\ 0} \\ 
X        \shortstack[l]{\rule{0mm}{2ex}prime\ =\ 0} \\ 
X        \shortstack[l]{\rule{0mm}{2ex}others\ =\ 0}%
X    } \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 1,\ N}}{%
X        \padcase{}{%
X            \shortstack[l]{\rule{0mm}{2ex}A[i]=1}:%
X                \padbox{\shortstack[l]{\rule{0mm}{2ex}one\ =\ one\ +\ 1}},%
X            \shortstack[l]{%
X                \shortstack[l]{\rule{0mm}{2ex}A[i]=2} \\ %
X                \shortstack[l]{\rule{0mm}{2ex}A[i]=3} \\ %
X                \shortstack[l]{\rule{0mm}{2ex}A[i]=5} \\ %
X                \shortstack[l]{\rule{0mm}{2ex}A[i]=7}%
X            }:%
X                \padbox{\shortstack[l]{\rule{0mm}{2ex}prime\ =\ prime\ +\ 1}},%
X            \rule{0mm}{2ex}:%
X                \padbox{\shortstack[l]{\rule{0mm}{2ex}others\ =\ others\ +\ 1}}%
X        }%
X    }%
}%
}
X
\end{center}
X
X
You can omit the contents of {\bf case} and {\bf default}, thereby stating
that nothing is to be done when the corresponding condition is true.
In this case put only an empty line after the condition.
Here is an example:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
switch{
X    case x%3=0:
X
X    case x%3=1:
X        move(+1)
X    case x%3=2:
X        move(-1)
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
This example will produce the next PAD figure:
\begin{center}
X
\fbox{%
\padcase{}{%
X    \shortstack[l]{\rule{0mm}{2ex}x\%3=0}:%
,%
X    \shortstack[l]{\rule{0mm}{2ex}x\%3=1}:%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}move(+1)}},%
X    \shortstack[l]{\rule{0mm}{2ex}x\%3=2}:%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}move($-$1)}}%
}%
}
X
\end{center}
\noindent
X
You can make a new line just before \verb@{@ in {\bf switch} command.
You can put as many spaces as you like.
These rules are quite the same as those of loop and a simple branch.
You have to write a branch label such as {\bf case} and {\bf default}
in one line.
So, the next example is an error.
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
switch{
X    case n > 0  &&
X         m > 0:
X                print n*m > 0
X    case n < 0: print n < 0
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
Now, I am going to show you the way to write a multiplex branch with 
{\bf if $\sim$ else if $\sim$ else}\index{if $\sim$ else}.
X
Check the next example:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
if(x>0)
X    return 1
else if(x=0)
X    return 0
else
X    error
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
This is equivalent to the next example with {\bf switch} statement:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
switch{
X    case x>0:
X        return 1
X    case x=0:
X        return 0
X    default:
X        error
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
\begin{center}
X
\fbox{%
\padcase{}{%
X    \shortstack[l]{\rule{0mm}{2ex}x$>$0}:%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}return\ 1}},%
X    \shortstack[l]{\rule{0mm}{2ex}x=0}:%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}return\ 0}},%
X    \rule{0mm}{2ex}:%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}error}}%
}%
}
X
\end{center}
X
If you add a newline in middle of {\bf else if}, it is no longer 
regarded as {\bf if $\sim$ else if $\sim$ else}.
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
if(x>0)
X    return 1
else
if(x=0)
X    return 0
else
X    error
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
In this case the result is like this.
Notice that it has become a nesting of {\bf if $\sim$ else} commands.
X
\begin{center}
X
\fbox{%
\padcond{\shortstack[l]{\rule{0mm}{2ex}x$>$0}}{%
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}return\ 1}}%
}{%
X    \padcond{\shortstack[l]{\rule{0mm}{2ex}x=0}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}return\ 0}}%
X    }{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}error}}%
X    }%
}%
}
X
\end{center}
X
As shown in this example, you need to be careful when using {\bf if} command.
When your PAD figure looks different from what you have expected, recall 
the contents in this section and debug your source.
On contrary, you can change shapes of branches by using these command properly.
X
\subsection{Exception handler}
X
Exception handler is defined as a set of processes to be executed when 
some errors are detected while executing certain set of processes.
These error-handling processes are written useing 
{\bf try $\sim$ catch}\index{try $\sim$ catch}.
The syntax is probably obvious from the next example:
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
try{
X    for(x = 0, 1, 0.01){
X        y = f(x) / g(x)
X        print y
X    }
}catch(g(x) = 0){
X    print 'Divided by 0!'
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
The result is the following:
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}x\ =\ 0,\ 1,\ 0.01}}{%
X        \padseq{%
X            \padbox{\shortstack[l]{\rule{0mm}{2ex}y\ =\ f(x)\ /\ g(x)}} \\ %
X            \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ y}}%
X        }%
X    } \\ %
X    \padcond{\shortstack[l]{\rule{0mm}{2ex}g(x)\ =\ 0}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ 'Divided\ by\ 0!'}}%
X    }{}%
}%
}
X
\end{center}
X
The output PAD figure is as same as {\bf if} statement.  This is because
there is no such concept as exception handler in PAD itself.
X
The rules for putting a return code and \verb@{ }@ is as same as that of
repetition and conditional branch.
If the content of {\bf try} or {\bf catch} is in one line, you do not have
to enclose the content with \verb@{ }@.
You can add a return code before and after \verb@{@ or \verb@}@, and you
can put as many spaces as you like.
Hence, the next example is valid.
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
try
X    print sty
catch(str = NULL)
X    print 'NULL!'
X
try
{
X    print sty
}
catch (str = NULL) {
X    print 'NULL!'
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
The next example is invalid.
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
try{  print sty  }
catch(str = NULL)  print 'NULL!'
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
\subsection{Labeling and referencing}
X
In PADEL, you can draw labels in PAD figure.
In PAD figure the labels are encircled.
To draw the label, you use {\bf label}\index{label} command.
This means that you can use spaces and \verb@{ }@ freely.
X
To refer to the label, you use {\bf refer}\index{refer} command.
The label to be referenced is also encircled in PAD figure.
You can use any label name in {\bf refer} statement.
The label to be referenced is not checked for its existance, so you can
use undefined label name.
X
Here is an example of labeling and referencing:
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
label Let's start!
input x
label Repeat 10 times.
for (i = 1, 10)
X    print x*i
refer (Let's start!) {
X    goto
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
The result figure is the following.
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padlabel{\shortstack[l]{\rule{0mm}{2ex}Let's\ start!}} \\ %
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}input\ x}} \\ %
X    \padlabel{\shortstack[l]{\rule{0mm}{2ex}Repeat\ 10\ times.}} \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 1,\ 10}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ x$*$i}}%
X    } \\ %
X    \padboxss{%
X        \shortstack[l]{\rule{0mm}{2ex}goto} \padref{\shortstack[l]{\rule{0mm}{2ex}Let's\ start!}}%
X    }%
}%
}
X
\end{center}
X
As in this example, all you have to do is to write a label after {\bf label}
command.  Notice you have to write this in one line, without any return code.
X
Let explain more about referencing by {\bf refer} statement.
In {\bf refer} statement, you first write the name of its reference 
destination label inside \verb@( )@, and then write statements inside 
\verb@{ }@.
Therefore, to draw ``goto label'', you would write as follows:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
refer (LABEL) {
X    goto
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
This syntax is similar to that of repetition and conditional branch, and
the rules for putting a return code and spaces are also the same.
How the inside of \verb@{ }@ is handled, however, is not as same as that
of repetition and conditional branch, so be careful.
In {\bf refer} statement the content of \verb@{ }@ is treated as a normal 
string.
For example, the following example:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
refer (EXIT) {
X    if (x = 0)
X        print '\n'
X    print 'The End'
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
will produce:
\begin{center}
X
\fbox{%
\padboxss{%
X    \shortstack[l]{\rule{0mm}{2ex}if\ (x\ =\ 0)} \\
X    \shortstack[l]{\rule{0mm}{2ex}print\ '$\backslash$n'} \padref{\shortstack[l]{\rule{0mm}{2ex}EXIT}} \\
X    \shortstack[l]{\rule{0mm}{2ex}print\ 'The\ End'}%
}%
}
X
\end{center}
\noindent
X
There is also an abbreviated label format.
Syntax of abbreviated label is as same as that of C language; 
it is combination of alphabets and \_{} (underscore), and : (column) is 
attached to tail of label.
For instance:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
LABEL1:
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
is as same as:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
label LABEL1
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
Be careful that you cannot write other commands after : (column).  
You can add spaces before label, between label and :, and after :, but
the label name itself cannot include spaces.
You cannot use reserved words such as \verb@for@ for label name.
X
\subsection{Comment}
\label{seq:com}
X
As in other program languages, you can write comments in PADEL.
The content of comment will not take effect on PAD figure.
X
The style of writing comments is as same as that of C and C++.
So, these two styles are both valid.
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
/* Comment */
// Comment
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
\index{/$*$ $\sim$ $*$/}
\index{//}
X
Please note that you cannot write a comment wherever you like.
In PADEL, a comment has to be independent as a comment line.
It means you cannot write a PADEL command and comment in one line.
To be more exact, there should be no character other than spaces before 
\verb@/*@ or \verb@//@, and there should be no character other than spaces
and a return code after \verb@*/@.
Therefore, the following example is illegal:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
for ( i = 0, N )        /* sum up til N */
X    sum = sum + i
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
It is OK to add a newline code in middle of C-style comment.
X
By the way, a comment is also used to set parameter variables in PADEL.
By setting these parameters, you can enrich and decorate your PAD figures.
These parameter variables are fully explained in chapter~\ref{chap:param}.
X
\newpage
X
\section{Draw PAD figure directly from a program}
X
This chapter explains how to make {\bf pad2ps} series draw PAD figure 
directly from a program source.
It's commonly hard to read someone's program, but it will be much easier 
to understand with {\bf pad2ps} series.
X
When drawing PAD directly from a program , {\bf pad2ps} series
carry out two steps.
At first {\bf pad2ps} series call a parser for the appropriate 
language and translate the original program into a PADEL file.
Then {\bf pad2ps} series read this PADEL file and draw PAD figure from it.
If you want to modify PAD figure of a program, not only to draw PAD of
the program as it is, you had better use the parser directly and
translate the program into a PADEL file.  Then you can modify the PAD figure
freely without touching the original program.
To convert programs into PADEL, use {\tt mkpad}\index{mkpad} command.
If the original program is in C, for example:
X
\begin{center}
\verb@% c2pad foo.c > foo.pad@
\end{center}
\noindent
X
Then modify this {\tt foo.pad} accordingly and then translate it with 
{\tt pad2ps} series.
X
In case of error the line number printed is not a line number on an original
program, but a line number on a file created by parser.
X
\subsection{C}
\label{sec:C}
\index{C}
X
When drawing a PAD figure directly from C program, type in:
\begin{center}
\verb@% pad2ps -c foo.c > foo.ps@
\end{center}
\noindent
You do not have to specify the option {\tt -c}\index{-c} if the suffix
of the input file is {\tt .c}.
X
A parser of C language is {\bf c2pad}\index{c2pad}.
To execute this parser directly and convert program into PADEL, type in:
\begin{center}
\verb@% mkpad -c foo.c > foo.pad@
\end{center}
\noindent
In this case you cannot omit the option {\tt -c}.
X
When processing C program, each function will become a PAD figure.
Each function name becomes the corresponding PAD's title.
All global variables outside function is discarded.
You can also discard variable declarations without initialization by setting
{\tt -O}\index{-O} option, even if the declaration is made inside function.
X
By defalut, ; (semicolumn) at end of line is not printed in PAD figure.
By setting {\tt -semicolon}\index{-semicolon} option, you can override this.
X
The most important point when converting C program is conditional compile
controller, such as {\tt \#ifdef}.
For example, you are to create PAD figure of {\tt foo.c}.  If you have 
set {\tt -DENGLISH} when you compiled {\tt foo.c} like the following:
X
\begin{center}
\verb@% gcc foo.c -DENGLISH@
\end{center}
\noindent
X
then you also have to set the same option when you let {\bf pad2ps} series
draw PAD figure.  This is accomplished using {\tt -D}\index{-D} option:
X
\begin{center}
\verb@% pad2ps foo.c -D ENGLISH > foo.ps@
\end{center}
\noindent
X
Notice that the way of setting option is slightly different from that of C 
compiler.
X
There are some symbols, however, that are automatically defined by C compiler.
Besides {\bf pad2ps} series ignore \quad {\tt \#include <stdio.h>} \quad 
so the symbols defined in header files are also missed.
Therefore you should define all the symbols that should be defined 
with {\tt -D} option.
You can list up all the symbols which have something to do with
conditional compilation with {\tt -ifdef} option.  Here is an example: 
X
\begin{center}
\verb@% pad2ps foo.c -ifdef@
\end{center}
\noindent
X
You should be able to draw PAD figures for most of your C programs.
Only exception case is programs that do not match with C syntax in appearance 
due to macros. 
Especially a macro command which doesn't end with ';' (a semicolon) like:
\begin{tabular}{l}
\verb@#define NUMBER(X)  { int a; for( a='0' ; a<=X ; a++) putchar(a);}@ \\
\( \quad \quad \vdots \) \\
\verb@puts(``Print Numbers'');@ \\
\verb@NUMBER('9')@ \\
\verb@putchar('\n');@ \\
\end{tabular}\\
X
\noindent
often causes an error.
X
In this case, the only solution is to modify it manually.
Even if no errors occur, output PAD figure may be incorrect.
After all you have to pay special attention when drawing PAD figure of a 
program with many macros.
X
\subsection{C++}
\index{C++}
X
To draw a PAD figure directly from C++ program, type in:
\begin{center}
\verb@% pad2ps -c++ foo.C > foo.ps@
\end{center}
\noindent
You can omit the option {\tt -c++}\index{-c++} if the suffix of the input
file is {\tt .C}, {\tt .cc}, or {\tt .cpp}.
X
A parser for C++ program is {\bf c2pad}\index{c2pad}.
To execute this parser directly, type in:
\begin{center}
\verb@% mkpad -c++ foo.C > foo.pad@
\end{center}
\noindent
In this case you cannot omit {\tt -c++} option.
X
The points you should be aware of when translating C++ programs 
are the same as those of C, so refer to section~\ref{sec:C}.
X
In case of C++, class definitions will be also ignored.
By default, inline functions defined in a class definition will also
be ignored.  To override this feature, set {\tt -inline}\index{-inline}
option.  In this case the class name will be attached to the name of
the inline function.
X
\subsection{Bourne shell}
\index{Bourne shell}
X
To draw a PAD figure directly from Bourne shell program, type in:
\begin{center}
\verb@% pad2ps -sh foo.sh > foo.ps@
\end{center}
\noindent
You can omit {\tt -sh}\index{-sh} option if the suffix of the input file is
{\tt .sh}.
X
A parser for Bourne shell program is {\bf sh2pad}\index{sh2pad}.
To execute this parser directly to convert the program into PADEL, type in:
\begin{center}
\verb@% mkpad -sh foo.sh > foo.pad@
\end{center}
\noindent
In this case you cannot omit {\tt -sh} option.
X
A Bourne shell program is drawn as one PAD, and no title will be set.
When functions are defined using \verb@function@, however, the PADs for 
those functions are drawn after diagraming the PAD of the whole program.
In this case each function name becomes the corresponding PAD's title.
X
Here is an example of Bourne shell program:
X
\begin{tabular}{l}
\verb@cat << EOF@ \\
\( \quad \quad \vdots \) \\
\verb@EOF@ \\
\end{tabular}\\
X
In this case all parts between \verb@cat << EOF@ and \verb@EOF@ is 
surrounded by a rectangular frame, and it is drawn as one PAD box.
X
You should be able to convert almost any Bourne shell program to PAD figures.
X
\subsection{C shell}
\index{C shell}
X
To draw a PAD figure directly from C shell program, type in;
\begin{center}
\verb@% pad2ps -csh foo.csh > foo.ps@
\end{center}
\noindent
You can omit {\tt -csh}\index{-csh} option if the suffix of the input file
is {\tt .csh}.
X
A parser for C shell program is {\bf csh2pad}\index{csh2pad}.
To execute this parser directly to convert the program into PADEL, type in:
\begin{center}
\verb@% mkpad -csh foo.csh > foo.pad@
\end{center}
\noindent
In this case you cannot omit {\tt -csh} option.
X
A C shell program is drawn as one PAD, and no title will be set.
X
Here is an example of C shell program:
X
\begin{tabular}{l}
\verb@cat << EOF@ \\
\( \quad \quad \vdots \) \\
\verb@EOF@ \\
\end{tabular}\\
X
In this case all parts between \verb@cat << EOF@ and \verb@EOF@ is
surrounded by a rectangular frame, and it is drawn as one PAD box.
X
You should be able to convert almost any C shell program to PAD figures.
X
\subsection{Java}
\index{Java}
X 
To draw a PAD figure directly from a Java program, type in:
\begin{center}
\verb@% pad2ps -java foo.java > foo.ps@
\end{center}
\noindent
You can omit {\tt -java}\index{-java} option if the suffix of the input file
is {\tt .java}.
X
A parser for Java program is {\bf java2pad}\index{java2pad}.
To execute this parser directly to convert the program into PADEL, type in:
\begin{center}
\verb@% mkpad -java foo.java > foo.pad@
\end{center}
\noindent
In this case you cannot omit {\tt -java} option.
X
When converting a Java program, each member function is draw as a PAD figure.
The name of each function becomes the corresponding PAD's title.
X
By specifying {\tt -O}\index{-O} option, all variable declarations without 
initialization are discarded.
X
By default, ; (semi-column) at end of line is not printed in PAD figure.  
You can override this feature by setting {\tt -semicolon}\index{-semicolon}
option.
X
You should be able to draw PAD figures for almost all Java programs.
X
\subsection{AWK}
\index{AWK}
X
To draw a PAD figure directly from an AWK program, type in:
\begin{center}
\verb@% pad2ps -awk foo.awk > foo.ps@
\end{center}
\noindent
You can omit {\tt -awk}\index{-awk} option if the suffix of the input file
is {\tt .awk}.
X
A parser for AWK program is {\bf awk2pad}\index{awk2pad}.
To execute this parser directly to convert the program into PADEL, type in:
\begin{center}
\verb@% mkpad -awk foo.awk > foo.pad@
\end{center}
\noindent
In this case you cannot omit {\tt -awk} option.
X
When converting an AWK program, a PAD figure is drawn for each \verb@BEGIN@,
\verb@END@, or each pattern.  \verb@BEGIN@, \verb@END@, or each pattern 
becomes the corresponding PAD's title.
X
You should be able to draw PAD figures for almost any AWK programs.
X
\subsection{Other languages}
X
Unfortunately, the current version 3.1 does not support other languages.
We are now working to support more languages in near future, though.
Tcl/Tk, Pascal, Fortran, and Perl may be supported in the next release.
X
By the way, it is not that tough to create a translation tool for some
languages using sed or awk.  The author of {\bf pad2ps} series mainly
use C language, so if you are familiar with other languages why don't you
try creating a translation tool by yourself.  I am glad if you would 
send your work as a feedback. 
X
\newpage
X
\section{About parameter variables}
\label{chap:param}
X
Parameter variables are used to enrich, decorate, and align PAD figures.
X
The parameter variables are to be written either as PADEL comments
\begin{center}
\verb@/* pad2ps: centering = on */@
\end{center}
\noindent
or as {\tt -P}\index{-P} option
\begin{center}
\verb@% pad2ps foo.pad -P centering=on > foo.ps@
\end{center}
X
You can set these parameter variables anywhere, except the following 
four parameters: {\bf message}, {\bf comment}, {\bf newpage},and 
{\bf vsp}.
X
There are some parameters that take no effect when printing in \LaTeX 
format.
X
\subsection{Set overall title}
X
You can set the overall title by using the parameter {\bf title}\index{title}.
The title string is to be set as an argument:
X
\begin{center}
\verb@/* pad2ps: title = This is a pad title. */@
\end{center}
X
By default, the file name becomes the title when the command is executed 
with the file name; otherwise no title is set.
X
\subsection{Write messages}
X
You can write messages in PAD figure using the parameter
{\bf message}\index{message}.
X
This parameter should be used at the place where you want to write a 
message.
The content is to be set as an argument.
Here is an example:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
{
X    input N
X
X    /* pad2ps: message = Input each element */
X    for(i = 1, N)
X        input A[i]
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
The result figure is the following:
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}input\ N}} \\ %
X    \padmessage{\shortstack[l]{\rule{0mm}{2ex}Input each element}} \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 1,\ N}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}input\ A[i]}}%
X    }%
}%
}
X
\end{center}
\noindent
X
You should consider the messages as a normal statement without frame, not as
comment or parameter.  It means the place where you can put messages are the
place where you can put the normal statement.  And the message is regarded as
a statement.
Therefore, the following is invalid:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
/* pad2ps: message = Add/Subtract 1 */
X
{
X    for(i = 1, N){
X        if( A[i] > 0 )
X            /* pad2ps: message = Add 1 if positive */
X            m = m + 1
X        else
X            /* pad2ps: message = Subtract 1 if negative or 0 */
X            m = m - 1
X    }
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
This should be written as the following:\index{\{,\}}
X
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
{
X    /* pad2ps: message = Add/Subtract 1 */
X
X    for(i = 1, N){
X        if( A[i] > 0 ) {
X            /* pad2ps: message = Add 1 if positive */
X            m = m + 1
X        } else {
X            /* pad2ps: message = Subtract 1 if negative or 0 */
X            m = m - 1
X        }
X    }
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
X
\subsection{Write comment}
X
To write a comment, you specify the parameter {\bf comment}\index{comment}
in the next line of PADEL command on which the comment is attached.
Do not be confused with the comment described with Section\ref{seq:com};
The comment described here is the comment that is written in PAD figure.
X
The comment is drawn at right of the PAD box.
For example, this PADEL
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
{
X    {
X        sum = 0
X        N = 100
X    }
X    // pad2ps: comment = /* initialization */
X
X    for(i = 1, N)
X        sum = sum + i * i
X        // pad2ps: comment = /* calculate the sum of the square */
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
will create the following:
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padboxss{%
X        \shortstack[l]{\rule{0mm}{2ex}sum\ =\ 0} \\ 
X        \shortstack[l]{\rule{0mm}{2ex}N\ =\ 100}%
X    } \padcomment{\shortstack[l]{\rule{0mm}{2ex}/$*$\ Initialization\ $*$/}} \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 1,\ N}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}sum\ =\ sum\ +\ i\ $*$\ i}} \padcomment{\shortstack[l]{\rule{0mm}{2ex}/$*$\ Calculate the sum of the square\ $*$/}}%
X    }%
}%
}
X
\end{center}
\noindent
X
You cannot insert an empty line between the comment and the corresponding
statement or block.
This is because the comment, unlike messages, is not treated as a statement 
but is treated as an attachment.
Thus, you did not have to put the loop in \verb@{ }@ (braces)\index{\{,\}}
in the previous example.
X
When attaching a comment onto a loop, you should put the parameter in the 
next line of innermost, repeated command.
Therefore, the following is invalid:
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
for(i = 1, N)
/* pad2ps: comment = Calculate the sum of the square */
{
X    sum = sum + i * i
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
X
\subsection{Write \LaTeX command in PADEL}
X
By selecting the parameter variable {\bf texmode}\index{texmode} 
either latex or verbatim, you can select whether the string in PADEL
is treated as \LaTeX command or normal command.
The default is verbatim and this setting will print the string in PADEL
in PAD figure as it is.
When latex is specifies, the following
\begin{quote}
\setlength{\baselineskip}{.7\normalbaselineskip}
\begin{verbatim}
/* pad2ps: texmode = latex */
{
X    /* pad2ps: message = Calculate $\sqrt{2}$ */
X    $ x = 1 $
X    while ( $ | x^{2} - 2 | > 0.0001 $) {
X        $ \displaystyle x = x - \frac{x^{2} - 2}{2 x} $
X    }
}
\end{verbatim}
\setlength{\baselineskip}{\normalbaselineskip}
\end{quote}
\noindent
will create this PAD figure.
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padmessage{\shortstack[l]{\rule{0mm}{2ex}Calculate $\sqrt{2}$}} \\ %
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}$ x = 1 $}} \\ %
X    \padwhile{\shortstack[l]{\rule{0mm}{2ex}$ | x^{2} - 2 | > 0.0001 $}}{%
X        \padbox{\shortstack[l]{\rule{0mm}{2ex}$ \displaystyle x = x - \frac{x^{2} - 2}{2 x} $}}%
X    }%
}%
}
X
\end{center}
X
X
\subsection{Centerize and Align to left}
X
By selecting the parameter {\bf centering}\index{centering} on and off, 
you can set the alignment.
When the parameter is set on, the output in centerized; when set off, the
output is aligned to left.
The default setting is on.
X
\subsection{Change the placing of PAD figure}
X
By setting the parameter {\bf locate}\index{locate}, you can select
how the height is to be aligned for loops and conditional branches.
The parameter may be set as either topdown, bottomup, or middle.
The default is middle.
X
\subsection{Print the page number}
X
To print the page number, set the starting number in the parameter 
{\bf page}\index{page}.
X
By default, the page number is not printed.  It is therefore required to
put the parameter even if you are to print the page number from the first
page.
X
\subsection{Print the figure number}
X
To print the figure number, set the starting number in  the parameter 
{\bf figure}\index{figure}.
By default, the figure number is not printed.
X
\subsection{Change the location of the figure title}
X
By selecting the parameter {\bf figure\_{}locate}\index{figure\_{}locate}
as top or bottom, you can select the place of each PAD figure's title.
When set top, the title is put above the PAD figure; when set bottom the 
title is put below.
By default, bottom is selected when printing the figure number and top is 
selected when printing only title.
X
\subsection{Change the output format of each PAD's title}
X
By selecting the parameter {\bf titlebox}\index{titlebox} as on or off,
you can select the output format of each PAD figure's title.
When off is selected, each title (function name for C program) is treated
as each PAD figure title; when on is selected, the title is drawn in PAD
as a PAD box with double-lined sidelines.
The default is off.
X
The example of {\bf titlebox} set on is the following:
X
\begin{center}
X
\fbox{%
\padseq{%
X    \padsub{\shortstack[l]{\rule{0mm}{2ex}Adding from 1\ to\ N}} \\ %
X    \padbox{\shortstack[l]{\rule{0mm}{2ex}input\ N}} \\ %
X    \padcond{\shortstack[l]{\rule{0mm}{2ex}N\ $>$\ 1}}{%
X        \padseq{%
X            \padbox{\shortstack[l]{\rule{0mm}{2ex}sum\ =\ 0}} \\ %
X            \padwhile{\shortstack[l]{\rule{0mm}{2ex}i\ =\ 1\ ,\ N}}{%
X                \padbox{\shortstack[l]{\rule{0mm}{2ex}sum\ =\ sum\ +\ i}}%
X            } \\ %
X            \padbox{\shortstack[l]{\rule{0mm}{2ex}print\ sum}}%
X        }%
X    }{}%
}%
}
X
\end{center}
X
\subsection{Add a frame to a page}
X
By setting the parameter {\bf pageframe}\index{pageframe} on, the frame for
the whole page will be drawn.
The default for this parameter is off.
X
\subsection{Add a frame to each PAD figure}
X
By setting the parameter {\bf padframe}\index{padframe} on, the frame for
each PAD figure will be drawn.
The default setting is on, so if you do not like this framing you can set
this option off.
X
When the parameter {\bf centering} is on, the size of the frame is adjusted
according to the size of each PAD figure.  When it is off, the horizontal 
width of the frame becomes as same as the horizontal width of the page.
X
\subsection{Enlarge or shrink all}
X
In {\bf pad2ps} series you can enlarge or shrink PAD figures freely, both
in vertical and in horizontal.
The magnification ratio is set using {\bf hrate}\index{hrate} for horizontal
and {\bf vrate}\index{vrate} for vertical.
The value may be a fraction number.  The default value is 1.0 for both cases.
X
Too large {\bf hrate} value will result in too large output that would not
fit in the page even with folding, and in this case {\bf hrate} will be
adjusted automatically.
You can use this feature to create the largest output; it is done by setting 
the value fairly large and let your computer readjust the value.
Of course, you can enlarge as much as you want when the parameter {\bf poster}
is set on, thereby disabling the folding feature.
X
On contrary, {\bf vrate} may be set as large as you like.
X
\subsection{Create huge PAD figure without folding}
\label{param:poster}
X
In {\bf pad2ps} series a huge PAD figure that will not fit in one paper
is put in the paper by folding each PAD box.
If the figure still does not fit, the parameter {\bf hrate} will be 
automatically calculated as to shrink the figure accordingly.
X
When you want to create a huge output that would cross over several pages
in sideway, therefore want to disable the folding feature, set the parameter
{\bf poster}\index{poster} on.
X
When you want to create a poster of a PAD figure, use {\bf hrate} and 
{\bf vrate} to enlarge your figure along with setting {\bf poster} on.
X
For example, this is a PAD figure of Ackerman function enlarged 3 times.
(Figure~\ref{fig:ack}).
The original file is {\tt ack.pad}.
By setting {\bf poster} on and laying the output figures in sideway, you
can get a huge PAD figure.
By the way this is in EPS format, so you cannot check this dvi file directly.
You need to use something like {\tt dvi2ps} and convert to PostScript.
X
\begin{figure}
X
\begin{minipage}{5cm}
\fbox{\epsfile{file=ack.2.eps,width=4cm,height=5cm}}
\end{minipage}
\nolinebreak
\begin{minipage}{5cm}
\fbox{\epsfile{file=ack.1.eps,width=4cm,height=5cm}}
\end{minipage}
\nolinebreak
\begin{minipage}{5cm}
\fbox{\epsfile{file=ack.3.eps,width=4cm,height=5cm}}
\end{minipage}
X
\caption{A PAD figure poster of Ackerman function}
\label{fig:ack}
X
\end{figure}
X
\subsection{Set the width of folding PAD figure}
X
In {\bf pad2ps} a large PAD figure will be folded as to fit in one page.
The folding width is calculated by {\bf pad2ps} series, so normally we
do not have to bother with it.
X
But sometimes you may want to set a limit to the string length in PAD.
The output PAD figure may be tough to read if the original figure
is long in sideway.
In these cases you may want to set the limit to the string length to prevent
the folding. 
X
To set the maximum and minimum length of the string, set the parameter
{\bf max\_{}length}\index{max\_{}length} and
{\bf min\_{}length}\index{min\_{}length}.
These values are set as infinity and 0 by default.
By setting these parameters, {\bf pad2ps} series will fold the figures
under specified condition.
X
\subsection{Insert a page break}
X
To break a page, set the parameter {\bf newpage}\index{newpage} at the place
where you want to insert a page break.
This parameter does not have any argument.
X
\subsection{Adjust the vertical interval between PADs}
\label{param:vsp}
X
The PAD boxes are drawn with appropriate intervals, but sometimes you may
want to change this setting.
Also you better change the interval manually when a PAD box is at end of a 
page and it splits over two pages.
These problems are usually solved by adding empty lines, but you sometimes
may want to fine-tune the intervals. 
In this case use the parameter {\bf vsp}\index{vsp}.
Also empty lines at top of PADEL is ignored, so to adjust the interval before
the first PAD figure a only solution is to use {\bf vsp}.
X
As an argument of {\bf vsp}, specify the size of spaces to be put.
As a reference, an empty line put the space of $400$ outside PAD and the
spaces of $120$ inside PAD by default.
Also, you can set a negative number for {\bf vsp}.  By doing so, you can
lessen or nullify the interval and even overlap two PAD boxes.
To nullify the interval, set the argument $-120$.
Lesser value causes two PADs to overlap.
X
\subsection{Change the page size}
X
By setting the parameter variables in the chart, you can specify the
coordinates of upper, lower, left, and right side of a page.
Changing these values cause the size of the page to change accordingly.
\index{page\_{}top}
\index{page\_{}bottom}
\index{page\_{}left}
\index{page\_{}right}
X
\begin{center}
\begin{tabular}{|l|l|c|r|} \hline
Parameter & Meaning & Range & Default \\ \hline \hline
{\bf page\_{}top} & top & $ 0 - 10000 $ & $ 9800 $ \\ \hline
{\bf page\_{}bottom} & bottom & $ 0 - 10000 $ & $ 0 $ \\ \hline
{\bf page\_{}left} & left & $ 0 - 9000 $ & $ 500 $ \\ \hline
{\bf page\_{}right} & right & $ 0 - 9000 $ & $ 8500 $ \\ \hline
\end{tabular}
\end{center}
X
The parameters {\bf page\_{}left} and {\bf page\_{}right} are only effective
when {\bf centering} is set off; otherwise the values are ignored.
Also, setting {\bf page\_{}bottom} does not change the printing position of
the page number.
X
\subsection{Change the font size}
X
\subsubsection{Change the normal font size}
To change the font size, set {\bf fontsize}\index{fontsize} for the height and
{\bf fontwidth}\index{fontwidth} for the width.
The default values are 200 and 100 for each parameter.
X
\subsubsection{Change the special font size}
For the overall title, the PAD title, and the PAD figure title, slightly bigger
font is used.
These size may be modified by setting the parameters in the chart.  Each value
is the magnification ratio to the normal font size.
\index{title\_{}rate}
\index{padtitle\_{}rate}
\index{figure\_{}rate}
X
\begin{center}
\begin{tabular}{|l|l|r|} \hline
Parameter & Object & Default \\ \hline \hline
{\bf title\_{}rate} & overall title & $ 2.0 $ \\ \hline
{\bf padtitle\_{}rate} & PAD title & $ 1.5 $ \\ \hline
{\bf figure\_{}rate} & figure title & $ 1.5 $ \\ \hline
\end{tabular}
\end{center}
X
Difference between {\bf padtitle\_{}rate} and {\bf figure\_{}rate} is that
the former is used when the parameter {\bf figure} is not defined and the 
figure number is not printed, whereas the latter is used when the figure 
number is printed.
X
\subsection{Change the size of spaces}
X
To put spaces inside a PAD box or between PADs, change the parameters in the
chart.
\index{pad\_{}vspace}
\index{vspace}
\index{hspace}
\index{if\_{}vspace}
\index{box\_{}hspace}
\index{if\_{}rightspace}
\index{sideline\_{}space}
\index{padframe\_{}vspace}
\index{padframe\_{}hspace}
X
\begin{center}
\begin{tabular}{|l|r|} \hline
Parameter & Default \\ \hline \hline
{\bf pad\_{}vspace} & $ 400 $ \\ \hline
{\bf vspace} & $ 200 $ \\ \hline
{\bf hspace} & $ 200 $ \\ \hline
{\bf if\_{}vspace} & $ 50 $ \\ \hline
{\bf box\_{}hspace} & $ 125 $ \\ \hline
{\bf if\_{}rightspace} & $ 200 $ \\ \hline
{\bf sideline\_{}space} & $ 50 $ \\ \hline
{\bf padframe\_{}vspace} & $ 180 $ \\ \hline
{\bf padframe\_{}hspace} & $ 300 $ \\ \hline
\end{tabular}
\end{center}
X
\subsection{Change the line thickness}
X
The thickness of the line used to draw PAD figures can be modified by setting
the parameter variables in the chart.
\index{linewidth}
\index{padlinewidth}
\index{framelinewidth}
X
\begin{center}
\begin{tabular}{|l|l|r|} \hline
Parameter & Object & Default \\ \hline \hline
{\bf linewidth} & a line connecting PAD boxes & $ 16 $ \\ \hline
{\bf padlinewidth} & a line drawing PAD box & $ 16 $ \\ \hline
{\bf framelinewidth} & a line surrounding PAD figure & $ 8 $ \\ \hline
\end{tabular}
\end{center}
X
\newpage
X
\appendix
X
\section{Modules system in pad2ps series}
\label{adx:modules}
X
Many modules compose {\bf pad2ps} series and they share part of a whole
job each other.
The figure shows the system of the modules and their roles.
X
\begin{figure}[h]
\fbox{\epsfile{file=modules.eps,width=160mm,height=146mm}}
\end{figure}
X
\twocolumn
X
\newpage
X
\section*{Index}
\markboth{index}{index}
\noindent
\input{manual.index}
X
\end{document}
SHAR_EOF
  $shar_touch -am 1102175196 'pad2ps-3.1/doc/manual.tex' &&
  chmod 0644 'pad2ps-3.1/doc/manual.tex' ||
  $echo 'restore of' 'pad2ps-3.1/doc/manual.tex' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'pad2ps-3.1/doc/manual.tex:' 'MD5 check failed'
ca163d0f0c80c923633afe06b9366f05  pad2ps-3.1/doc/manual.tex
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pad2ps-3.1/doc/manual.tex'`"
    test 67839 -eq "$shar_count" ||
    $echo 'pad2ps-3.1/doc/manual.tex:' 'original size' '67839,' 'current size' "$shar_count!"
  fi
fi
# ============= pad2ps-3.1/doc/ack.1.eps ==============
if test -f 'pad2ps-3.1/doc/ack.1.eps' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'pad2ps-3.1/doc/ack.1.eps' '(file already exists)'
  rm -f _sh23946/new
else
  > _sh23946/new
  $echo 'x -' extracting 'pad2ps-3.1/doc/ack.1.eps' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'pad2ps-3.1/doc/ack.1.eps' &&
%!PS-Adobe-1.0 EPSF-1.0
% pad2ps Encapsulated PostScript output
%   S. Yoshida (g3p120@cfi.waseda.ac.jp)
%
%%BoundingBox: 0 49 540 637
%
clippath pathbbox
/page-height exch def
/page-width exch def
pop pop
%
/string {
X   moveto show
} def
%
% PAD line -- usage: x0 y0 w h line
/line {
X   neg 4 -2 roll moveto rlineto
} def
%
% PAD box -- usage: x0 y0 w h box
/box {
X   4 -2 roll moveto
X   dup neg 0 exch rlineto
X   exch dup 0 rlineto
X   exch dup 0 exch rlineto
X   pop pop
X   closepath
} def
%
% PAD ifline -- usage: x0 y0 w h ifline
/ifline {
X   4 -2 roll moveto
X   dup neg 0 exch rlineto
X   exch dup 0 rlineto
X   exch dup 2 idiv dup -200 exch rlineto
X   sub 200 exch rlineto
X   pop
} def
%
% PAD ifbox -- usage: x0 y0 w h ifbox
/ifbox {
X   ifline closepath
} def
%
/clippingpath {
X   newpath
X   0 3266 moveto
X   0 0 lineto
X   3000 0 lineto
X   3000 3266 lineto
X   closepath
} def
%
/pageframe {
X   8 setlinewidth
X   newpath
X   0 3266 moveto
X   0 0 lineto
X   3000 0 lineto
X   3000 3266 lineto
X   closepath stroke
} def
%
/Courier findfont 200 scalefont setfont
%
%%PageTrailer
%%Page: 1 1
%
%
% newpage
%
page-width 538.583 sub 2 div
page-height 538.583 sub 2 div
translate
%
0.18 0.18 scale
%
clippingpath clip
%
/Courier-Bold findfont [333 0 0 400 0 0] makefont setfont
(Ackermann Function) -300 2896 string
/Courier findfont [250 0 0 300 0 0] makefont setfont
(ack\(m,n\)) 900 2196 string
8 setlinewidth
newpath
X  -1375 1916 5750 0 line
X  -1375 1916 0 1350 line
X  4375 1916 0 1350 line
stroke
16 setlinewidth
newpath
X  75 1736 1450 250 box
stroke
/Courier findfont [166 0 0 200 0 0] makefont setfont
(return \(n+1\)) 200 1551 string
newpath
X  -125 1611 200 0 line
X  -1075 1611 950 555 ifbox
stroke
(m = 0) -950 1274 string
newpath
X  1225 1366 1950 250 box
stroke
(return ack\(m-1,1\)) 1350 1181 string
newpath
X  1025 1241 200 0 line
X  75 1241 950 370 ifbox
stroke
(n = 0) 200 996 string
newpath
X  -125 1056 200 0 line
X  1225 996 2850 250 box
stroke
(return ack\(m-1,ack\(m,n-1\)\)) 1350 811 string
newpath
X  1025 871 200 0 line
stroke
8 setlinewidth
newpath
X  -1375 566 5750 0 line
stroke
showpage
clear
%%PageTrailer
%%Pages: 1
% End of pad2ps PostScript output
SHAR_EOF
  $shar_touch -am 0911225495 'pad2ps-3.1/doc/ack.1.eps' &&
  chmod 0644 'pad2ps-3.1/doc/ack.1.eps' ||
  $echo 'restore of' 'pad2ps-3.1/doc/ack.1.eps' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'pad2ps-3.1/doc/ack.1.eps:' 'MD5 check failed'
d54dc1163ab4415883d66d4c5c63a34f  pad2ps-3.1/doc/ack.1.eps
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pad2ps-3.1/doc/ack.1.eps'`"
    test 2165 -eq "$shar_count" ||
    $echo 'pad2ps-3.1/doc/ack.1.eps:' 'original size' '2165,' 'current size' "$shar_count!"
  fi
fi
# ============= pad2ps-3.1/doc/ack.2.eps ==============
if test -f 'pad2ps-3.1/doc/ack.2.eps' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'pad2ps-3.1/doc/ack.2.eps' '(file already exists)'
  rm -f _sh23946/new
else
  > _sh23946/new
  $echo 'x -' extracting 'pad2ps-3.1/doc/ack.2.eps' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'pad2ps-3.1/doc/ack.2.eps' &&
%!PS-Adobe-1.0 EPSF-1.0
% pad2ps Encapsulated PostScript output
%   S. Yoshida (g3p120@cfi.waseda.ac.jp)
%
%%BoundingBox: 0 49 540 637
%
clippath pathbbox
/page-height exch def
/page-width exch def
pop pop
%
/string {
X   moveto show
} def
%
% PAD line -- usage: x0 y0 w h line
/line {
X   neg 4 -2 roll moveto rlineto
} def
%
% PAD box -- usage: x0 y0 w h box
SHAR_EOF
  : || $echo 'restore of' 'pad2ps-3.1/doc/ack.2.eps' 'failed'
fi
$echo 'End of' 'archive' 'part' '1'
$echo 'File' 'pad2ps-3.1/doc/ack.2.eps' 'is continued in part' '2'
echo 2 > _sh23946/seq
exit 0


