ppudump is a program which shows the contents of a Free Pascal unit. It is distributed with the compiler. You can just issue the following command
ppudump [options] foo.ppu |
The options can be used to change the verbosity of the display. By default, all available information is displayed. You can set the verbosity level using the -Vxxx option. Here, xxx is a combination of the following letters:
ppumove is a program to make shared or static libraries from multiple units. It can be compared with the tpumove program that comes with Turbo Pascal.
It should be distributed in binary form along with the compiler.
Its usage is very simple:
ppumove [options] unit1.ppu unit2.ppu ... unitn.ppu |
The action of the ppumve program is as follows: It takes each of the unit files, and modifies it so that the compile will know that it should look for the unit code in the library. The new unit files will have an extension .ppu, this can be changed with the -e option. It will then put together all the object files of the units into one library, static or dynamic, depending on the presence of the -s option.
The name of this library must be set with the -o option. If needed, the prefix lib will be prepended under LINUX.. The extension will be set to .a for static libraries, for shared libraries the extensions are .so on linux, and .dll under WINDOWS NT and OS/2.
As an example, the following command
./ppumove -o both -e ppl ppu.ppu timer.ppu |
PPU-Mover Version 0.99.7 Copyright (c) 1998 by the Free Pascal Development Team Processing ppu.ppu... Done. Processing timer.ppu... Done. Linking timer.o ppu.o Done. |
You could then use or distribute the files libboth.so, timer.ppl and ppu.ppl.
ptop is a source beautifier written by Peter Grogono based on the ancient pretty-printer by Ledgard, Hueras, and Singer, modernized by the Free Pascal team (objects, streams, configurability etc)
This configurability, and the thorough bottom-up design are the advantages of this program over the diverse TurboPascal sourcebeautifiers on e.g. SIMTEL.
The program is quite simple to operate:
ptop ”[-v] [-i indent] [-b bufsize ][-c optsfile] infile outfile”
The Infile parameter is the pascal file to be processed, and will be written to outfile, overwriting an existing outfile if it exists.
Some options modify the behaviour of ptop:
Creating and distributing a configuration file for ptop is not necesarry, unless you want to modify the standard behaviour of ptop. The configuration file 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 configuration file is a simple buildingblock repeated several (20-30) times, for each pascal keyword known to the ptop program. (see the default configuration file or ptopu.pp source to find out which keywords are known)
The basic building block of the configuration file consists out of one or two lines, describing how ptop should react on a certain keyword. First 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 like this:
[keyword]=otherkeyword1,otherkeyword2,otherkeyword3,...
As you can see the block contains two types of identifiers, keywords(keyword and otherkeyword1..3 in above example) and options, (option1..3 above).
Keywords are the built-in valid Pascal structure-identifiers like BEGIN, END, CASE, IF, THEN, ELSE, IMPLEMENTATION. The default configuration file lists most of these.
Besides the real Pascal keywords, some other codewords are used for operators and comment expressions. table (8.1)
|
|
”dinkdonkey” deindents if any of the keywords specified by the extra options of the square-bracket line is found.
Example: The lines
else=crbefore,dindonkey,inbytab,upper [else]=if,then,else |
mean the following:
Try to play with the configfile step by step until you find the effect you desire. The configurability 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 file 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 made any errors.
The source of the PtoP program is conveniently split in two files: One is a unit containing an object that does the actual beautifying of the source, the other is a shell built around this object so it can be used from the command line. This design makes it possible to include the object in some program (e.g. an IDE) and use its features to format code.
The object resided in the PtoPU unit, and is declared as follows
TPrettyPrinter=Object(TObject) Indent : Integer; { How many characters to indent ? } InS : PStream; OutS : PStream; DiagS : PStream; CfgS : PStream; Constructor Create; Function PrettyPrint : Boolean; end; |
Using this object is very simple. The procedure is as follows:
So, a minimal procedure would be:
Procedure CleanUpCode; var Ins,OutS : PBufStream; PPRinter : TPrettyPrinter; begin Ins:=New(PBufStream,Init('ugly.pp',StopenRead,TheBufSize)); OutS:=New(PBufStream,Init('beauty.pp',StCreate,TheBufSize)); PPrinter.Create; PPrinter.Ins:=Ins; PPrinter.outS:=OutS; PPrinter.PrettyPrint; end; |
Using memory streams allows very fast formatting of code, and is perfectly suitable for editors.
The rstconv program converts the resource string files generates by the compiler (when you use resource string sections) to .po files that can be understood by the GNU msgfmt program.
Its usage is very easy; it accepts the following options:
As an example:
rstconv -i resdemo.rst -o resdemo.po |
More information on the rstconv utility can be found in the Programmers guide, under the chapter about resource strings.
fpcmake is the Free Pascal makefile constructor program.
It reads a Makefile.fpc configuration file and converts it to a Makefile suitable for reading by GNU make to compile your projects. It is similar in functionality to GNU autoconf or Imake for making X projects.
fpcmake accepts filenames of makefile description files as its command-line arguments. For each of these files it will create a Makefile in the same directory where the file is located, overwriting any other existing file.
If no options are given, it just attempts to read the file Makefile.fpc in the current directory and tries to construct a makefile from it. any previously existing Makefile will be erased.
The format of the fpcmake configuration file is described in great detail in the appendices of the Programmers guide.