/* ** Title: Circle ** SCCSid: %W% %E% %U% ** CCid: %W% %E% %U% ** Author: Informix Software, Inc. ** Created: 06/11/1998 14:53 ** Description: This is the generated 'C' file for the Circle DataBlade. ** Comments: Generated for project Circle.3.6 */ /* ** The following is placed here to insure ** that name "mangling" does not occur. */ #ifdef __cplusplus extern "C" { #endif /* Standard library includes. */ #include #include #include #include /* Used by Informix GLS routines. */ #include /* Include when accessing the Informix API. */ #include /* This is the project include file. */ #include "Circle.h" /* {{FUNCTION(abad8df5-5f52-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** CircSend ** ** Description: ** ** The binary send function is used to convert an instance of a ** data type between its internal representation on the server and ** on the client. ** ** Special Comments: ** ** Support routine for opaque type Circ returns mi_sendrecv. ** ** Parameters: ** ** Circ * Gen_param1; Pointer to the input text. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** mi_sendrecv * The constructed UDT value. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** CircSend FunctionId: abad8df5-5f52-11d0-93a5-00a0c9202325 ** ***************************************************************** */ mi_sendrecv * CircSend ( Circ * Gen_param1, /* The UDT value */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ Circ * Gen_InData; /* Pointer to the UDT value. */ Circ * Gen_OutData; /* Pointer to the packet data. */ mi_sendrecv * Gen_RetVal; /* The return value. */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in CircSend." */ DBDK_TRACE_ERROR( "CircSend", ERRORMESG1, 10 ); /* not reached */ } /* Point to the input data. */ Gen_InData = Gen_param1; /* Allocate a new return value. */ Gen_RetVal = (mi_sendrecv *)mi_new_var( sizeof( Circ ) ); if( Gen_RetVal == 0 ) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in CircSend." */ DBDK_TRACE_ERROR( "CircSend", ERRORMESG2, 10 ); /* not reached */ } /* Point to the output data. */ Gen_OutData = (Circ *)mi_get_vardata( (mi_lvarchar *)Gen_RetVal ); /* Prepare the value for Gen_OutData->center.x. */ mi_put_double_precision( (mi_unsigned_char1 *)&Gen_OutData->center.x, &Gen_InData->center.x ); /* Prepare the value for Gen_OutData->center.y. */ mi_put_double_precision( (mi_unsigned_char1 *)&Gen_OutData->center.y, &Gen_InData->center.y ); /* Prepare the value for Gen_OutData->radius. */ mi_put_double_precision( (mi_unsigned_char1 *)&Gen_OutData->radius, &Gen_InData->radius ); /* Close the connection. */ mi_close( Gen_Con ); /* Return the UDT for transmission. */ return Gen_RetVal; } /* }}FUNCTION (#CA4J0TJ7) */ /* {{FUNCTION(abad8df6-5f52-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** CircReceive ** ** Description: ** ** The binary receive function is used to convert an instance of a ** data type between its internal representation on the server and ** on the client. ** ** Special Comments: ** ** Support routine for opaque type Circ returns Circ. ** ** Parameters: ** ** mi_lvarchar * Gen_param1; Pointer to the input text. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** Circ * The constructed UDT value. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** CircReceive FunctionId: abad8df6-5f52-11d0-93a5-00a0c9202325 ** ***************************************************************** */ Circ * CircReceive ( mi_sendrecv * Gen_param1, /* The UDT value. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ Circ * Gen_RetVal; /* The return value. */ Circ * Gen_InData; /* Packet data. */ Circ * Gen_OutData; /* Output UDT value. */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in CircReceive." */ DBDK_TRACE_ERROR( "CircReceive", ERRORMESG1, 10 ); /* not reached */ } /* Point to the input data. */ Gen_InData = (Circ *)mi_get_vardata( (mi_lvarchar *)Gen_param1 ); /* Allocate room for the UDT. */ Gen_RetVal = (Circ *)mi_alloc( sizeof( Circ ) ); if( Gen_RetVal == 0 ) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in CircReceive." */ DBDK_TRACE_ERROR( "CircReceive", ERRORMESG2, 10 ); /* not reached */ } /* Point to the output data. */ Gen_OutData = (Circ *)Gen_RetVal; /* Copy the attribute value(s) from the transmission parcel. */ /* Prepare the value for Gen_OutData->center.x. */ mi_get_double_precision( (mi_unsigned_char1 *)&Gen_InData->center.x, &Gen_OutData->center.x ); /* Prepare the value for Gen_OutData->center.y. */ mi_get_double_precision( (mi_unsigned_char1 *)&Gen_InData->center.y, &Gen_OutData->center.y ); /* Prepare the value for Gen_OutData->radius. */ mi_get_double_precision( (mi_unsigned_char1 *)&Gen_InData->radius, &Gen_OutData->radius ); /* Return the transmitted UDT value. */ return Gen_RetVal; } /* }}FUNCTION (#1SSF52HR) */ /* {{FUNCTION(851d2d97-5f56-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** CircCompare ** ** Description: ** ** Perform the comparison operations required to compare two ** UDT values. ** ** This function returns zero if the two UDT values are equal and ** a non-zero value otherwise. ** ** Special Comments: ** ** Compares two fixed-sized opaque types ** ** Parameters: ** ** Circ * Gen_param1; The first UDT value to compare. ** Circ * Gen_param2; The second UDT value to compare. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** mi_integer The comparison result. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** CircCompare FunctionId: 851d2d97-5f56-11d0-93a5-00a0c9202325 ** ***************************************************************** */ mi_integer CircCompare ( Circ * Gen_param1, /* The first UDT value to compare. */ Circ * Gen_param2, /* The second UDT value to compare. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ mi_integer Gen_cc; /* Numeric attribute difference. */ Circ * Gen_Value1; /* Pointer to the first value. */ Circ * Gen_Value2; /* Pointer to the second value. */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in CircCompare." */ DBDK_TRACE_ERROR( "CircCompare", ERRORMESG1, 10 ); /* not reached */ } /* Point to the data values that are to be compared. */ Gen_Value1 = Gen_param1; Gen_Value2 = Gen_param2; /* Compare the two values. */ Gen_cc = Gen_Value1->center.x > Gen_Value2->center.x ? +1 : Gen_Value1->center.x < Gen_Value2->center.x ? -1 : 0 ; if( Gen_cc ) { return Gen_cc < 0 ? -1 : 1; } /* Compare the two values. */ Gen_cc = Gen_Value1->center.y > Gen_Value2->center.y ? +1 : Gen_Value1->center.y < Gen_Value2->center.y ? -1 : 0 ; if( Gen_cc ) { return Gen_cc < 0 ? -1 : 1; } /* Compare the two values. */ Gen_cc = Gen_Value1->radius > Gen_Value2->radius ? +1 : Gen_Value1->radius < Gen_Value2->radius ? -1 : 0 ; if( Gen_cc ) { return Gen_cc < 0 ? -1 : 1; } /* Close the connection. */ mi_close( Gen_Con ); return 0; } /* }}FUNCTION (#2AN24P1R) */ /* {{FUNCTION(851d2d98-5f56-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** CircEqual ** ** Description: ** ** Determine if one UDT value is equal to another. ** ** Special Comments: ** ** Compares two fixed-sized opaque types for equality ** ** Parameters: ** ** Circ * Gen_param1; The first UDT value to compare. ** Circ * Gen_param2; The second UDT value to compare. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** mi_boolean The comparison result. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** CircEqual FunctionId: 851d2d98-5f56-11d0-93a5-00a0c9202325 ** ***************************************************************** */ mi_boolean CircEqual ( Circ * Gen_param1, /* The first UDT value to compare. */ Circ * Gen_param2, /* The second UDT value to compare. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { /* Call Compare to perform the comparison. */ return (mi_boolean)(0 == CircCompare( Gen_param1, Gen_param2, Gen_fparam )); } /* }}FUNCTION (#0FNCK44G) */ /* {{FUNCTION(851d2d99-5f56-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** CircNotEqual ** ** Description: ** ** Determine if one UDT value is not equal to another. ** ** Special Comments: ** ** Compares two fixed-sized opaque types for non-equality ** ** Parameters: ** ** Circ * Gen_param1; The first UDT value to compare. ** Circ * Gen_param2; The second UDT value to compare. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** mi_boolean The comparison result. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** CircNotEqual FunctionId: 851d2d99-5f56-11d0-93a5-00a0c9202325 ** ***************************************************************** */ mi_boolean CircNotEqual ( Circ * Gen_param1, /* The first UDT value to compare. */ Circ * Gen_param2, /* The second UDT value to compare. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { /* Call Compare to perform the comparison. */ return (mi_boolean)(0 != CircCompare( Gen_param1, Gen_param2, Gen_fparam )); } /* }}FUNCTION (#1DUGCG3T) */ /* {{FUNCTION(abad8df7-5f52-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** CircInput ** ** Description: ** ** This function converts from the external representation of the ** UDT type Circ to its internal representation. The external ** representation is a blank-separated list of values and the ** internal representation is a 'C' structure of type Circ as ** defined in the header file. ** ** ** Data can be inserted into a table using an SQL insert statement: ** ** insert into tablename values ( 'value-list' ); ** ** value-list is a space-delimited list of values. ** ** Special Comments: ** ** Support routine for opaque type Circ returns Circ. ** ** Parameters: ** ** mi_lvarchar * Gen_param1; Pointer to the input text. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** Circ * The constructed UDT value. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** CircInput FunctionId: abad8df7-5f52-11d0-93a5-00a0c9202325 ** ***************************************************************** */ Circ * CircInput ( mi_lvarchar * Gen_param1, /* Pointer to the input text. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ gl_mchar_t * Gen_InData; /* Pointer to the input data. */ gl_mchar_t * Gen_StartInData; /* First value of Gen_InData. */ Circ * Gen_OutData; /* Pointer to the output data. */ mi_integer Gen_DataLen; /* Length of the data in bytes. */ Circ * Gen_RetVal; /* The return value. */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in CircInput." */ DBDK_TRACE_ERROR( "CircInput", ERRORMESG1, 10 ); /* not reached */ } /* Point to the input data. */ Gen_InData = (gl_mchar_t *)mi_get_vardata( (mi_lvarchar *) Gen_param1 ); Gen_StartInData = Gen_InData; /* Get the length of the input string. */ Gen_DataLen = mi_get_varlen( Gen_param1 ); /* Allocate a new UDT for the return result. */ Gen_RetVal = (Circ *)mi_alloc( sizeof( Circ ) ); if( Gen_RetVal == 0 ) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in CircInput." */ DBDK_TRACE_ERROR( "CircInput", ERRORMESG2, 10 ); /* not reached */ } /* Point to the output data. */ Gen_OutData = (Circ *)Gen_RetVal; /* Get the mi_double_precision value for center.x. */ Gen_InData = Gen_sscanf( Gen_Con, "CircInput", Gen_InData, Gen_DataLen - (Gen_InData - Gen_StartInData), 0, "(%lf %n,", (char *)&Gen_OutData->center.x ); /* Get the mi_double_precision value for center.y. */ Gen_InData = Gen_sscanf( Gen_Con, "CircInput", Gen_InData, Gen_DataLen - (Gen_InData - Gen_StartInData), 0, "%lf %n,", (char *)&Gen_OutData->center.y ); /* Get the mi_double_precision value for radius. */ Gen_InData = Gen_sscanf( Gen_Con, "CircInput", Gen_InData, Gen_DataLen - (Gen_InData - Gen_StartInData), 0, "%lf %n)", (char *)&Gen_OutData->radius ); /* Close the connection. */ mi_close( Gen_Con ); /* Return the UDT value. */ return Gen_RetVal; } /* }}FUNCTION (#AK3J0C4G) */ /* {{FUNCTION(abad8df8-5f52-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** CircOutput ** ** Description: ** ** This function converts from the internal representation of the ** UDT type Circ to its external representation. The external ** representation is a blank-separated list of values and the ** internal representation is a 'C' structure of type Circ as ** defined in the header file. ** ** Data can be retrieved from a table using an SQL select statement: ** ** select * from tablename; ** ** Special Comments: ** ** Support routine for opaque type Circ returns mi_lvarchar. ** ** Parameters: ** ** Circ * Gen_param1; Pointer to the input text. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** mi_lvarchar * The constructed UDT value. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** CircOutput FunctionId: abad8df8-5f52-11d0-93a5-00a0c9202325 ** ***************************************************************** */ mi_lvarchar * CircOutput ( Circ * Gen_param1, /* The UDT value. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ mi_integer Gen_CharLen; /* Estimate maximum length. */ Circ * Gen_InData; /* Pointer to the input data. */ char * Gen_OutData; /* Pointer to the output data. */ mi_lvarchar * Gen_RetVal; /* The return result. */ mi_integer Gen_DataLen; /* The data length. */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in CircOutput." */ DBDK_TRACE_ERROR( "CircOutput", ERRORMESG1, 10 ); /* not reached */ } /* Point to the input data. */ Gen_InData = Gen_param1; /* Compute the maximum length of the text representation. */ Gen_CharLen = 1 /* Leave room for the NULL terminator. */ + ( + 61 /* Add the length for x. */ + 61 /* Add the length for y. */ ) + 61 /* Add the length for radius. */ ; /* Allocate room for the output string. */ Gen_RetVal = mi_new_var( Gen_CharLen ); if( Gen_RetVal == 0 ) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in CircOutput." */ DBDK_TRACE_ERROR( "CircOutput", ERRORMESG2, 10 ); /* not reached */ } /* Point to the output data. */ Gen_OutData = mi_get_vardata( Gen_RetVal ); /* Format the attribute value into the output string. */ /* Format the mi_double_precision value for center.x. */ sprintf( Gen_OutData, "(%lf,", Gen_InData->center.x ); Gen_OutData += strlen( Gen_OutData ); /* Format the mi_double_precision value for center.y. */ sprintf( Gen_OutData, "%lf,", Gen_InData->center.y ); Gen_OutData += strlen( Gen_OutData ); /* Format the mi_double_precision value for radius. */ sprintf( Gen_OutData, "%lf)", Gen_InData->radius ); Gen_OutData += strlen( Gen_OutData ); /* ** Compute the length of the data and ** place it in the return structure. */ Gen_DataLen = (mi_integer)(Gen_OutData - mi_get_vardata( Gen_RetVal )); mi_set_varlen ( Gen_RetVal, Gen_DataLen ); /* Close the connection. */ mi_close( Gen_Con ); /* Return the UDT value. */ return Gen_RetVal; } /* }}FUNCTION (#7KGV4V8J) */ #ifdef __cplusplus } #endif