Index: excitation.c =================================================================== --- excitation.c (revision 30902) +++ excitation.c (revision 30903) @@ -86,7 +86,7 @@ if (orig != NULL) { hv.lng = strtol(orig, &end, 10); if (*end != '\0') { - pcb_message(PCB_MSG_ERROR, "Invalid integer value in board attribute '%s': '%s'\n", attrkey, orig); + rnd_message(PCB_MSG_ERROR, "Invalid integer value in board attribute '%s': '%s'\n", attrkey, orig); hv.lng = 0; } } @@ -115,7 +115,7 @@ if (*end != '\0') { while(isspace(*end)) end++; if (pcb_strcasecmp(end, "hz") != 0) { - pcb_message(PCB_MSG_ERROR, "Invalid real value (Hz) in board attribute '%s': '%s'\n", attrkey, orig); + rnd_message(PCB_MSG_ERROR, "Invalid real value (Hz) in board attribute '%s': '%s'\n", attrkey, orig); hv.dbl = 0; } } @@ -143,7 +143,7 @@ static void exc_val_chg_cb(void *hid_ctx, void *caller_data, pcb_hid_attribute_t *attr); -static pcb_bool to_hz(const char *s, double *out) +static rnd_bool to_hz(const char *s, double *out) { const pcb_unit_t *u; double d; @@ -187,10 +187,10 @@ double f0 = 0, fc = 0; if (!to_hz(pcb_attribute_get(&PCB->Attributes, AEPREFIX "gaussian::f0"), &f0)) - pcb_message(PCB_MSG_ERROR, "Gauss excitation: unable to parse frequency gaussian::f0\n"); + rnd_message(PCB_MSG_ERROR, "Gauss excitation: unable to parse frequency gaussian::f0\n"); if (!to_hz(pcb_attribute_get(&PCB->Attributes, AEPREFIX "gaussian::fc"), &fc)) - pcb_message(PCB_MSG_ERROR, "Gauss excitation: unable to parse frequency gaussian::fc\n"); + rnd_message(PCB_MSG_ERROR, "Gauss excitation: unable to parse frequency gaussian::fc\n"); return pcb_strdup_printf("FDTD = SetGaussExcite(FDTD, %f, %f);", fc, f0); } @@ -225,7 +225,7 @@ double f0; if (!to_hz(pcb_attribute_get(&PCB->Attributes, AEPREFIX "sinusoidal::f0"), &f0)) - pcb_message(PCB_MSG_ERROR, "Sinus excitation: unable to parse frequency sinusoidal::f0\n"); + rnd_message(PCB_MSG_ERROR, "Sinus excitation: unable to parse frequency sinusoidal::f0\n"); return pcb_strdup_printf("FDTD = SetSinusExcite(FDTD, %f);", f0); } @@ -265,7 +265,7 @@ double f0; if (!to_hz(pcb_attribute_get(&PCB->Attributes, AEPREFIX "custom::f0"), &f0)) - pcb_message(PCB_MSG_ERROR, "Custom excitation: unable to parse frequency custom::f0\n"); + rnd_message(PCB_MSG_ERROR, "Custom excitation: unable to parse frequency custom::f0\n"); return pcb_strdup_printf( "FDTD = SetCustomExcite(FDTD, %f, %s)", @@ -371,7 +371,7 @@ hv.lng = exc_ctx.selected; if ((exc_ctx.selected < 0) || (exc_ctx.selected >= sizeof(excitations)/sizeof(excitations[0]))) { - pcb_message(PCB_MSG_ERROR, "Invalid excitation selected\n"); + rnd_message(PCB_MSG_ERROR, "Invalid excitation selected\n"); exc_ctx.selected = 0; } @@ -410,7 +410,7 @@ if (excnames[0] == NULL) { for(n = 0, e = excitations; e->name != NULL; n++,e++) { if (n >= MAX_EXC) { - pcb_message(PCB_MSG_ERROR, "internal error: too many excitations"); + rnd_message(PCB_MSG_ERROR, "internal error: too many excitations"); break; } excnames[n] = e->name; @@ -470,7 +470,7 @@ pcb_dlg_exc(); else if (strcmp(op, "select") == 0) { if (a1 == NULL) { - pcb_message(PCB_MSG_ERROR, "OpenemsExcitation(select) needs a excitation name"); + rnd_message(PCB_MSG_ERROR, "OpenemsExcitation(select) needs a excitation name"); goto error; } pcb_attribute_put(&PCB->Attributes, AEPREFIX "type", a1); @@ -485,7 +485,7 @@ case 4: a1 = excitations[exc_ctx.selected].name; start = 2; break; case 5: start = 3; break; default: - pcb_message(PCB_MSG_ERROR, "OpenemsExcitation(set) needs exactly 2 or 3 more arguments"); + rnd_message(PCB_MSG_ERROR, "OpenemsExcitation(set) needs exactly 2 or 3 more arguments"); goto error; } @@ -506,7 +506,7 @@ case 3: a1 = excitations[exc_ctx.selected].name; start = 2; break; case 4: start = 3; break; default: - pcb_message(PCB_MSG_ERROR, "OpenemsExcitation(get) needs exactly 1 or 2 more arguments"); + rnd_message(PCB_MSG_ERROR, "OpenemsExcitation(get) needs exactly 1 or 2 more arguments"); goto error; } @@ -528,7 +528,7 @@ static char *pcb_openems_excitation_get(pcb_board_t *pcb) { if ((exc_ctx.selected < 0) || (exc_ctx.selected >= sizeof(excitations)/sizeof(excitations[0]))) { - pcb_message(PCB_MSG_ERROR, "No excitation selected\n"); + rnd_message(PCB_MSG_ERROR, "No excitation selected\n"); return pcb_strdup("%% ERROR: no excitation selected\n"); } return excitations[exc_ctx.selected].get(exc_ctx.selected); Index: export_openems.c =================================================================== --- export_openems.c (revision 30902) +++ export_openems.c (revision 30903) @@ -82,7 +82,7 @@ int clayer; /* current layer (lg index really) */ long oid; /* unique object ID - we need some unique variable names, keep on counting them */ long port_id; /* unique port ID for similar reasons */ - pcb_coord_t ox, oy; + rnd_coord_t ox, oy; unsigned warn_subc_term:1; unsigned warn_port_pstk:1; } wctx_t; @@ -360,7 +360,7 @@ fprintf(ctx->f, "\n"); } -static void openems_vport_write(wctx_t *ctx, pcb_any_obj_t *o, pcb_coord_t x, pcb_coord_t y, pcb_layergrp_id_t gid1, pcb_layergrp_id_t gid2, const char *port_name) +static void openems_vport_write(wctx_t *ctx, pcb_any_obj_t *o, rnd_coord_t x, rnd_coord_t y, pcb_layergrp_id_t gid1, pcb_layergrp_id_t gid2, const char *port_name) { char *end, *s, *safe_name = pcb_strdup(port_name); const char *att; @@ -375,7 +375,7 @@ if (*end == '\0') resistance = tmp; else - pcb_message(PCB_MSG_WARNING, "Ignoring invalid openems::resistance value for port %s: '%s' (must be a number without suffix)\n", port_name, att); + rnd_message(PCB_MSG_WARNING, "Ignoring invalid openems::resistance value for port %s: '%s' (must be a number without suffix)\n", port_name, att); } att = pcb_attribute_get(&o->Attributes, "openems::active"); @@ -385,7 +385,7 @@ else if (pcb_strcasecmp(att, "false") == 0) act = 0; else - pcb_message(PCB_MSG_WARNING, "Ignoring invalid openems::active value for port %s: '%s' (must be true or false)\n", port_name, att); + rnd_message(PCB_MSG_WARNING, "Ignoring invalid openems::active value for port %s: '%s' (must be true or false)\n", port_name, att); } for(s = safe_name; *s != '\0'; s++) @@ -408,15 +408,15 @@ bot = (pcb_pstk_shape(ps, PCB_LYT_COPPER | PCB_LYT_BOTTOM, 0) != NULL); intern = (pcb_pstk_shape(ps, PCB_LYT_INTERN | PCB_LYT_BOTTOM, 0) != NULL); if (intern) { - pcb_message(PCB_MSG_ERROR, "Can not export openems vport %s: it has internal copper\n(must be either top or bottom copper)\n", port_name); + rnd_message(PCB_MSG_ERROR, "Can not export openems vport %s: it has internal copper\n(must be either top or bottom copper)\n", port_name); return -1; } if (top && bot) { - pcb_message(PCB_MSG_ERROR, "Can not export openems vport %s: it has both top and bottom copper\n", port_name); + rnd_message(PCB_MSG_ERROR, "Can not export openems vport %s: it has both top and bottom copper\n", port_name); return -1; } if (!top && !bot) { - pcb_message(PCB_MSG_ERROR, "Can not export openems vport %s: it does not have copper either on top or bottom\n", port_name); + rnd_message(PCB_MSG_ERROR, "Can not export openems vport %s: it does not have copper either on top or bottom\n", port_name); return -1; } @@ -430,7 +430,7 @@ *gstep = -1; } if (gid1 < 0) { - pcb_message(PCB_MSG_ERROR, "Can not export openems vport %s: can not find top or bottom layer group ID\n", port_name); + rnd_message(PCB_MSG_ERROR, "Can not export openems vport %s: can not find top or bottom layer group ID\n", port_name); return -1; } @@ -445,7 +445,7 @@ if (pcb->LayerGroups.grp[gid2].ltype & PCB_LYT_COPPER) return gid2; - pcb_message(PCB_MSG_ERROR, "Can not export openems vport %s: can not find pair layer\n", port_name); + rnd_message(PCB_MSG_ERROR, "Can not export openems vport %s: can not find pair layer\n", port_name); return -1; } @@ -467,7 +467,7 @@ if (o->type == PCB_OBJ_SUBC) { if (!ctx->warn_subc_term) - pcb_message(PCB_MSG_ERROR, "Subcircuit being a terminal is not supported.\n"); + rnd_message(PCB_MSG_ERROR, "Subcircuit being a terminal is not supported.\n"); ctx->warn_subc_term = 1; continue; } @@ -501,7 +501,7 @@ break; default: if (!ctx->warn_port_pstk) - pcb_message(PCB_MSG_ERROR, "Only padstacks can be openems ports at the moment\n"); + rnd_message(PCB_MSG_ERROR, "Only padstacks can be openems ports at the moment\n"); ctx->warn_port_pstk = 1; break; } @@ -708,7 +708,7 @@ free(gc); } -static void openems_set_drawing_mode(pcb_hid_t *hid, pcb_composite_op_t op, pcb_bool direct, const pcb_box_t *screen) +static void openems_set_drawing_mode(pcb_hid_t *hid, pcb_composite_op_t op, rnd_bool direct, const pcb_box_t *screen) { switch(op) { case PCB_HID_COMP_RESET: @@ -717,7 +717,7 @@ case PCB_HID_COMP_POSITIVE_XOR: break; case PCB_HID_COMP_NEGATIVE: - pcb_message(PCB_MSG_ERROR, "Can't draw composite layer, especially not on copper\n"); + rnd_message(PCB_MSG_ERROR, "Can't draw composite layer, especially not on copper\n"); break; case PCB_HID_COMP_FLUSH: break; @@ -733,7 +733,7 @@ gc->cap = style; } -static void openems_set_line_width(pcb_hid_gc_t gc, pcb_coord_t width) +static void openems_set_line_width(pcb_hid_gc_t gc, rnd_coord_t width) { gc->width = width; } @@ -744,19 +744,19 @@ ; } -static void openems_fill_rect(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) +static void openems_fill_rect(pcb_hid_gc_t gc, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2) { } -static void openems_draw_rect(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) +static void openems_draw_rect(pcb_hid_gc_t gc, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2) { } -static void openems_draw_arc(pcb_hid_gc_t gc, pcb_coord_t cx, pcb_coord_t cy, pcb_coord_t width, pcb_coord_t height, pcb_angle_t start_angle, pcb_angle_t delta_angle) +static void openems_draw_arc(pcb_hid_gc_t gc, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t width, rnd_coord_t height, pcb_angle_t start_angle, pcb_angle_t delta_angle) { } -static void openems_fill_circle(pcb_hid_gc_t gc, pcb_coord_t cx, pcb_coord_t cy, pcb_coord_t radius) +static void openems_fill_circle(pcb_hid_gc_t gc, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t radius) { wctx_t *ctx = ems_ctx; long oid = ctx->oid++; @@ -766,7 +766,7 @@ pcb_fprintf(ctx->f, "CSX = AddPcbrndTrace(CSX, PCBRND, %d, points%ld, %mm, 0);\n", ctx->clayer, oid, radius*2); } -static void openems_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y, pcb_coord_t dx, pcb_coord_t dy) +static void openems_fill_polygon_offs(pcb_hid_gc_t gc, int n_coords, rnd_coord_t *x, rnd_coord_t *y, rnd_coord_t dx, rnd_coord_t dy) { wctx_t *ctx = ems_ctx; int n; @@ -778,17 +778,17 @@ fprintf(ctx->f, "CSX = AddPcbrndPoly(CSX, PCBRND, %d, poly%ld_xy, 1);\n", ctx->clayer, oid); } -static void openems_fill_polygon(pcb_hid_gc_t gc, int n_coords, pcb_coord_t *x, pcb_coord_t *y) +static void openems_fill_polygon(pcb_hid_gc_t gc, int n_coords, rnd_coord_t *x, rnd_coord_t *y) { openems_fill_polygon_offs(gc, n_coords, x, y, 0, 0); } -static void openems_draw_line(pcb_hid_gc_t gc, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) +static void openems_draw_line(pcb_hid_gc_t gc, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2) { wctx_t *ctx = ems_ctx; if (gc->cap == pcb_cap_square) { - pcb_coord_t x[4], y[4]; + rnd_coord_t x[4], y[4]; pcb_line_t tmp; tmp.Point1.X = x1; tmp.Point1.Y = y1; @@ -808,11 +808,11 @@ static void openems_calibrate(pcb_hid_t *hid, double xval, double yval) { - pcb_message(PCB_MSG_ERROR, "openems_calibrate() not implemented"); + rnd_message(PCB_MSG_ERROR, "openems_calibrate() not implemented"); return; } -static void openems_set_crosshair(pcb_hid_t *hid, pcb_coord_t x, pcb_coord_t y, int a) +static void openems_set_crosshair(pcb_hid_t *hid, rnd_coord_t x, rnd_coord_t y, int a) { } Index: mesh.c =================================================================== --- mesh.c (revision 30902) +++ mesh.c (revision 30903) @@ -56,11 +56,11 @@ static void mesh2dlg() { int n; - pcb_coord_t subst_thick; + rnd_coord_t subst_thick; subst_thick = pcb_board_thickness(PCB, "openems", PCB_BRDTHICK_PRINT_ERROR); if (subst_thick <= 0) { - pcb_message(PCB_MSG_ERROR, "Assuming 1.5mm thick substrate because of the missing thickness attributes.\nFeel free to change it in the mesh dialog or add the attributes to the substrate groups."); + rnd_message(PCB_MSG_ERROR, "Assuming 1.5mm thick substrate because of the missing thickness attributes.\nFeel free to change it in the mesh dialog or add the attributes to the substrate groups."); subst_thick = PCB_MM_TO_COORD(1.5); } @@ -122,12 +122,12 @@ #endif TODO("reorder to avoid fwd decl") -static void mesh_auto_add_smooth(vtc0_t *v, pcb_coord_t c1, pcb_coord_t c2, pcb_coord_t d1, pcb_coord_t d, pcb_coord_t d2); +static void mesh_auto_add_smooth(vtc0_t *v, rnd_coord_t c1, rnd_coord_t c2, rnd_coord_t d1, rnd_coord_t d, rnd_coord_t d2); #define SAVE_INT(name) \ pcb_append_printf(dst, "%s " #name" = %d\n", prefix, (int)me->dlg[me->name].val.lng); #define SAVE_COORD(name) \ - pcb_append_printf(dst, "%s " #name" = %.08$$mm\n", prefix, (pcb_coord_t)me->dlg[me->name].val.crd); + pcb_append_printf(dst, "%s " #name" = %.08$$mm\n", prefix, (rnd_coord_t)me->dlg[me->name].val.crd); void pcb_mesh_save(const mesh_dlg_t *me, gds_t *dst, const char *prefix) { int n; @@ -186,12 +186,12 @@ int v; \ char *end; \ if (n->type != LHT_TEXT) { \ - pcb_message(PCB_MSG_ERROR, "Invalid mesh item: " #name " should be text\n"); \ + rnd_message(PCB_MSG_ERROR, "Invalid mesh item: " #name " should be text\n"); \ return -1; \ } \ v = strtol(n->data.text.value, &end, 10); \ if (*end != '\0') { \ - pcb_message(PCB_MSG_ERROR, "Invalid mesh integer: " #name "\n"); \ + rnd_message(PCB_MSG_ERROR, "Invalid mesh integer: " #name "\n"); \ return -1; \ } \ PCB_DAD_SET_VALUE(me->dlg_hid_ctx, me->name, lng, v); \ @@ -203,17 +203,17 @@ lht_node_t *n = lht_dom_hash_get(root, #name); \ if (n != NULL) { \ double v; \ - pcb_bool succ; \ + rnd_bool succ; \ if (n->type != LHT_TEXT) { \ - pcb_message(PCB_MSG_ERROR, "Invalid mesh item: " #name " should be text\n"); \ + rnd_message(PCB_MSG_ERROR, "Invalid mesh item: " #name " should be text\n"); \ return -1; \ } \ v = pcb_get_value(n->data.text.value, NULL, NULL, &succ); \ if (!succ) { \ - pcb_message(PCB_MSG_ERROR, "Invalid mesh coord: " #name "\n"); \ + rnd_message(PCB_MSG_ERROR, "Invalid mesh coord: " #name "\n"); \ return -1; \ } \ - PCB_DAD_SET_VALUE(me->dlg_hid_ctx, me->name, crd, (pcb_coord_t)v); \ + PCB_DAD_SET_VALUE(me->dlg_hid_ctx, me->name, crd, (rnd_coord_t)v); \ } \ } while(0) @@ -223,7 +223,7 @@ int __found__ = 0, __n__; \ const char **__a__; \ if (node->type != LHT_TEXT) { \ - pcb_message(PCB_MSG_ERROR, "Invalid mesh value: " #name " should be text\n"); \ + rnd_message(PCB_MSG_ERROR, "Invalid mesh value: " #name " should be text\n"); \ return -1; \ } \ if (strcmp(node->data.text.value, "invalid") == 0) break; \ @@ -234,7 +234,7 @@ } \ } \ if (!__found__) { \ - pcb_message(PCB_MSG_ERROR, "Invalid mesh value '%s' for " #name "\n", node->data.text.value); \ + rnd_message(PCB_MSG_ERROR, "Invalid mesh value '%s' for " #name "\n", node->data.text.value); \ return -1; \ } \ PCB_DAD_SET_VALUE(me->dlg_hid_ctx, dst, lng, __n__); \ @@ -246,7 +246,7 @@ lht_node_t *lst, *nd; if ((root->type != LHT_HASH) || (strcmp(root->name, "pcb-rnd-mesh-v1") != 0)) { - pcb_message(PCB_MSG_ERROR, "Input is not a valid mesh save - should be a ha:pcb-rnd-mesh subtree\n"); + rnd_message(PCB_MSG_ERROR, "Input is not a valid mesh save - should be a ha:pcb-rnd-mesh subtree\n"); return -1; } @@ -271,7 +271,7 @@ if (lst != NULL) { int n; if (lst->type != LHT_LIST) { - pcb_message(PCB_MSG_ERROR, "Boundary shall be a list\n"); + rnd_message(PCB_MSG_ERROR, "Boundary shall be a list\n"); return -1; } for(n = 0, nd = lst->data.list.first; (n < 6) && (nd != NULL); n++,nd = nd->next) @@ -303,17 +303,17 @@ } -static void mesh_add_edge(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, pcb_coord_t crd) +static void mesh_add_edge(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, rnd_coord_t crd) { vtc0_append(&mesh->line[dir].edge, crd); } -static void mesh_add_result(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, pcb_coord_t crd) +static void mesh_add_result(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, rnd_coord_t crd) { vtc0_append(&mesh->line[dir].result, crd); } -static void mesh_add_range(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, pcb_coord_t c1, pcb_coord_t c2, pcb_coord_t dens) +static void mesh_add_range(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, rnd_coord_t c1, rnd_coord_t c2, rnd_coord_t dens) { pcb_range_t *r = vtr0_alloc_append(&mesh->line[dir].dens, 1); r->begin = c1; @@ -321,7 +321,7 @@ r->data[0].c = dens; } -static void mesh_add_obj(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, pcb_coord_t c1, pcb_coord_t c2, int aligned) +static void mesh_add_obj(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, rnd_coord_t c1, rnd_coord_t c2, int aligned) { if (aligned) { mesh_add_edge(mesh, dir, c1 - mesh->dens_obj * 2 / 3); @@ -353,7 +353,7 @@ } linelist_foreach(&layer->Line, &it, line) { - pcb_coord_t x1 = line->Point1.X, y1 = line->Point1.Y, x2 = line->Point2.X, y2 = line->Point2.Y; + rnd_coord_t x1 = line->Point1.X, y1 = line->Point1.Y, x2 = line->Point2.X, y2 = line->Point2.Y; int aligned = (x1 == x2) || (y1 == y2); switch(dir) { @@ -389,13 +389,13 @@ pcb_polyarea_t *pa; for(pa = pcb_poly_island_first(poly, &it); pa != NULL; pa = pcb_poly_island_next(&it)) { - pcb_coord_t x, y; + rnd_coord_t x, y; pcb_pline_t *pl; int go; pl = pcb_poly_contour(&it); if (pl != NULL) { - pcb_coord_t lx, ly, minx, miny, maxx, maxy; + rnd_coord_t lx, ly, minx, miny, maxx, maxy; pcb_poly_vect_first(&it, &minx, &miny); maxx = minx; @@ -461,7 +461,7 @@ static int cmp_coord(const void *v1, const void *v2) { - const pcb_coord_t *c1 = v1, *c2 = v2; + const rnd_coord_t *c1 = v1, *c2 = v2; return *c1 < *c2 ? -1 : +1; } @@ -473,8 +473,8 @@ typedef struct { - pcb_coord_t min; - pcb_coord_t max; + rnd_coord_t min; + rnd_coord_t max; int found; } mesh_maybe_t; @@ -481,7 +481,7 @@ static int cmp_maybe_add(const void *k, const void *v) { const mesh_maybe_t *ctx = k; - const pcb_coord_t *c = v; + const rnd_coord_t *c = v; if ((*c >= ctx->min) && (*c <= ctx->max)) return 0; @@ -490,19 +490,19 @@ return -1; } -static void mesh_maybe_add_edge(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, pcb_coord_t at, pcb_coord_t dist) +static void mesh_maybe_add_edge(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, rnd_coord_t at, rnd_coord_t dist) { mesh_maybe_t ctx; - pcb_coord_t *c; + rnd_coord_t *c; ctx.min = at - dist; ctx.max = at + dist; ctx.found = 0; - c = bsearch(&ctx, mesh->line[dir].edge.array, vtc0_len(&mesh->line[dir].edge), sizeof(pcb_coord_t), cmp_maybe_add); + c = bsearch(&ctx, mesh->line[dir].edge.array, vtc0_len(&mesh->line[dir].edge), sizeof(rnd_coord_t), cmp_maybe_add); if (c == NULL) { TODO(": optimization: run a second bsearch and insert instead of this; testing: 45 deg line (won't have axis aligned edge for the 2/3 1/3 rule)") vtc0_append(&mesh->line[dir].edge, at); - qsort(mesh->line[dir].edge.array, vtc0_len(&mesh->line[dir].edge), sizeof(pcb_coord_t), cmp_coord); + qsort(mesh->line[dir].edge.array, vtc0_len(&mesh->line[dir].edge), sizeof(rnd_coord_t), cmp_coord); } } @@ -512,16 +512,16 @@ pcb_range_t *r; if (vtr0_len(&mesh->line[dir].dens) < 1) { - pcb_message(PCB_MSG_ERROR, "There are not enough objects to do the meshing\n"); + rnd_message(PCB_MSG_ERROR, "There are not enough objects to do the meshing\n"); return -1; } - qsort(mesh->line[dir].edge.array, vtc0_len(&mesh->line[dir].edge), sizeof(pcb_coord_t), cmp_coord); + qsort(mesh->line[dir].edge.array, vtc0_len(&mesh->line[dir].edge), sizeof(rnd_coord_t), cmp_coord); qsort(mesh->line[dir].dens.array, vtr0_len(&mesh->line[dir].dens), sizeof(pcb_range_t), cmp_range); /* warn for edges too close */ for(n = 0; n < vtc0_len(&mesh->line[dir].edge)-1; n++) { - pcb_coord_t c1 = mesh->line[dir].edge.array[n], c2 = mesh->line[dir].edge.array[n+1]; + rnd_coord_t c1 = mesh->line[dir].edge.array[n], c2 = mesh->line[dir].edge.array[n+1]; if (c2 - c1 < mesh->min_space) { if ((c2 - c1) < PCB_MM_TO_COORD(0.1)) { mesh->line[dir].edge.array[n] = (c1 + c2) / 2; @@ -528,7 +528,7 @@ vtc0_remove(&mesh->line[dir].edge, n+1, 1); } else - pcb_message(PCB_MSG_ERROR, "meshing error: invalid minimum spacing (%$mm) required: forced %s edges are closer than that around %$mm..%$mm; try decreasing your minimum spacing to below %$mm\n", mesh->min_space, dir == PCB_MESH_VERTICAL ? "vertical" : "horizonal", c1, c2, c2-c1); + rnd_message(PCB_MSG_ERROR, "meshing error: invalid minimum spacing (%$mm) required: forced %s edges are closer than that around %$mm..%$mm; try decreasing your minimum spacing to below %$mm\n", mesh->min_space, dir == PCB_MESH_VERTICAL ? "vertical" : "horizonal", c1, c2, c2-c1); } } @@ -549,7 +549,7 @@ for(n = 0; n < vtr0_len(&mesh->line[dir].dens)-1; n++) { pcb_range_t *r1 = &mesh->line[dir].dens.array[n], *r2 = &mesh->line[dir].dens.array[n+1]; if (r1->end < r2->begin) { - pcb_coord_t my_end = r2->begin; /* the insert will change r2 pointer */ + rnd_coord_t my_end = r2->begin; /* the insert will change r2 pointer */ pcb_range_t *r = vtr0_alloc_insert(&mesh->line[dir].dens, n+1, 1); r->begin = r1->end; r->end = my_end; @@ -583,7 +583,7 @@ static int cmp_range_at(const void *key_, const void *v_) { - const pcb_coord_t *key = key_; + const rnd_coord_t *key = key_; const pcb_range_t *v = v_; if ((*key >= v->begin) && (*key <= v->end)) @@ -592,7 +592,7 @@ return +1; } -static pcb_range_t *mesh_find_range(const vtr0_t *v, pcb_coord_t at, pcb_coord_t *dens, pcb_coord_t *dens_left, pcb_coord_t *dens_right) +static pcb_range_t *mesh_find_range(const vtr0_t *v, rnd_coord_t at, rnd_coord_t *dens, rnd_coord_t *dens_left, rnd_coord_t *dens_right) { pcb_range_t *r; r = bsearch(&at, v->array, vtr0_len((vtr0_t *)v), sizeof(pcb_range_t), cmp_range_at); @@ -619,7 +619,7 @@ static int mesh_auto_z(pcb_mesh_t *mesh) { pcb_layergrp_id_t gid; - pcb_coord_t y = 0, ytop = 0, ybottom, top_dens, bottom_dens; + rnd_coord_t y = 0, ytop = 0, ybottom, top_dens, bottom_dens; int n, lns, first = 1; vtc0_truncate(&mesh->line[PCB_MESH_Z].result, 0); @@ -633,7 +633,7 @@ /* Ignore the thickness of copper layers for now: copper sheets are modelled in 2d */ } else if (grp->ltype & PCB_LYT_SUBSTRATE) { - pcb_coord_t d, t = mesh->def_subs_thick; + rnd_coord_t d, t = mesh->def_subs_thick; double dens = (double)t/(double)lns; bottom_dens = pcb_round(dens); if (lns != 0) { @@ -691,7 +691,7 @@ return 0; } -static void mesh_draw_line(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, pcb_coord_t at, pcb_coord_t aux1, pcb_coord_t aux2, pcb_coord_t thick) +static void mesh_draw_line(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, rnd_coord_t at, rnd_coord_t aux1, rnd_coord_t aux2, rnd_coord_t thick) { if (dir == PCB_MESH_HORIZONTAL) pcb_line_new(mesh->ui_layer_xy, aux1, at, aux2, at, thick, 0, pcb_no_flags()); @@ -699,7 +699,7 @@ pcb_line_new(mesh->ui_layer_xy, at, aux1, at, aux2, thick, 0, pcb_no_flags()); } -static void mesh_draw_range(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, pcb_coord_t at1, pcb_coord_t at2, pcb_coord_t aux, pcb_coord_t thick) +static void mesh_draw_range(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, rnd_coord_t at1, rnd_coord_t at2, rnd_coord_t aux, rnd_coord_t thick) { if (dir == PCB_MESH_HORIZONTAL) pcb_line_new(mesh->ui_layer_xy, aux, at1, aux, at2, thick, 0, pcb_no_flags()); @@ -707,7 +707,7 @@ pcb_line_new(mesh->ui_layer_xy, at1, aux, at2, aux, thick, 0, pcb_no_flags()); } -static void mesh_draw_label(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, pcb_coord_t aux, const char *label) +static void mesh_draw_label(pcb_mesh_t *mesh, pcb_mesh_dir_t dir, rnd_coord_t aux, const char *label) { aux -= PCB_MM_TO_COORD(0.6); if (dir == PCB_MESH_HORIZONTAL) @@ -720,7 +720,7 @@ static int mesh_vis_xy(pcb_mesh_t *mesh, pcb_mesh_dir_t dir) { size_t n; - pcb_coord_t end; + rnd_coord_t end; mesh_draw_label(mesh, dir, PCB_MM_TO_COORD(0.1), "object edge"); @@ -756,10 +756,10 @@ { int n; pcb_layergrp_id_t gid; - pcb_coord_t y0 = PCB->hidlib.size_y/3, y = y0, y2; - pcb_coord_t xl = PCB->hidlib.size_x/5; /* board left */ - pcb_coord_t xr = PCB->hidlib.size_x/5*3; /* board right */ - pcb_coord_t spen = PCB_MM_TO_COORD(0.3), cpen = PCB_MM_TO_COORD(0.2), mpen = PCB_MM_TO_COORD(0.03); + rnd_coord_t y0 = PCB->hidlib.size_y/3, y = y0, y2; + rnd_coord_t xl = PCB->hidlib.size_x/5; /* board left */ + rnd_coord_t xr = PCB->hidlib.size_x/5*3; /* board right */ + rnd_coord_t spen = PCB_MM_TO_COORD(0.3), cpen = PCB_MM_TO_COORD(0.2), mpen = PCB_MM_TO_COORD(0.03); int mag = 2; for(gid = 0; gid < PCB->LayerGroups.len; gid++) { @@ -782,7 +782,7 @@ mesh_trace("Z lines:\n"); for(n = 0; n < vtc0_len(&mesh->line[PCB_MESH_Z].result); n++) { - pcb_coord_t y = y0+mesh->line[PCB_MESH_Z].result.array[n]*mag; + rnd_coord_t y = y0+mesh->line[PCB_MESH_Z].result.array[n]*mag; mesh_trace(" %mm", y); pcb_line_new(mesh->ui_layer_z, 0, y, PCB->hidlib.size_x, y, mpen, 0, pcb_no_flags()); } @@ -791,7 +791,7 @@ } -static void mesh_auto_add_even(vtc0_t *v, pcb_coord_t c1, pcb_coord_t c2, pcb_coord_t d) +static void mesh_auto_add_even(vtc0_t *v, rnd_coord_t c1, rnd_coord_t c2, rnd_coord_t d) { long num = (c2 - c1) / d; @@ -806,7 +806,7 @@ } } -static pcb_coord_t mesh_auto_add_interp(vtc0_t *v, pcb_coord_t c, pcb_coord_t d1, pcb_coord_t d2, pcb_coord_t dd) +static rnd_coord_t mesh_auto_add_interp(vtc0_t *v, rnd_coord_t c, rnd_coord_t d1, rnd_coord_t d2, rnd_coord_t dd) { if (dd > 0) { for(; d1 <= d2; d1 += dd) { @@ -825,9 +825,9 @@ } -static void mesh_auto_add_smooth(vtc0_t *v, pcb_coord_t c1, pcb_coord_t c2, pcb_coord_t d1, pcb_coord_t d, pcb_coord_t d2) +static void mesh_auto_add_smooth(vtc0_t *v, rnd_coord_t c1, rnd_coord_t c2, rnd_coord_t d1, rnd_coord_t d, rnd_coord_t d2) { - pcb_coord_t len = c2 - c1, begin = c1, end = c2, glen; + rnd_coord_t len = c2 - c1, begin = c1, end = c2, glen; int lines; /* ramp up (if there's room) */ @@ -861,8 +861,8 @@ static int mesh_auto_build(pcb_mesh_t *mesh, pcb_mesh_dir_t dir) { size_t n; - pcb_coord_t c1, c2; - pcb_coord_t d1, d, d2; + rnd_coord_t c1, c2; + rnd_coord_t d1, d, d2; mesh_trace("build:\n"); @@ -982,7 +982,7 @@ f = pcb_fopen_askovr(&PCB->hidlib, fname, "w", NULL); if (f == NULL) { - pcb_message(PCB_MSG_ERROR, "Can not open '%s' for write\n", fname); + rnd_message(PCB_MSG_ERROR, "Can not open '%s' for write\n", fname); return; } @@ -1012,11 +1012,11 @@ f = pcb_fopen(&PCB->hidlib, fname, "r"); if (f == NULL) { - pcb_message(PCB_MSG_ERROR, "Can not open '%s' for read\n", fname); + rnd_message(PCB_MSG_ERROR, "Can not open '%s' for read\n", fname); return; } if (mesh_load_file(&ia, f) != 0) - pcb_message(PCB_MSG_ERROR, "Loading mesh settings from '%s' failed.\n", fname); + rnd_message(PCB_MSG_ERROR, "Loading mesh settings from '%s' failed.\n", fname); fclose(f); } Index: mesh.h =================================================================== --- mesh.h (revision 30902) +++ mesh.h (revision 30903) @@ -22,17 +22,17 @@ pcb_layer_t *layer; /* input layer (objects are picked up from this layer) */ pcb_layer_t *ui_layer_xy, *ui_layer_z; /* optional UI layers to draw the mesh on */ char *ui_name_xy; /* name of the UI layer */ - pcb_coord_t dens_obj, dens_gap; /* target density: distance between mesh lines above objects and above gaps */ - pcb_coord_t min_space; /* make sure there's always at least this much space between two mesh lines */ - pcb_coord_t def_subs_thick; /* default substrate thickness */ - pcb_coord_t def_copper_thick; /* default copper thickness */ + rnd_coord_t dens_obj, dens_gap; /* target density: distance between mesh lines above objects and above gaps */ + rnd_coord_t min_space; /* make sure there's always at least this much space between two mesh lines */ + rnd_coord_t def_subs_thick; /* default substrate thickness */ + rnd_coord_t def_copper_thick; /* default copper thickness */ pcb_mesh_lines_t line[PCB_MESH_max]; /* actual lines of the mesh */ const char *bnd[6]; /* temporary: boundary conditions */ - pcb_coord_t z_bottom_copper; /* z coordinate of the bottom copper layer, along the z-mesh (0 is the top copper) */ + rnd_coord_t z_bottom_copper; /* z coordinate of the bottom copper layer, along the z-mesh (0 is the top copper) */ int pml; /* add pml cells around the exterior of the existing mesh of "perfectly matched" impedance */ int subslines; /* number of mesh lines in substrate (z) */ - pcb_coord_t dens_air; /* mesh line density (spacing) in air */ - pcb_coord_t max_air; /* how far out to mesh in air */ + rnd_coord_t dens_air; /* mesh line density (spacing) in air */ + rnd_coord_t max_air; /* how far out to mesh in air */ unsigned hor:1; /* enable adding horizontal mesh lines */ unsigned ver:1; /* enable adding vertical mesh lines */ unsigned smooth:1; /* if set, avoid jumps in the meshing by gradually changing meshing distance: x and y direction */