Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

m4(1)

CPP(1)  —  HP-UX

NAME

cpp − the C language preprocessor

SYNOPSIS

/lib/cpp [ option ...  ] [ 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. Its purpose is to process include and conditional compilation instructions, and macros.  Thus 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 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. 

The following 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 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, where name is a reserved symbol that is predefined by the particular preprocessor.  The current list of these possibly reserved symbols includes:

operating system: mert, ibm, gcos, os, tss, unix

hardware: hp9000s800, hp9000s500, hp9000s300, hp9000s200, hp9000ipc, interdata, pdp11, u370, u3b, u3b5, vax

UNIX systems variant:
RES, RT, TS, PWB, hpux

lint(1): lint

All HP−UX systems will have the symbols PWB, hpux, and unix defined.  Each system will define exactly one hardware variant, as appropriate.  The lint symbol will be defined when lint(1) is running.

−Dname

−Dname=def
Define name as if by a #define directive.  If no =def is given, name is defined as 1.  The −D option has lower precedence than the −U option.  That is, if the same name is used in both a −U option and a −D option, the name will be undefined regardless of the order of the options. 

−T On HP-UX, preprocessor symbols are no longer restricted to eight characters.  The −T option forces cpp to use only the first eight characters for distinguishing different preprocessor names.  This behavior is the same as preprocessors on some other systems with respect to the length of names and is included for backward compatability. 
 

−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 containing the #include line, then in directories named in −I options in left-to-right order, and last in directories on a standard list.  For #include files whose names are enclosed in <>, the directory of the file containing the #include line is not searched.  However, the directory dir is still searched. 

−Hnnn
Change the internal macro definition table to be nnn bytes in size.  The macro symbol table will be increased proportionally.  The default table size is at least 36000 bytes.  This option serves to eliminate the "too many defines" and "too much defining" errors. 

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. They can be used anywhere (including in macros) just as any other defined name. 

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

#define name
Replace subsequent instances of name with token-string. (token-string may be null). 

#define name(arg, ..., arg) token-string
Notice that there can be no space between name and the (.  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 the token-string is replaced by the corresponding set of tokens in the comma-separated 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 re-starts its scan for names to expand at the beginning of newly created token-string.

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

#include "filename"

#include
Include at this point the contents of filename (which will then be run through cpp). See the −I 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 file name 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.  Any text occurring on the same line as the #endif is ignored and thus may be used to mark matching #if-#endif pairs.  This makes it easier, when reading the source, to match #if, #ifdef, and #ifndef directives with their associated #endif directive. 

#ifdef name
The lines following will 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 will 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 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 by the C language. There is also a unary operator defined, which can be used in constant-expression in these two forms: defined 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 which matches this directive.  Thus 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.  Cpp supports names up to 255 characters in length. 

HARDWARE DEPENDENCIES

Series 200, 300:
In the hardware name definition associated with predefined symbols (see −U option), two hardware variants are defined instead of one.  Both hp9000s200 and hp9000s300 are present, and they are treated synonymously because of the similarity between the two series. 

FILES

/usr/include standard directory for #include files

SEE ALSO

cc(1), m4(1). 

DIAGNOSTICS

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

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 to alleviate problems that the previous versions had when this occurred. 

INTERNATIONAL SUPPORT

8- and 16-bit data, 8-bit filenames. 

Hewlett-Packard Company  —  Version B.1,  April 12, 1993

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