/* ** 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" /* Local forward declaration */ UDREXPORT mi_double_precision * Distance( Pnt *, Pnt *, MI_FPARAM * ); double sqrt(double); /* {{FUNCTION(abad8df9-5f52-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** Contains ** ** Description: ** ** Special Comments: ** ** Entrypoint for the SQL routine Contains (Circ,Pnt) returns boolean. ** ** Parameters: ** ** Return value: ** ** mi_integer ** ** History: ** ** 06/30/1998 - Generated by BladeSmith Version 3.60.630 . ** ** Identification: ** ** NOTE: ** ** BladeSmith will add and remove parameters from the function ** prototype, and will generate tracing calls. ONLY EDIT code ** in blocks marked Your_
. Any other modifications ** will require manual merging. ** ***************************************************************** */ UDREXPORT mi_integer Contains ( Circ * circ1, Pnt * pnt1, MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs.*/ ) { MI_CONNECTION * Gen_Con; /* The connection handle. */ mi_integer Gen_RetVal; /* The return value. */ /* ------ {{Your_Declarations (PreserveSection) BEGIN ------ */ double * dist; /* ------ }}Your_Declarations (#0000) END ------ */ /* Use the NULL connection. */ Gen_Con = NULL; /* ------ {{Your_Code (PreserveSection) BEGIN ------ */ /* ** Write to the trace file indicating ** that Contains has been called. */ DBDK_TRACE_ENTER( "Contains" ); /* ** Computes the distance between ** the center of the circle and ** the point. */ dist = Distance( pnt1, &circ1->center, Gen_fparam ); /* Is the distance within the radius? */ if( (*dist - circ1->radius) <= 0 ) { Gen_RetVal = 1; } else { Gen_RetVal = 0; } mi_free( (char *)dist ); /* ** Write to the trace file indicating ** that Contains has successfully exited. */ DBDK_TRACE_EXIT( "Contains" ); /* ------ }}Your_Code (#BD8C) END ------ */ /* Return the function's return value. */ return Gen_RetVal; } /* }}FUNCTION (#PKG9IIA9) */ /* {{FUNCTION(abad8df4-5f52-11d0-93a5-00a0c9202325) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** Distance ** ** Description: ** ** Special Comments: ** ** Entrypoint for the SQL routine Distance (Pnt,Pnt) returns double precision. ** ** Parameters: ** ** Return value: ** ** mi_double_precision ** ** History: ** ** 06/30/1998 - Generated by BladeSmith Version 3.60.630 . ** ** Identification: ** ** NOTE: ** ** BladeSmith will add and remove parameters from the function ** prototype, and will generate tracing calls. ONLY EDIT code ** in blocks marked Your_
. Any other modifications ** will require manual merging. ** ***************************************************************** */ UDREXPORT mi_double_precision *Distance ( Pnt * Pnt1, Pnt * Pnt2, MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs.*/ ) { mi_double_precision* Gen_RetVal; /* The return value. */ MI_CONNECTION * Gen_Con; /* The connection handle. */ /* ------ {{Your_Declarations (PreserveSection) BEGIN ------ */ /* ------ }}Your_Declarations (#0000) END ------ */ /* Use the NULL connection. */ Gen_Con = NULL; /* ------ {{Your_Code (PreserveSection) BEGIN ------ */ /* ** Write to the trace file indicating ** that Distance has been called. */ DBDK_TRACE_ENTER( "Distance" ); /* ** Allocate the return value. It must be ** allocated if it is a UDT or type whose ** size is greater than 4 bytes. */ Gen_RetVal = (mi_double_precision *)mi_alloc( sizeof( mi_double_precision ) ); if( Gen_RetVal == 0) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in Distance." */ DBDK_TRACE_ERROR( "Distance", ERRORMESG2, 10 ); /* not reached */ } *Gen_RetVal = sqrt( (Pnt1->x - Pnt2->x) * (Pnt1->x - Pnt2->x) + (Pnt1->y - Pnt2->y) * (Pnt1->y - Pnt2->y) ); /* ** Write to the trace file indicating ** that Distance has successfully exited. */ DBDK_TRACE_EXIT( "Distance" ); /* ------ }}Your_Code (#91B0) END ------ */ /* Return the function's return value. */ return Gen_RetVal; } /* }}FUNCTION (#I76GJTL2) */ #ifdef __cplusplus } #endif