header.gml
来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 1,049 行 · 第 1/3 页
GML
1,049 行
.section Header Files
.*
.np
The following header files are supplied with the C library. As has been
previously noted, when a library function is referenced in a source
file, the related header files (shown in the synopsis for that function)
should be included into that source file. The header files provide the
proper declarations for the functions and for the number and types of
arguments used with them. Constant values used in conjunction with the
functions are also declared. The files can be included multiple times
and in any order.
.if '&machsys' eq 'PP' .do begin
.np
When the &company C compiler option "za" is used ("ANSI conformance"),
the macro
.kw NO_EXT_KEYS
is predefined. The "za" option is used when you are creating an
application that must conform to a certain standard, whether it be ANSI
or POSIX. The effect on the inclusion of ANSI- and POSIX-defined header
files is that certain portions of the header files are omitted. For ANSI
header files, these are the portions that go beyond the ANSI standard.
For POSIX header files, these are the portions that go beyond the POSIX
standard. Feature test macros may then be defined to select those
portions which are omitted.
.if &unifnc eq 1 .do begin
Three feature test macros may be defined.
.do end
.el .do begin
Two feature test macros may be defined.
.do end
.begterm 17
.term _POSIX_SOURCE
Include those portions of the ANSI header files which relate to the
POSIX standard
.us (IEEE Standard Portable Operating System Interface for Computer
.us Environments - POSIX 1003.1)
.term _PP_SOURCE
Include those portions of the ANSI and POSIX header files which relate
to the POSIX standard and all extensions provided by the PenPoint system.
In essence, the definition of
.kw _PP_SOURCE
before any header files are included is equivalent to omitting the
specification of the "za" compiler option.
Note that when
.kw _PP_SOURCE
is defined, it encompasses
.kw _POSIX_SOURCE
so it is not necessary to define
.kw _POSIX_SOURCE
also.
.if &unifnc eq 1 .do begin
.term __UNICODE__
Select PenPoint's Unicode variation of the "U..." function macros.
Certain header files define a set of macros of the form
"Ufunction".
If
.kw __UNICODE__
is defined then the 16-bit Unicode version of "Ufunction" is selected;
otherwise the 8-bit non-Unicode version of "Ufunction" is selected.
The purpose of this feature is to provide portability of applications
between the 8-bit character set supported by PenPoint 1.0 and the
16-bit Unicode character set supported by PenPoint 2.0.
.do end
.endterm
.np
Feature test macros may be defined on the command line or in the
source file before any header files are included.
The latter is illustrated in the following example in which an ANSI
and POSIX conforming application is being developed.
.millust begin
#define _POSIX_SOURCE
#include <limits.h>
#include <stdio.h>
.
.
.
#if defined(_PP_SOURCE)
#include "non_POSIX_header1.h"
#include "non_POSIX_header2.h"
#include "non_POSIX_header3.h"
#endif
.millust end
.pc
The source code is then compiled using the "za" option.
.if &unifnc eq 1 .do begin
.np
The use of the
.kw __UNICODE__
feature test macro is illustrated in the following examples.
.millust begin
Example:
#include <string.h>
Ustrcpy( dst, src ); /* 8-bit strcpy is selected */
Example:
#define __UNICODE__
#include <string.h>
Ustrcpy( dst, src ); /* 16-bit _ustrcpy is selected */
.millust end
.do end
.np
The following ANSI header files are affected by the
.kw _POSIX_SOURCE
feature test macro.
.millust begin
limits.h
stdlib.h
time.h
.millust end
.np
The following ANSI and POSIX header files are affected by the
.kw _PP_SOURCE
feature test macro.
.millust begin
assert.h (ANSI)
ctype.h (ANSI)
dirent.h (POSIX)
env.h (POSIX)
fcntl.h (POSIX)
float.h (ANSI)
limits.h (ANSI)
math.h (ANSI)
sys&pc.stat.h (POSIX)
stdio.h (ANSI)
stdlib.h (ANSI)
string.h (ANSI)
time.h (ANSI)
unistd.h (POSIX)
utime.h (POSIX)
.millust end
.if &unifnc eq 1 .do begin
.np
The following header files are affected by the
.kw __UNICODE__
feature test macro.
.millust begin
assert.h
ctype.h
dirent.h
env.h
fcntl.h
stdio.h
stdlib.h
string.h
time.h
unistd.h
utime.h
.millust end
.do end
.do end
.el .if '&machsys' eq 'QNX' .do begin
.np
When the &company C compiler option "za" is used ("ANSI conformance"),
the macro
.kw NO_EXT_KEYS
is predefined. The "za" option is used when you are creating an
application that must conform to a certain standard, whether it be ANSI
or POSIX. The effect on the inclusion of ANSI- and POSIX-defined header
files is that certain portions of the header files are omitted. For ANSI
header files, these are the portions that go beyond the ANSI standard.
For POSIX header files, these are the portions that go beyond the POSIX
standard. Feature test macros may then be defined to select those
portions which are omitted. Two feature test macros may be defined.
.begterm 17
.term _POSIX_SOURCE
Include those portions of the ANSI header files which relate to the
POSIX standard
.us (IEEE Standard Portable Operating System Interface for Computer
.us Environments - POSIX 1003.1)
.term _QNX_SOURCE
Include those portions of the ANSI and POSIX header files which relate
to the POSIX standard and all extensions provided by the QNX system.
In essence, the definition of
.kw _QNX_SOURCE
before any header files are included is equivalent to omitting the
specification of the "za" compiler option.
Note that when
.kw _QNX_SOURCE
is defined, it encompasses
.kw _POSIX_SOURCE
so it is not necessary to define
.kw _POSIX_SOURCE
also.
.endterm
.np
Feature test macros may be defined on the command line or in the source
file before any header files are included. The latter is illustrated in
the following example in which an ANSI and POSIX conforming application
is being developed.
.millust begin
#define _POSIX_SOURCE
#include <limits.h>
#include <stdio.h>
.
.
.
#if defined(_QNX_SOURCE)
#include "non_POSIX_header1.h"
#include "non_POSIX_header2.h"
#include "non_POSIX_header3.h"
#endif
.millust end
.pc
The source code is then compiled using the "za" option.
.np
The following ANSI header files are affected by the
.kw _POSIX_SOURCE
feature test macro.
.millust begin
limits.h
setjmp.h
signal.h
stdio.h
stdlib.h
time.h
.millust end
.np
The following ANSI and POSIX header files are affected by the
.kw _QNX_SOURCE
feature test macro.
.millust begin
ctype.h (ANSI)
env.h (POSIX)
fcntl.h (POSIX)
float.h (ANSI)
limits.h (ANSI)
math.h (ANSI)
process.h (extension to POSIX)
setjmp.h (ANSI)
signal.h (ANSI)
sys&pc.stat.h (POSIX)
stdio.h (ANSI)
stdlib.h (ANSI)
string.h (ANSI)
termios.h (POSIX)
time.h (ANSI)
sys&pc.types.h (POSIX)
unistd.h (POSIX)
.millust end
.do end
.*
.beglevel
.*
.section Header Files in &hdrdir.
.*
.np
The following header files are provided with the software. The header
files that are located in the
.id &hdrdirup.
directory are described first.
.dfbeg
.*------------------------------
.df assert.h
This ISO C90 header file is required when an
.kw assert
macro is used. These assertions will be ignored when the identifier
.mono NDEBUG
is defined.
.*------------------------------
.if '&machsys' ne 'QNX' .do begin
.df bios.h
This header file declares all BIOS related functions.
.do end
.*------------------------------
.df conio.h
.ix '&KbIo'
.ix '&PortIo'
This header file declares console and
Intel 80x86 port input/output functions.
.*------------------------------
.df ctype.h
This ISO C90 header file declares functions that perform character
classification and case conversion operations. Similar functions for
wide characters are declared in <wctype.h>.
.*------------------------------
.if '&machsys' ne 'QNX' .do begin
.df direct.h
This header file declares functions related to directories and the type
.kw DIR
which describes an entry in a directory.
.do end
.*------------------------------
.if '&machsys' eq 'PP' or '&machsys' eq 'QNX' .do begin
.df dirent.h
This POSIX header file declares functions related to directories and
the type
.kw DIR
which describes an entry in a directory.
.do end
.*------------------------------
.if '&machsys' ne 'QNX' .do begin
.df dos.h
This header file declares functions that interact with DOS. It includes
the definitions of the
.kw FP_OFF
.ct,
.kw FP_SEG
and
.kw MK_FP
macros, and for the following structures and unions:
.sfbeg
.sf DOSERROR
describes the DOS error information.
.sf REGS
describes the CPU registers for Intel 8086 family.
.sf SREGS
describes the segment registers for the Intel 8086 family.
.sf REGPACK
describes the CPU registers and segment registers for Intel 8086 family.
.sf INTPACK
describes the input parameter to an "interrupt" function.
.sfend
.do end
.*------------------------------
.df env.h
This POSIX header file declares environment string functions.
.*------------------------------
.df errno.h
.ix '&Errs'
This ISO C90 header file provides the
.kw extern
declaration for error variable
.kw errno
and provides the symbolic names for error codes that can be placed in
the error variable.
.*------------------------------
.df fcntl.h
This POSIX header file defines the flags used by the
.if '&machsys' ne 'QNX' .do begin
.kw open
and
.kw sopen
functions. The function declarations for these functions are found in the
.hdrfile &iohdr
header file.
.do end
.if '&machsys' eq 'QNX' .do begin
.kw creat
.kw fcntl
.ct,
.kw open
.ct,
and
.kw sopen
functions.
.do end
.*------------------------------
.df fenv.h
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?