HomeMiscellaneousDefinitionsIndices
User Manual UDO > The UDO syntax > Miscellaneous Index

Symbols

Symbols are user-defined variables which can be set with the !set command or via the command line with the -D option. Symbols can be deleted with the !unset command. If a symbol is set you can test with the query commands !ifset and !ifnset.

Symbols can be used for different purposes. In the following example I will show you how to make a destination file with a different contents depending on set symbols.

Assuming that you have written a soure file that contains three chapters, the first two chapters have been finished and you are still working on the third chapter. To mimize the conversion time of UDO you want only to convert the last chapter if the symbol AllChapters is set:

!begin_document
!tableofcontents
!ifset [AllChapters]
!include chapter1.ui
!include chapter2.ui
!endif
!include chapter3.ui
!end_document

If you start UDO as you without setting the symbol it will make a destination file that contains all chapters. If you set the symbol via adding the option -D AllChapters you will get a destination file that contains only the last chapter.

You can even do more. If you use more symbols you can make destination files with only one, some or all chapters. If you use the following example and you call UDO with the option -D Chapter1 you will get only the first chapter. If you call UDO with the options -D Chapter1 and -D Chapter2 you will get a destination file with the first and second chapter. If you call UDO with the option AllChapters you will get a complete destination file:

!begin_document
!tableofcontents
!ifset [Chapter1, AllChapters]
!include chapter1.ui
!endif
!ifset [Chapter2, AllChapters]
!include chapter2.ui
!endif
!ifset [Chapter3, AllChapters]
!include chapter3.ui
!endif
!end_document

As I descriped at the beginning of this section you can delete symbols with the !unset command.

If you want to avoid that all chapters are saved in the destination file you can add the following lines to the beginning of your source file. Here the symbol AllChapters will be deleted if it is set:

!ifset [AllChapters]
!unset AllChapters
!endif

In first place it will be testet if the symbol is set. If you don't test the symbol UDO will print an error message if you want to delete an unused symbol.

Hints:

  1. You may use up to 128 symbols.
  2. The name of a symbol may be up to 32 characters long.

Copyright © www.udo-open-source.org (Contact)
Last updated on May 19, 2014

HomeMiscellaneousDefinitionsIndices