Stack functions for C
To call a C function, EGL uses an argument stack, a mechanism that passes arguments between the functions and the calling code. The EGL calling function pushes its arguments onto the stack and the called C function pops them off of the stack to use the values. The called function pushes its return values onto the stack and the caller pops them off to retrieve the values. The pop and return external functions are provided with the argument stack library. The pop external functions are described below according to the data type of the value that each pops from the argument stack. The return external functions are described in Return functions for C.
Library functions for returning values
- extern void ibm_lib4gl_popMInt(int *iv)
- extern void ibm_lib4gl_popInt2(short *siv)
- extern void ibm_lib4gl_popInt4(int *liv)
- extern void ibm_lib4gl_popFloat(float *fv)
- extern void ibm_lib4gl_popDouble(double *dfv)
- extern void ibm_lib4gl_popDecimal(dec_t *decv)
- extern void ibm_lib4gl_popInt8(ifx_int8_t *bi)
| Pre-Version 7.31 name | Version 7.31 and later name |
|---|---|
| popint | ibm_lib4gl_popMInt |
| popshort | ibm_lib4gl_popInt2 |
| poplong | ibm_lib4gl_popInt4 |
| popflo | ibm_lib4gl_popFloat |
| popdub | ibm_lib4gl_popDouble |
| popdec | ibm_lib4gl_popDecimal |
- Removes one value from the argument stack.
- Converts its data type if necessary. If the value on the stack cannot be converted to the specified type, an error occurs.
- Copies the value to the designated variable.
The structure types dec_t and ifx_int8_t are used to represent DECIMAL and BIGINT data in a C program. For more information about the dec_t and ifx_int8_t structure types and library functions for manipulating and printing DECIMAL and BIGINT variables, see the IBM® Informix® ESQL/C Programmer's Manual.
Library Functions for Popping Character Strings
- extern void ibm_lib4gl_popQuotedStr(char *qv, int len)
- extern void ibm_lib4gl_popString(char *qv, int len)
- extern void ibm_lib4gl_popVarChar(char *qv, int len)
| Pre-Version 7.31 name | Version 7.31 and later name |
|---|---|
| popquote | ibm_lib4gl_popQuotedStr |
| popstring | ibm_lib4gl_popString |
| popvchar | ibm_lib4gl_popVarChar |
Both ibm_lib4gl_popQuotedStr( ) and ibm_lib4gl_popVarChar( ) copy exactly len bytes into the string buffer *qv. Here ibm_lib4gl_popQuotedStr( ) pads with spaces as necessary, but ibm_lib4gl_popVarChar( ) does not pad to the full length. The final byte copied to the buffer is a null byte to terminate the string, so the maximum string data length is len-1. If the stacked argument is longer than len-1, its trailing bytes are lost.
Library Functions for Popping Time Values
- extern void ibm_lib4gl_popDate(int *datv)
- extern void ibm_lib4gl_popInterval(intrvl_t *iv, int qual)
- extern void ibm_lib4gl_popDateTime(dtime_t *dtv, int qual)
| Pre-Version 7.31 name | Version 7.31 and later name |
|---|---|
| popdate | ibm_lib4gl_popDate |
| popdtime | ibm_lib4gl_popDateTime |
| popinv | ibm_lib4gl_popInterval |
The structure types dtime_t and intrvl_t are used to represent DATETIME and INTERVAL data in a C program. The qual argument receives the binary representation of the DATETIME or INTERVAL qualifier. For more information about the dtime_t and intrvl_t structure types and library functions for manipulating and printing DATE, DATETIME, and INTERVAL variables, see the IBM® Informix® ESQL/C Programmer's Manual.
Library Functions for Popping BYTE or TEXT Values
- extern void ibm_lib4gl_popBlobLocator(loc_t **blob)
| Pre-Version 7.31 name | Version 7.31 and later name |
|---|---|
| poplocator | ibm_lib4gl_popBlobLocator |
Any BYTE or TEXT argument must be popped as BYTE or TEXT because EGL provides no automatic data type conversion.