// get_mythryl_callable_c_function() in src/c/lib/mythryl-callable-c-libraries.c #ifndef CLIB_NAME #define CLIB_NAME "opengl" #define CLIB_VERSION "1.0" #define CLIB_DATE "February 13, 2008" #endif // The table of C functions and their Mythryl names: // #define CFUNC(NAME, NAME2, FUNC, LIB7TYPE) CFUNC_BIND(NAME, NAME2, FUNC, LIB7TYPE) static Mythryl_Name_With_C_Function CFunTable[] = { CFUNC("init","init", do__init, "Void -> Void") CFUNC("callback_queue_is_empty","callback_queue_is_empty", do__callback_queue_is_empty, "Void -> Bool") CFUNC("number_of_queued_callbacks","number_of_queued_callbacks", do__number_of_queued_callbacks, "Void -> Int") CFUNC("type_of_next_queued_callback","type_of_next_queued_callback", do__type_of_next_queued_callback, "Void -> Int") CFUNC("get_queued_int_pair_callback","get_queued_button_press_callback", do__get_queued_int_pair_callback, "Void -> (Int, Int, Int)") // Void -> (callback_number, x, y) ///////////////////////////////////////////////////////////////////////////////////// // The following stuff gets built from paragraphs in // src/opt/opengl/etc/opengl-construction.plan // via logic in // src/lib/make-library-glue/make-library-glue.pkg // // Paragraphs like // build-a: plain-fn
// get_mythryl_callable_c_function() in src/c/lib/mythryl-callable-c-libraries.c #ifndef CLIB_NAME #define CLIB_NAME "ncurses" #define CLIB_VERSION "1.0" #define CLIB_DATE "February 13, 2008" #endif // The table of C functions and their Mythryl names: // #define CFUNC(NAME, NAME2, FUNC, LIB7TYPE) CFUNC_BIND(NAME, NAME2, FUNC, LIB7TYPE) static Mythryl_Name_With_C_Function CFunTable[] = { CFUNC("init","init", do__init, "Void -> Void") CFUNC("callback_queue_is_empty","callback_queue_is_empty", do__callback_queue_is_empty, "Void -> Bool") CFUNC("number_of_queued_callbacks","number_of_queued_callbacks", do__number_of_queued_callbacks, "Void -> Int") CFUNC("type_of_next_queued_callback","type_of_next_queued_callback", do__type_of_next_queued_callback, "Void -> Int") CFUNC("get_queued_int_pair_callback","get_queued_button_press_callback", do__get_queued_int_pair_callback, "Void -> (Int, Int, Int)") // Void -> (callback_number, x, y) ///////////////////////////////////////////////////////////////////////////////////// // The following stuff gets built from paragraphs in // src/opt/ncurses/etc/ncurses-construction.plan // via logic in // src/lib/make-library-glue/make-library-glue.pkg // // Paragraphs like // build-a: plain-fn
static void FUNC ( void ) { CreateArraySequenceIn input; UINT4Vector dimLength; UINT4 data[] = { 2, 3, 2 }; UINT4 dataBad[] = { 2, 3, 0 }; static LALStatus status; static VTYPE *sequence; static VTYPE sstore; /* * * Test ordinary behavior. * */ dimLength.length = 3; dimLength.data = data; input.length = 2; input.dimLength = &dimLength; CFUNC ( &status, &sequence, &input ); TestStatus( &status, CODES( 0 ), 1 ); memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( TYPE ) ); DFUNC ( &status, &sequence ); TestStatus( &status, CODES( 0 ), 1 ); LALCheckMemoryLeaks(); /* * * Test error codes. * */ #ifndef LAL_NDEBUG if ( ! lalNoDebug ) { input.length = 0; CFUNC ( &status, &sequence, &input ); TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 ); input.length = 2; input.dimLength->data = dataBad; CFUNC ( &status, &sequence, &input ); TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 ); CFUNC ( &status, &sequence, NULL ); TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 ); DFUNC ( &status, NULL ); TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 ); input.dimLength->data = data; CFUNC ( &status, NULL, &input ); TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 ); DFUNC ( &status, &sequence ); TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 ); sequence = &sstore; CFUNC ( &status, &sequence, &input ); TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 ); DFUNC ( &status, &sequence ); TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 ); } #else (void)sstore; (void)dataBad; #endif LALCheckMemoryLeaks(); printf( "PASS: tests of %s and %s\n", STRING(CFUNC), STRING(DFUNC)); return; }
static void FUNC ( void ) { static UINT4 dims[3] = { 1, 2, 4 }; UINT4Vector dimLength = { 3, dims }; #ifndef LAL_NDEBUG static UINT4 dbad[3] = { 1, 0, 4 }; UINT4Vector badLength1 = { 3, NULL }; UINT4Vector badLength2 = { 0, dims }; UINT4Vector badLength3 = { 3, dbad }; #endif static LALStatus status; static VTYPE *array; static VTYPE astore; static TYPE datum; /* * * Test ordinary behavior. * */ CFUNC ( &status, &array, &dimLength ); TestStatus( &status, CODES( 0 ), 1 ); memset( array->data, 0, dims[0]*dims[1]*dims[2]*sizeof( TYPE ) ); /* resize up */ /* * dimLength.data[0] *= 2; * dimLength.data[1] *= 3; * dimLength.data[2] *= 4; */ dims[0] *= 2; dims[1] *= 3; dims[2] *= 4; RFUNC ( &status, &array, &dimLength ); TestStatus( &status, CODES( 0 ), 1 ); memset( array->data, 0, dims[0]*dims[1]*dims[2]*sizeof( TYPE ) ); /* resize down */ dims[0] /= 2; dims[1] /= 3; dims[2] /= 2; RFUNC ( &status, &array, &dimLength ); TestStatus( &status, CODES( 0 ), 1 ); memset( array->data, 0, dims[0]*dims[1]*dims[2]*sizeof( TYPE ) ); /* resize down again */ dims[2] /= 2; RFUNC ( &status, &array, &dimLength ); TestStatus( &status, CODES( 0 ), 1 ); memset( array->data, 0, dims[0]*dims[1]*dims[2]*sizeof( TYPE ) ); DFUNC ( &status, &array ); TestStatus( &status, CODES( 0 ), 1 ); LALCheckMemoryLeaks(); /* * * Test error codes. * */ #ifndef LAL_NDEBUG if ( ! lalNoDebug ) { CFUNC ( &status, &array, &badLength1 ); TestStatus( &status, CODES( AVFACTORIESH_EVPTR ), 1 ); RFUNC ( &status, &array, &badLength1 ); TestStatus( &status, CODES( AVFACTORIESH_EVPTR ), 1 ); CFUNC ( &status, &array, &badLength2 ); TestStatus( &status, CODES( AVFACTORIESH_ELENGTH ), 1 ); RFUNC ( &status, &array, &badLength2 ); TestStatus( &status, CODES( AVFACTORIESH_ELENGTH ), 1 ); CFUNC ( &status, &array, &badLength3 ); TestStatus( &status, CODES( AVFACTORIESH_ELENGTH ), 1 ); RFUNC ( &status, &array, &badLength3 ); TestStatus( &status, CODES( AVFACTORIESH_ELENGTH ), 1 ); LALCheckMemoryLeaks(); DFUNC ( &status, NULL ); TestStatus( &status, CODES( AVFACTORIESH_EVPTR ), 1 ); CFUNC ( &status, NULL, &dimLength ); TestStatus( &status, CODES( AVFACTORIESH_EVPTR ), 1 ); RFUNC ( &status, NULL, &badLength1 ); TestStatus( &status, CODES( AVFACTORIESH_EVPTR ), 1 ); DFUNC ( &status, &array ); TestStatus( &status, CODES( AVFACTORIESH_EUPTR ), 1 ); array = &astore; CFUNC ( &status, &array, &dimLength ); TestStatus( &status, CODES( AVFACTORIESH_EUPTR ), 1 ); RFUNC ( &status, &array, &badLength1 ); TestStatus( &status, CODES( AVFACTORIESH_EVPTR ), 1); RFUNC ( &status, &array, &badLength2 ); TestStatus( &status, CODES( AVFACTORIESH_ELENGTH ), 1); RFUNC ( &status, &array, &badLength3 ); TestStatus( &status, CODES( AVFACTORIESH_ELENGTH ), 1); DFUNC ( &status, &array ); TestStatus( &status, CODES( AVFACTORIESH_EDPTR ), 1 ); array->data = &datum; DFUNC ( &status, &array ); TestStatus( &status, CODES( AVFACTORIESH_EDPTR ), 1 ); ClearStatus( &status ); } #else array = &astore; array->data = &datum; #endif LALCheckMemoryLeaks(); printf( "PASS: tests of %s, %s, and %s\n", STRING(CFUNC), STRING(RFUNC), STRING(DFUNC)); return; }