Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cpp(1) — A/UX 0.7

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

m4(1)



     cpp(1)                                                     cpp(1)



     NAME
          cpp - the C language preprocessor

     SYNOPSIS
          /lib/cpp [-C] [-Dname[=def]] [-Idir] [-P] [-Uname]
          [ifile[ofile]]

     DESCRIPTION
          cpp is the C language preprocessor which is invoked as the
          first pass of any C compilation using the cc(1) command.
          The output of cpp is designed to be in a form acceptable as
          input to the next pass of the C compiler.  As the C language
          evolves, cpp and the rest of the C compilation package will
          be modified to follow these changes.  Therefore, the use of
          cpp other than in this framework is not suggested.  The
          preferred way to invoke cpp is through the cc(1) command
          since the functionality of cpp may someday be moved
          elsewhere.  See m4(1) for a general macro processor.

          cpp optionally accepts two filenames as arguments.  ifile is
          the input and ofile is the output for the preprocessor.
          They default to standard input and standard output if not
          supplied.

          The following flag options to cpp are recognized:

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

          -C   Pass along all comments except those found on cpp
               directive lines.  By default, cpp strips C-style
               comments.

          -Uname
               Remove any initial definition of name, where name is a
               reserved symbol that is predefined by the particular
               preprocessor.  The current list of these possibly
               reserved symbols includes:
                    operating system:    ibm, gcos, os, tss, unix
                    hardware:            interdata, pdp11, u370, u3b,
                                         vax, m68k
                    UNIX® System variant:
                                         RES, RT

          -Dname
          -Dname=def
               Define name as if by a #define directive.  If no =def
               is given, name is defined as 1.

          -Idir
               Search for #include files (whose names do not begin
               with /) in dir before looking in the directories on the



     Page 1                                        (last mod. 1/16/87)





     cpp(1)                                                     cpp(1)



               standard list.  When this flag option is used, #include
               files whose names are enclosed in "" are searched for
               first in the directory of the ifile argument, then in
               directories named in -I flag options, and last in
               directories on a standard list.  For #include files
               whose names are enclosed in <>, the directory of the
               ifile argument is not searched.

          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 filename
          (as a C string) as known by cpp.  They can be used anywhere
          (including in macros) just as any other defined name.

          All cpp directives start with lines begun by #.  The
          directives are:

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

          #define name( arg, . . ., arg ) token-string
               Notice that there can be no space between name and the
               left parenthesis [(].  Replace subsequent instances of
               name followed by a left parenthesis [(], a list of
               comma-separated tokens, and a right parenthesis [)] by
               token-string where each occurrence of an arg in the
               token-string is replaced by the corresponding token in
               the comma-separated list.

          #undef name
               Cause the definition of name (if any) to be forgotten
               from now on.

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

          #line integer-constant "filename"
               Causes cpp to 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 "filename" is not given, 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.



     Page 2                                        (last mod. 1/16/87)





     cpp(1)                                                     cpp(1)



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

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

          #if constant-expression
               Lines following 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 by 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.

          #else
               Reverses the notion of the test directive that matches
               this directive.  If lines previous to this directive
               are ignored, the following lines appear in the output.
               If lines previous to this directive are not ignored,
               the following lines do not appear in the output.

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

     FILES
          /lib/cpp
          /usr/include

     SEE ALSO
          cc(1), m4(1),
          ``Other tools'' in Oreo Programming Languages and Tools,
          Volume 2.

     DIAGNOSTICS
          The error messages produced by cpp are self-explanatory.
          The line number and filename where the error occurred are
          printed along with the diagnostic.

     NOTES
          When newline characters were found in argument lists for
          macros to be expanded, previous versions of cpp put out the



     Page 3                                        (last mod. 1/16/87)





     cpp(1)                                                     cpp(1)



          newlines as they were found and expanded.  The current
          version of cpp replaces these newlines with blanks to
          alleviate problems that the previous versions had when this
          occurred.



















































     Page 4                                        (last mod. 1/16/87)



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