Other Tools Developed Here

1. Introduction

Subdirectory source/tools/ inside PasDoc sources contains some useful programs related to PasDoc. They are either small programs helpful for development of PasDoc, or tools that use PasDoc units to do other tasks.

2. file_to_pascal_string

Converts any text file into a Pascal string. This allows to embed contents of any text file into a compiled program.

3. file_to_pascal_data

Converts any file into a Pascal array of bytes. This allows to embed contents of any binary file into a compiled program.

4. pascal_pre_proc

Pascal preprocessor. Rreads the Pascal source file given on the command-line, and outputs it’s processed version to the standard output. Features (all inherited from pasdoc tokenizer and scanner):

  • Handles $ifdef and related constructs, see conditional expressions support.

  • Handles FPC macros (very useful if you want to use FPC source code using macros in Delphi)

  • Handles $include

  • Preserves whitespace

The preprocessor behavior can be configured by a couple of command-line options, a subset of PasDoc command line options. Run pascal_pre_proc --help to get a list of supported options. Examples of use:

  • Basic test of handling macros using ok_macros.pas file from pasdoc tests:

    pascal_pre_proc pasdoc/tests/ok_macros.pas
  • Generate a single (without any $include, $ifdef etc.) source code of the SysUtils unit for Linux/i386 target from FPC sources:

    pascal_pre_proc unix/sysutils.pp \
     -I objpas/sysutils/ -I inc/ -I i386/ -I ./linux/ \
     -D UNIX -D cpui386 > linux_i386_sysutils.pas