Calling Method
The functions can be called with mdlCExpression_ getValue(). The code example below illustrates the method:
void Example( void)
| if (TmCall( &Ret, "FnSurfaceCount()") > 0) |
| mdlOutput_printf( MSG_PROMPT, “%d surfaces”, Ret) ; |
| sprintf( Expr, "FnSurfaceName(%ld,%d)", (long) Name, 0) ; |
| if (TmCall( &Ret, Expr) > 0) |
| mdlOutput_printf( MSG_MESSAGE, “Name is %s”, Name) ; |
}
int TmCall( int *Ret, const char *Expr)
| if (!LoadApp( "TMODEL")) return (0) ; |
| Ok = mdlCExpression_getValue( &Val, &Res, Expr, VISIBILITY_CALCULATOR); |
| if (Ok != SUCCESS) return (-1) ; |
| *Ret = (int) Val.val.valLong ; |
}
int LoadApp( char *Name)
| Ptr = mdlSystem_findMdlDesc( Name) ; |
| Ok = mdlSystem_loadMdlProgram( Name, NULL, "") ; |
| if (Ok == SUCCESS) return (1) ; |
}