Professional Documents
Culture Documents
C Preprocessor
The C preprocessor, Cprep, manipulates the text of a source file as the first phase of
compilation. You can run Cprep as an independent process in either the Guardian or
OSS environment. The C preprocessor is embedded in the C compiler that runs in the
Guardian environment. The C compiler that runs in the OSS environment does not
contain the C preprocessor; Cprep must be run separately. (The OSS TNS c89 utility
runs the C preprocessor by default.)
C Compiler
The C compiler then translates C source text into machine language code. If there are
mistakes in your program, then error messages are generated; if not, object code is
generated.
C Run-Time Library
The C run-time library contains the functions defined in the ISO/ANSI C standard as
well as several functions that are extensions to the standard. Macros that are not in the
library are expanded during the preprocessing phase of the compiler.
The Guardian C run-time library and the OSS C run-time library share the same set of
header files. Header files contain function prototypes and the variable and type
declarations used by the functions.
For the complete semantics and syntax of the C run-time library in the Guardian TNS C
environment, see the Guardian TNS C Library Calls Reference Manual. For the
complete semantics and syntax of the C run-time library in the OSS environment, see
the Open System Services Library Calls Reference Manual.
Binder
The Binder collects and links object files generated by the C compiler and produces an
executable object file (a program file).
Accelerator
The Accelerator enables you to increase the performance of programs that run on
TNS/R systems. The Accelerator optimizes TNS program files (compiled and bound
object files) to take advantage of the TNS/R architecture.
• Ellis, Margaret A. and Stroustrup, Bjarne. The Annotated C++ Reference Manual.
Addison Wesley, 1990.
• ISO/IEC. Programming Languages – C. International Standard ISO/IEC 9899. First
edition 1990-12-15.
• Working Paper for Draft Proposed International Standard for Information Systems–
Programming Language C++. X3, Information Processing Systems. 2 Dec 1996.
X3J16/96-0225 WG21/N1043 (the standard on which the NonStop VERSION2 of
the Standard C++ Library is based).
• International Standard ISO/IEC 14882:1998(E) Programming Languages -- C++
(the 1998 standard on which the NonStop VERSION3 of the Standard C++ Library
is based).
• International Standard ISO/IEC 14882:2003(E) Programming Languages -- C++ (a
newer standard)
HP includes several extensions to ISO/ANSI standard C that make C an effective
language for writing applications that execute under the HP NonStop Kernel operating
system. Some of these features are:
• Access to several types of physical files
There is an extensive set of I/O library routines that enable you to access many
different types of physical files, including:
° C disk files, which are odd-unstructured files and have a file code of 180
° EDIT disk files, which have a file code of 101
° Processes
° Terminals
° $RECEIVE
• Two file-reference models
There are two sets of input and output routines; each set has its own method of
tracking, maintaining, and referring to a file. These methods, called file-reference
models, are:
° The alternate or UNIX-style model, which uses file descriptors to identify files
With two file-reference models available, you can select the model whose I/O
services best suit the needs of your application. For more details, see Section 4,
Using the C Run-Time Library.
• Access to Guardian system procedures
You can call procedures in the Guardian system library using the cextdecs
header file in the Guardian environment or the cextdecs.h header file in the OSS
environment.
° Feature-test macros
° System headers
° Local headers
° Macros
° File scope variables
° External variables
° External functions
° Structures and unions
° Signal-catching functions
° Functions
° main function
• Do not write code that relies on processor architecture. Be careful when writing
code that relies on word size, pointer size, bit fields, arithmetic precision, byte
order, stack size, stack growth, heap size, and heap growth.
• Do not make assumptions about the size and format of any data type:
° Use type short and type long instead of type int, if possible. In particular,
do not interchange between type int and type long.