/* * mdextend.h * * Summary: Support extended use of MDAPI for advanced engine development. * This is primarily intended for remote communications module. * * Author: David Hardy */ #ifndef MD_EXTEND_H #include "mdapi.h" #include "mdengine.h" #ifdef __cplusplus extern "C" { #endif /* data structures used by MD_Sim */ /* * Contains information about each engine data array. */ struct MD_Data_Tag { void * ppdata; /* pointer to data array pointer */ MD_Int * plen; /* pointer to array length variable */ MD_Data_Attr attr; /* data array attributes */ MD_Setlen_Fptr setlen; /* pointer to setlen function for this array */ MD_Setdata_Fptr setdata; /* pointer to setdata function for this array */ MD_Getdata_Fptr getdata; /* pointer to getdata function for this array */ MD_Int link; /* links to next data array that uses same variable */ /* for length information (creates a circular link */ /* list used for resizing all arrays together) */ }; /* * Storage needed for a registered call back. */ typedef struct MD_Callback_Tag { MD_Callback_Fptr f; /* pointer to front end function */ MD_Callback_Data *data; /* back end data that function needs */ MD_Int datanum; /* number of entries in data array */ /* * current time for simulation is t = dt * (stepnum + numer/denom), * where the position array approximates the exact x(t) * * stepnum, numer, and denom are uniquely defined if denom > numer >= 0 * and gcd(numer,denom) = 1 */ MD_Int stepnum; MD_Int numer; MD_Int denom; } MD_Callback; /* * Combine error diagnostic messages with the "is fatal" flag. */ typedef struct MD_Err_Tag { const char *msg; MD_Int isfatal; } MD_Err; /* * Type information needed to derive new types from existing types. */ typedef struct MD_Type_Tag { const char *name; MD_Int * subtype; MD_Int subtypelen; MD_Int typenum; MD_Int * flipoffset; MD_Int flipoffsetlen; } MD_Type; /* prototypes */ MD_Errcode MD_set_isdone( MD_Sim *, MD_Int (*)(MD_Sim *) ); MD_Errcode MD_set_wait( MD_Sim *, MD_Errcode (*)(MD_Sim *) ); MD_Errcode MD_set_prcb( MD_Sim *, MD_Errcode (*)(MD_Sim *, MD_Callback *) ); MD_Errcode MD_set_isdoneprcb( MD_Sim *, MD_Int (*)(MD_Sim *) ); MD_Errcode MD_set_waitprcb( MD_Sim *, MD_Errcode (*)(MD_Sim *) ); MD_Errcode MD_flip_bytes(MD_Sim *, void *vbuf, MD_Int nelems, MD_Int typenum); #ifdef __cplusplus } #endif #endif /* MD_EXTEND_H */