📄 cpp.doc
字号:
NAME cpp - A FPL and C-Compiler Compatible Preprocessor. SYNOPSIS ccp [options] [infile|-] [outfile|-]COPYRIGHT 'cpp' is Copyright (C) 1993-1995 by FrexxWare. Author: Daniel Stenberg.DESCRIPTION The C preprocessor is a macro processor that is used au- tomatically by the C compiler to transform your program be- fore actual compilation. It is called a macro processor be- cause it allows you to define macros, which are brief abbre- viations for longer constructs. The C preprocessor provides four separate facilities that you can use as you see fit: o Inclusion of header files. These are files of declara- tions that can be substituted into your program. o Macro expansion. You can define macros, which are ab- breviations for arbitrary fragments of C code, and then the C preprocessor will replace the macros with their definitions throughout the program. o Conditional compilation. Using special preprocessing directives, you can include or exclude parts of the program according to various conditions. o Line control. If you use a program to combine or rear- range source files into an intermediate file which is then compiled, you can use line control to inform the compiler of where each source line originally came from. Most often when you use the C preprocessor you will not have to invoke it explicitly: the C/FPL compiler will do so automatically. However, the preprocessor is sometimes useful individually. The C preprocessor expects two file names as arguments, in- file and outfile. The preprocessor reads infile together with any other files it specifies with `#include'. All the output generated by the combined input files is written in outfile. Either infile or outfile may be `-', which as infile means to read from standard input and as outfile means to write to standard output. Also, if outfile or both file names are omitted, the standard output and standard input are used for the omitted file names.OPTIONS Options are first read in the file "cpp.prefs" in current directory or in "s:cpp.prefs" (AmigaDOS) or "$HOME/cpp.prefs" (UNIX), then the environment variable CPP_PREFS is scanned, and after that, the regular command line options are read. Options must be written separated, with a preceding '-'. Thus, the two options X and Y must be written "-X -Y" and *NOT* "-XY". The following options are supported: -B CPP normally predefines some symbols defining the target computer and operating system. If -B is specified, no such symbols will be predefined. -b Warnings will be displayed if there isn't as many open as close characters of the parentheses, brackets and braces symbols. -C If set, source-file comments are written to the output. This allows the output of CPP to be used as the input to a program, such as lint, that expects commands embedded in specially- formatted comments. -Dname=value Define the name as if the programmer wrote #define name value at the start of the first file. If "=value" is not given, a value of "1" will be used. -d Display all given options, including input and output files. -E Always return "success" to the operating system, even if errors were detected. Note that some fatal errors will terminate CPP, returning "failure" even if the -E option is given. -F Print the pathnames of included files, one per line on the standard error. -H Try to keep all whitespaces as found in the source. This is useful when you want an output using the same indent as the source has. Otherwise, any number of whitespaces will be replaced with one single space (' '). -h Output help text. -Idirectory Add this directory to the list of directories searched for #include "..." and #include <...> commands. Note that there is no space between the "-I" and the directory string (that must end with a slash '/'). More than one -I command is permitted. -J Allow nested comments. -j Warn whenever a nested comment is discovered. -LL Preprocesses input without producing line control information for the next pass of the C compiler. This also produces an output without unnecessary empty lines. -L Output "# <line>" prior to "#line <line>". -M Disable warnings when an include file isn't found. -N If this is specified, the "always present" symbols, __LINE__, __FILE__, __TIME__, __DATE__, __FUNCTION__ and __FUNC_LINE__ are not defined. -P Do not recognize and remove C++ style comments. -p Enable warnings on non ANSI preprocessor instructions. When this option is enabled, all #-keywords that are not specified in the ANSI standard X3J11 will be reported with warnings. -Q Makes cpp ignore and visualize all unrecognized flags. This flag was implemented to make it possible to use my cpp with the default AIX 'cc' compiler. Since that compiler always calls the preprocessor with some other flags not identified by this compiler, I had to do this... -q Same as -Q, but silent. Nothing is output when unknown options are ignored. -R In situations where concatenated macros are used like: #define FOOBAR fooBAR #define append(x,y) x ## y #define BAR bar append(FOO, BAR) Result without -R: fooBAR Result with -R: FOObar It is unspecified in the ANSI draft in which order to evaluate this. Should the "real" second word first be appended before the macro substitution occurs, or should the word get subsitituted first? Most ANSI compilers first append the "real" words and so does 'cpp' if -R isn't specified. If -R is specified, the right part of the concat is first subject to substitution, and then append is done. -Stext cpp normally assumes that thesize of the target computer's basic variable types is the same as the size of these types of the host computer. The -S option allows dynamic respecification of these values. "text" is a string of numbers, separated by commas, that specifies correct sizes. The sizes must be specified in the exact order: char short int long float double If you specify the option as "-S*text", pointers to these types will be specified. -S* takes one additional argument for pointer to function (e.g. int (*)()) For example, to specify sizes appropriate for a PDP-11, you would write: c s i l f d func -S1,2,2,2,4,8, -S*2,2,2,2,2,2,2 Note that *ALL* values must be specified. -Uname Undefine the name as if #undef name were given. -V Do not output the version information at startup. -W Outputs all #defines at the end of the output file. -w Only output #defines and nothing else. -X #Includes the specified file at the top of the source file. PRE-DEFINED VARIABLES: ====================== When CPP begins processing, the following variables will have been defined (unless the -B option is specified): Preprocessor: frexxcpp Target computer (as appropriate): m68000 amiga (on the Amiga version) Target operating system (as appropriate): amigados (on the Amiga version) The following are always available unless undefined (or -N was specified): __FILE__ The input (or #include) file being compiled (as a quoted string). __FUNCTION__ The function being compiled (as a quoted string). __FUNC_LINE__ The start line of the function being compiled. __LINE__ The line number being compiled. __DATE__ The date of compilation as a Unix ctime quoted string (the trailing newline is removed). __TIME__ The time of compilation. printf("Bug at line %d,", __LINE__); printf(" source file %s", __FILE__); printf(" compiled on %s", __DATE__); printf(" at the time %s", __TIME__); printf(" in function %s", __FUNCTION__); printf(" start line %d ", __FUNC_LINE__); PREPROCESSOR INSTRUCTIONS ========================= All cpp directive lines must begin with a # (pound sign). These directives are: #define Name TokenString Replaces subsequent instances of Name with TokenString. #define Name(Argument, . . . ,Argument) TokenString Replaces subsequent instances of the sequence Name (Argument, ... ,Argument) with TokenString, where each occurrence of an Argument in TokenString is replaced by the corresponding token in the comma-separated list. Note that there must not be any space between Name and the left parenthesis. #error String Generates an error string on this position. #undef Name Ignores the definition of Name from this point on. #include "File" or #include <File> Includes at this point the contents of File, which cpp then processes. If you enclose File in " " (double quotation marks) the cpp command searches first in the directory of InFile, second in directories named with the -I flag, and last in directories on a standard list. If you use the <File> notation, cpp searches for File only in the standard directories. It does not search the directory in which InFile resides. #line Number ["File"] Causes the implementation to behave as if the following sequence of source lines begins with a source line that has a line number as specified by Number. If File is supplied, the presumed name of the file is changed to be File. #pragma TokenString An implementation-defined instruction to the compiler.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -