mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-25 19:02:29 +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:
parent
4db1ade3bd
commit
2737f8a3fa
23
dump.c
23
dump.c
@ -436,8 +436,7 @@ char *print_vec(const struct vec *vec)
|
|||||||
/* ----- frames ------------------------------------------------------------ */
|
/* ----- frames ------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
static void dump_frame(FILE *file, const struct frame *frame,
|
static void dump_frame(FILE *file, struct frame *frame, const char *indent)
|
||||||
const char *indent)
|
|
||||||
{
|
{
|
||||||
const struct table *table;
|
const struct table *table;
|
||||||
const struct loop *loop;
|
const struct loop *loop;
|
||||||
@ -446,6 +445,17 @@ static void dump_frame(FILE *file, const struct frame *frame,
|
|||||||
const struct order *item;
|
const struct order *item;
|
||||||
char *s, *s1;
|
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)
|
for (table = frame->tables; table; table = table->next)
|
||||||
dump_table(file, table, indent);
|
dump_table(file, table, indent);
|
||||||
for (loop = frame->loops; loop; loop = loop->next)
|
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);
|
fprintf(file, "%s%s\n", indent, s);
|
||||||
free(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)
|
int dump(FILE *file)
|
||||||
{
|
{
|
||||||
const struct frame *frame;
|
struct frame *frame;
|
||||||
|
|
||||||
fprintf(file, "/* MACHINE-GENERATED ! */\n\n");
|
fprintf(file, "/* MACHINE-GENERATED ! */\n\n");
|
||||||
|
for (frame = frames; frame; frame = frame->next)
|
||||||
|
frame->dumped = 0;
|
||||||
for (frame = frames; frame; frame = frame->next) {
|
for (frame = frames; frame; frame = frame->next) {
|
||||||
if (!frame->name) {
|
if (!frame->name) {
|
||||||
fprintf(file, "package \"%s\"\n", pkg_name);
|
fprintf(file, "package \"%s\"\n", pkg_name);
|
||||||
dump_frame(file, frame, "");
|
dump_frame(file, frame, "");
|
||||||
} else {
|
} else {
|
||||||
fprintf(file, "frame %s {\n", frame->name);
|
|
||||||
dump_frame(file, frame, "\t");
|
dump_frame(file, frame, "\t");
|
||||||
fprintf(file, "}\n\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fflush(file);
|
fflush(file);
|
||||||
|
2
fbga.fpd
2
fbga.fpd
@ -35,7 +35,7 @@ frame first {
|
|||||||
frame pad @
|
frame pad @
|
||||||
}
|
}
|
||||||
|
|
||||||
part "Fake_BGA"
|
package "Fake_BGA"
|
||||||
table
|
table
|
||||||
{ row, rname, inner }
|
{ row, rname, inner }
|
||||||
{ 0, "A", 1 }
|
{ 0, "A", 1 }
|
||||||
|
1
inst.h
1
inst.h
@ -72,7 +72,6 @@ struct inst_ops {
|
|||||||
struct inst {
|
struct inst {
|
||||||
const struct inst_ops *ops;
|
const struct inst_ops *ops;
|
||||||
struct coord base;
|
struct coord base;
|
||||||
// struct inst *base_inst; /* frame or vector leading to this item */
|
|
||||||
struct bbox bbox;
|
struct bbox bbox;
|
||||||
struct vec *vec; /* NULL if not vector */
|
struct vec *vec; /* NULL if not vector */
|
||||||
struct obj *obj; /* NULL if not object */
|
struct obj *obj; /* NULL if not object */
|
||||||
|
3
obj.h
3
obj.h
@ -122,6 +122,9 @@ struct frame {
|
|||||||
/* generating and editing */
|
/* generating and editing */
|
||||||
struct obj *active_ref;
|
struct obj *active_ref;
|
||||||
|
|
||||||
|
/* for dumping */
|
||||||
|
int dumped;
|
||||||
|
|
||||||
/* for the GUI */
|
/* for the GUI */
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
};
|
};
|
||||||
|
45
postscript.c
45
postscript.c
@ -31,6 +31,8 @@
|
|||||||
#define PS_MEAS_ARROW_ANGLE 30
|
#define PS_MEAS_ARROW_ANGLE 30
|
||||||
#define PS_MEAS_TEXT_HEIGHT mm_to_units(0.2)
|
#define PS_MEAS_TEXT_HEIGHT mm_to_units(0.2)
|
||||||
#define PS_MEAS_BASE_OFFSET mm_to_units(0.05)
|
#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 = {
|
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)
|
int postscript(FILE *file)
|
||||||
{
|
{
|
||||||
enum inst_prio prio;
|
enum inst_prio prio;
|
||||||
@ -292,7 +306,7 @@ int postscript(FILE *file)
|
|||||||
|
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
"/dotpath {\n"
|
"/dotpath {\n"
|
||||||
" gsave pathbbox clip newpath\n"
|
" gsave flattenpath pathbbox clip newpath\n"
|
||||||
" 1 setlinecap %d setlinewidth\n"
|
" 1 setlinecap %d setlinewidth\n"
|
||||||
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
|
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
|
||||||
" llx %d urx {\n"
|
" llx %d urx {\n"
|
||||||
@ -304,7 +318,7 @@ int postscript(FILE *file)
|
|||||||
|
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
"/hatchpath {\n"
|
"/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"
|
" /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 */
|
" lly ury sub %d urx llx sub {\n" /* for -(ury-lly) to urx-llx */
|
||||||
" llx add dup lly moveto\n"
|
" llx add dup lly moveto\n"
|
||||||
@ -314,7 +328,7 @@ int postscript(FILE *file)
|
|||||||
|
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
"/backhatchpath {\n"
|
"/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"
|
" /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 */
|
" 0 %d ury lly sub urx llx sub add {\n" /* for 0 to urx-llx_ury-lly */
|
||||||
" llx add dup lly moveto\n"
|
" llx add dup lly moveto\n"
|
||||||
@ -335,7 +349,7 @@ fprintf(file,
|
|||||||
" gsave 0 0 moveto\n"
|
" gsave 0 0 moveto\n"
|
||||||
" /f exch def /h exch def /w exch def\n"
|
" /f exch def /h exch def /w exch def\n"
|
||||||
" exch f scalefont setfont\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"
|
" /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"
|
" w urx llx sub div h ury lly sub div 2 copy gt { exch } if pop\n"
|
||||||
" f mul grestore } def\n");
|
" f mul grestore } def\n");
|
||||||
@ -346,10 +360,12 @@ fprintf(file,
|
|||||||
|
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
"/center {\n"
|
"/center {\n"
|
||||||
" gsave dup false charpath pathbbox\n"
|
" currentpoint /y exch def /x exch def\n"
|
||||||
" /ury exch def /urx exch def /lly exch def /llx 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"
|
" 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
|
* Stack: string dist -> string
|
||||||
@ -358,7 +374,7 @@ fprintf(file,
|
|||||||
fprintf(file,
|
fprintf(file,
|
||||||
"/hcenter {\n"
|
"/hcenter {\n"
|
||||||
" /off exch def\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"
|
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
|
||||||
" grestore\n"
|
" grestore\n"
|
||||||
" llx urx sub 2 div\n"
|
" llx urx sub 2 div\n"
|
||||||
@ -371,9 +387,20 @@ fprintf(file,
|
|||||||
fprintf(file,
|
fprintf(file,
|
||||||
"/showoutlined {\n"
|
"/showoutlined {\n"
|
||||||
" gsave 2 mul setlinewidth 1 setgray\n"
|
" gsave 2 mul setlinewidth 1 setgray\n"
|
||||||
" dup false charpath stroke grestore\n"
|
" dup false charpath flattenpath stroke grestore\n"
|
||||||
" show } def\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_INST_PRIOS_UP(prio)
|
||||||
FOR_ALL_INSTS(i, prio, inst)
|
FOR_ALL_INSTS(i, prio, inst)
|
||||||
ps_background(file, prio, inst);
|
ps_background(file, prio, inst);
|
||||||
|
Loading…
Reference in New Issue
Block a user