trick/trick_source/trick_swig/extra_functions.i
Alex Lin 4f3ef64002 Use udunits package for units conversions
Changed the handling of how we handle doubles and ints allowing
more mathematical operations like multiplication, division, and
some limited exponentiation.

refs #231
2016-05-09 08:36:43 -05:00

42 lines
651 B
OpenEdge ABL

// These are utility routines that are used within the python scripts to do unusual conversions
%inline %{
// This takes a pointer and adds a level of indirection.
void * wrap_ptr ( void * in_ptr ) {
void ** temp_ptr = new void * ;
temp_ptr[0] = in_ptr ;
return(temp_ptr) ;
}
double unhex_double ( long long in_value ) {
union LL2D {
double d ;
long long ll ;
} ;
union LL2D ll2d ;
ll2d.ll = in_value ;
return(ll2d.d) ;
}
float unhex_float ( long in_value ) {
union L2F {
float f ;
long l ;
} ;
union L2F l2f ;
l2f.l = in_value ;
return(l2f.f) ;
}
%}