1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-22 02:20:16 +02:00

fix whitespace anomalies

/ \t/, / $/, and /\t$/
This commit is contained in:
Werner Almesberger 2012-05-28 03:11:15 -03:00
parent 4c3dea7111
commit f2d3986600
19 changed files with 29 additions and 31 deletions

View File

@ -112,7 +112,7 @@ struct coord sub_vec(struct coord a, struct coord b)
struct coord neg_vec(struct coord v) struct coord neg_vec(struct coord v)
{ {
v.x = -v.x; v.x = -v.x;
v.y = -v.y; v.y = -v.y;
return v; return v;
} }

6
expr.c
View File

@ -330,7 +330,7 @@ static struct num sin_cos(const struct expr *self,
if (is_undef(res)) if (is_undef(res))
return undef; return undef;
if (!is_dimensionless(res)) { if (!is_dimensionless(res)) {
fail("angle must be dimensionless"); fail("angle must be dimensionless");
return undef; return undef;
} }
res.n = fn(res.n/180.0*M_PI); 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)) if (is_undef(res))
return undef; return undef;
if (res.exponent & 1) { 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; return undef;
} }
if (res.n < 0) { if (res.n < 0) {
fail("argument of sqrt must be positive"); fail("argument of sqrt must be positive");
return undef; return undef;
} }
res.n = sqrt(res.n); res.n = sqrt(res.n);

2
fpd.l
View File

@ -192,7 +192,7 @@ SP [\t ]*
^#\ [0-9]+\ \"[^"]*\"(\ [0-9]+)*\n { ^#\ [0-9]+\ \"[^"]*\"(\ [0-9]+)*\n {
if (!disable_keywords) if (!disable_keywords)
BEGIN(INITIAL); BEGIN(INITIAL);
lineno = strtol(yytext+2, NULL, 0); } lineno = strtol(yytext+2, NULL, 0); }
. return *yytext; . return *yytext;

6
fpd.y
View File

@ -773,7 +773,7 @@ var:
n_vars++; n_vars++;
} }
; ;
opt_key: opt_key:
{ {
$$ = 0; $$ = 0;
@ -973,8 +973,8 @@ obj:
$$->u.arc.end = $4; $$->u.arc.end = $4;
$$->u.arc.width = $5; $$->u.arc.width = $5;
} }
| TOK_FRAME ID | TOK_FRAME ID
{ {
$<num>$.n = lineno; $<num>$.n = lineno;
} }
base base

6
gui.c
View File

@ -94,7 +94,7 @@ static void swap_var_code(void)
static GtkItemFactoryEntry menu_entries[] = { static GtkItemFactoryEntry menu_entries[] = {
{ "/File", NULL, NULL, 0, "<Branch>" }, { "/File", NULL, NULL, 0, "<Branch>" },
{ "/File/Save", NULL, save_fpd, 0, "<Item>" }, { "/File/Save", NULL, save_fpd, 0, "<Item>" },
{ "/File/Save as", NULL, save_as_fpd, 0, "<Item>" }, { "/File/Save as", NULL, save_as_fpd, 0, "<Item>" },
{ "/File/sep1", NULL, NULL, 0, "<Separator>" }, { "/File/sep1", NULL, NULL, 0, "<Separator>" },
@ -277,7 +277,7 @@ static void make_center_area(GtkWidget *vbox)
paned = gtk_hpaned_new(); paned = gtk_hpaned_new();
gtk_box_pack_start(GTK_BOX(hbox), paned, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), paned, TRUE, TRUE, 0);
/* Frames */ /* Frames */
frames_area = gtk_scrolled_window_new(NULL, NULL); frames_area = gtk_scrolled_window_new(NULL, NULL);
@ -338,7 +338,7 @@ void change_world(void)
after = inst_get_bbox(); after = inst_get_bbox();
label_in_box_bg(active_frame->label, COLOR_FRAME_SELECTED); label_in_box_bg(active_frame->label, COLOR_FRAME_SELECTED);
do_build_frames(); 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) after.max.x > before.max.x || after.max.y > before.max.y)
zoom_to_extents(); zoom_to_extents();
else else

View File

@ -208,7 +208,7 @@ static void pop_up_frame(struct frame *frame, GdkEventButton *event)
can_add_frame()); can_add_frame());
enable_add_var(frame, factory_frame); enable_add_var(frame, factory_frame);
pop_up(popup_frame_widget, event, 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_row_spacings(GTK_TABLE(tab), 1);
gtk_table_set_col_spacings(GTK_TABLE(tab), 1); gtk_table_set_col_spacings(GTK_TABLE(tab), 1);
} }
name = stralloc_printf("%s%s", var->key ? "?" : "", var->name); name = stralloc_printf("%s%s", var->key ? "?" : "", var->name);
field = label_in_box_new(name, field = label_in_box_new(name,
"Variable (column) name. Click to edit."); "Variable (column) name. Click to edit.");
@ -1122,7 +1122,6 @@ static void build_table(GtkWidget *vbox, struct frame *frame,
n_var++; n_var++;
n_vars++; n_vars++;
} }
} }

View File

@ -22,7 +22,7 @@
extern int show_vars; 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); const struct var *self);
void reselect_var(struct var *var); void reselect_var(struct var *var);

View File

@ -86,7 +86,7 @@ int is_dragging_anything(void)
NDX_n++; \ NDX_n++; \
NDX_n; }) NDX_n; })
#define NTH(first, n) \ #define NTH(first, n) \
({ typeof(first) *NTH_walk; \ ({ typeof(first) *NTH_walk; \
int NTH_n = (n); \ int NTH_n = (n); \
for (NTH_walk = &(first); NTH_n; NTH_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); b = pick_table_cell(table_b, b_col, b_row);
if (a) { if (a) {
g_object_ref(a); g_object_ref(a);
gtk_container_remove(GTK_CONTAINER(table_a), a); gtk_container_remove(GTK_CONTAINER(table_a), a);
} }
if (b) { if (b) {
g_object_ref(b); g_object_ref(b);
gtk_container_remove(GTK_CONTAINER(table_b), b); gtk_container_remove(GTK_CONTAINER(table_b), b);
} }
if (a) if (a)
gtk_table_attach_defaults(GTK_TABLE(table_b), a, gtk_table_attach_defaults(GTK_TABLE(table_b), a,

View File

@ -561,7 +561,7 @@ char *format_len(const char *label, unit_type len, enum curr_unit unit)
abort(); abort();
} }
return stralloc_printf(mm ? return stralloc_printf(mm ?
"%s" MM_FORMAT_SHORT "%s" : "%s" MM_FORMAT_SHORT "%s" :
"%s" MIL_FORMAT_SHORT "%s", "%s" MIL_FORMAT_SHORT "%s",
label, n, u); label, n, u);
} }

View File

@ -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) void *ctx, const char *tooltip)
{ {
static struct edit_unique_ctx unique_ctx; 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_y = add_entry(tab, 2, 1);
status_entry_x = gtk_widget_ref(make_entry()); status_entry_x = gtk_widget_ref(make_entry());
/* name and input */ /* name and input */
status_name = add_label(tab, 1, 2); status_name = add_label(tab, 1, 2);

View File

@ -223,7 +223,7 @@ GtkWidget *tool_button(GtkWidget *bar, GdkDrawable *drawable,
gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data), gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data),
gpointer data) gpointer data)
{ {
GtkWidget *image, *evbox; GtkWidget *image, *evbox;
GtkToolItem *item; GtkToolItem *item;
/* /*

2
inst.c
View File

@ -283,7 +283,7 @@ static int __inst_select(struct coord pos, int tries)
best_dist = dist; best_dist = dist;
} }
} }
if (selected_inst) if (selected_inst)
goto selected; goto selected;
} }

4
inst.h
View File

@ -59,7 +59,7 @@ struct inst_ops {
void (*save)(FILE *file, struct inst *self); void (*save)(FILE *file, struct inst *self);
void (*draw)(struct inst *self); void (*draw)(struct inst *self);
struct pix_buf *(*hover)(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); unit_type scale);
void (*select)(struct inst *self); void (*select)(struct inst *self);
void (*begin_drag_move)(struct inst *from, int i); void (*begin_drag_move)(struct inst *from, int i);
@ -207,7 +207,7 @@ void inst_revert(void);
void inst_draw(void); void inst_draw(void);
void inst_highlight_vecs(int (*pick)(struct inst *inst, void *user), void inst_highlight_vecs(int (*pick)(struct inst *inst, void *user),
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); int (*pick)(struct inst *inst, void *user), void *user);
struct inst *insts_ip_vec(void); struct inst *insts_ip_vec(void);

View File

@ -77,7 +77,7 @@ static void kicad_pad(FILE *file, const struct inst *inst)
/* /*
* name, shape (rectangle), Xsize, Ysize, Xdelta, Ydelta, Orientation * name, shape (rectangle), Xsize, Ysize, Xdelta, Ydelta, Orientation
*/ */
fprintf(file, "Sh \"%s\" %c %d %d 0 0 0\n", fprintf(file, "Sh \"%s\" %c %d %d 0 0 0\n",
inst->u.pad.name, inst->obj->u.pad.rounded ? 'O' : 'R', inst->u.pad.name, inst->obj->u.pad.rounded ? 'O' : 'R',
size.x, size.y); size.x, size.y);

2
meas.h
View File

@ -45,7 +45,7 @@ struct meas {
/* low is obj->base */ /* low is obj->base */
struct vec *high; struct vec *high;
struct expr *offset; struct expr *offset;
/* frame qualifiers */ /* frame qualifiers */
struct frame_qual *low_qual; struct frame_qual *low_qual;
struct frame_qual *high_qual; struct frame_qual *high_qual;

View File

@ -40,7 +40,7 @@ int inside(const struct inst *a, const struct inst *b)
abort(); abort();
} }
sort_coord(&min_a, &max_a); sort_coord(&min_a, &max_a);
min_b = b->base; min_b = b->base;
switch (b->obj->type) { switch (b->obj->type) {
case ot_pad: case ot_pad:

View File

@ -654,7 +654,7 @@ static int generate_frames(FILE *file, const struct pkg *pkg,
* quantitative one, emphasizing the logical structure of the drawing * quantitative one, emphasizing the logical structure of the drawing
* and not the actual sizes. * 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 * etc. size, then let their size be determined by the amount of text
* that's needed and the size of subordinate vectors. One difficulty * that's needed and the size of subordinate vectors. One difficulty
* would be in making vectors with a fixed length ratio look correct, * would be in making vectors with a fixed length ratio look correct,

View File

@ -88,7 +88,6 @@ static char *unparse_op(const struct expr *expr, enum prec prec)
char tmp[100]; char tmp[100];
char *buf, *temp; char *buf, *temp;
if (prec > precedence(expr->op)) { if (prec > precedence(expr->op)) {
temp = unparse_op(expr, prec_add); temp = unparse_op(expr, prec_add);
buf = alloc_size(strlen(temp)+3); buf = alloc_size(strlen(temp)+3);

2
util.c
View File

@ -52,7 +52,7 @@ char *stralloc_printf(const char *fmt, ...)
/* ----- identifier syntax check ------------------------------------------- */ /* ----- 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 == '_') if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_')
return 1; return 1;