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

📄 pragma.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 5 页
字号:
.gt id delete
.gt eid delete
.gt op delete
.gt eop delete
.gt rp delete
.gt erp delete
.gt or delete
.gt prgbeg delete
.gt prgend delete
.*
.dm @id begin
:HP2.&*.
.dm @id end
.gt id add @id cont
.*
.dm @eid begin
:eHP2.&*
.dm @eid end
.gt eid add @eid cont
.*
.dm @op begin
:HP2.[:eHP2.&*
.dm @op end
.gt op add @op cont
.*
.dm @eop begin
:HP2.]:eHP2.&*
.dm @eop end
.gt eop add @eop cont
.*
.dm @rp begin
:HP2.{:eHP2.&*
.dm @rp end
.gt rp add @rp cont
.*
.dm @erp begin
:HP2.}:eHP2.&*
.dm @erp end
.gt erp add @erp cont
.*
.dm @or begin
:HP2.|:eHP2.&*
.dm @or end
.gt or add @or cont
.*
.if '&lang' eq 'FORTRAN 77' .do begin
.dm @prgbeg begin
*$pragma&*
.dm @prgbeg end
.gt prgbeg add @prgbeg cont
.*
.dm @prgend begin
.dm @prgend end
.gt prgend add @prgend cont texterror tagnext
.do end
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.dm @prgbeg begin
#pragma&*.
.dm @prgbeg end
.gt prgbeg add @prgbeg cont
.*
.dm @prgend begin
:HP2.[:eHP2.;:HP2.]:eHP2.
.dm @prgend end
.gt prgend add @prgend cont texterror tagnext
.do end
.*
.if '&lang' eq 'FORTRAN 77' .do begin
:set symbol="pragma" value="*$pragma".
:set symbol="epragma" value="".
:set symbol="function" value="subprogram".
:set symbol="functions" value="subprograms".
:set symbol="ufunction" value="Subprogram".
:set symbol="ufunctions" value="Subprograms".
:set symbol="short_int" value="INTEGER*2".
:set symbol="long_int" value="INTEGER*4".
:set symbol="int" value="INTEGER".
:set symbol="char" value="INTEGER*1".
:set symbol="ushort_int" value="INTEGER*2".
:set symbol="ulong_int" value="INTEGER*4".
:set symbol="uint" value="INTEGER".
:set symbol="uchar" value="INTEGER*1".
:set symbol="double" value="DOUBLE PRECISION".
:set symbol="single" value="REAL".
:set symbol="alias_name" value="WC".
:set symbol="other_cmp" value="&company C".
.if '&machine' eq '8086' .do begin
:set symbol="winopt" value="windows".
.do end
:set symbol="pragcont" value="c".
.do end
.*
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
:set symbol="pragma" value="#pragma".
:set symbol="epragma" value="~;".
:set symbol="function" value="function".
:set symbol="functions" value="functions".
:set symbol="ufunction" value="Function".
:set symbol="ufunctions" value="Functions".
:set symbol="short_int" value="short int".
:set symbol="long_int" value="long int".
:set symbol="int" value="int".
:set symbol="char" value="char".
:set symbol="ushort_int" value="unsigned short int".
:set symbol="ulong_int" value="unsigned long int".
:set symbol="uint" value="unsigned int".
:set symbol="uchar" value="unsigned char".
:set symbol="double" value="double".
:set symbol="single" value="float".
.if '&machine' eq '8086' .do begin
:set symbol="alias_name" value="MS_C".
:set symbol="other_cmp" value="Microsoft C".
:set symbol="winopt" value="zW".
.do end
.if '&machine' eq '80386' .do begin
:set symbol="alias_name" value="HIGH_C".
:set symbol="other_cmp" value="MetaWare High C".
.do end
:set symbol="pragcont" value="".
.do end
.*
.if '&machine' eq '80386' .do begin
:set symbol="ax" value="eax".
:set symbol="bx" value="ebx".
:set symbol="cx" value="ecx".
:set symbol="dx" value="edx".
:set symbol="di" value="edi".
:set symbol="si" value="esi".
:set symbol="sp" value="esp".
:set symbol="bp" value="ebp".
:set symbol="axup" value="EAX".
:set symbol="bxup" value="EBX".
:set symbol="cxup" value="ECX".
:set symbol="dxup" value="EDX".
:set symbol="diup" value="EDI".
:set symbol="siup" value="ESI".
:set symbol="spup" value="ESP".
:set symbol="bpup" value="EBP".
:set symbol="reg32" value="EAX".
:set symbol="intsize" value="4".
:set symbol="machint" value="int".
.if '&lang' eq 'FORTRAN 77' .do begin
:set symbol="machint" value="INTEGER".
:set symbol="arg_2_regs" value="DOUBLE PRECISION".
.do end
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
:set symbol="machint" value="int".
:set symbol="arg_2_regs" value="double".
.do end
.do end
.if '&machine' eq '8086' .do begin
:set symbol="ax" value="ax".
:set symbol="bx" value="bx".
:set symbol="cx" value="cx".
:set symbol="dx" value="dx".
:set symbol="di" value="di".
:set symbol="si" value="si".
:set symbol="sp" value="sp".
:set symbol="bp" value="bp".
:set symbol="axup" value="AX".
:set symbol="bxup" value="BX".
:set symbol="cxup" value="CX".
:set symbol="dxup" value="DX".
:set symbol="diup" value="DI".
:set symbol="siup" value="SI".
:set symbol="spup" value="SP".
:set symbol="bpup" value="BP".
:set symbol="reg32" value="pair DX:AX".
:set symbol="intsize" value="2".
.if '&lang' eq 'FORTRAN 77' .do begin
:set symbol="machint" value="INTEGER*2".
:set symbol="arg_2_regs" value="INTEGER".
.do end
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
:set symbol="machint" value="int".
:set symbol="arg_2_regs" value="long int".
.do end
.do end
.if '&machine' eq '8086' .do begin
:set symbol="pragref" value="prg86".
:set symbol="praglib" value="prgl86".
:set symbol="pragttl" value="16-bit Pragmas".
:set symbol="pragx87" value="prg87".
:set symbol="pragenbl" value="prgen16".
:set symbol="pragdsbl" value="prgds16".
.do end
.el .do begin
:set symbol="pragref" value="prg386".
:set symbol="praglib" value="prgl386".
:set symbol="pragttl" value="32-bit Pragmas".
:set symbol="pragx87" value="prg387".
:set symbol="pragenbl" value="prgen32".
:set symbol="pragdsbl" value="prgds32".
.do end
.*
.chap *refid=&pragref. &pragttl.
.*
.im pragstx
.*
.if &e'&dohelp eq 1 .do begin
.   .if '&machine' eq '8086' .do begin
.   .   .helppref 16-bit:
.   .do end
.   .el .do begin
.   .   .helppref 32-bit:
.   .do end
.do end
.*
.pc
The following classes of pragmas are supported.
.begbull
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.bull
pragmas that specify options
.do end
.bull
pragmas that specify default libraries
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.bull
pragmas that describe the way structures are stored in memory
.do end
.bull
pragmas that provide auxiliary information used for
.if '&cmpclass' eq 'load-n-go' .do begin
argument passing.
.do end
.el .do begin
code generation
.do end
.endbull
.*
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.section Using Pragmas to Specify Options
.*
.np
.ix 'pragma options'
.ix 'options' 'using pragmas'
Currently, the following options can be specified with pragmas:
.ix 'unreferenced option'
.ix 'check_stack option'
.begnote
.note unreferenced
.ix 'unreferenced option'
.ix 'options' 'unreferenced'
The "unreferenced" option controls the way &cmpname handles unused
symbols.
For example,
.millust begin
#pragma on (unreferenced);
.millust end
.pc
will cause &cmpname to issue warning messages for all unused symbols.
This is the default.
Specifying
.millust begin
#pragma off (unreferenced);
.millust end
.pc
will cause &cmpname to ignore unused symbols.
Note that if the warning level is not high enough, warning messages
for unused symbols will not be issued even if "unreferenced" was
specified.
.note check_stack
.ix 'check_stack option'
.ix 'options' 'check_stack'
The "check_stack" option controls the way stack overflows are to be
handled.
For example,
.millust begin
#pragma on (check_stack);
.millust end
.pc
will cause stack overflows to be detected and
.millust begin
#pragma off (check_stack);
.millust end
.pc
will cause stack overflows to be ignored.
When "check_stack" is on, &cmpname will generate a run-time call
to a stack-checking routine at the start of every routine compiled.
This run-time routine will issue an error if a stack overflow occurs
when invoking the routine.
The default is to check for stack overflows.
Stack overflow checking is particularly useful when functions are
invoked recursively.
Note that if the stack overflows and stack checking has been
suppressed, unpredictable results can occur.
.np
If a stack overflow does occur during execution and you are sure that
your program is not in error
(i.e. it is not unnecessarily recursing), you must increase the stack
size.
This is done by linking your application again and specifying the
"STACK" option to the &lnkname with a larger stack size.
.np
It is also possible to specify more than one option in a pragma as
illustrated by the following example.
.millust begin
#pragma on (check_stack unreferenced);
.millust end
.note reuse_duplicate_strings (C only)
.ix 'reuse_duplicate_strings option'
.ix 'options' 'reuse_duplicate_strings'
(C Only) The "reuse_duplicate_strings" option controls the way
&cmpcname handles identical strings in an expression.
For example,
.millust begin
#pragma on (reuse_duplicate_strings);
.millust end
.pc
will cause &cmpcname to reuse identical strings in an expression.
This is the default.
Specifying
.millust begin
#pragma off (reuse_duplicate_strings);
.millust end
.pc
will cause &cmpcname to generate additional copies of the identical
string.
The following example shows where this may be of importance to the way
the application behaves.
.exam begin
#include <stdio.h>

#pragma off (reuse_duplicate_strings)


void poke( char *, char * );

void main()
  {
    poke( "Hello world\n", "Hello world\n" );
  }

void poke( char *x, char *y )
  {
    x[3] = 'X';
    printf( x );
    y[4] = 'Y';
    printf( y );
  }
/*
Default output:
HelXo world
HelXY world
*/
.exam end
.endnote
.*
.do end
.*
.section *refid=&praglib Using Pragmas to Specify Default Libraries
.*
.if '&cmpclass' ne 'load-n-go' .do begin
.np
.ix 'pragmas' 'specifying default libraries'
.ix 'default libraries' 'using pragmas'
Default libraries are specified in special object module records.
Library names are extracted from these special records by the
&lnkname..
When unresolved references remain after processing all object modules
specified in linker "FILE" directives, these default libraries are
searched after all libraries specified in linker "LIBRARY" directives
have been searched.
.np
By default, that is if no library pragma is specified, the &cmpname
compiler generates, in the object file defining the main program,
default libraries corresponding to the memory model and floating-point
model used to compile the file.
For example, if you have compiled the source file containing
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.if '&machine' eq '8086' .do begin
the main program for the medium memory model and the floating-point
calls floating-point model, the libraries "clibm" and "mathm" will be
.do end
.if '&machine' eq '80386' .do begin
the main program for the flat memory model and the floating-point
calls floating-point model, the libraries "clib3r" and "math3r" will
be
.do end
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
.if '&machine' eq '8086' .do begin
the main program for the medium memory model and the floating-point
calls floating-point model, the library "flibm" will be
.do end
.if '&machine' eq '80386' .do begin
the main program for the flat memory model and the floating-point
calls floating-point model, the library "flib" will be
.do end
.do end
placed in the object file.
.do end
.if '&cmpclass' eq 'load-n-go' .do begin
.np
The library pragma can be used to specify object libraries that are to
be searched by &product when resolving references to undefined
symbols.
.ix '&ccmdup options' 'link'
These libraries will only be searched when the "link" compiler option
has been specified.
.do end
.el .do begin
.np
If you wish to add your own default libraries to this list, you can do
so with a library pragma.
.do end
Consider the following example.
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.millust begin
#pragma library (mylib);
.millust end
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
.millust begin
*$pragma library mylib
.millust end
.do end
.pc
The name "mylib" will be added to the list of default libraries
.if '&cmpclass' eq 'load-n-go' .do begin
searched by &product when resolving undefined references.
.do end
.el .do begin
specified in the object file.
.do end
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.np
If the library specification contains characters such as '&pc', ':' or
',' (i.e., any character not allowed in a C identifier), you must
enclose it in double quotes as in the following example.
.millust begin
.if '&target' eq 'QNX' .do begin
#pragma library ("&pathnam.&libdir.&pc.graph.lib");
.do end
.el .do begin
#pragma library ("&pathnam.&libdir16.&pc.dos&pc.graph.lib");
#pragma library ("&pathnam.&libdir32.&pc.dos&pc.graph.lib");
.do end
.millust end
.do end
.np
If you wish to specify more than one library in a library pragma you
must separate them with spaces as in the following example.
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.millust begin
.if '&target' eq 'QNX' .do begin
#pragma library (mylib "&pathnam.&libdir.&pc.graph.lib");
.do end

⌨️ 快捷键说明

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