Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/miriad/progguide/node58.html
Дата изменения: Unknown Дата индексирования: Tue Feb 5 09:25:47 2013 Кодировка: Поисковые слова: mdi |
The basic syntax is the same as the optimization directives (i.e. `c#' or `#' starting a line, followed by the directive). However, as code using conditional compilation will have to be passed through RATTY to produce the correct code, the `#' form is preferred. This will be seen as an error by a standard compiler, thus preventing code from accidently no being passed through the preprocessor.
There are four directives of interest, namely ifdef, ifndef, else and endif. Like the cpp preprocessor, ifdef and ifndef pass the following section of code to the compiler if a particular ``symbol'' is defined or not. Currently there are only one or two symbols that are defined. Firstly a symbol with the compiler target name is defined (the target compiler name is gained from the command line -s flag). Secondly a symbol ``vector'' is defined if the target computer is a vector machine. For example the command line:
% ratty -s cft input outputcauses the symbol `cft' and `vector' to become defined. Then, given the following code fragment from ``input'', the first section is copied to ``output'', whereas the second is discarded.
#ifdef cft . . Use this code on the Cray. . #else . . This code on all other machines. . #endif
Miriad manager