1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-05 06:41:51 +02:00

- postscript.c: always run flattenpath before pathbbox

- postscript.c: fixed algorithm in "center"
- dump.c: reorder frames if we would end up with forward-references
- sc89.fpd, fbga.fpd: changed "part" to new "package"



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5490 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2009-08-19 22:13:47 +00:00
parent 4db1ade3bd
commit 2737f8a3fa
6 changed files with 59 additions and 17 deletions

23
dump.c
View File

@ -436,8 +436,7 @@ char *print_vec(const struct vec *vec)
/* ----- frames ------------------------------------------------------------ */
static void dump_frame(FILE *file, const struct frame *frame,
const char *indent)
static void dump_frame(FILE *file, struct frame *frame, const char *indent)
{
const struct table *table;
const struct loop *loop;
@ -446,6 +445,17 @@ static void dump_frame(FILE *file, const struct frame *frame,
const struct order *item;
char *s, *s1;
if (frame->dumped)
return;
frame->dumped = 1;
for (obj = frame->objs; obj; obj = obj->next)
if (obj->type == ot_frame)
dump_frame(file, obj->u.frame.ref, "\t");
if (frame->name)
fprintf(file, "frame %s {\n", frame->name);
for (table = frame->tables; table; table = table->next)
dump_table(file, table, indent);
for (loop = frame->loops; loop; loop = loop->next)
@ -472,6 +482,9 @@ static void dump_frame(FILE *file, const struct frame *frame,
fprintf(file, "%s%s\n", indent, s);
free(s);
}
if (frame->name)
fprintf(file, "}\n\n");
}
@ -480,17 +493,17 @@ static void dump_frame(FILE *file, const struct frame *frame,
int dump(FILE *file)
{
const struct frame *frame;
struct frame *frame;
fprintf(file, "/* MACHINE-GENERATED ! */\n\n");
for (frame = frames; frame; frame = frame->next)
frame->dumped = 0;
for (frame = frames; frame; frame = frame->next) {
if (!frame->name) {
fprintf(file, "package \"%s\"\n", pkg_name);
dump_frame(file, frame, "");
} else {
fprintf(file, "frame %s {\n", frame->name);
dump_frame(file, frame, "\t");
fprintf(file, "}\n\n");
}
}
fflush(file);

View File

@ -35,7 +35,7 @@ frame first {
frame pad @
}
part "Fake_BGA"
package "Fake_BGA"
table
{ row, rname, inner }
{ 0, "A", 1 }

1
inst.h
View File

@ -72,7 +72,6 @@ struct inst_ops {
struct inst {
const struct inst_ops *ops;
struct coord base;
// struct inst *base_inst; /* frame or vector leading to this item */
struct bbox bbox;
struct vec *vec; /* NULL if not vector */
struct obj *obj; /* NULL if not object */

3
obj.h
View File

@ -122,6 +122,9 @@ struct frame {
/* generating and editing */
struct obj *active_ref;
/* for dumping */
int dumped;
/* for the GUI */
GtkWidget *label;
};

View File

@ -31,6 +31,8 @@
#define PS_MEAS_ARROW_ANGLE 30
#define PS_MEAS_TEXT_HEIGHT mm_to_units(0.2)
#define PS_MEAS_BASE_OFFSET mm_to_units(0.05)
#define PS_CROSS_WIDTH mm_to_units(0.01)
#define PS_CROSS_DASH mm_to_units(0.1)
struct postscript_params postscript_params = {
@ -274,6 +276,18 @@ static void ps_foreground(FILE *file, enum inst_prio prio,
}
static void ps_cross(FILE *file, const struct inst *inst)
{
fprintf(file, "gsave 0 setgray %d setlinewidth\n", PS_CROSS_WIDTH);
fprintf(file, " [%d] 0 setdash\n", PS_CROSS_DASH);
fprintf(file, " %d 0 moveto %d 0 lineto\n",
inst->bbox.min.x, inst->bbox.max.x);
fprintf(file, " 0 %d moveto 0 %d lineto\n",
inst->bbox.min.y, inst->bbox.max.y);
fprintf(file, " stroke grestore \n");
}
int postscript(FILE *file)
{
enum inst_prio prio;
@ -292,7 +306,7 @@ int postscript(FILE *file)
fprintf(file,
"/dotpath {\n"
" gsave pathbbox clip newpath\n"
" gsave flattenpath pathbbox clip newpath\n"
" 1 setlinecap %d setlinewidth\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" llx %d urx {\n"
@ -304,7 +318,7 @@ int postscript(FILE *file)
fprintf(file,
"/hatchpath {\n"
" gsave pathbbox clip newpath\n"
" gsave flattenpath pathbbox clip newpath\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" lly ury sub %d urx llx sub {\n" /* for -(ury-lly) to urx-llx */
" llx add dup lly moveto\n"
@ -314,7 +328,7 @@ int postscript(FILE *file)
fprintf(file,
"/backhatchpath {\n"
" gsave pathbbox clip newpath\n"
" gsave flattenpath pathbbox clip newpath\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" 0 %d ury lly sub urx llx sub add {\n" /* for 0 to urx-llx_ury-lly */
" llx add dup lly moveto\n"
@ -335,7 +349,7 @@ fprintf(file,
" gsave 0 0 moveto\n"
" /f exch def /h exch def /w exch def\n"
" exch f scalefont setfont\n"
" false charpath pathbbox\n"
" false charpath flattenpath pathbbox\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" w urx llx sub div h ury lly sub div 2 copy gt { exch } if pop\n"
" f mul grestore } def\n");
@ -346,10 +360,12 @@ fprintf(file,
fprintf(file,
"/center {\n"
" gsave dup false charpath pathbbox\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" currentpoint /y exch def /x exch def\n"
" gsave dup false charpath flattenpath pathbbox\n"
" /ury exch def /urx exch def\n"
" /lly exch def /llx exch def\n"
" grestore\n"
" llx urx sub 2 div lly ury sub 2 div rmoveto } def\n");
" x llx urx add 2 div sub y lly ury add 2 div sub rmoveto } def\n");
/*
* Stack: string dist -> string
@ -358,7 +374,7 @@ fprintf(file,
fprintf(file,
"/hcenter {\n"
" /off exch def\n"
" gsave dup false charpath pathbbox\n"
" gsave dup false charpath flattenpath pathbbox\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" grestore\n"
" llx urx sub 2 div\n"
@ -371,9 +387,20 @@ fprintf(file,
fprintf(file,
"/showoutlined {\n"
" gsave 2 mul setlinewidth 1 setgray\n"
" dup false charpath stroke grestore\n"
" dup false charpath flattenpath stroke grestore\n"
" show } def\n");
/*
* Stack: string -> string
*/
fprintf(file,
"/debugbox { gsave dup false charpath flattenpath pathbbox\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" 0 setgray 100 setlinewidth\n"
" llx lly urx llx sub ury lly sub rectstroke grestore } def\n");
ps_cross(file, pkgs->insts[ip_frame]);
FOR_INST_PRIOS_UP(prio)
FOR_ALL_INSTS(i, prio, inst)
ps_background(file, prio, inst);

View File

@ -50,7 +50,7 @@ frame outline {
line top_left . 5mil
}
part "SC89"
package "SC89"
table
{ Px, Py, Gy, Wx }
{ 0.5mm, 0.6mm, 0.7mm, 1.5mm }