⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpwcc.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 5 页
字号:
.chap *refid=cpwcc The &product Compilers
.*
.np
.ix 'compiler' 'features'
This chapter covers the following topics.
.begbull
.bull
Command line syntax
(see :HDREF refid='wccclf'.)
.bull
Environment variables used by the compilers
(see :HDREF refid='wccenv'.)
.bull
Examples of command line syntax
(see :HDREF refid='wcccle'.)
.bull
Interpreting diagnostic messages
(see :HDREF refid='wccdiag'.)
.bull
#include file handling
(see :HDREF refid='wccinc'.)
.bull
Using the preprocessor built into the compilers
(see :HDREF refid='wccprep'.)
.bull
System-dependent macros predefined by the compilers
(see :HDREF refid='wccmacs'.)
.bull
Additional keywords supported by the compilers
(see :HDREF refid='wccext'.)
.bull
Based pointer support in the compilers
(see :HDREF refid='wccbase'.)
.bull
Notes about the Code Generator
(see :HDREF refid='wccgen'.)
.endbull
.*
.section *refid=wccclf &product Command Line Format
.*
.np
.ix 'command line format'
.ix 'compiling' 'command line format'
The formal &product command line syntax is shown below.
.ix 'invoking &product'
.mbigbox
compiler_name [options] [file_spec] [options] [@extra_opts]
.embigbox
.np
The square brackets [ ] denote items which are optional.
.begnote
.note compiler_name
is one of the &product compiler command names.
.ix 'command name' 'compiler'
.if '&target' eq 'QNX' .do begin
.begnote $compact
.note &ccmd16
is the &cmpcname compiler for 16-bit Intel platforms.
.note &pcmd16
is the &cmppname compiler for 16-bit Intel platforms.
.note &ccmd32
is the &cmpcname compiler for 32-bit Intel platforms.
.note &pcmd32
is the &cmppname compiler for 32-bit Intel platforms.
.if '&alpha' eq 'AXP' .do begin
.note &ccmdAX
is the &cmpcname compiler for DEC Alpha AXP platforms.
.note &pcmdAX
is the &cmppname compiler for DEC Alpha AXP platforms.
.do end
.endnote
.do end
.el .do begin
.begnote $compact
.note &ccmdup16
is the &cmpcname compiler for 16-bit Intel platforms.
.note &pcmdup16
is the &cmppname compiler for 16-bit Intel platforms.
.note &ccmdup32
is the &cmpcname compiler for 32-bit Intel platforms.
.note &pcmdup32
is the &cmppname compiler for 32-bit Intel platforms.
.if '&alpha' eq 'AXP' .do begin
.note &ccmdupAX
is the &cmpcname compiler for DEC Alpha AXP platforms.
.note &pcmdupAX
is the &cmppname compiler for DEC Alpha AXP platforms.
.do end
.endnote
.do end
.note file_spec
is the file name specification of
one or more files to be compiled.
If file_spec is specified as the single character ".", an input file
is read from standard input and the output file name defaults to
stdin.obj.
.if '&target' ne 'QNX' .do begin
.np
If no drive is specified, the default drive is assumed.
.do end
.np
If no path is specified, the current working directory is assumed.
.ix 'directories' 'C'
.ix 'C directory'
If the file is not in the current directory, an adjacent "C" directory
(i.e.,
.fi ~..&pc.c
.ct ) is searched if it exists.
.np
.ix 'filename extension'
.ix 'default filename extension'
.ix 'extension' 'default'
If no file extension is specified, the compiler will check for a file
with one of the following extensions in the order listed:
.if '&target' eq 'QNX' .do begin
.begnote $compact
.note ~.cpp
(C++ only)
.note ~.cc
(C++ only)
.note ~.c
(C/C++)
.endnote
.np
A QNX filename extension consists of that portion of a filename
containing the last "." and any characters which follow it.
.exam begin 5
File Specification              Extension
/home/john.doe/foo              (none)
/home/john.doe/foo.             .
/home/john.doe/foo.bar          .bar
/home/john.doe/foo.goo.bar      .bar
.exam end
.do end
.el .do begin
.begnote $compact
.note ~.CPP
(C++ only)
.note ~.CC
(C++ only)
.note ~.C
(C/C++)
.endnote
.do end
.np
If a period "." is specified but not the extension, the file is
assumed to have no filename extension.
.np
If only the compiler name is specified then the compiler will display
a list of available options.
.note options
.ix 'command line options' 'compiler'
is a list of valid compiler options, each preceded by
.if '&target' ne 'QNX' .do begin
a slash ("/") or
.do end
a dash ("&minus.").
Options may be specified in any order.
.note extra_opts
.ix 'command line options' 'environment variable'
.ix 'environment variable' 'command line options'
.ix 'command line options' 'options file'
.ix 'options file' 'command line options'
is the name of an environment variable or file which contains
additional command line options to be processed.
If the specified environment variable does not exist, a search is made
for a file with the specified name.
.ix 'occ file extension'
If no file extension is included in the specified name, the default
file extension is ".occ".
A search of the current directory is made.
.ix 'directories' 'OCC'
.ix 'OCC directory'
If not successful, an adjacent "OCC" directory (i.e.,
.fi ~..&pc.occ
.ct ) is searched if it exists.
.endnote
.*
.if '&target' ne 'QNX' .do begin
.*
.section *refid=wccdll &product DLL-based Compilers
.*
.np
.ix 'DLL compilers'
.ix 'compiling' 'using DLL compilers'
The compilers are also available in Dynamic Link Library (DLL) form.
.begnote $compact
.note WCCD
is the DLL version of the &cmpcname compiler for 16-bit Intel platforms.
.note WPPDI86
is the DLL version of the &cmppname compiler for 16-bit Intel platforms.
.note WCCD386
is the DLL version of the &cmpcname compiler for 32-bit Intel platforms.
.note WPPD386
is the DLL version of the &cmppname compiler for 32-bit Intel platforms.
.if '&alpha' eq 'AXP' .do begin
.note WCCDAXP
is the DLL version of the &cmpcname compiler for DEC Alpha AXP platforms.
.note WPPDAXP
is the DLL version of the &cmppname compiler for DEC Alpha AXP platforms.
.do end
.endnote
.np
The DLL versions of the compilers can be loaded from the &wide (&vip)
and &makname..
.*
.do end
.*
.section *refid=wccenv Environment Variables
.*
.np
.ix 'environment variables'
Environment variables can be used to specify commonly used compiler
options.
There is one environment variable for each compiler (the name of the
environment variable is the same as the compiler name).
The &product environment variable names are:
.ix '&setcmdup'
.*
.dm ixev begin
.ix 'environment variables' '&*'
.ix '&* environment variable'
.dm ixev end
.*
.begnote
.note &cvarup16
.ixev &cvarup16
used with the &cmpcname compiler for 16-bit Intel platforms
.exam begin 1
&prompt.&setcmd &setdelim.&cvar16=&sw.d1 &sw.ot&setdelim
.exam end
.note &pvarup16
.ixev &pvarup16
used with the &cmppname compiler for 16-bit Intel platforms
.exam begin 1
&prompt.&setcmd &setdelim.&pvar16=&sw.d1 &sw.ot&setdelim
.exam end
.note &cvarup32
.ixev &cvarup32
used with the &cmpcname compiler for 32-bit Intel platforms
.exam begin 1
&prompt.&setcmd &setdelim.&cvar32=&sw.d1 &sw.ot&setdelim
.exam end
.note &pvarup32
.ixev &pvarup32
used with the &cmppname compiler for 32-bit Intel platforms
.exam begin 1
&prompt.&setcmd &setdelim.&pvar32=&sw.d1 &sw.ot&setdelim
.exam end
.if '&alpha' eq 'AXP' .do begin
.note &cvarupAX
.ixev &cvarupAX
used with the &cmpcname compiler for DEC Alpha AXP platforms
.exam begin 1
&prompt.&setcmd &setdelim.&cvarAX=&sw.d1 &sw.ot&setdelim
.exam end
.note &pvarupAX
.ixev &pvarupAX
used with the &cmppname compiler for DEC Alpha AXP platforms
.exam begin 1
&prompt.&setcmd &setdelim.&pvarAX=&sw.d1 &sw.ot&setdelim
.exam end
.do end
.endnote
.np
The options specified in environment variables are processed before
options specified on the command line.
The above examples define the default options to be "d1" (include line
number debugging information in the object file), and "ot" (favour
time optimizations over size optimizations).
.if '&target' ne 'QNX' .do begin
.np
.ix 'environment string' '= substitute'
.ix 'environment string' '#'
Whenever you wish to specify an option that requires the use of an
"=" character, you can use the "#" character in its place.
This is required by the syntax of the "&setcmdup" command.
.do end
.np
Once a particular environment variable has been defined, those options
listed become the default each time the associated compiler is used.
The compiler command line can be used to override any options
specified in the environment string.
.*
.if '&target' ne 'QNX' .do begin
.np
These environment variables are not examined by the &wclname utilities.
Since the &wclname utilities pass the relevant options found in their
associated environment variables to the compiler command line, their
environment variable options take precedence over the options
specified in the environment variables associated with the compilers.
.do end
.keep 18
.hint
.if '&target' eq 'QNX' .do begin
.ix 'user initialization file'
If you use the same compiler options all the time, you may find it
handy to define the environment variable in your user initialization
file.
.do end
.el .do begin
.ix 'system initialization file' 'AUTOEXEC.BAT'
.ix 'AUTOEXEC.BAT'
If you are running DOS and you use the same compiler options all the
time, you may find it handy to define the environment variable in your
DOS system initialization file,
.fi AUTOEXEC.BAT.
.np
.ix 'system initialization' 'Windows NT'
.ix 'Windows NT' 'system initialization'
If you are running Windows NT, use the "System" icon in the
.bd Control Panel
to define environment variables.
.np
.ix 'system initialization file' 'CONFIG.SYS'
.ix 'CONFIG.SYS'
If you are running OS/2 and you use the same compiler options all the
time, you may find it handy to define the environment variable in your
OS/2 system initialization file,
.fi CONFIG.SYS.
.do end
.ehint
.*
.section *refid=wcccle &product Command Line Examples
.*
.np
The following are some examples of using &product to compile &lang
source programs.
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. report &sw.d1 &sw.s
.exam end
.pc
The compiler processes
.fi report.c(pp)
producing an object file which contains source line number
information.
Stack overflow checking is omitted from the object code.
.ix 'memory model'
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. &sw.mm &sw.fpc calc
.exam end
.pc
The compiler compiles
.fi calc.c(pp)
for the Intel "medium" memory model and generates calls to
floating-point library emulation routines for all floating-point
operations.
Memory models are described in the
chapter entitled :HDREF refid='mdl86'..
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. kwikdraw &sw.2 &sw.fpi87 &sw.oaxt
.exam end
.pc
The compiler processes
.fi kwikdraw.c(pp)
producing 16-bit object code for an Intel 286 system equipped with an
Intel 287 numeric data processor (or any upward compatible 386/387,
486DX, or Pentium system).
While the choice of these options narrows the number of microcomputer
systems where this code will execute, the resulting code will be
highly optimized for this type of system.
.ix 'memory model'
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. &sw.mf &sw.3s calc
.exam end
.pc
The compiler compiles
.fi calc.c(pp)
for the Intel 32-bit "flat" memory model.
The compiler will generate 386 instructions based on 386 instruction
timings using the stack-based argument passing convention.
The resulting code will be optimized for Intel 386 systems.
Memory models are described in the
chapter entitled :HDREF refid='mdl386'..
Argument passing conventions are described in the
chapter entitled :HDREF refid='cal386'..
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. kwikdraw &sw.4r &sw.fpi87 &sw.oaimxt
.exam end
.pc
The compiler processes
.fi kwikdraw.c(pp)
producing 32-bit object code for an Intel 386-compatible system
equipped with a 387 numeric data processor.
The compiler will generate 386 instructions based on 486 instruction
timings using the register-based argument passing convention.
The resulting code will be highly optimized for Intel 486 systems.
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. ..&pc.source&pc.modabs &sw.d2
.exam end
.pc
The compiler processes
.fi ~..&pc.source&pc.modabs.c(pp)
(a file in a directory which is adjacent to the current one).
The object file is placed in the current directory.
Included with the object code and data is information on local
symbols and data types.
The code generated is straight-forward, unoptimized code which can
be readily debugged with the &dbgname..
.exam begin 2
.if '&target' eq 'QNX' .do begin
&prompt.&setcmd &setdelim.:SF font=1.compiler_name:eSF.=&sw.i=&pc.includes &sw.mc&setdelim.
.do end
.el .do begin
&prompt.&setcmd &setdelim.:SF font=1.compiler_name:eSF.=&sw.i#&pc.includes &sw.mc&setdelim.
.do end
&prompt.:SF font=1.compiler_name:eSF. &pc.cprogs&pc.grep.tst &sw.fi=iomods.c
.exam end
.pc
The compiler processes the program contained in the file
.fi &pc.cprogs&pc.grep.tst.
The file
.fi iomods.c
is included as if it formed part of the source input stream.
The include search path and memory model options are defaults each
time the compiler is invoked.
The memory model option could be overridden on the command line.
After looking for an "include" file in the current directory, the
compiler will search each directory listed in the "i" path.
See the section entitled :HDREF refid='wccinc'. for more information.
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. grep &sw.fo=..&pc.obj&pc.
.exam end
.pc
The compiler processes the program contained in the file
.fi grep.c(pp)
which is located in the current directory.
The object file is placed in the directory
.fi ~..&pc.obj
under the name
.fi grep&obj..
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. &sw.dDBG=1 grep &sw.fo=..&pc.obj&pc..dbo
.exam end
.pc
The compiler processes the program contained in the file
.fi grep.c(pp)
which is located in the current directory.
The macro "DBG" is defined so that conditional debugging statements
that have been placed in the source are compiled.
The object file is placed in the directory
.fi ~..&pc.obj
and its filename extension will be ".dbo" (instead of "&obj").
Selection of a different filename extension permits easy
identification of object files that have been compiled with debugging
statements.
.exam begin 1
&prompt.:SF font=1.compiler_name:eSF. &sw.g=GKS &sw.s &pc.gks&pc.gopks

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -