Chapter 17

Using the command-line compiler

********* replacement paragraphs

***************> benefit statement: use somewhere in introduction

This will not only save you time in recompiling a single program, but will really prove valuable when you need to recompile a long list of program modules, that all use the same set of subroutines and functions.

After you fix something in one of the functions, you can quickly and easily recompile the whole set of modules, with a batch file. This is the great advantage of a command-line compiler.

Example

pbc /CE SourcePath\module0.bas > results.fil

pbc /CE SourcePath\module1.bas >> results.fil

pbc /CE SourcePath\module2.bas >> results.fil

pbc /CE SourcePath\module3.bas >> results.fil

pbc /CE SourcePath\module4.bas >> results.fil

pbc /CE SourcePath\module5.bas >> results.fil

pbc /CE SourcePath\module6.bas >> results.fil

pbc /CE SourcePath\module7.bas >> results.fil

pbc /CE SourcePath\module8.bas >> results.fil

pbc /CE SourcePath\module9.bas >> results.fil

pbc /CE SourcePath\module10.bas >> results.fil

pbc /CE SourcePath\module11.bas >> results.fil

pbc /CE SourcePath\module12.bas >> results.fil

pbc /CE SourcePath\module13.bas >> results.fil

pbc /CE SourcePath\module14.bas >> results.fil

The compiler output will be saved in the file "results.fil".

***********************************> [ 398 ]

Configuration file

( PBC.CFG )

The command-line compiler PBC.EXE will read in your options from either the command line, or from an ASCII file named PBC.CFG.

PBC.EXE will only recognize the filename PBC.CFG for this purpose, but if you are developing more than one project, you can use individual alternative PBC.CFG files that you copy to PBC.CFG in your batch file, just before compilation.

You can have one alternative file for testing, PBCwhERR.CFG, when you want all the error-checking code generated, to help you debug it, and then when you are thru testing, you use a different one, PBCnoERR.CFG, without all the error-checking code.

PBCwhERR.CFG file contents

/CE /DSC:\MySource /G386 /OZF+ /DEC:\MyCompiled /LA-

/EB+ /EN+ /EO+ /ES+

copy PBCwhERR.CFG PBC.CFG

The default is that the error tests, /EB, /EN, /EO, and /ES are assumed

to be on (+), and code is generated for error-checking, unless you specify

differently.

PBCnoERR.CFG file contents

/CE /DSC:\MySource /G386 /OZF+ /DEC:\MyCompiled /LA-

/EB- /EN- /EO- /ES-

copy PBCnoERR.CFG PBC.CFG

You might want one for use with PBD.EXE,

PBCwhPDB.CFG file contents

/CE /DSC:\MySource /G386 /OZF+ /DEC:\MyCompiled /LA-

/EB+ /EN+ /EO+ /ES+

/OD+ /OG+ /OM+ /OP+ /OU+

copy PBCwhPDB.CFG PBC.CFG

There is no fixed format. Just record all the same command-line options

that you would use on the command line.

PBC.CFG file contents can be each on a separate line, or all strung

together, on a single or more line(s).

Actual command-line options overrule options listed in PBC.CFG.

Options specified in PBC.CFG overrule the default options.

Examples

Command-line

PBC /CE /DSC:\MySource /G386 /OZF+ /DEC:\MyCompiled /LA-

/CE

/DSC:\MySource

/G386

/OZF+

/DEC:\MyCompiled

/LA-

or

/CE /DSC:\MySource /G386 /OZF+ /DEC:\MyCompiled /LA-

Remarks

Do not use any comments in your PBC.CFG file.

If you include the directory pathnames, with the /DE, /DL, /DS, and /DU

options, your alternative PBC.CFG file will help you remember where every-

thing goes.

You can make a subdirectory for these alternative PBC.CFG files, and save

a copy of each alternative file, in there. This might help make it easier

for someone else to help you do your work.

Everything you do repetitively, that you can record into batch files,

script files, and other kinds of stored form, makes your own work easier,

reduces your stress level, and makes it easier to have other people help

you.

PBC.CFG and its alternate forms can help do all this.

See also, $ERROR

***********************************> [ 400 ]

Optimizations

(/OZF)

PBC.EXE will choose forms of compiled output that will run faster, but may

be larger, with the /OZF+ option.

It will choose forms of compiled output that will be smaller in memory size,

but probably slower, with the /OZF- option.

If you use just /OZF, the compiler assumes that you want the -, or /OZF-,

which means smaller, slower code.

Also, see the /G options, which can be used to generate different sizes

and speeds of compiled output, designed to run on different microprocessors.

Declarations

(/ODA and /ODV)

PBC.EXE will usually let you use arrays and variables without explicit

DECLARED statements for them, but if you want the compiler to check to see

that you do have explicit DECLARED statements, you can enable this compile-

time checking, by using option /ODA, for just arrays, or /ODV, for both

arrays and variables.

This might be useful when working on units or when preparing to make a

version in another language that does require DECLARED statements.

***********************************> [ 401 ]

Stand-alone debugger

information (/OD)

PBC.EXE will attach debugging information to your .EXE file, for use with

the PBD stand-alone debugger, when you use the /OD option. See chapter 16,

Debugging PowerBASIC programs.

GOSUB preserve (/OG)

PBC.EXE will generate code to save the subroutine's stack in case of error,

as an additional dimension of debug information, and error recovery,

when you use the /OG option.

Include path names

(/OP)

PBC.EXE will include full path names of your source files, in the debug

information generated. This may be important if your source files are in

more than one subdirectory.

Unit debug information

(/OU)

PBC.EXE will generate debug information for your units, so that you can

step into and trace into the unit code. When this is off, you cannot

go thru your units step by step.

Example

While testing

/CU /DSC:\MySource /G386 /OZF- /DEC:\MyUnits /LA-

/EB+ /EN+ /EO+ /ES+ /OU+

After testing is complete

/CU /DSC:\MySource /G386 /OZF+ /DEC:\MyUnits /LA-

/EB- /EN- /EO- /ES- /OU-

******************small changes on page 403

proofread it

******************

new old

/DS /DI in first sentence

/DL /DO in example line

This file has been created with the evaluation or unregistered copy of
EasyHelp from Eon Solutions
(Tel: UK 0973 209667, Email: eon@cix.compulink.co.uk)