Index: trunk/doc-rnd/hacking/renames =================================================================== --- trunk/doc-rnd/hacking/renames (revision 4837) +++ trunk/doc-rnd/hacking/renames (revision 4838) @@ -125,3 +125,7 @@ ReleaseMode -> pcb_release_mode AFAIL -> PCB_AFAIL ACTION_ARG -> PCB_ACTION_ARG +AttributeGetFromList -> pcb_attribute_get +AttributePutToList -> pcb_attribute_put +AttributeRemoveFromList -> pcb_attribute_remove +FreeAttributeListMemory -> pcb_attribute_free Index: trunk/src/attrib.c =================================================================== --- trunk/src/attrib.c (revision 4837) +++ trunk/src/attrib.c (revision 4838) @@ -31,7 +31,7 @@ #include "compat_misc.h" #include "attrib.h" -char *AttributeGetFromList(pcb_attribute_list_t * list, const char *name) +char *pcb_attribute_get(pcb_attribute_list_t * list, const char *name) { int i; for (i = 0; i < list->Number; i++) @@ -40,7 +40,7 @@ return NULL; } -int AttributePutToList(pcb_attribute_list_t * list, const char *name, const char *value, int replace) +int pcb_attribute_put(pcb_attribute_list_t * list, const char *name, const char *value, int replace) { int i; @@ -70,7 +70,7 @@ return 0; } -int AttributeRemoveFromList(pcb_attribute_list_t * list, const char *name) +int pcb_attribute_remove(pcb_attribute_list_t * list, const char *name) { int i, j, found = 0; for (i = 0; i < list->Number; i++) @@ -85,10 +85,7 @@ return found; } -/* --------------------------------------------------------------------------- - * frees memory used by an attribute list - */ -void FreeAttributeListMemory(pcb_attribute_list_t *list) +void pcb_attribute_free(pcb_attribute_list_t *list) { int i; Index: trunk/src/attrib.h =================================================================== --- trunk/src/attrib.h (revision 4837) +++ trunk/src/attrib.h (revision 4838) @@ -43,20 +43,21 @@ /* Returns NULL if the name isn't found, else the value for that named attribute. */ -char *AttributeGetFromList(pcb_attribute_list_t * list, const char *name); +char *pcb_attribute_get(pcb_attribute_list_t * list, const char *name); /* Adds an attribute to the list. If the attribute already exists, whether it's replaced or a second copy added depends on REPLACE. Returns non-zero if an existing attribute was replaced. */ -int AttributePutToList(pcb_attribute_list_t * list, const char *name, const char *value, int replace); +int pcb_attribute_put(pcb_attribute_list_t * list, const char *name, const char *value, int replace); /* Simplistic version: Takes a pointer to an object, looks up attributes in it. */ -#define AttributeGet(OBJ,name) AttributeGetFromList (&(OBJ->Attributes), name) +#define AttributeGet(OBJ,name) pcb_attribute_get(&(OBJ->Attributes), name) /* Simplistic version: Takes a pointer to an object, sets attributes in it. */ -#define AttributePut(OBJ,name,value) AttributePutToList (&(OBJ->Attributes), name, value, 1) +#define AttributePut(OBJ,name,value) pcb_attribute_put(&(OBJ->Attributes), name, value, 1) /* Remove an attribute by name; returns number of items removed */ -int AttributeRemoveFromList(pcb_attribute_list_t * list, const char *name); +int pcb_attribute_remove(pcb_attribute_list_t * list, const char *name); /* Simplistic version of Remove. */ -#define AttributeRemove(OBJ, name) AttributeRemoveFromList (&(OBJ->Attributes), name) +#define AttributeRemove(OBJ, name) pcb_attribute_remove(&(OBJ->Attributes), name) -void FreeAttributeListMemory(pcb_attribute_list_t *list); +/* Frees memory used by an attribute list */ +void pcb_attribute_free(pcb_attribute_list_t *list); #endif Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 4837) +++ trunk/src/board.c (revision 4838) @@ -57,7 +57,7 @@ for (i = 0; i < NUM_NETLISTS; i++) FreeLibraryMemory(&(pcb->NetlistLib[i])); vtroutestyle_uninit(&pcb->RouteStyle); - FreeAttributeListMemory(&pcb->Attributes); + pcb_attribute_free(&pcb->Attributes); /* clear struct */ memset(pcb, 0, sizeof(pcb_board_t)); } Index: trunk/src/data.c =================================================================== --- trunk/src/data.c (revision 4837) +++ trunk/src/data.c (revision 4838) @@ -201,7 +201,7 @@ list_map0(&data->Rat, pcb_rat_t, RemoveFreeRat); for (layer = data->Layer, i = 0; i < MAX_LAYER + 2; layer++, i++) { - FreeAttributeListMemory(&layer->Attributes); + pcb_attribute_free(&layer->Attributes); TEXT_LOOP(layer); { free(text->TextString); Index: trunk/src/obj_elem.c =================================================================== --- trunk/src/obj_elem.c (revision 4837) +++ trunk/src/obj_elem.c (revision 4838) @@ -104,7 +104,7 @@ list_map0(&element->Line, pcb_line_t, RemoveFreeLine); list_map0(&element->Arc, pcb_arc_t, RemoveFreeArc); - FreeAttributeListMemory(&element->Attributes); + pcb_attribute_free(&element->Attributes); reset_obj_mem(pcb_element_t, element); } @@ -552,7 +552,7 @@ END_LOOP; for (i = 0; i < Src->Attributes.Number; i++) - AttributePutToList(&Dest->Attributes, Src->Attributes.List[i].name, Src->Attributes.List[i].value, 0); + pcb_attribute_put(&Dest->Attributes, Src->Attributes.List[i].name, Src->Attributes.List[i].value, 0); Dest->MarkX = Src->MarkX + dx; Dest->MarkY = Src->MarkY + dy; Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 4837) +++ trunk/src/object_act.c (revision 4838) @@ -692,7 +692,7 @@ delete_attr(&e->Attributes, attr); } if (!attr && value) { - AttributePutToList(&e->Attributes, name, value, 0); + pcb_attribute_put(&e->Attributes, name, value, 0); } return 0; Index: trunk/src_plugins/export_bboard/bboard.c =================================================================== --- trunk/src_plugins/export_bboard/bboard.c (revision 4837) +++ trunk/src_plugins/export_bboard/bboard.c (revision 4838) @@ -210,7 +210,7 @@ char *clr; unsigned int r, g, b; - if ((clr = AttributeGetFromList(&(layer->Attributes), "BBoard::LayerColor")) != NULL) { + if ((clr = pcb_attribute_get(&(layer->Attributes), "BBoard::LayerColor")) != NULL) { if (clr[0] == '#') { if (sscanf(&(clr[1]), "%02x%02x%02x", &r, &g, &b) == 3) goto ok; @@ -397,7 +397,7 @@ ASSERT_CAIRO; - s1 = AttributeGetFromList(&(element->Attributes), "BBoard::Model"); + s1 = pcb_attribute_get(&(element->Attributes), "BBoard::Model"); if (s1) { s = pcb_strdup(s1); if (!s) @@ -422,7 +422,7 @@ /* invalidate offset from BBoard::Model, if such model does not exist */ offset_in_model = pcb_false; - s = AttributeGetFromList(&(element->Attributes), "Footprint::File"); + s = pcb_attribute_get(&(element->Attributes), "Footprint::File"); if (s) { if (!EMPTY_STRING_P(VALUE_NAME(element))) { fname = bboard_get_model_filename(s, VALUE_NAME(element), pcb_true); @@ -460,7 +460,7 @@ /* read offest from attribute */ if (!offset_in_model) { - s = AttributeGetFromList(&(element->Attributes), "BBoard::Offset"); + s = pcb_attribute_get(&(element->Attributes), "BBoard::Offset"); /* Parse values with units... */ if (s) { @@ -472,7 +472,7 @@ cairo_save(bboard_cairo_ctx); - if ((model_angle = AttributeGetFromList(&(element->Attributes), "Footprint::RotationTracking")) != NULL) { + if ((model_angle = pcb_attribute_get(&(element->Attributes), "Footprint::RotationTracking")) != NULL) { sscanf(model_angle, "%lf", &tmp_angle); } Index: trunk/src_plugins/export_openscad/scadcomp.c =================================================================== --- trunk/src_plugins/export_openscad/scadcomp.c (revision 4837) +++ trunk/src_plugins/export_openscad/scadcomp.c (revision 4838) @@ -295,16 +295,16 @@ int x = element->MarkX, y = element->MarkY; model_rotation = - AttributeGetFromList(&(element->Attributes), + pcb_attribute_get(&(element->Attributes), (model_type == SCAD_OVERLAY) ? "OpenSCAD::Overlay:rotate" : "OpenSCAD::Model:rotate"); model_scale = - AttributeGetFromList(&(element->Attributes), + pcb_attribute_get(&(element->Attributes), (model_type == SCAD_OVERLAY) ? "OpenSCAD::Overlay:scale" : "OpenSCAD::Model:scale"); model_translate = - AttributeGetFromList(&(element->Attributes), + pcb_attribute_get(&(element->Attributes), (model_type == SCAD_OVERLAY) ? "OpenSCAD::Overlay:translate" : "OpenSCAD::Model:translate"); - if ((model_angle = AttributeGetFromList(&(element->Attributes), "Footprint::RotationTracking")) != NULL) { + if ((model_angle = pcb_attribute_get(&(element->Attributes), "Footprint::RotationTracking")) != NULL) { sscanf(model_angle, "%lf", &tmp_angle); } @@ -383,11 +383,11 @@ int n, ln; char val[32], *s; - if ((bbox = AttributeGetFromList(&(element->Attributes), "Footprint::BoundingBox")) == NULL) + if ((bbox = pcb_attribute_get(&(element->Attributes), "Footprint::BoundingBox")) == NULL) return; - if ((model_angle = AttributeGetFromList(&(element->Attributes), "Footprint::RotationTracking")) != NULL) { + if ((model_angle = pcb_attribute_get(&(element->Attributes), "Footprint::RotationTracking")) != NULL) { sscanf(model_angle, "%lf", &tmp_angle); } @@ -480,11 +480,11 @@ char *model_name, *s; pcb_bool imported_model; - s = AttributeGetFromList(&(element->Attributes), "OpenSCAD::Model:type"); + s = pcb_attribute_get(&(element->Attributes), "OpenSCAD::Model:type"); imported_model = s && (strcmp(s, "STL") == 0); /* get model name from attibute */ - model_name = AttributeGetFromList(&(element->Attributes), "OpenSCAD::Model"); + model_name = pcb_attribute_get(&(element->Attributes), "OpenSCAD::Model"); if (model_name) { scad_writeout_element(element, model_name, SCAD_STANDARD, imported_model, simple); @@ -491,7 +491,7 @@ } else { /* no model variable found, try model, based on footprint name attribute */ - model_name = AttributeGetFromList(&(element->Attributes), "Footprint::File"); + model_name = pcb_attribute_get(&(element->Attributes), "Footprint::File"); if (model_name) { scad_writeout_element(element, model_name, SCAD_STANDARD, imported_model, simple); } @@ -504,11 +504,11 @@ } } - s = AttributeGetFromList(&(element->Attributes), "OpenSCAD::Overlay:type"); + s = pcb_attribute_get(&(element->Attributes), "OpenSCAD::Overlay:type"); imported_model = s && (strcmp(s, "STL") == 0); /* get overlay name from attibute */ - model_name = AttributeGetFromList(&(element->Attributes), "OpenSCAD::Overlay"); + model_name = pcb_attribute_get(&(element->Attributes), "OpenSCAD::Overlay"); if (model_name) { scad_writeout_element(element, model_name, SCAD_OVERLAY, imported_model, simple); Index: trunk/src_plugins/export_xy/xy.c =================================================================== --- trunk/src_plugins/export_xy/xy.c (revision 4837) +++ trunk/src_plugins/export_xy/xy.c (revision 4838) @@ -245,7 +245,7 @@ centroidx = sumx / (double) pin_cnt; centroidy = sumy / (double) pin_cnt; - if (NSTRCMP(AttributeGetFromList(&element->Attributes, "xy-centre"), "origin") == 0) { + if (NSTRCMP(pcb_attribute_get(&element->Attributes, "xy-centre"), "origin") == 0) { x = element->MarkX; y = element->MarkY; } @@ -254,7 +254,7 @@ y = centroidy; } - fixed_rotation = AttributeGetFromList(&element->Attributes, "xy-fixed-rotation"); + fixed_rotation = pcb_attribute_get(&element->Attributes, "xy-fixed-rotation"); if (fixed_rotation) { /* The user specified a fixed rotation */ theta = atof(fixed_rotation); Index: trunk/src_plugins/io_lihata/read.c =================================================================== --- trunk/src_plugins/io_lihata/read.c (revision 4837) +++ trunk/src_plugins/io_lihata/read.c (revision 4838) @@ -67,7 +67,7 @@ for(n = lht_dom_first(&it, nd); n != NULL; n = lht_dom_next(&it)) { if (n->type == LHT_TEXT) - AttributePutToList(list, n->name, n->data.text.value, 0); + pcb_attribute_put(list, n->name, n->data.text.value, 0); } return 0; Index: trunk/src_plugins/io_pcb/attribs.c =================================================================== --- trunk/src_plugins/io_pcb/attribs.c (revision 4837) +++ trunk/src_plugins/io_pcb/attribs.c (revision 4838) @@ -72,7 +72,7 @@ if (n->type == LHT_TEXT) { conf_native_t *nv = conf_get_field(path); if ((nv != NULL) && (!nv->random_flags.io_pcb_no_attrib)) - AttributePutToList(&pcb->Attributes, apath, n->data.text.value, 1); + pcb_attribute_put(&pcb->Attributes, apath, n->data.text.value, 1); } else if (n->type == LHT_LIST) { lht_node_t *i; @@ -85,7 +85,7 @@ gds_append_str(&conc, LISTSEP); gds_append_str(&conc, i->data.text.value); } - AttributePutToList(&pcb->Attributes, apath, conc.array, 1); + pcb_attribute_put(&pcb->Attributes, apath, conc.array, 1); gds_uninit(&conc); } } Index: trunk/src_plugins/io_pcb/file.c =================================================================== --- trunk/src_plugins/io_pcb/file.c (revision 4837) +++ trunk/src_plugins/io_pcb/file.c (revision 4838) @@ -518,7 +518,7 @@ { pcb_cardinal_t i; - AttributePutToList(&PCB->Attributes, "PCB::loader", ctx->description, 1); + pcb_attribute_put(&PCB->Attributes, "PCB::loader", ctx->description, 1); pcb_printf_slot[0] = ((io_pcb_ctx_t *)(ctx->plugin_data))->write_coord_fmt; WritePCBInfoHeader(FP); Index: trunk/src_plugins/io_pcb/parse_l.c =================================================================== --- trunk/src_plugins/io_pcb/parse_l.c (revision 4837) +++ trunk/src_plugins/io_pcb/parse_l.c (revision 4838) @@ -2556,7 +2556,7 @@ } if (retval == 0) { /* restore loader so the next save will use the same units */ - const char *loader = AttributeGetFromList(&PCB->Attributes, "PCB::loader"); + const char *loader = pcb_attribute_get(&PCB->Attributes, "PCB::loader"); if (loader != NULL) { pcb_find_io_t f; int len; Index: trunk/src_plugins/io_pcb/parse_l.l =================================================================== --- trunk/src_plugins/io_pcb/parse_l.l (revision 4837) +++ trunk/src_plugins/io_pcb/parse_l.l (revision 4838) @@ -415,7 +415,7 @@ } if (retval == 0) { /* restore loader so the next save will use the same units */ - const char *loader = AttributeGetFromList(&PCB->Attributes, "PCB::loader"); + const char *loader = pcb_attribute_get(&PCB->Attributes, "PCB::loader"); if (loader != NULL) { pcb_find_io_t f; int len; Index: trunk/src_plugins/io_pcb/parse_y.c =================================================================== --- trunk/src_plugins/io_pcb/parse_y.c (revision 4837) +++ trunk/src_plugins/io_pcb/parse_y.c (revision 4838) @@ -2861,7 +2861,7 @@ case 200: #line 1977 "parse_y.y" /* yacc.c:1646 */ { - AttributePutToList(attr_list, (yyvsp[-2].string), (yyvsp[-1].string) ? (yyvsp[-1].string) : (char *)"", 0); + pcb_attribute_put(attr_list, (yyvsp[-2].string), (yyvsp[-1].string) ? (yyvsp[-1].string) : (char *)"", 0); free ((yyvsp[-2].string)); free ((yyvsp[-1].string)); } Index: trunk/src_plugins/io_pcb/parse_y.y =================================================================== --- trunk/src_plugins/io_pcb/parse_y.y (revision 4837) +++ trunk/src_plugins/io_pcb/parse_y.y (revision 4838) @@ -1975,7 +1975,7 @@ attribute : T_ATTRIBUTE '(' STRING STRING ')' { - AttributePutToList(attr_list, $3, $4 ? $4 : (char *)"", 0); + pcb_attribute_put(attr_list, $3, $4 ? $4 : (char *)"", 0); free ($3); free ($4); } Index: trunk/src_plugins/propedit/propsel.c =================================================================== --- trunk/src_plugins/propedit/propsel.c (revision 4837) +++ trunk/src_plugins/propedit/propsel.c (revision 4838) @@ -202,12 +202,12 @@ static void set_attr(set_ctx_t *st, pcb_attribute_list_t *list) { const char *key = st->name+2; - const char *orig = AttributeGetFromList(list, key); + const char *orig = pcb_attribute_get(list, key); if ((orig != NULL) && (strcmp(orig, st->value) == 0)) return; - AttributePutToList(list, key, st->value, 1); + pcb_attribute_put(list, key, st->value, 1); st->set_cnt++; } @@ -482,7 +482,7 @@ static void del_attr(void *ctx, pcb_attribute_list_t *list) { del_ctx_t *st = (del_ctx_t *)ctx; - if (AttributeRemoveFromList(list, st->key+2)) + if (pcb_attribute_remove(list, st->key+2)) st->del_cnt++; } Index: trunk/src_plugins/query/query_access.c =================================================================== --- trunk/src_plugins/query/query_access.c (revision 4837) +++ trunk/src_plugins/query/query_access.c (revision 4838) @@ -232,7 +232,7 @@ if (fh1 == query_fields_a) { const char *s2; fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&l->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&l->Attributes, s2)); } if (fld->next != NULL) @@ -291,7 +291,7 @@ if (fh1 == query_fields_a) { const char *s2; fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&l->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&l->Attributes, s2)); } if (fh1 == query_fields_layer) { @@ -335,7 +335,7 @@ if (fh1 == query_fields_a) { const char *s2; fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&a->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&a->Attributes, s2)); } if (fh1 == query_fields_angle) { @@ -389,7 +389,7 @@ if (fh1 == query_fields_a) { const char *s2; fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&t->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&t->Attributes, s2)); } if (fh1 == query_fields_layer) { @@ -424,7 +424,7 @@ if (fh1 == query_fields_a) { const char *s2; fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&p->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&p->Attributes, s2)); } if (fh1 == query_fields_layer) { @@ -465,7 +465,7 @@ if (fh1 == query_fields_a) { const char *s2; fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&p->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&p->Attributes, s2)); } if (fld->next != NULL) @@ -495,7 +495,7 @@ if (fh1 == query_fields_a) { const char *s2; fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&p->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&p->Attributes, s2)); } if (fh1 == query_fields_layer) @@ -634,7 +634,7 @@ { const char *s2; fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&p->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&p->Attributes, s2)); } case query_fields_layer: return layer_of_obj(fld->next, res, PCB_LYT_COPPER | (TEST_FLAG(PCB_FLAG_ONSOLDER, p) ? PCB_LYT_BOTTOM : PCB_LYT_TOP)); case query_fields_element: return field_element_obj(obj, fld->next, res); @@ -680,7 +680,7 @@ fld2str_req(s2, fld, 0); if (!PCB_OBJ_IS_CLASS(obj->type, PCB_OBJ_CLASS_OBJ)) PCB_QRY_RET_INV(res); - PCB_QRY_RET_STR(res, AttributeGetFromList(&obj->data.anyobj->Attributes, s2)); + PCB_QRY_RET_STR(res, pcb_attribute_get(&obj->data.anyobj->Attributes, s2)); } if (fh1 == query_fields_ID) {