r5345 - developers/werner/fped
werner at docs.openmoko.org
werner at docs.openmoko.org
Fri Jul 31 03:33:56 CEST 2009
Author: werner
Date: 2009-07-31 03:33:56 +0200 (Fri, 31 Jul 2009)
New Revision: 5345
Modified:
developers/werner/fped/README
developers/werner/fped/TODO
developers/werner/fped/fpd.l
developers/werner/fped/fpd.y
developers/werner/fped/gui.c
developers/werner/fped/gui_style.c
developers/werner/fped/obj.c
developers/werner/fped/obj.h
developers/werner/fped/qfn.fpd
Log:
- name of anonymous vectors wasn't initialized
- made active vectors a little brighter to better tell them apart from inactive
ones
- frames are now (again) ordered from root down
- added new item .circ to avoid crazy .arc syntax
Modified: developers/werner/fped/README
===================================================================
--- developers/werner/fped/README 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/README 2009-07-31 01:33:56 UTC (rev 5345)
@@ -86,27 +86,26 @@
A circle is defined by its center and a point on the circle:
-.arc <center> <point>
+.circ <center> <point>
This example draws a unit circle:
.vec @ 1mm, 0mm
-.arc @ .
+.circ @ .
An arc is like a circle, but the part of the circle drawn is determined
by two points. The first point determines the radius and the starting
angle. The second point only determines the end angle but its distance
from the center is ignored.
-.arc <center> <radius>, <end>
+.arc <center> <radius> <end>
-Note the comma between the radius and the end angle. The arc is drawn
-in a counter-clockwise direction. The following example draws an arc
-of the unit circle in the x > 0, y > 0 quadrant:
+The arc is drawn in a counter-clockwise direction. The following example
+draws an arc of the unit circle in the x > 0, y > 0 quadrant:
from = .vec @ 1mm, 0mm
to = .vec @ 0mm, 1mm
-.arc @ from, to
+.arc @ from to
Pads
@@ -225,7 +224,7 @@
x = 1, 3
.vec @ x*1mm, 0mm
-.arc @ .
+.circ @ .
Tables
@@ -250,7 +249,7 @@
{ 2mm }
{ 3mm }
.vec @ x, 0mm
-.arc @ .
+.circ @ .
Note that we can set the unit of the values directly in this case.
Modified: developers/werner/fped/TODO
===================================================================
--- developers/werner/fped/TODO 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/TODO 2009-07-31 01:33:56 UTC (rev 5345)
@@ -17,7 +17,6 @@
- consider adding auto/mm/mil selection for each dimension
- syntax seems a little cryptic. too many dots and at signs.
- add measurements
-- arc syntax is weird, with comma where we use spaces
- Q: allow reassignment of vector names ? (no: would cause confusion in GUI)
- add KiCad output
- add postscript output
Modified: developers/werner/fped/fpd.l
===================================================================
--- developers/werner/fped/fpd.l 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/fpd.l 2009-07-31 01:33:56 UTC (rev 5345)
@@ -37,6 +37,7 @@
".pad" return TOK_PAD;
".rect" return TOK_RECT;
".line" return TOK_LINE;
+".circ" return TOK_CIRC;
".arc" return TOK_ARC;
[a-zA-Z_][a-zA-Z_0-9]* { yylval.id = unique(yytext);
Modified: developers/werner/fped/fpd.y
===================================================================
--- developers/werner/fped/fpd.y 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/fpd.y 2009-07-31 01:33:56 UTC (rev 5345)
@@ -21,7 +21,7 @@
static struct frame *curr_frame;
-static struct frame **next_frame;
+static struct frame *last_frame = NULL;
static struct table **next_table;
static struct loop **next_loop;
static struct vec **next_vec;
@@ -122,7 +122,8 @@
};
-%token TOK_FRAME TOK_TABLE TOK_VEC TOK_PAD TOK_RECT TOK_LINE TOK_ARC
+%token TOK_FRAME TOK_TABLE TOK_VEC
+%token TOK_PAD TOK_RECT TOK_LINE TOK_CIRC TOK_ARC
%token <num> NUMBER
%token <str> STRING
@@ -141,11 +142,17 @@
all:
{
- frames = zalloc_type(struct frame);
- next_frame = &frames->next;
- set_frame(frames);
+ root_frame = zalloc_type(struct frame);
+ set_frame(root_frame);
}
frame_defs frame_items
+ {
+ root_frame->prev = last_frame;
+ if (last_frame)
+ last_frame->next = root_frame;
+ else
+ frames = root_frame;
+ }
;
frame_defs:
@@ -157,15 +164,20 @@
{
if (find_frame($2))
yyerrorf("duplicate frame \"%s\"", $2);
- *next_frame = zalloc_type(struct frame);
- (*next_frame)->name = $2;
- set_frame(*next_frame);
- next_frame = &(*next_frame)->next;
+ curr_frame = zalloc_type(struct frame);
+ curr_frame->name = $2;
+ set_frame(curr_frame);
+ curr_frame->prev = last_frame;
+ if (last_frame)
+ last_frame->next = curr_frame;
+ else
+ frames = curr_frame;
+ last_frame = curr_frame;
}
frame_items '}'
{
- set_frame(frames);
+ set_frame(root_frame);
}
;
@@ -301,6 +313,7 @@
TOK_VEC base expr ',' expr
{
$$ = alloc_type(struct vec);
+ $$->name = NULL;
$$->base = $2;
if ($2)
$2->n_refs++;
@@ -353,13 +366,20 @@
$$->base = $2;
$$->u.line.other = $3;
}
- | TOK_ARC base base opt_base
+ | TOK_CIRC base base
{
$$ = new_obj(ot_arc);
$$->base = $2;
$$->u.arc.start = $3;
- $$->u.arc.end = $4 ? $4 : $3;
+ $$->u.arc.end = $3;
}
+ | TOK_ARC base base base
+ {
+ $$ = new_obj(ot_arc);
+ $$->base = $2;
+ $$->u.arc.start = $3;
+ $$->u.arc.end = $4;
+ }
| TOK_FRAME ID base
{
$$ = new_obj(ot_frame);
Modified: developers/werner/fped/gui.c
===================================================================
--- developers/werner/fped/gui.c 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/gui.c 2009-07-31 01:33:56 UTC (rev 5345)
@@ -220,7 +220,7 @@
struct frame *f;
GtkWidget *label;
- for (f = frames; f; f = f->next) {
+ for (f = root_frame; f; f = f->prev) {
label = label_in_box_new(f->name ? f->name : "(root)");
gtk_box_pack_start(GTK_BOX(vbox), box_of_label(label),
FALSE, TRUE, 0);
@@ -321,13 +321,13 @@
G_CALLBACK(gtk_main_quit), NULL);
make_screen(root);
- build_vars(vars_box, frames);
+ build_vars(vars_box, root_frame);
gtk_widget_show_all(root);
gui_setup_style(root->window);
init_canvas();
- select_frame(frames);
+ select_frame(root_frame);
gtk_main();
Modified: developers/werner/fped/gui_style.c
===================================================================
--- developers/werner/fped/gui_style.c 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/gui_style.c 2009-07-31 01:33:56 UTC (rev 5345)
@@ -51,7 +51,7 @@
{
gc_bg = gc("#000000", 0);
/* inactive in+path active act+path selected */
- style(gc_vec, "#202000", "#404020", "#808040", "#c0c080", "#ffff80");
+ style(gc_vec, "#202000", "#404020", "#909040", "#c0c080", "#ffff80");
style(gc_obj, "#006060", INVALID, "#00ffff", INVALID, "#ffff80");
style(gc_pad, "#400000", INVALID, "#ff0000", INVALID, "#ffff80");
style(gc_frame, "#004000", "#205020", "#00ff00", INVALID, INVALID);
Modified: developers/werner/fped/obj.c
===================================================================
--- developers/werner/fped/obj.c 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/obj.c 2009-07-31 01:33:56 UTC (rev 5345)
@@ -25,6 +25,7 @@
struct frame *frames = NULL;
+struct frame *root_frame = NULL;
struct frame *active_frame = NULL;
@@ -277,7 +278,7 @@
int ok;
inst_start();
- ok = generate_frame(frames, zero, NULL, 1);
+ ok = generate_frame(root_frame, zero, NULL, 1);
if (ok)
inst_commit();
else
Modified: developers/werner/fped/obj.h
===================================================================
--- developers/werner/fped/obj.h 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/obj.h 2009-07-31 01:33:56 UTC (rev 5345)
@@ -79,6 +79,7 @@
struct vec *vecs;
struct obj *objs;
struct frame *next;
+ struct frame *prev; /* for the list of frames in the GUI */
/* used during generation */
const struct frame *curr_parent;
@@ -123,8 +124,9 @@
};
-struct frame *frames;
-struct frame *active_frame;
+extern struct frame *frames;
+extern struct frame *root_frame;
+extern struct frame *active_frame;
int instantiate(void);
Modified: developers/werner/fped/qfn.fpd
===================================================================
--- developers/werner/fped/qfn.fpd 2009-07-31 00:07:41 UTC (rev 5344)
+++ developers/werner/fped/qfn.fpd 2009-07-31 01:33:56 UTC (rev 5345)
@@ -51,10 +51,10 @@
c = .vec @ -1mm, 1mm
r = .vec c 0mm, 0.5mm
e = .vec c -0.5mm, 0mm
-.arc c r, e
+.arc c r e
r2 = .vec c 0mm, 0.8mm
-.arc c r2
+.circ c r2
/*
x1 = 1+2*3
More information about the commitlog
mailing list