8.8.2 The ptop conguration le

Creating and distributing a conguration le for ptop is not necessary, unless you want to modify the standard behaviour of ptop. The conguration le is never preloaded, so if you want to use it you should always specify it with a -c ptop.cfg parameter.

The structure of a ptop conguration le is a simple building block repeated several (20-30) times, for each Pascal keyword known to the ptop program. (See the default conguration le or ptopu.pp source to nd out which keywords are known).

The basic building block of the conguration le consists of one or two lines, describing how ptop should react on a certain keyword. First comes a line without square brackets with the following format:

keyword=option1,option2,option3,...

If one of the options is "dindonkey" (see further below), a second line - with square brackets - is needed:

[keyword]=otherkeyword1,otherkeyword2,otherkeyword3,...

As you can see the block contains two types of identiers: keywords (keyword and otherkeyword1..3 in above example) and options, (option1..3 above).

Keywords are the built-in valid Pascal structure-identiers like BEGIN, END, CASE, IF, THEN, ELSE, IMPLEMENTATION. The default conguration le lists most of these.

Besides the real Pascal keywords, some other codewords are used for operators and comment expressions as in table (8.1).


Table 8.1: Keywords for operators

Name of codewordOperator



casevar : in a case label ( unequal 'colon')
becomes :=
delphicomment //
opencomment f or (*
closecomment g or *)
semicolon ;
colon :
equals =
openparen [
closeparen ]
period .

The options codewords dene actions to be taken when the keyword before the equal sign is found, as listed in table (8.2).


Table 8.2: Possible options

Option does what



crsupp Suppress CR before the keyword.
crbefore Force CR before keyword.
(do not use with crsupp.)
blinbeforeBlank line before keyword.
dindonkeyDe-indent on associated keywords.
(see below)
dindent Deindent (always)
spbef Space before
spaft Space after
gobsym Print symbols which follow a
keyword but which do not
aect layout. prints until
terminators occur.
(terminators are hard-coded in pptop,
still needs changing)
inbytab Indent by tab.
crafter Force CR after keyword.
upper Prints keyword all uppercase
lower Prints keyword all lowercase
capital Capitalizes keyword: 1st letter
uppercase, rest lowercase.

The option "dindonkey" given in table table (8.2) requires some further explanation. "dindonkey" is a contraction of "DeINDent ON associated KEYword". When it is present as an option in the rst line, then a second, square-bracketed, line is required. A de-indent will be performed when any of the other keywords listed in the second line are encountered in the source.

Example: The lines

else=crbefore,dindonkey,inbytab,upper  
[else]=if,then,else

mean the following:

Try to play with the congle step by step until you nd the eect you desire. The congurability and possibilities of ptop are quite large. E.g. I like all keywords uppercased instead of capitalized, so I replaced all capital keywords in the default le by upper.

ptop is still development software. So it is wise to visually check the generated source and try to compile it, to see if ptop hasn't introduced any errors.