Send commitlog mailing list submissions to
commitlog@lists.openmoko.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
commitlog-requ...@lists.openmoko.org
You can reach the person managing the list at
commitlog-ow...@lists.openmoko.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r5343 - developers/werner/fped (wer...@docs.openmoko.org)
2. r5344 - developers/werner/fped (wer...@docs.openmoko.org)
3. r5345 - developers/werner/fped (wer...@docs.openmoko.org)
4. r5346 - developers/werner/fped (wer...@docs.openmoko.org)
--- Begin Message ---
Author: werner
Date: 2009-07-30 23:18:07 +0200 (Thu, 30 Jul 2009)
New Revision: 5343
Modified:
developers/werner/fped/gui.c
developers/werner/fped/gui_canvas.c
developers/werner/fped/gui_canvas.h
developers/werner/fped/obj.c
developers/werner/fped/obj.h
Log:
- disentangled active path vs. active frame logic
- frame selection now marks the selection in the frame list
- reordered gui.c to avoid forward reference
Modified: developers/werner/fped/gui.c
===================================================================
--- developers/werner/fped/gui.c 2009-07-30 20:24:37 UTC (rev 5342)
+++ developers/werner/fped/gui.c 2009-07-30 21:18:07 UTC (rev 5343)
@@ -19,6 +19,7 @@
#include "obj.h"
#include "unparse.h"
#include "gui_util.h"
+#include "gui_style.h"
#include "gui_status.h"
#include "gui_canvas.h"
#include "gui.h"
@@ -29,8 +30,9 @@
static GtkWidget *vars_box;
-static void build_vars(GtkWidget *vbox, struct frame *frame);
+/* ----- menu bar ---------------------------------------------------------- */
+
static void make_menu_bar(GtkWidget *vbox)
{
GtkWidget *bar;
@@ -53,36 +55,9 @@
}
-static gboolean frame_select_event(GtkWidget *widget, GdkEventButton *event,
- gpointer data)
-{
- inst_deselect();
- active_frame = data;
- instantiate();
- build_vars(vars_box, active_frame);
- redraw();
- return TRUE;
-}
+/* ----- variable list ----------------------------------------------------- */
-static void show_frames(GtkWidget *vbox)
-{
- struct frame *f;
- GtkWidget *label;
-
- for (f = frames; f; f = f->next) {
- label = label_in_box_new(f->name ? f->name : "(root)");
- gtk_box_pack_start(GTK_BOX(vbox), box_of_label(label),
- FALSE, TRUE, 0);
- gtk_misc_set_padding(GTK_MISC(label), 2, 2);
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
-
- g_signal_connect(G_OBJECT(box_of_label(label)),
- "button_press_event", G_CALLBACK(frame_select_event), f);
- }
-}
-
-
static void add_sep(GtkWidget *box, int size)
{
GtkWidget *sep;
@@ -94,6 +69,9 @@
}
+/* ----- GUI construction -------------------------------------------------- */
+
+
static void build_assignment(GtkWidget *vbox, struct frame *frame,
struct table *table)
{
@@ -212,6 +190,55 @@
}
+/* ----- frame list -------------------------------------------------------- */
+
+
+static void select_frame(struct frame *frame)
+{
+ if (active_frame) {
+ label_in_box_bg(active_frame->label, "grey");
+ inst_deselect();
+ }
+ active_frame = frame;
+ instantiate();
+ label_in_box_bg(active_frame->label, "pink");
+ build_vars(vars_box, active_frame);
+ redraw();
+}
+
+
+static gboolean frame_select_event(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
+{
+ select_frame(data);
+ return TRUE;
+}
+
+
+static void show_frames(GtkWidget *vbox)
+{
+ struct frame *f;
+ GtkWidget *label;
+
+ for (f = frames; f; f = f->next) {
+ label = label_in_box_new(f->name ? f->name : "(root)");
+ gtk_box_pack_start(GTK_BOX(vbox), box_of_label(label),
+ FALSE, TRUE, 0);
+ gtk_misc_set_padding(GTK_MISC(label), 2, 2);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+
+ label_in_box_bg(label, "grey");
+
+ g_signal_connect(G_OBJECT(box_of_label(label)),
+ "button_press_event", G_CALLBACK(frame_select_event), f);
+ f->label = label;
+ }
+}
+
+
+/* ----- central screen area ----------------------------------------------- */
+
+
static void make_center_area(GtkWidget *vbox)
{
GtkWidget *hbox, *vars, *paned;
@@ -257,6 +284,9 @@
}
+/* ----- GUI construction -------------------------------------------------- */
+
+
static void make_screen(GtkWidget *window)
{
GtkWidget *vbox;
@@ -295,6 +325,10 @@
gtk_widget_show_all(root);
+ gui_setup_style(root->window);
+ init_canvas();
+ select_frame(frames);
+
gtk_main();
return 0;
Modified: developers/werner/fped/gui_canvas.c
===================================================================
--- developers/werner/fped/gui_canvas.c 2009-07-30 20:24:37 UTC (rev 5342)
+++ developers/werner/fped/gui_canvas.c 2009-07-30 21:18:07 UTC (rev 5343)
@@ -237,16 +237,11 @@
gpointer data)
{
static int first = 1;
-
if (first) {
- gui_setup_style(widget->window);
- center();
- auto_scale();
+ init_canvas();
first = 0;
}
-
redraw();
-
return TRUE;
}
@@ -272,6 +267,19 @@
/* ----- canvas setup ------------------------------------------------------ */
+/*
+ * Note that we call init_canvas twice: first to make sure we'll make it safely
+ * through select_frame, and the second time to set the geometry for the actual
+ * screen.
+ */
+
+void init_canvas(void)
+{
+ center();
+ auto_scale();
+}
+
+
GtkWidget *make_canvas(void)
{
GtkWidget *canvas;
Modified: developers/werner/fped/gui_canvas.h
===================================================================
--- developers/werner/fped/gui_canvas.h 2009-07-30 20:24:37 UTC (rev 5342)
+++ developers/werner/fped/gui_canvas.h 2009-07-30 21:18:07 UTC (rev 5343)
@@ -20,5 +20,6 @@
void redraw(void);
GtkWidget *make_canvas(void);
+void init_canvas(void);
#endif /* !GUI_CANVAS_H */
Modified: developers/werner/fped/obj.c
===================================================================
--- developers/werner/fped/obj.c 2009-07-30 20:24:37 UTC (rev 5342)
+++ developers/werner/fped/obj.c 2009-07-30 21:18:07 UTC (rev 5343)
@@ -29,7 +29,7 @@
static int generate_frame(struct frame *frame, struct coord base,
- const struct frame *parent);
+ const struct frame *parent, int active);
static int is_id(char c, int first)
@@ -133,7 +133,7 @@
}
-static int generate_objs(struct frame *frame, struct coord base)
+static int generate_objs(struct frame *frame, struct coord base, int active)
{
struct obj *obj;
char *name;
@@ -143,7 +143,7 @@
switch (obj->type) {
case ot_frame:
if (!generate_frame(obj->u.frame,
- obj->base ? obj->base->pos : base, frame))
+ obj->base ? obj->base->pos : base, frame, active))
return 0;
break;
case ot_line:
@@ -184,8 +184,8 @@
{
int ok;
- inst_begin_active(active);
- ok = generate_vecs(frame, base) && generate_objs(frame, base);
+ inst_begin_active(active && frame == active_frame);
+ ok = generate_vecs(frame, base) && generate_objs(frame, base, active);
inst_end_active();
return ok;
}
@@ -256,7 +256,7 @@
static int generate_frame(struct frame *frame, struct coord base,
- const struct frame *parent)
+ const struct frame *parent, int active)
{
int ok;
@@ -265,7 +265,7 @@
*/
inst_begin_frame(frame, base, frame == active_frame);
frame->curr_parent = parent;
- ok = iterate_tables(frame, frame->tables, base, frame == active_frame);
+ ok = iterate_tables(frame, frame->tables, base, active);
inst_end_frame(frame);
return ok;
}
@@ -277,7 +277,7 @@
int ok;
inst_start();
- ok = generate_frame(frames, zero, NULL);
+ ok = generate_frame(frames, zero, NULL, 1);
if (ok)
inst_commit();
else
Modified: developers/werner/fped/obj.h
===================================================================
--- developers/werner/fped/obj.h 2009-07-30 20:24:37 UTC (rev 5342)
+++ developers/werner/fped/obj.h 2009-07-30 21:18:07 UTC (rev 5343)
@@ -14,6 +14,8 @@
#ifndef OBJ_H
#define OBJ_H
+#include <gtk/gtk.h>
+
#include "expr.h"
#include "coord.h"
@@ -80,6 +82,9 @@
/* used during generation */
const struct frame *curr_parent;
+
+ /* for the GUI */
+ GtkWidget *label;
};
enum obj_type {
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-07-31 02:07:41 +0200 (Fri, 31 Jul 2009)
New Revision: 5344
Added:
developers/werner/fped/README
Modified:
developers/werner/fped/TODO
developers/werner/fped/error.c
Log:
Added README.
Added: developers/werner/fped/README
===================================================================
--- developers/werner/fped/README (rev 0)
+++ developers/werner/fped/README 2009-07-31 00:07:41 UTC (rev 5344)
@@ -0,0 +1,273 @@
+fped - Footprint editor
+=======================
+
+fped is an editor that allows the interactive creation of footprints of
+electronic components. Footprint definitions are stored in a text format
+that resembles a programming language.
+
+The language is constrained such that anything that can be expressed in
+the textual definition also has a straightforward equivalent operation
+that can be performed through the GUI.
+
+
+Geometry model
+==============
+
+The geometry model consists of frames, vectors, and objects. The shape of
+objects is defined by a number of points. These points are produced by
+concatenating vectors.
+
+E.g., to draw a line from (1mm, 1mm) to (2mm, 2mm), one would make a
+vector from the origin to (1mm, 1mm) and one either from the origin or
+from the previous vector to (2mm, 2mm), and then make a line connecting
+the two points.
+
+
+Units
+-----
+
+fped can calculate in mm and mil. Units are specified by following a
+number with "mm" or "mil", separated by zero or more spaces or tabs.
+
+Examples:
+
+1mm
+2 mil
+
+Units can be mixed in calculations, e.g.,
+
+a = 1mm+20mil
+b = 10*1mm
+
+All values used as dimensions must be either mm or mil.
+
+
+Vectors
+-------
+
+Vectors can be anonymous or they can be named for future reference:
+
+.vec <base> <x-expr>, <y-expr>
+<identifier> = .vec <base> <x-expr>, <y-expr>
+
+The base can be one of the following items:
+
+- @: the origin of the frame containing the vector
+- .: the end of the previous vector in this frame
+- <identifier>: the name of a previous vector in the same frame
+
+The following example would draw the line described in the previous
+section:
+
+a = .vec @ 1mm, 1mm
+b = .vec . 1mm, 1mm
+.line a b
+
+
+Silk screen objects
+-------------------
+
+The output of fped is a footprint definition that contains pads and silk
+screen drawings (we may add more layers in the future). These items are
+called "objects". Their geometry is defined through points obtained with
+vectors.
+
+A line connects two points:
+
+.line <point-a> <point-b>
+
+The points can be specified with @, ., and an identifier, just like
+a vector base.
+
+A rectangle has sides parallel to the x and y axis and is defined
+by two diagonally opposite corners:
+
+.rect <point-a> <point-b>
+
+A circle is defined by its center and a point on the circle:
+
+.arc <center> <point>
+
+This example draws a unit circle:
+
+.vec @ 1mm, 0mm
+.arc @ .
+
+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>
+
+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:
+
+from = .vec @ 1mm, 0mm
+to = .vec @ 0mm, 1mm
+.arc @ from, to
+
+
+Pads
+----
+
+Pads are similar to rectangles, but they also have a name.
+
+.pad "<name>" <point-a> <point-b>
+
+Variables can be expanded in a pad's name by prefixing their name with
+a dollar sign. The ${name} syntax is also available.
+
+Example:
+
+.vec @ 1mm, 1mm
+.pad "1" @ .
+
+
+Frames
+------
+
+Frames are used to group things and to reuse them multiple times. Frames
+must be defined before they can be used:
+
+.frame <name> {
+ ... items ...
+}
+
+Once defined, a frame is placed at a given location with
+
+.frame <name> <point>
+
+The frame definitions must precede all other items in a footprint
+description. Frames cannot be defined inside other frames, but frames
+can invoke each other recursively.
+
+For example, this puts two unity squares, one centered at (0 mm, 0 mm),
+the other at (2 mm, 0 mm):
+
+.frame unit_square {
+ a = .vec @ -0.5mm, -0.5mm
+ b = .vec . 1mm, 1mm
+ .rect a b
+}
+
+.frame unit_square @
+.vec @ 2mm, 0mm
+.frame unit_square .
+
+
+Names and variables
+===================
+
+fped uses several name spaces:
+
+- frame names occupy one global name space
+
+- vector names occupy name spaces delimited by the frame they're
+ contained in. A vector name is only visible inside the frame in which
+ it is defined.
+
+- variable names occupy name spaces delimited by the frame they're
+ contained in. A variable lookup starts in the frame in which the
+ corresponding expression appears and propagates to outer frames
+ until the variable is found.
+
+- pads occupy one global name space (this is currently not enforced)
+
+Note that names cannot be redefined. E.g., this does not work:
+
+a = 1
+a = a+1
+
+The names spaces of frames, vectors, variables, and pads are separate
+from each other.
+
+
+Simple variables
+----------------
+
+A variable with a single value is defined with the usual C-like
+assignment syntax:
+
+<identifier> = <expression>
+
+Example:
+
+a = b+2
+
+
+Loops
+-----
+
+A loop is a variable with a range of values:
+
+<identifier> = <from>, <to>
+
+The variable assumes all the values i for <from> <= i <= <to>, in
+increments of one. E.g.,
+
+n = 1, 3
+
+and
+
+n = 1, 3
+
+both assigns the values 1, 2, and 3 to the variable "n".
+
+When a loop is executed, the objects contained in the body of the
+enclosing frame are generated for each value of the variable. If
+a frame contains multiple loops, all possible combinations of the
+values are generated.
+
+The following example draws three concentric circles around the
+origin, with radii 1, 2, and 3:
+
+x = 1, 3
+.vec @ x*1mm, 0mm
+.arc @ .
+
+
+Tables
+------
+
+Tables combine values for multiple variables. Like loops, they are
+used to iteratively generate objects. A table begins with a row of
+variable names, followed by one or more rows with values. Rows are
+enclosed in curly braces and their elements are separated by commas.
+
+.table
+ { <identifier>, ... }
+ { <expression>, ... }
+ ...
+
+Like loops, tables are iterated to generate objects. The following
+example is equivalent to the one in the previous section:
+
+.table
+ { x }
+ { 1mm }
+ { 2mm }
+ { 3mm }
+.vec @ x, 0mm
+.arc @ .
+
+Note that we can set the unit of the values directly in this case.
+
+Iteration is performed over rows. All variables of the table are set
+to the value in the respective row at the same time. For example, in
+
+.table
+ { x, y }
+ { 1, 2 }
+ { 3, 4 }
+
+(x, y) assume the values (1, 2) and (3, 4).
+
+
+Expressions
+===========
+
+Expressions can contain numeric constants (in non-exponential notation),
+variable names, the arithmetic operations +, -, *, /, and unary -.
+Parentheses can be used to change precedence.
Modified: developers/werner/fped/TODO
===================================================================
--- developers/werner/fped/TODO 2009-07-30 21:18:07 UTC (rev 5343)
+++ developers/werner/fped/TODO 2009-07-31 00:07:41 UTC (rev 5344)
@@ -1,5 +1,4 @@
- make frame selection work
-- add table/var/loop representation
- Q: should loop be (start, last) or (start, iterations) ?
- add row selection
- change vector circle color ? (also, highlight on hover ?)
@@ -19,7 +18,7 @@
- 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 ?
+- Q: allow reassignment of vector names ? (no: would cause confusion in GUI)
- add KiCad output
- add postscript output
- add option to include/omit helper vecs and frames (display and postscript)
@@ -28,3 +27,6 @@
- Q: add frame arguments ? (e.g., .frame pad(pin_num_offset) ...)
- Q: should we make it a requirement to generate objects only once ?
- convert status display to table
+- advanced: non-standard solder mask
+- advanced: solder paste exceptions (subtractive, additive)
+- advanced: silk line width
Modified: developers/werner/fped/error.c
===================================================================
--- developers/werner/fped/error.c 2009-07-30 21:18:07 UTC (rev 5343)
+++ developers/werner/fped/error.c 2009-07-31 00:07:41 UTC (rev 5344)
@@ -31,7 +31,7 @@
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
- fprintf(stderr, "near \"%s\"\n", yytext);
+ fprintf(stderr, " near \"%s\"\n", yytext);
exit(1);
}
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-07-31 04:04:43 +0200 (Fri, 31 Jul 2009)
New Revision: 5346
Modified:
developers/werner/fped/README
developers/werner/fped/fpd.l
developers/werner/fped/fpd.y
developers/werner/fped/qfn.fpd
Log:
- de-quirked vector syntax. instead of ".vec b x, y" it's now simply "b(x, y)"
Modified: developers/werner/fped/README
===================================================================
--- developers/werner/fped/README 2009-07-31 01:33:56 UTC (rev 5345)
+++ developers/werner/fped/README 2009-07-31 02:04:43 UTC (rev 5346)
@@ -47,8 +47,8 @@
Vectors can be anonymous or they can be named for future reference:
-.vec <base> <x-expr>, <y-expr>
-<identifier> = .vec <base> <x-expr>, <y-expr>
+<base> ( <x-expr>, <y-expr> )
+<identifier> = <base> ( <x-expr>, <y-expr> )
The base can be one of the following items:
@@ -59,8 +59,8 @@
The following example would draw the line described in the previous
section:
-a = .vec @ 1mm, 1mm
-b = .vec . 1mm, 1mm
+a = @(1mm, 1mm)
+b = .(1mm, 1mm)
.line a b
@@ -90,7 +90,7 @@
This example draws a unit circle:
-.vec @ 1mm, 0mm
+@(1mm, 0mm)
.circ @ .
An arc is like a circle, but the part of the circle drawn is determined
@@ -103,8 +103,8 @@
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
+from = @(1mm, 0mm)
+to = @(0mm, 1mm)
.arc @ from to
@@ -120,7 +120,7 @@
Example:
-.vec @ 1mm, 1mm
+@(1mm, 1mm)
.pad "1" @ .
@@ -146,13 +146,13 @@
the other at (2 mm, 0 mm):
.frame unit_square {
- a = .vec @ -0.5mm, -0.5mm
- b = .vec . 1mm, 1mm
+ a = @(-0.5mm, -0.5mm)
+ b = .(1mm, 1mm)
.rect a b
}
.frame unit_square @
-.vec @ 2mm, 0mm
+@(2mm, 0mm)
.frame unit_square .
@@ -223,7 +223,7 @@
origin, with radii 1, 2, and 3:
x = 1, 3
-.vec @ x*1mm, 0mm
+@(x*1mm, 0mm)
.circ @ .
@@ -248,7 +248,7 @@
{ 1mm }
{ 2mm }
{ 3mm }
-.vec @ x, 0mm
+@(x, 0mm)
.circ @ .
Note that we can set the unit of the values directly in this case.
Modified: developers/werner/fped/fpd.l
===================================================================
--- developers/werner/fped/fpd.l 2009-07-31 01:33:56 UTC (rev 5345)
+++ developers/werner/fped/fpd.l 2009-07-31 02:04:43 UTC (rev 5346)
@@ -33,7 +33,6 @@
".frame" return TOK_FRAME;
".table" return TOK_TABLE;
-".vec" return TOK_VEC;
".pad" return TOK_PAD;
".rect" return TOK_RECT;
".line" return TOK_LINE;
Modified: developers/werner/fped/fpd.y
===================================================================
--- developers/werner/fped/fpd.y 2009-07-31 01:33:56 UTC (rev 5345)
+++ developers/werner/fped/fpd.y 2009-07-31 02:04:43 UTC (rev 5346)
@@ -122,7 +122,7 @@
};
-%token TOK_FRAME TOK_TABLE TOK_VEC
+%token TOK_FRAME TOK_TABLE
%token TOK_PAD TOK_RECT TOK_LINE TOK_CIRC TOK_ARC
%token <num> NUMBER
@@ -133,7 +133,7 @@
%type <var> vars var
%type <row> rows
%type <value> row value
-%type <vec> vec base opt_base
+%type <vec> vec base
%type <obj> obj
%type <expr> opt_range
%type <expr> expr add_expr mult_expr unary_expr primary_expr
@@ -310,13 +310,13 @@
;
vec:
- TOK_VEC base expr ',' expr
+ base '(' expr ',' expr ')'
{
$$ = alloc_type(struct vec);
$$->name = NULL;
- $$->base = $2;
- if ($2)
- $2->n_refs++;
+ $$->base = $1;
+ if ($1)
+ $1->n_refs++;
$$->x = $3;
$$->y = $5;
$$->n_refs = 0;
@@ -390,16 +390,6 @@
}
;
-opt_base:
- {
- $$ = NULL;
- }
- | ',' base
- {
- $$ = $2;
- }
- ;
-
expr:
add_expr
{
Modified: developers/werner/fped/qfn.fpd
===================================================================
--- developers/werner/fped/qfn.fpd 2009-07-31 01:33:56 UTC (rev 5345)
+++ developers/werner/fped/qfn.fpd 2009-07-31 02:04:43 UTC (rev 5346)
@@ -8,8 +8,8 @@
*/
.frame pad_up {
- c = .vec @ -D/2, 0mm
- .vec . D, C
+ c = @(-D/2, 0mm)
+ .(D, C)
pad = n+1
.pad "$pad" c .
}
@@ -17,7 +17,7 @@
.frame pads {
n = 0, N/4-1
- .vec @ P*(n-(N/4-1)/2), -Ay/2
+ @(P*(n-(N/4-1)/2), -Ay/2)
.frame pad_up .
}
@@ -36,24 +36,24 @@
{ 0.5mm, 5mm, 5mm, 3.2mm, 3.2mm, 0.9mm, 0.24mm, 2.1mm, 2.1mm, 1.2mm,
1.2mm, 0.45mm, 0.45mm, 4.3mm, 4.3mm, 5.25mm, 5.25mm }
-h_x0y0 = .vec @ -Hx/2, -Hy/2
-h_x1y1 = .vec . Hx, Hy
+h_x0y0 = @(-Hx/2, -Hy/2)
+h_x1y1 = .(Hx, Hy)
.rect h_x0y0 h_x1y1
-g_x0y0 = .vec @ -Gx/2, -Gy/2
-g_x1y1 = .vec . Gx, Gy
+g_x0y0 = @(-Gx/2, -Gy/2)
+g_x1y1 = .(Gx, Gy)
.rect g_x0y0 g_x1y1
.frame pads @
// ARC, just for testing
-c = .vec @ -1mm, 1mm
-r = .vec c 0mm, 0.5mm
-e = .vec c -0.5mm, 0mm
+c = @(-1mm, 1mm)
+r = c(0mm, 0.5mm)
+e = c(-0.5mm, 0mm)
.arc c r e
-r2 = .vec c 0mm, 0.8mm
+r2 = c(0mm, 0.8mm)
.circ c r2
/*
--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog