1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-09-28 22:14:10 +03:00

The partial order algorithm in dump.c sometimes dumped objects before a vector

they referenced. As a band-aid, we now explicitly keep track of which vectors 
have been dumped, and defer objects accordingly. A more correct solution would
be to properly abstract the partial order algorithms (along with the heuristics
for maximizing the number of ".") and to implement it properly.

- fpd.y (debug_item): new rule for %dump and %exit, which can appear also among
  measurements
- fpd.y (frame_items, measurements):  rearranged grammar to allow debug_item
  also in measurements. To avoid ambiguities, the "measurements" section can no
  longer be empty, but it can be omitted as a whole.
- obj.h, dump.c (later, recurse_vec, order_frame): vectors now also have a
  "dumped" flag which is used in "later" to defer dumping an object until all
  the vectors it depends on have been dumped.



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5928 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2010-04-20 21:01:16 +00:00
parent b7db446cbb
commit 59335b63b0
3 changed files with 22 additions and 3 deletions

8
dump.c
View File

@ -75,6 +75,8 @@ static int need(const struct vec *base, const struct vec *prev)
static int later(const struct vec *base, const struct vec *prev) static int later(const struct vec *base, const struct vec *prev)
{ {
return base && !base->dumped;
#if 0
while (1) { while (1) {
prev = prev->next; prev = prev->next;
if (!prev) if (!prev)
@ -83,6 +85,7 @@ static int later(const struct vec *base, const struct vec *prev)
return 1; return 1;
} }
return 0; return 0;
#endif
} }
@ -134,7 +137,7 @@ static void put_obj(struct order **curr, struct obj *obj,
} }
/* /*
* Tricky logic ahead: when dumping a vector, we search for a vectors that * Tricky logic ahead: when dumping a vector, we search for a vector that
* depends on that vector for ".". If we find one, we dump it immediately after * depends on that vector for ".". If we find one, we dump it immediately after
* this vector. * this vector.
*/ */
@ -144,6 +147,7 @@ static void recurse_vec(struct order **curr, struct vec *vec)
struct vec *next; struct vec *next;
struct obj *obj; struct obj *obj;
vec->dumped = 1;
add_item(curr, vec, NULL); add_item(curr, vec, NULL);
for (obj = vec->frame->objs; obj; obj = obj->next) for (obj = vec->frame->objs; obj; obj = obj->next)
if (may_put_obj_now(obj, vec)) if (may_put_obj_now(obj, vec))
@ -178,6 +182,8 @@ struct order *order_frame(const struct frame *frame)
if (obj->type != ot_meas) if (obj->type != ot_meas)
n++; n++;
for (vec = frame->vecs; vec; vec = vec->next)
vec->dumped = 0;
for (obj = frame->objs; obj; obj = obj->next) for (obj = frame->objs; obj; obj = obj->next)
obj->dumped = 0; obj->dumped = 0;

14
fpd.y
View File

@ -404,7 +404,7 @@ frame_def:
; ;
frame_items: frame_items:
measurements | measurements
| frame_item frame_items | frame_item frame_items
; ;
@ -459,7 +459,11 @@ frame_item:
if (!dbg_print($2)) if (!dbg_print($2))
YYABORT; YYABORT;
} }
| TOK_DBG_DUMP | debug_item
;
debug_item:
TOK_DBG_DUMP
{ {
/* /*
* It's okay to do append the root frame multiple * It's okay to do append the root frame multiple
@ -718,11 +722,17 @@ pad_type:
; ;
measurements: measurements:
meas
{
*next_obj = $1;
next_obj = &$1->next;
}
| measurements meas | measurements meas
{ {
*next_obj = $2; *next_obj = $2;
next_obj = &$2->next; next_obj = &$2->next;
} }
| measurements debug_item
; ;
meas: meas:

3
obj.h
View File

@ -142,6 +142,9 @@ struct vec {
/* for re-ordering after a move */ /* for re-ordering after a move */
int mark; int mark;
/* for dumping */
int dumped;
/* for the GUI */ /* for the GUI */
GtkWidget *list_widget; /* NULL if items aren't shown */ GtkWidget *list_widget; /* NULL if items aren't shown */
}; };