/*------------------------------------------------------------------------- * Function: lite_PD_typedef * * Purpose: Define an alias for a type which exists in the host * chart. The indented use is to provide a correspondence * between a type that has been defined to PDBLib (ONAME) and * a typedef'd type in programs (TNAME). Can be used in * conjunction with PD_defix and PD_defloat to have a primitive * type known to both charts. * * Return: Success: ptr to the original type's defstr * * Failure: NULL * * Programmer: Adapted from PACT PDB * Mar 6, 1996 11:47 AM EST * * Modifications: * Eric Brugger, Tue Dec 8 15:36:49 PST 1998 * I added calls to lite_SC_mark to bump memory reference counts as * appropriate. * *------------------------------------------------------------------------- */ defstr * lite_PD_typedef (PDBfile *file, char *oname, char *tname) { defstr *dp; dp = PD_inquire_host_type(file, oname); if (dp == NULL) { sprintf(lite_PD_err, "ERROR: HOST TYPE %s UNKNOWN - PD_TYPEDEF\n", oname); } else { if (PD_inquire_host_type(file, tname) == NULL) { _lite_PD_d_install(tname, dp, file->host_chart); lite_SC_mark(dp, 1); lite_SC_mark(dp->order, 1); } } dp = PD_inquire_type(file, oname); if (dp == NULL) { sprintf(lite_PD_err, "ERROR: FILE TYPE %s UNKNOWN - PD_TYPEDEF\n", oname); } else { if (PD_inquire_type(file, tname) == NULL) { _lite_PD_d_install(tname, dp, file->chart); lite_SC_mark(dp, 1); lite_SC_mark(dp->order, 1); } } return(dp); }
PA_variable *_PA_mk_variable(const char *vname, PA_dimens *vdims, void *iv, PFVarInit ifn, int *vattr, const char *vtype, double conv_fact, double unit_fact, pcons *nu, pcons *du, pcons *alist) {int nd; dimdes *dims; defstr *dp; PA_variable *pp; PA_dimens *pvd; if (PA_gs.vif == NULL) PA_gs.vif = PA_open("vif", "r+", TRUE); pp = CMAKE(PA_variable); nd = 0; if (vdims == NULL) PA_VARIABLE_DESC(pp) = _PD_mk_syment(vtype, 1L, 0L, NULL, NULL); else {dims = _PA_mk_sym_dims(vdims); PA_VARIABLE_DESC(pp) = _PD_mk_syment(vtype, 0L, 0L, NULL, dims); for (pvd = vdims; pvd != NULL; pvd = pvd->next, nd++);}; if (_PD_indirection(vtype)) dp = PD_inquire_host_type(PA_gs.vif, "*"); else dp = PD_inquire_host_type(PA_gs.vif, vtype); PA_ERR((dp == NULL), "TYPE %s NOT DEFINED - _PA_MK_VARIABLE", vtype); PA_VARIABLE_PACKAGE(pp) = PA_current_package(); PA_VARIABLE_UNIT_NUMER(pp) = nu; PA_VARIABLE_UNIT_DENOM(pp) = du; PA_VARIABLE_FILE_NAME(pp) = NULL; PA_VARIABLE_ATTR(pp) = alist; PA_VARIABLE_NAME(pp) = CSTRSAVE(vname); PA_VARIABLE_FILE(pp) = NULL; PA_VARIABLE_FILE_CONVERS(pp) = NONE; PA_VARIABLE_CACHE_FILE_NAME(pp) = NULL; PA_VARIABLE_DATA(pp) = NULL; PA_VARIABLE_INIT_VAL(pp) = iv; PA_VARIABLE_INIT_FUNC(pp) = ifn; PA_VARIABLE_SIZE(pp) = 0L; PA_VARIABLE_INT_UNIT(pp) = unit_fact; PA_VARIABLE_EXT_UNIT(pp) = conv_fact; PA_VARIABLE_TYPE(pp) = dp; PA_VARIABLE_DIMS(pp) = vdims; PA_VARIABLE_N_DIMS(pp) = nd; PA_VARIABLE_SCOPE(pp) = vattr[0]; PA_VARIABLE_CLASS(pp) = vattr[1]; PA_VARIABLE_PERSISTENCE(pp) = vattr[2]; PA_VARIABLE_CENTERING(pp) = (PM_centering) vattr[3]; PA_VARIABLE_ALLOCATION(pp) = vattr[4]; PA_VARIABLE_ACCESS_LIST(pp) = NULL; return(pp);}