Store the preprocessed output in a file

From ISXKB

Revision as of 00:03, 12 September 2007 by Markus (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Contents

Introduction

The Inno Setup Preprocessor is a very powerful tool. Not using it is somewhat equal to not using the dishwasher but washing the china by hand instead.

As it is with all preprocessors it's syntax is not always easy to understand and the outcome sometimes unforeseeable.

Preprocessing

The preprocessor preprocesses the source script and provides the translated version to the actual script compiler (Inno Setup).

Capturing the translation

The Inno Setup Preprocessor (ISPP) has a built-in function called SaveToFile(). This function saves the current translation (the preprocessed output) into an arbitrary file. All that's required is to invoke this function at the end of the Inno Setup script.

If this

#expr SaveToFile(AddBackslash(SourcePath) + "Preprocessed.iss")

is the last line of the script the file 'Preprocessed.iss' contains a script where all preprocessor functions and macros have been evaluated/extracted. This can be very helpful during the development.

Sometimes the preprocessed output is not desirable, for example when there's no current bugs to fix. The preprocessor itself can be used to toggle the output generation:

// Beginning of Inno Setup script.
#define Debug

// ...Inno Setup script sections go here.

// Last few lines of script.
#ifdef Debug
  #expr SaveToFile(AddBackslash(SourcePath) + "Preprocessed.iss")
#endif

See also

External links

Personal tools
Ads: