Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cpp(1) — DG/UX 5.4R3.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

cpp(1)



cpp(1)                         DG/UX 5.4R3.00                         cpp(1)


NAME
       cpp - the C language preprocessor

SYNOPSIS
       /lib/cpp [ option ... ] [ ifile [ ofile ] ]

DESCRIPTION
       Cpp is the C language preprocessor.  Thus, the output of cpp is
       designed to be in a form acceptable as input to the next pass of the
       C compiler.  You should specify preprocessing by using the -E or -P
       option to cc(1), rather than by invoking /lib/cpp explicitly.

       Cpp optionally accepts two file names as arguments.  Ifile and ofile
       are respectively the input and output for the preprocessor.  They
       default to standard input and standard output if not supplied.

   Options
       -P     Preprocess the input without producing the line control
              information used by the next pass of the C compiler.

       -C     By default, cpp strips C-style comments.  If the -C option is
              specified, all comments (except those found on cpp directive
              lines) are passed along.

       -Uname Remove any initial definition of name.  Name is a reserved
              symbol that is predefined by the particular preprocessor.

       -Dname
       -Dname=def
              Define name as if by a #define directive.  If no =def is
              given, name is defined as 1.  If the same name is used in both
              -U and -D options, the last of these options will determine
              whether or not the name is defined.

       -Idir  Change the algorithm for searching for #include files whose
              names do not begin with / to look in dir before looking in the
              directories on the standard list.  Thus, #include files whose
              names are enclosed in "" will be searched for first in the
              directory of the file with the #include line, then in
              directories named in -I options, and last in directories on a
              standard list.  For #include files whose names are enclosed in
              <>, the directory of the file with the #include line is not
              searched.

       -T     Forces cpp to use only the first eight characters for
              distinguishing different preprocessor names.  This behavior is
              the same as for previous preprocessors with respect to the
              length of names and is included for backward compatibility.

       -Ydir  Use directory dir in place of the standard list of directories
              when searching for #include files.

       -H     Print the path names of included files (one per line) on
              standard error.



Licensed material--property of copyright holder(s)                         1




cpp(1)                         DG/UX 5.4R3.00                         cpp(1)


   Special Names
       Two special names are understood by cpp.  The name LINE is
       defined as the current line number (as a decimal integer) as known by
       cpp, and FILE is defined as the current file name (as a C string)
       as known by cpp.  You can use them anywhere (including in macros)
       just as any other defined name.

   Directives
       All cpp directives start with #.  Any number of blanks and tabs are
       allowed between the # and the directive.  The directives are:

       #define name token-string
              Replace subsequent instances of name with token-string.

       #define name( arg, ..., arg ) token-string
              Replace subsequent instances of name followed by a (, a list
              of comma-separated set of tokens, and a ) by token-string,
              where each occurrence of an arg in token-string is replaced by
              the corresponding set of tokens in the list.  When a macro
              with arguments is expanded, the arguments are placed into the
              expanded token-string unchanged.  After the entire token-
              string has been expanded, cpp restarts its scan for names to
              expand at the beginning of the newly created token-string.

              Notice that there can be no space between name and the (.

       #undef name
              Forget the definition of name (if any).

       #identstring
              Put string into the .comment section of an object file.

       #include "filename"
       #include <filename>
              Include at this point the contents of filename (which will
              then be run through cpp).  When you use the <filename>
              notation, filename is only searched for in the standard
              places.  See also the -I option above.

       #line integer-constant "filename"
              Makes cpp generate line control information for the next pass
              of the C compiler.  Integer-constant is the line number of the
              next line and filename is the file where it comes from.  If
              you omit filename, the current filename is unchanged.

       #endif
              Ends a section of lines begun by a test directive (#if,
              #ifdef, or #ifndef).  Each test directive must have a matching
              #endif.

       #ifdef name
              The lines following will appear in the output if name has been
              the subject of a previous #define without being the subject of
              an intervening #undef.



Licensed material--property of copyright holder(s)                         2




cpp(1)                         DG/UX 5.4R3.00                         cpp(1)


       #ifndef name
              The lines following will not appear in the output if name has
              been the subject of a previous #define without being the
              subject of an intervening #undef.

       #if constant-expression
              Lines following will appear in the output if the constant-
              expression evaluates to non-zero.  All binary non-assignment C
              operators, the ?: operator, the unary -, !, and ~ operators
              are legal in constant-expression.  The precedence of the
              operators is the same as defined by the C language.

              An unary operator is also defined, which can be used in
              constant-expression in these two forms: defined(name) or
              defined name.  This lets you use #ifdef and #ifndef in a #if
              directive.  In constant-expression, use only operators,
              integer constants, and names that cpp knows.  The sizeof
              operator is not available.

       #elif constant-expression
              Lines following will appear in the output if and only if the
              constant-expression evaluates to non-zero.  All binary non-
              assignment C operators, the ?: operator, the unary -,!, and ~
              operators are all legal in constant-expression.  The
              precedence of the operators is the same as defined in the C
              language.  There is also a unary operator defined, which can
              be used in constant-expression in these two forms: defined (
              name ) or defined name.  This allows the utility of #ifdef and
              #ifndef in a #if directive.  Only these operators, integer
              constants, and names, which are known by cpp, should be used
              in constant-expression.  In particular, the sizeof operator is
              not available.

              To test whether or not either of two symbols, bob and ted, are
              defined, use

                   #if defined(bob)|defined(ted)

       #else  Reverses the notion of the test directive that matches this
              directive.  If lines previous to this directive are ignored,
              the following lines will appear in the output, and vice versa.

       The test directives and the possible #else directives can be nested.

FILES
       /usr/include   Standard directory for #include files

DIAGNOSTICS
       Cpp error messages are intended to be self-explanatory.  The line
       number and filename where the error occurred are printed along with
       the diagnostic.

SEE ALSO
       cc(1).



Licensed material--property of copyright holder(s)                         3




cpp(1)                         DG/UX 5.4R3.00                         cpp(1)


NOTES
       When new-line characters were found in argument lists for macros to
       be expanded, previous versions of cpp put out the new-lines as they
       were found and expanded.  The current version of cpp replaces these
       new-lines with blanks.




















































Licensed material--property of copyright holder(s)                         4


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026