From f2d3986600ad5722b1f2fd4f71a5495dcc540447 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 28 May 2012 03:11:15 -0300 Subject: [PATCH] fix whitespace anomalies / \t/, / $/, and /\t$/ --- coord.c | 2 +- expr.c | 6 +++--- fpd.l | 2 +- fpd.y | 6 +++--- gui.c | 6 +++--- gui_frame.c | 5 ++--- gui_frame.h | 2 +- gui_frame_drag.c | 6 +++--- gui_inst.c | 2 +- gui_status.c | 4 ++-- gui_util.c | 2 +- inst.c | 2 +- inst.h | 4 ++-- kicad.c | 2 +- meas.h | 2 +- overlap.c | 2 +- postscript.c | 2 +- unparse.c | 1 - util.c | 2 +- 19 files changed, 29 insertions(+), 31 deletions(-) diff --git a/coord.c b/coord.c index 307f59b..84168c7 100644 --- a/coord.c +++ b/coord.c @@ -112,7 +112,7 @@ struct coord sub_vec(struct coord a, struct coord b) struct coord neg_vec(struct coord v) { - v.x = -v.x; + v.x = -v.x; v.y = -v.y; return v; } diff --git a/expr.c b/expr.c index 62d1e18..822f4a2 100644 --- a/expr.c +++ b/expr.c @@ -330,7 +330,7 @@ static struct num sin_cos(const struct expr *self, if (is_undef(res)) return undef; if (!is_dimensionless(res)) { - fail("angle must be dimensionless"); + fail("angle must be dimensionless"); return undef; } res.n = fn(res.n/180.0*M_PI); @@ -358,11 +358,11 @@ struct num op_sqrt(const struct expr *self, const struct frame *frame) if (is_undef(res)) return undef; if (res.exponent & 1) { - fail("exponent of sqrt argument must be a multiple of two"); + fail("exponent of sqrt argument must be a multiple of two"); return undef; } if (res.n < 0) { - fail("argument of sqrt must be positive"); + fail("argument of sqrt must be positive"); return undef; } res.n = sqrt(res.n); diff --git a/fpd.l b/fpd.l index ccc2623..5d2cd20 100644 --- a/fpd.l +++ b/fpd.l @@ -192,7 +192,7 @@ SP [\t ]* ^#\ [0-9]+\ \"[^"]*\"(\ [0-9]+)*\n { if (!disable_keywords) - BEGIN(INITIAL); + BEGIN(INITIAL); lineno = strtol(yytext+2, NULL, 0); } . return *yytext; diff --git a/fpd.y b/fpd.y index 0276f2e..2919961 100644 --- a/fpd.y +++ b/fpd.y @@ -773,7 +773,7 @@ var: n_vars++; } ; - + opt_key: { $$ = 0; @@ -973,8 +973,8 @@ obj: $$->u.arc.end = $4; $$->u.arc.width = $5; } - | TOK_FRAME ID - { + | TOK_FRAME ID + { $$.n = lineno; } base diff --git a/gui.c b/gui.c index 08b7cc6..6842c61 100644 --- a/gui.c +++ b/gui.c @@ -94,7 +94,7 @@ static void swap_var_code(void) static GtkItemFactoryEntry menu_entries[] = { - { "/File", NULL, NULL, 0, "" }, + { "/File", NULL, NULL, 0, "" }, { "/File/Save", NULL, save_fpd, 0, "" }, { "/File/Save as", NULL, save_as_fpd, 0, "" }, { "/File/sep1", NULL, NULL, 0, "" }, @@ -277,7 +277,7 @@ static void make_center_area(GtkWidget *vbox) paned = gtk_hpaned_new(); gtk_box_pack_start(GTK_BOX(hbox), paned, TRUE, TRUE, 0); - + /* Frames */ frames_area = gtk_scrolled_window_new(NULL, NULL); @@ -338,7 +338,7 @@ void change_world(void) after = inst_get_bbox(); label_in_box_bg(active_frame->label, COLOR_FRAME_SELECTED); do_build_frames(); - if (after.min.x < before.min.x || after.min.y < before.min.y || + if (after.min.x < before.min.x || after.min.y < before.min.y || after.max.x > before.max.x || after.max.y > before.max.y) zoom_to_extents(); else diff --git a/gui_frame.c b/gui_frame.c index a56f899..e16a264 100644 --- a/gui_frame.c +++ b/gui_frame.c @@ -208,7 +208,7 @@ static void pop_up_frame(struct frame *frame, GdkEventButton *event) can_add_frame()); enable_add_var(frame, factory_frame); - + pop_up(popup_frame_widget, event, frame); } @@ -1038,7 +1038,7 @@ static void build_table(GtkWidget *vbox, struct frame *frame, gtk_table_set_row_spacings(GTK_TABLE(tab), 1); gtk_table_set_col_spacings(GTK_TABLE(tab), 1); } - + name = stralloc_printf("%s%s", var->key ? "?" : "", var->name); field = label_in_box_new(name, "Variable (column) name. Click to edit."); @@ -1122,7 +1122,6 @@ static void build_table(GtkWidget *vbox, struct frame *frame, n_var++; n_vars++; } - } diff --git a/gui_frame.h b/gui_frame.h index e4bfef2..7d0f3a7 100644 --- a/gui_frame.h +++ b/gui_frame.h @@ -22,7 +22,7 @@ extern int show_vars; -int find_var_in_frame(const struct frame *frame, const char *name, +int find_var_in_frame(const struct frame *frame, const char *name, const struct var *self); void reselect_var(struct var *var); diff --git a/gui_frame_drag.c b/gui_frame_drag.c index 5bd4a96..47fa169 100644 --- a/gui_frame_drag.c +++ b/gui_frame_drag.c @@ -86,7 +86,7 @@ int is_dragging_anything(void) NDX_n++; \ NDX_n; }) -#define NTH(first, n) \ +#define NTH(first, n) \ ({ typeof(first) *NTH_walk; \ int NTH_n = (n); \ for (NTH_walk = &(first); NTH_n; NTH_n--) \ @@ -164,11 +164,11 @@ static void swap_table_cells_by_coord(GtkWidget *table_a, b = pick_table_cell(table_b, b_col, b_row); if (a) { g_object_ref(a); - gtk_container_remove(GTK_CONTAINER(table_a), a); + gtk_container_remove(GTK_CONTAINER(table_a), a); } if (b) { g_object_ref(b); - gtk_container_remove(GTK_CONTAINER(table_b), b); + gtk_container_remove(GTK_CONTAINER(table_b), b); } if (a) gtk_table_attach_defaults(GTK_TABLE(table_b), a, diff --git a/gui_inst.c b/gui_inst.c index c6ea2bb..eb2498b 100644 --- a/gui_inst.c +++ b/gui_inst.c @@ -561,7 +561,7 @@ char *format_len(const char *label, unit_type len, enum curr_unit unit) abort(); } return stralloc_printf(mm ? - "%s" MM_FORMAT_SHORT "%s" : + "%s" MM_FORMAT_SHORT "%s" : "%s" MIL_FORMAT_SHORT "%s", label, n, u); } diff --git a/gui_status.c b/gui_status.c index df4bae4..28feb41 100644 --- a/gui_status.c +++ b/gui_status.c @@ -431,7 +431,7 @@ static struct edit_ops edit_ops_unique = { }; -void edit_unique(const char **s, int (*validate)(const char *s, void *ctx), +void edit_unique(const char **s, int (*validate)(const char *s, void *ctx), void *ctx, const char *tooltip) { static struct edit_unique_ctx unique_ctx; @@ -1055,7 +1055,7 @@ void make_status_area(GtkWidget *vbox) status_entry_y = add_entry(tab, 2, 1); status_entry_x = gtk_widget_ref(make_entry()); - + /* name and input */ status_name = add_label(tab, 1, 2); diff --git a/gui_util.c b/gui_util.c index f7f8611..67620a4 100644 --- a/gui_util.c +++ b/gui_util.c @@ -223,7 +223,7 @@ GtkWidget *tool_button(GtkWidget *bar, GdkDrawable *drawable, gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data), gpointer data) { - GtkWidget *image, *evbox; + GtkWidget *image, *evbox; GtkToolItem *item; /* diff --git a/inst.c b/inst.c index 7c58691..07b9c09 100644 --- a/inst.c +++ b/inst.c @@ -283,7 +283,7 @@ static int __inst_select(struct coord pos, int tries) best_dist = dist; } } - + if (selected_inst) goto selected; } diff --git a/inst.h b/inst.h index d79c930..556c5a2 100644 --- a/inst.h +++ b/inst.h @@ -59,7 +59,7 @@ struct inst_ops { void (*save)(FILE *file, struct inst *self); void (*draw)(struct inst *self); struct pix_buf *(*hover)(struct inst *self); - unit_type (*distance)(struct inst *self, struct coord pos, + unit_type (*distance)(struct inst *self, struct coord pos, unit_type scale); void (*select)(struct inst *self); void (*begin_drag_move)(struct inst *from, int i); @@ -207,7 +207,7 @@ void inst_revert(void); void inst_draw(void); void inst_highlight_vecs(int (*pick)(struct inst *inst, void *user), void *user); -struct inst *inst_find_vec(struct coord pos, +struct inst *inst_find_vec(struct coord pos, int (*pick)(struct inst *inst, void *user), void *user); struct inst *insts_ip_vec(void); diff --git a/kicad.c b/kicad.c index 5eb8e2e..be3a4f3 100644 --- a/kicad.c +++ b/kicad.c @@ -77,7 +77,7 @@ static void kicad_pad(FILE *file, const struct inst *inst) /* * name, shape (rectangle), Xsize, Ysize, Xdelta, Ydelta, Orientation - */ + */ fprintf(file, "Sh \"%s\" %c %d %d 0 0 0\n", inst->u.pad.name, inst->obj->u.pad.rounded ? 'O' : 'R', size.x, size.y); diff --git a/meas.h b/meas.h index 0e6c3f1..83edd80 100644 --- a/meas.h +++ b/meas.h @@ -45,7 +45,7 @@ struct meas { /* low is obj->base */ struct vec *high; struct expr *offset; - + /* frame qualifiers */ struct frame_qual *low_qual; struct frame_qual *high_qual; diff --git a/overlap.c b/overlap.c index ff76dd8..e77c7f3 100644 --- a/overlap.c +++ b/overlap.c @@ -40,7 +40,7 @@ int inside(const struct inst *a, const struct inst *b) abort(); } sort_coord(&min_a, &max_a); - + min_b = b->base; switch (b->obj->type) { case ot_pad: diff --git a/postscript.c b/postscript.c index a214678..82aa96f 100644 --- a/postscript.c +++ b/postscript.c @@ -654,7 +654,7 @@ static int generate_frames(FILE *file, const struct pkg *pkg, * quantitative one, emphasizing the logical structure of the drawing * and not the actual sizes. * - * This could be done by ranking vectors by current, average, maximum, + * This could be done by ranking vectors by current, average, maximum, * etc. size, then let their size be determined by the amount of text * that's needed and the size of subordinate vectors. One difficulty * would be in making vectors with a fixed length ratio look correct, diff --git a/unparse.c b/unparse.c index 92bc28a..d7b7202 100644 --- a/unparse.c +++ b/unparse.c @@ -88,7 +88,6 @@ static char *unparse_op(const struct expr *expr, enum prec prec) char tmp[100]; char *buf, *temp; - if (prec > precedence(expr->op)) { temp = unparse_op(expr, prec_add); buf = alloc_size(strlen(temp)+3); diff --git a/util.c b/util.c index cbc506c..8b43682 100644 --- a/util.c +++ b/util.c @@ -52,7 +52,7 @@ char *stralloc_printf(const char *fmt, ...) /* ----- identifier syntax check ------------------------------------------- */ -int is_id_char(char c, int first) +int is_id_char(char c, int first) { if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_') return 1;