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

next up previous contents
Next: Comment Up: PADEL syntax Previous: Exception handler

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

Labeling and referencing

In PADEL, you can draw labels in PAD figure. In PAD figure the labels are encircled. To draw the label, you use label  command. This means that you can use spaces and { } freely.

To refer to the label, you use refer  command. The label to be referenced is also encircled in PAD figure. You can use any label name in refer statement. The label to be referenced is not checked for its existance, so you can use undefined label name.

Here is an example of labeling and referencing:

    label Let's start!
    input x
    label Repeat 10 times.
    for (i = 1, 10)
        print x*i
    refer (Let's start!) {
        goto
    }

The result figure is the following.

tex2html_wrap2548

As in this example, all you have to do is to write a label after label command. Notice you have to write this in one line, without any return code.

Let explain more about referencing by refer statement. In refer statement, you first write the name of its reference destination label inside ( ), and then write statements inside { }. Therefore, to draw ``goto label'', you would write as follows:

    refer (LABEL) {
        goto
    }

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 { } is handled, however, is not as same as that of repetition and conditional branch, so be careful. In refer statement the content of { } is treated as a normal string. For example, the following example:

    refer (EXIT) {
        if (x = 0)
            print '\n'
        print 'The End'
    }

will produce:

tex2html_wrap2550

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:

    LABEL1:

is as same as:

    label LABEL1

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 for for label name.

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

next up previous contents
Next: Comment Up: PADEL syntax Previous: Exception handler

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

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