/** * This routine must be prepared to run in parallel. */ HIDDEN int _rt_gettree_region_start(struct db_tree_state *tsp, const struct db_full_path *pathp, const struct rt_comb_internal *combp, void *UNUSED(client_data)) { if (tsp) { RT_CK_RTI(tsp->ts_rtip); RT_CK_RESOURCE(tsp->ts_resp); if (pathp) RT_CK_FULL_PATH(pathp); if (combp) RT_CHECK_COMB(combp); /* Ignore "air" regions unless wanted */ if (tsp->ts_rtip->useair == 0 && tsp->ts_aircode != 0) { tsp->ts_rtip->rti_air_discards++; return -1; /* drop this region */ } } return 0; }
void verify_region_attrs(struct directory *dp, struct db_i *dbip, Tcl_Obj *obj) { Tcl_Obj **objs; int len = 0; int i; struct rt_db_internal intern; struct rt_comb_internal *comb; if (rt_db_get_internal(&intern, dp, dbip, NULL, &rt_uniresource) < 0) { fprintf(stderr, "Cannot import %s\n", dp->d_namep); bu_exit(1, NULL); } comb = (struct rt_comb_internal *)intern.idb_ptr; RT_CHECK_COMB(comb); if (Tcl_ListObjGetElements(INTERP, obj, &len, &objs) != TCL_OK) { fprintf(stderr, "Cannot get length of attributes for %s\n", dp->d_namep); bu_exit(1, NULL); } for (i=1; i<len; i += 2) { char *key, *value; key = Tcl_GetStringFromObj(objs[i-1], NULL); value = Tcl_GetStringFromObj(objs[i], NULL); if (BU_STR_EQUAL(key, "region_id")) { long id; id = strtol(value, NULL, 0); if (id != comb->region_id) { fprintf(stderr, "WARNING: %s in %s: \"region_id\" attribute says %ld, while region says %ld\n", dp->d_namep, dbip->dbi_filename, id, comb->region_id); } } else if (BU_STR_EQUAL(key, "giftmater")) { long GIFTmater; GIFTmater = strtol(value, NULL, 0); if (GIFTmater != comb->GIFTmater) { fprintf(stderr, "WARNING: %s in %s: \"giftmater\" attribute says %ld, while region says %ld\n", dp->d_namep, dbip->dbi_filename, GIFTmater, comb->GIFTmater); } } else if (BU_STR_EQUAL(key, "los")) { long los; los = strtol(value, NULL, 0); if (los != comb->los) { fprintf(stderr, "WARNING: %s in %s: \"los\" attribute says %ld, while region says %ld\n", dp->d_namep, dbip->dbi_filename, los, comb->los); } } else if (BU_STR_EQUAL(key, "material")) { if (!bu_strncmp(value, "gift", 4)) { long GIFTmater; GIFTmater = strtol(&value[4], NULL, 0); if (GIFTmater != comb->GIFTmater) { fprintf(stderr, "WARNING: %s in %s: \"material\" attribute says %s, while region says %ld\n", dp->d_namep, dbip->dbi_filename, value, comb->GIFTmater); } } } else if (BU_STR_EQUAL(key, "aircode")) { long aircode; aircode = strtol(value, NULL, 0); if (aircode != comb->aircode) { fprintf(stderr, "WARNING: %s in %s: \"aircode\" attribute says %ld, while region says %ld\n", dp->d_namep, dbip->dbi_filename, aircode, comb->aircode); } } } rt_db_free_internal(&intern); }