r5346 - developers/werner/fped

werner at docs.openmoko.org werner at docs.openmoko.org
Fri Jul 31 04:04:43 CEST 2009

```Author: werner
Date: 2009-07-31 04:04:43 +0200 (Fri, 31 Jul 2009)
New Revision: 5346

Modified:
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)"

===================================================================
--- 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 @@

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:
{

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 @@
*/

-	c = .vec @ -D/2, 0mm
-	.vec . D, C
+	c = @(-D/2, 0mm)
+	.(D, C)
}
@@ -17,7 +17,7 @@
n = 0, N/4-1

-	.vec @ P*(n-(N/4-1)/2), -Ay/2
+	@(P*(n-(N/4-1)/2), -Ay/2)

}
@@ -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

// 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

/*

```