Read syntax diagramSkip visual syntax diagram
>>-+-------+--CALLC----fname------------------------------------>
'-label-'
.-,AMODE=amodedef-. (2)
>--(--+-----------------------+--)--+-----------------+--------><
| .-,-----------------. | '-,AMODE=-+-31-+--'
| V (1) | | '-64-'
'-------+-label1----+-+-'
+-freg------+
+-reg-------+
'-(regaddr)-'
Notes:
1. A maximum of 12 parameters can be specified.
2. The AMODE parameter is not supported for macros called from control program (CP) code. When CP is running, the z/TPF system must be in 64-bit mode.
label
is a symbolic name that can be assigned to the macro statement.
fname
is the C function name.
label1
is the label of an area of storage that contains a parameter.
freg
is a floating-point register (F0-F15) that contains data in binary floating-point format.
reg
is a register that contains a parameter.
regaddr
is a register that contains the address of the parameter.
AMODE
specifies the format that is used by all address parameters. The valid address format values are:
amodedef
The default value is specified by the AMODEDEF parameter of the BEGIN macro. If AMODEDEF is not specified on the BEGIN macro, the default value is 31.
31
indicates that addresses are specified in 31-bit format.
64
indicates that addresses are specified in 64-bit format.
Entry requirements
* R9 must point to the entry control block (ECB) address.
* R15 cannot be used as an input parameter register.
* You must define the prototype for the C function by using the CPROC macro before you use the CALLC macro.
* Floating-point data passed as a parameter must be in binary-floating-point format.
Return conditions
* If the C function returns floating-point data, F0 contains the return value.
* If the C function returns void or floating-point data, the contents of R15 are unknown.
* If the C function does not return floating-point data, R15 contains the return value.
Programming considerations
* See Register conventions for information about macro register conventions.
* The number of parameters specified using the CALLC macro must be equal to the number of parameters specified with the corresponding CPROC macro.
* The CALLC macro can be used by an application to receive or pass pointers to structures. An application cannot use the CALLC macro to receive or pass structures.
Examples
The following example shows an assembler program calling a C function that uses three parameters. The CPROC and CALLC macros are issued to call the C function.
...
CPROC RETURN=i,myfname,(c,p,us)
GETCC D1,L1 Get a core block
LR R2,R14 Copy address of core block
LA R3,=H'40' Get address of 40 in R3
Call CALLC myfname(parm_char,R2,(R3))
...
parm_char DC C'C' Character passed to C function
END
No comments:
Post a Comment