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

📄 pragma.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 5 页
字号:
.do end
.if '&machine' eq '80386' .do begin
&pragcont           modify [eax ebx ecx edx]
.do end
.millust end
.autonote Notes:
.note
All symbols are mapped to upper case.
.note
Arguments are pushed on the stack in reverse order.
That is, the first argument is pushed first, the second argument is pushed
next, and so on.
The routine being called will remove the arguments from the stack.
.note
Floating-point values are returned in the same way as structures.
When a structure is returned, the caller allocates space on the stack.
The address of the allocated space will be pushed on the stack
immediately before the call instruction.
Upon returning from the call, register &axup will contain address of
the space allocated for the return value.
.if '&machine' eq '80386' .do begin
.note
Registers EAX, EBX, ECX and EDX are not saved and restored when a call
is made.
.do end
.el .do begin
.note
Registers AX, BX, CX and DX, and segment register ES are not saved and
restored when a call is made.
.do end
.endnote
.*
.if '&machine' eq '80386' .do begin
.*
.section Predefined "__stdcall" Alias
.*
.millust begin
&pragma aux __stdcall "_*@nnn" \
&pragcont           parm routine [] \
&pragcont           value struct struct caller [] \
&pragcont           modify [eax ecx edx]
.millust end
.autonote Notes:
.note
All symbols are preceded by an underscore character.
.note
All C symbols (extern "C" symbols in C++) are suffixed by "@nnn" where
"nnn" is the sum of the argument sizes (each size is rounded up to a
multiple of 4 bytes so that char and short are size 4).
When the argument list contains "...", the "@nnn" suffix is omitted.
.note
Arguments are pushed on the stack from right to left.
That is, the last argument is pushed first.
The called routine will remove the arguments from the stack.
.note
When a structure is returned, the caller allocates space on the stack.
The address of the allocated space will be pushed on the stack
immediately before the call instruction.
Upon returning from the call, register EAX will contain address of
the space allocated for the return value.
Floating-point values are returned in 80x87 register ST(0).
.note
Registers EAX, ECX and EDX are not saved and restored when a call is
made.
.endnote
.*
.section Predefined "__syscall" Alias
.*
.millust begin
&pragma aux __syscall "*" \
&pragcont           parm caller [] \
&pragcont           value struct struct caller [] \
&pragcont           modify [eax ecx edx]
.millust end
.autonote Notes:
.note
Symbols names are not modified, that is, they are not adorned with
leading or trailing underscores.
.note
Arguments are pushed on the stack from right to left.
That is, the last argument is pushed first.
The calling routine will remove the arguments from the stack.
.note
When a structure is returned, the caller allocates space on the stack.
The address of the allocated space will be pushed on the stack
immediately before the call instruction.
Upon returning from the call, register EAX will contain address of
the space allocated for the return value.
Floating-point values are returned in 80x87 register ST(0).
.note
Registers EAX, ECX and EDX are not saved and restored when a call is
made.
.endnote
.*
.do end
.*
.if '&machine' eq '80386' .do begin
.section Predefined "__watcall" Alias (register calling convention)
.do end
.el .do begin
.section Predefined "__watcall" Alias
.do end
.*
.millust begin
&pragma aux __watcall "*_" \
.if '&machine' eq '80386' .do begin
&pragcont           parm routine [eax ebx ecx edx] \
.do end
.if '&machine' eq '8086' .do begin
&pragcont           parm routine [ax bx cx dx] \
.do end
&pragcont           value struct caller
.millust end
.autonote Notes:
.note
Symbol names are followed by an underscore character.
.note
Arguments are processed from left to right. The leftmost arguments
are passed in registers and the rightmost arguments are passed on
the stack (if the registers used for argument passing have been
exhausted). Arguments that are passed on the stack are pushed from
right to left. The calling routine will remove the arguments if any
were pushed on the stack.
.note
When a structure is returned, the caller allocates space on the stack.
The address of the allocated space is put into &siup register. 
The called routine then places the return value there.
Upon returning from the call, register &axup will contain address of
the space allocated for the return value.
.note
Floating-point values are returned using 80x86 registers ("fpc" option)
or using 80x87 floating-point registers ("fpi" or "fpi87" option).
.note
All registers must be preserved by the called routine.
.endnote
.*
.if '&machine' eq '80386' .do begin
.section Predefined "__watcall" Alias (stack calling convention)
.*
.millust begin
&pragma aux __watcall "*" \
&pragcont           parm caller [] \
&pragcont           value no8087 struct caller \
&pragcont           modify [eax ecx edx 8087]
.millust end
.autonote Notes:
.note
All symbols appear in object form as they do in source form.
.note
Arguments are pushed on the stack from right to left.
That is, the last argument is pushed first.
The calling routine will remove the arguments from the stack.
.note
When a structure is returned, the caller allocates space on the stack.
The address of the allocated space will be pushed on the stack
immediately before the call instruction.
Upon returning from the call, register &axup will contain address of
the space allocated for the return value.
.note
Floating-point values are returned only using 80x86 registers.
.note
Registers EAX, ECX and EDX are not preserved by the called routine.
.note
Any local variables that are located in the 80x87 cache are not
preserved by the called routine.
.endnote
.*
.do end
.*
.endlevel
.*
.do end
.* end of if '&cmpclass' ne 'load-n-go'
.*
.section Alternate Names for Symbols
.*
.np
The following form of the auxiliary pragma can be used to describe the
mapping of a symbol from its source form to its object form.
.ix 'pragmas' 'alternate name'
.mbox begin
:prgbeg. aux :id.sym:eid. :id.obj_name:eid. :prgend.
.mbox end
.synote
.note sym
is any valid &lang identifier.
.note obj_name
is any character string enclosed in double quotes.
.esynote
.pc
When specifying
.id obj_name,
some characters have a special meaning:
.synote
.note *
is unmodified symbol name
.note ^
is symbol name converted to uppercase
.note !
is symbol name converted to lowercase
.note #
is a placeholder for "@nnn", where nnn is size of all function parameters
on the stack; it is ignored for functions with variable argument lists, or
for symbols that are not functions
.note \
next character is treated as literal
.esynote
.np
Several examples of source to object form symbol name translation follow:
.if '&lang' eq 'FORTRAN 77' .do begin
By default, the upper case version "MYRTN" or "MYVAR" is placed in the object file.
.do end
.np
In the following example, the name "MyRtn" will be replaced by
.if '&lang' eq 'FORTRAN 77' .do begin
"MYRTN_"
.do end
.el .do begin
"MyRtn_"
.do end
in the object file.
.millust begin
.if '&lang' eq 'FORTRAN 77' .do begin
&pragma aux MyRtn "^_"&epragma
.do end
.el .do begin
&pragma aux MyRtn "*_"&epragma
.do end
.millust end
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.pc
This is the default for all function names.
.do end
.np
In the following example, the name "MyVar" will be replaced by
.if '&lang' eq 'FORTRAN 77' .do begin
"_MYVAR"
.do end
.el .do begin
"_MyVar"
.do end
in the object file.
.millust begin
.if '&lang' eq 'FORTRAN 77' .do begin
&pragma aux MyVar "_^"&epragma
.do end
.el .do begin
&pragma aux MyVar "_*"&epragma
.do end
.millust end
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.pc
This is the default for all variable names.
.do end
.np
In the following example, the lower case version "myrtn" will be placed in
the object file.
.millust begin
&pragma aux MyRtn "!"&epragma
.millust end
.*
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.np
In the following example, the upper case version "MYRTN" will be placed in
the object file.
.millust begin
&pragma aux MyRtn "^"&epragma
.millust end
.do end
.*
.np
In the following example, the name "MyRtn" will be replaced by
"_MyRtn@nnn" in the object file. "nnn" represents the size of all function
parameters.
.millust begin
&pragma aux MyRtn "_*#"&epragma
.millust end
.np
In the following example, the name "MyRtn" will be replaced by
"_MyRtn#" in the object file.
.millust begin
&pragma aux MyRtn "_*\#"&epragma
.millust end
.*
.np
The default mapping for all symbols can also be changed as illustrated
by the following example.
.millust begin
.if '&lang' eq 'FORTRAN 77' .do begin
&pragma aux default "_^_"&epragma
.do end
.el .do begin
&pragma aux default "_*_"&epragma
.do end
.millust end
.pc
The above auxiliary pragma specifies that all names will be prefixed
and suffixed by an underscore character ('_').
.*
.if '&cmpclass' ne 'load-n-go' .do begin
.*
.section Describing Calling Information
.*
.np
.ix 'calling &functions' 'near'
.ix 'calling &functions' 'far'
The following form of the auxiliary pragma can be used to describe the
way a &function is to be called.
.ix 'pragmas' 'calling information'
.ix 'pragmas' 'far'
.if '&lang' eq 'FORTRAN 77' and '&machine' eq '80386' .do begin
.ix 'pragmas' 'far16'
.do end
.ix 'pragmas' 'near'
.ix 'pragmas' '= const'
.ix 'pragmas' 'in-line assembly'
.ix 'calling information (pragma)'
.ix 'far (pragma)'
.if '&lang' eq 'FORTRAN 77' and '&machine' eq '80386' .do begin
.ix 'far16 (pragma)'
.do end
.ix 'near (pragma)'
.ix 'in-line assembly' 'in pragmas'
.*
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.* ---------------------------------------
.if '&machine' eq '8086' .do begin
.mbox begin
:prgbeg. aux :id.sym:eid. far :prgend.
    or
:prgbeg. aux :id.sym:eid. near :prgend.
    or
:prgbeg. aux :id.sym:eid. = :id.in_line:eid. :prgend.

:id.in_line ::= { const | (:eid.seg:id. id) | (:eid.offset:id. id) | (:eid.reloff:id. id)
                    | (:eid.float:id. fpinst) | :eid.":id.asm:eid." :id.}:eid.
.mbox end
.do end
.* ---------------------------------------
.if '&machine' eq '80386' .do begin
.mbox begin
:prgbeg. aux :id.sym:eid. far :prgend.
    or
:prgbeg. aux :id.sym:eid. near :prgend.
    or
:prgbeg. aux :id.sym:eid. = :id.in_line:eid. :prgend.

:id.in_line ::= { const | (:eid.seg:id. id) | (:eid.offset:id. id) | (:eid.reloff:id. id)
                    | :eid.":id.asm:eid." :id.}:eid.
.mbox end
.do end
.* ---------------------------------------
.do end
.*
.if '&lang' eq 'FORTRAN 77' .do begin
.* ---------------------------------------
.if '&machine' eq '8086' .do begin
.mbox begin
:prgbeg. aux :id.sym:eid. far
    or
:prgbeg. aux :id.sym:eid. near
    or
:prgbeg. aux :id.sym:eid. = :id.in_line:eid.

:id.in_line ::= { const | :eid.":id.asm:eid.":id. | (:eid.float:id. fpinst) }:eid.
.mbox end
.do end
.* ---------------------------------------
.if '&machine' eq '80386' .do begin
.mbox begin
:prgbeg. aux :id.sym:eid. far
    or
:prgbeg. aux :id.sym:eid. far16
    or
:prgbeg. aux :id.sym:eid. near
    or
:prgbeg. aux :id.sym:eid. = :id.in_line:eid.

:id.in_line ::= { const | :eid.":id.asm:eid.":id. }:eid.
.mbox end
.do end
.* ---------------------------------------
.do end
.*
.synote
.note sym
is a &function name.
.note const
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
is a valid &lang integer constant.
.note id
is any valid &lang identifier.
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
is a valid &lang hexadecimal constant.
.do end
.if '&machine' eq '8086' .do begin
.note fpinst
is a sequence of bytes that forms a valid 80x87 instruction.
The keyword
.kw float
must precede
.id fpinst
so that special fixups are applied to the 80x87 instruction.
.do end
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.note seg
specifies the segment of the symbol
.id id.
.note offset
specifies the offset of the symbol
.id id.
.note reloff
specifies the relative offset of the symbol
.id id
for near control transfers.
.do end
.note asm
is an assembly language instruction or directive.
.esynote
.pc
In the following example, &cmpname will generate a far call to the
&function
.id myrtn.
.millust begin
&pragma aux myrtn far&epragma
.millust end
.pc
Note that this overrides the calling sequence that would normally be
generated for a particular memory model.
In other words, a far call will be generated even if you are compiling
for a memory model with a small code model.
.np
In the following example, &cmpname will generate a near call to the
&function
.id myrtn.
.millust begin
&pragma aux myrtn near&epragma
.millust end
.pc
Note that this overrides the calling sequence that would normally be
generated for a particular memory model.
In other words, a near call will be generated even if you are
compiling for a memory model with a big code model.
.np
In the following DOS example, &cmpname will generate the sequence of
bytes follow

⌨️ 快捷键说明

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