static int xdr_RPGP_area_t (XDR *xdrs, RPGP_area_t *area) { if (xdrs->x_op == XDR_DECODE) { area->comp_params = NULL; area->points = NULL; } if (xdr_int (xdrs, &(area->comp_type)) == 0 || xdr_int (xdrs, &(area->numof_comp_params)) == 0 || (area->numof_comp_params > 0 && xdr_array (xdrs, (char **)&(area->comp_params), (unsigned int *)&(area->numof_comp_params), MAX_ARRAY_SIZE, sizeof (RPGP_parameter_t), (xdrproc_t)xdr_RPGP_parameter_t) == 0) || xdr_int (xdrs, &(area->area_type)) == 0 || xdr_int (xdrs, &(area->numof_points)) == 0) return (0); if (area->numof_points > 0) { int ret; switch (RPGP_LOCATION_TYPE (area->area_type)) { case RPGP_LATLON_LOCATION: case RPGP_XY_LOCATION: case RPGP_AZRAN_LOCATION: ret = xdr_array (xdrs, (char **)&(area->points), (unsigned int *)&(area->numof_points), MAX_ARRAY_SIZE, sizeof (RPGP_location_t), (xdrproc_t)xdr_RPGP_location_t); break; default: fprintf (stderr, "Unexpected Location type (%x)\n", RPGP_LOCATION_TYPE (area->area_type)); return (0); } if (ret == 0) return (0); } return (1); }
void get_component_subtype(char *desc, int comp_code, int index ) { RPGP_product_t *generic_product; RPGP_radial_t *radial_comp=NULL; RPGP_grid_t *grid_comp=NULL; RPGP_area_t *area_comp=NULL; RPGP_text_t *text_comp=NULL; RPGP_table_t *table_comp=NULL; RPGP_event_t *event_comp=NULL; int sub_type, r; char sub_type_str[30], sub_type_str2[10]; size_t t_len; char title_str[51]; generic_product = (RPGP_product_t *)sd->generic_prod_data; switch ( comp_code) { case 2801: radial_comp = (RPGP_radial_t *)generic_product->components[index]; /* NEED TO LIMIT STRING TO 50 CHARS */ t_len = strlen(radial_comp->description); /* title_str must be no longer than 39, for output to be 50 max */ if(t_len > 39) t_len = 39; for(r=0;r<=50;r++) title_str[r] = '\0'; strncpy(title_str, radial_comp->description, t_len); sprintf(desc, " %s Elev:%4.1f", title_str, radial_comp->radials[1].elevation); break; case 2802: grid_comp = (RPGP_grid_t *)generic_product->components[index]; sub_type = grid_comp->grid_type; if(sub_type==RPGP_GT_ARRAY) strcpy(sub_type_str, "Non-Geographical Array"); else if(sub_type==RPGP_GT_EQUALLY_SPACED) strcpy(sub_type_str, "Flat Equally Spaced Grid"); else if(sub_type==RPGP_GT_LAT_LON) strcpy(sub_type_str, "Equally Spaced Lat Lon Grid"); else if(sub_type==RPGP_GT_POLAR) strcpy(sub_type_str, "Rotated Polar Grid"); sprintf(desc, "%s", sub_type_str); break; case 2803: area_comp = (RPGP_area_t *)generic_product->components[index]; sub_type = RPGP_AREA_TYPE(area_comp->area_type); if(sub_type==RPGP_AT_POINT) strcpy(sub_type_str, "Geographical Point"); else if(sub_type==RPGP_AT_AREA) strcpy(sub_type_str, "Geographical Area"); else if(sub_type==RPGP_AT_POLYLINE) strcpy(sub_type_str, "Geographical Polyline"); sub_type = RPGP_LOCATION_TYPE(area_comp->area_type); if(sub_type==RPGP_LATLON_LOCATION) strcpy(sub_type_str2, "(LAT LON)"); else if(sub_type==RPGP_XY_LOCATION) strcpy(sub_type_str2, "(XY)"); else if(sub_type==RPGP_AZRAN_LOCATION) strcpy(sub_type_str2, "(AZRAN)"); sprintf(desc, "%s %s", sub_type_str, sub_type_str2); break; case 2804: text_comp = (RPGP_text_t *)generic_product->components[index]; sprintf(desc, " "); break; case 2805: table_comp = (RPGP_table_t *)generic_product->components[index]; /* NEED TO LIMIT STRING TO 50 chars */ t_len = strlen(table_comp->title.text); /* title_str must be no longer than 43, for output to be 50 max */ if(t_len > 43) t_len = 43; for(r=0;r<=50;r++) title_str[r] = '\0'; strncpy(title_str, table_comp->title.text, t_len); sprintf(desc, "Title: %s", title_str); break; case 2806: event_comp = (RPGP_event_t *)generic_product->components[index]; sprintf(desc, " "); break; default: break; } /* end switch */ } /* end get_component_subtype */