---------------------------------------------------------------------

next up previous contents
Next: Write a statement Up: PADEL syntax Previous: PADEL syntax

---------------------------------------------------------------------

Composition of PAD and PAD title

The common style of writng PADEL source is like this. This is a function to calculate factorial of n.

    factorial(n)
    {
        f = 1
        for(i = 1, n)
            f = f * i
        return f
    }

This example shows the fundamental composition of a PAD in PADEL file. First of all, you write a PAD title. Then enclose commands with { }  . Inside { } 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.

Now I will point out some critical points.

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.

    factorial(n){
        f = 1
        for(i = 1, n)
            f = f * i
        return f
    }

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.

I have said that PADEL commands are enclosed by { }, but to be more exact, line ONLY with {(left brace) expresses beginning of PAD commands, and line ONLY with }(right brace) means ending of PAD commands. Hence, you cannot omit a newline code.

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:

  • A title which consists of only one { or }
  • A title which begins with / tex2html_wrap_inline2432 or //

If you like, you can omit a PAD title.

---------------------------------------------------------------------

Go back to pad2ps - automatic PAD drawer.
Go back to Seiichi Yoshida's Home Page.
Copyright(C) Seiichi Yoshida (comet@aerith.net). All rights reserved.
Sun Nov 10 01:36:04 JST 1996