2009-08-05 13:35:48 +03:00
|
|
|
/*
|
|
|
|
* dump.c - Dump objects in the native FPD format
|
|
|
|
*
|
2015-01-08 00:56:25 +02:00
|
|
|
* Written 2009-2012, 2014-2015 by Werner Almesberger
|
|
|
|
* Copyright 2009-2012, 2014-2015 by Werner Almesberger
|
2009-08-05 13:35:48 +03:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
#include <string.h>
|
2011-03-23 09:14:13 +02:00
|
|
|
#include <assert.h>
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
#include <sys/types.h>
|
2009-08-05 13:35:48 +03:00
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
#include "unparse.h"
|
|
|
|
#include "obj.h"
|
2009-08-22 18:58:58 +03:00
|
|
|
#include "gui_status.h"
|
2009-08-05 13:35:48 +03:00
|
|
|
#include "dump.h"
|
|
|
|
|
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
/* ----- order items ------------------------------------------------------- */
|
2009-08-06 07:56:47 +03:00
|
|
|
|
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
static void add_item(struct order **curr, struct vec *vec, struct obj *obj)
|
2009-08-05 13:35:48 +03:00
|
|
|
{
|
2009-08-12 13:45:52 +03:00
|
|
|
(*curr)->vec = vec;
|
|
|
|
(*curr)->obj = obj;
|
|
|
|
(*curr)++;
|
2009-08-05 13:35:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int n_vec_refs(const struct vec *vec)
|
|
|
|
{
|
|
|
|
const struct vec *walk;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
for (walk = vec->frame->vecs; walk; walk = walk->next)
|
|
|
|
if (walk->base == vec)
|
|
|
|
n++;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-08-12 20:01:40 +03:00
|
|
|
* If "prev" is non-NULL, we're looking for objects that need to be put after
|
|
|
|
* the current vector (in "prev"). Only those objects need to be put there
|
|
|
|
* that have at least one base that isn't the frame's origin.
|
2009-08-05 13:35:48 +03:00
|
|
|
*
|
2009-08-12 20:01:40 +03:00
|
|
|
* We could also make an exception for manually named vectors, but we get
|
|
|
|
* better clustering without.
|
2009-08-05 13:35:48 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
static int need(const struct vec *base, const struct vec *prev)
|
|
|
|
{
|
|
|
|
if (!base)
|
|
|
|
return 0;
|
2009-08-12 20:01:40 +03:00
|
|
|
#if 0
|
|
|
|
if (base->name && *base->name != '_')
|
2009-08-05 13:35:48 +03:00
|
|
|
return 0;
|
2009-08-12 20:01:40 +03:00
|
|
|
#endif
|
2009-08-05 13:35:48 +03:00
|
|
|
if (prev)
|
|
|
|
return base == prev;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-06 07:56:47 +03:00
|
|
|
/*
|
|
|
|
* If we need a vector that's defined later, we have to defer dumping the
|
|
|
|
* object.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int later(const struct vec *base, const struct vec *prev)
|
2009-08-05 13:35:48 +03:00
|
|
|
{
|
2010-04-21 00:01:16 +03:00
|
|
|
return base && !base->dumped;
|
|
|
|
#if 0
|
2009-08-12 20:01:40 +03:00
|
|
|
while (1) {
|
|
|
|
prev = prev->next;
|
|
|
|
if (!prev)
|
|
|
|
break;
|
2009-08-06 07:56:47 +03:00
|
|
|
if (base == prev)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
2010-04-21 00:01:16 +03:00
|
|
|
#endif
|
2009-08-06 07:56:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
static int may_put_obj_now(const struct obj *obj, const struct vec *prev)
|
2009-08-06 07:56:47 +03:00
|
|
|
{
|
|
|
|
int n, l;
|
2009-08-05 13:35:48 +03:00
|
|
|
|
|
|
|
n = need(obj->base, prev);
|
2009-08-06 07:56:47 +03:00
|
|
|
l = later(obj->base, prev);
|
2009-08-05 13:35:48 +03:00
|
|
|
|
|
|
|
switch (obj->type) {
|
|
|
|
case ot_frame:
|
|
|
|
break;
|
|
|
|
case ot_line:
|
|
|
|
n |= need(obj->u.line.other, prev);
|
2009-08-06 07:56:47 +03:00
|
|
|
l |= later(obj->u.line.other, prev);
|
2009-08-05 13:35:48 +03:00
|
|
|
break;
|
|
|
|
case ot_rect:
|
|
|
|
n |= need(obj->u.rect.other, prev);
|
2009-08-06 07:56:47 +03:00
|
|
|
l |= later(obj->u.rect.other, prev);
|
2009-08-05 13:35:48 +03:00
|
|
|
break;
|
|
|
|
case ot_pad:
|
|
|
|
n |= need(obj->u.pad.other, prev);
|
2009-08-06 07:56:47 +03:00
|
|
|
l |= later(obj->u.pad.other, prev);
|
2009-08-05 13:35:48 +03:00
|
|
|
break;
|
2010-04-25 13:58:07 +03:00
|
|
|
case ot_hole:
|
|
|
|
n |= need(obj->u.hole.other, prev);
|
|
|
|
l |= later(obj->u.hole.other, prev);
|
|
|
|
break;
|
2009-08-05 13:35:48 +03:00
|
|
|
case ot_arc:
|
|
|
|
n |= need(obj->u.arc.start, prev);
|
|
|
|
n |= need(obj->u.arc.end, prev);
|
2009-08-06 07:56:47 +03:00
|
|
|
l |= later(obj->u.arc.start, prev);
|
|
|
|
l |= later(obj->u.arc.end, prev);
|
2009-08-05 13:35:48 +03:00
|
|
|
break;
|
|
|
|
case ot_meas:
|
2009-08-09 03:06:54 +03:00
|
|
|
return 0;
|
2009-08-05 13:35:48 +03:00
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
2009-08-06 07:56:47 +03:00
|
|
|
return n && !l;
|
|
|
|
}
|
2009-08-05 13:35:48 +03:00
|
|
|
|
2009-08-06 07:56:47 +03:00
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
static void put_obj(struct order **curr, struct obj *obj,
|
|
|
|
struct vec *prev)
|
|
|
|
{
|
|
|
|
if (obj->dumped)
|
|
|
|
return;
|
|
|
|
obj->dumped = 1;
|
|
|
|
add_item(curr, prev, obj);
|
|
|
|
}
|
2009-08-09 03:06:54 +03:00
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
/*
|
2010-04-21 00:01:16 +03:00
|
|
|
* Tricky logic ahead: when dumping a vector, we search for a vector that
|
2009-08-12 13:45:52 +03:00
|
|
|
* depends on that vector for ".". If we find one, we dump it immediately after
|
|
|
|
* this vector.
|
|
|
|
*/
|
2009-08-09 03:06:54 +03:00
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
static void recurse_vec(struct order **curr, struct vec *vec)
|
|
|
|
{
|
|
|
|
struct vec *next;
|
|
|
|
struct obj *obj;
|
2009-08-09 03:06:54 +03:00
|
|
|
|
2010-04-21 00:01:16 +03:00
|
|
|
vec->dumped = 1;
|
2009-08-12 13:45:52 +03:00
|
|
|
add_item(curr, vec, NULL);
|
|
|
|
for (obj = vec->frame->objs; obj; obj = obj->next)
|
|
|
|
if (may_put_obj_now(obj, vec))
|
|
|
|
put_obj(curr, obj, vec);
|
|
|
|
if (n_vec_refs(vec) == 1) {
|
|
|
|
for (next = vec->next; next->base != vec; next = next->next);
|
|
|
|
recurse_vec(curr, next);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void order_vecs(struct order **curr, struct vec *vecs)
|
2009-08-09 03:06:54 +03:00
|
|
|
{
|
2009-08-12 13:45:52 +03:00
|
|
|
struct vec *vec;
|
|
|
|
|
2015-01-08 00:56:25 +02:00
|
|
|
for (vec = vecs; vec; vec = vec->next) {
|
|
|
|
const char *name = (const char *) vec->base;
|
|
|
|
|
|
|
|
if (!vec->base || *name || n_vec_refs(vec->base) != 1)
|
2009-08-12 13:45:52 +03:00
|
|
|
recurse_vec(curr, vec);
|
2015-01-08 00:56:25 +02:00
|
|
|
}
|
2009-08-09 03:06:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
struct order *order_frame(const struct frame *frame)
|
2009-08-06 07:56:47 +03:00
|
|
|
{
|
2009-08-12 13:45:52 +03:00
|
|
|
struct order *order, *curr;
|
|
|
|
struct vec *vec;
|
|
|
|
struct obj *obj;
|
|
|
|
int n = 0;
|
2009-08-06 07:56:47 +03:00
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
for (vec = frame->vecs; vec; vec = vec->next)
|
|
|
|
n++;
|
|
|
|
for (obj = frame->objs; obj; obj = obj->next)
|
|
|
|
if (obj->type != ot_meas)
|
|
|
|
n++;
|
|
|
|
|
2010-04-21 00:01:16 +03:00
|
|
|
for (vec = frame->vecs; vec; vec = vec->next)
|
|
|
|
vec->dumped = 0;
|
2009-08-12 13:45:52 +03:00
|
|
|
for (obj = frame->objs; obj; obj = obj->next)
|
|
|
|
obj->dumped = 0;
|
|
|
|
|
|
|
|
order = alloc_size(sizeof(*order)*(n+1));
|
|
|
|
curr = order;
|
|
|
|
|
|
|
|
order_vecs(&curr, frame->vecs);
|
|
|
|
|
|
|
|
/* frames based on @ (anything else ?) */
|
|
|
|
for (obj = frame->objs; obj; obj = obj->next)
|
|
|
|
if (obj->type != ot_meas)
|
|
|
|
put_obj(&curr, obj, NULL);
|
|
|
|
|
|
|
|
assert(curr == order+n);
|
|
|
|
add_item(&curr, NULL, NULL);
|
|
|
|
|
|
|
|
return order;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ----- variables --------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
static void dump_var(FILE *file, const struct table *table,
|
|
|
|
const char *indent)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
s = unparse(table->rows->values->expr);
|
2012-05-27 22:10:59 +03:00
|
|
|
fprintf(file, "%sset %s%s = %s\n\n", indent,
|
|
|
|
table->vars->key ? "?" : "", table->vars->name, s);
|
2009-08-12 13:45:52 +03:00
|
|
|
free(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void dump_table(FILE *file, const struct table *table,
|
|
|
|
const char *indent)
|
|
|
|
{
|
|
|
|
const struct var *var;
|
|
|
|
const struct row *row;
|
|
|
|
const struct value *value;
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
if (table->vars && !table->vars->next &&
|
|
|
|
table->rows && !table->rows->next) {
|
|
|
|
dump_var(file, table, indent);
|
2009-08-06 07:56:47 +03:00
|
|
|
return;
|
2009-08-12 13:45:52 +03:00
|
|
|
}
|
|
|
|
fprintf(file, "%stable\n%s {", indent, indent);
|
|
|
|
for (var = table->vars; var; var = var->next)
|
2012-05-27 22:10:59 +03:00
|
|
|
fprintf(file, "%s %s%s", var == table->vars ? "" : ",",
|
|
|
|
var->key ? "?" : "", var->name);
|
2009-08-12 13:45:52 +03:00
|
|
|
fprintf(file, " }\n");
|
|
|
|
for (row = table->rows; row; row = row->next) {
|
|
|
|
fprintf(file, "%s {", indent);
|
|
|
|
for (value = row->values; value; value = value->next) {
|
|
|
|
s = unparse(value->expr);
|
|
|
|
fprintf(file, "%s %s",
|
|
|
|
value == row->values? "" : ",", s);
|
|
|
|
free(s);
|
|
|
|
}
|
|
|
|
fprintf(file, " }\n");
|
|
|
|
}
|
|
|
|
fprintf(file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void dump_loop(FILE *file, const struct loop *loop, const char *indent)
|
|
|
|
{
|
|
|
|
char *from, *to;
|
|
|
|
|
|
|
|
from = unparse(loop->from.expr);
|
|
|
|
to = unparse(loop->to.expr);
|
|
|
|
fprintf(file, "%sloop %s = %s, %s\n\n",
|
|
|
|
indent, loop->var.name, from, to);
|
|
|
|
free(from);
|
|
|
|
free(to);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ----- vectors and objects ----------------------------------------------- */
|
|
|
|
|
|
|
|
|
2009-11-27 21:55:25 +02:00
|
|
|
static void generate_name(struct vec *base)
|
2009-08-12 13:45:52 +03:00
|
|
|
{
|
2009-11-27 21:55:25 +02:00
|
|
|
char tmp[10]; /* plenty */
|
|
|
|
const char *s;
|
|
|
|
struct vec *walk;
|
|
|
|
int n = 0;
|
2009-08-12 13:45:52 +03:00
|
|
|
|
2009-11-27 21:55:25 +02:00
|
|
|
while (1) {
|
|
|
|
sprintf(tmp, "__%d", n);
|
|
|
|
s = unique(tmp);
|
|
|
|
for (walk = base->frame->vecs; walk; walk = walk->next)
|
|
|
|
if (walk->name == s)
|
|
|
|
break;
|
|
|
|
if (!walk)
|
|
|
|
break;
|
2009-08-12 13:45:52 +03:00
|
|
|
n++;
|
2009-11-27 21:55:25 +02:00
|
|
|
}
|
|
|
|
base->name = s;
|
2009-08-12 13:45:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-27 21:55:25 +02:00
|
|
|
static const char *base_name(struct vec *base, const struct vec *next)
|
2009-08-12 13:45:52 +03:00
|
|
|
{
|
2011-10-25 22:46:26 +03:00
|
|
|
const char *name = (const char *) base;
|
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
if (!base)
|
2009-11-27 21:55:25 +02:00
|
|
|
return "@";
|
2011-10-25 22:46:26 +03:00
|
|
|
if (*name)
|
|
|
|
return name;
|
2009-08-12 13:45:52 +03:00
|
|
|
if (next && base->next == next)
|
2009-11-27 21:55:25 +02:00
|
|
|
return ".";
|
|
|
|
if (!base->name)
|
|
|
|
generate_name(base);
|
|
|
|
return base->name;
|
2009-08-12 13:45:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-27 21:55:25 +02:00
|
|
|
static const char *obj_base_name(struct vec *base, const struct vec *prev)
|
2009-08-12 13:45:52 +03:00
|
|
|
{
|
|
|
|
if (base && base == prev)
|
2009-11-27 21:55:25 +02:00
|
|
|
return ".";
|
2009-08-12 13:45:52 +03:00
|
|
|
return base_name(base, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *print_obj(const struct obj *obj, const struct vec *prev)
|
|
|
|
{
|
2009-11-27 21:55:25 +02:00
|
|
|
const char *base, *s1, *s3;
|
|
|
|
char *s, *s2;
|
2009-08-12 13:45:52 +03:00
|
|
|
|
2009-08-05 13:35:48 +03:00
|
|
|
base = obj_base_name(obj->base, prev);
|
|
|
|
switch (obj->type) {
|
|
|
|
case ot_frame:
|
2009-08-12 13:45:52 +03:00
|
|
|
s = stralloc_printf("frame %s %s",
|
|
|
|
obj->u.frame.ref->name, base);
|
2009-08-05 13:35:48 +03:00
|
|
|
break;
|
|
|
|
case ot_line:
|
|
|
|
s1 = obj_base_name(obj->u.line.other, prev);
|
|
|
|
s2 = unparse(obj->u.line.width);
|
2009-08-12 13:45:52 +03:00
|
|
|
s = stralloc_printf("line %s %s %s", base, s1, s2);
|
2009-08-05 13:35:48 +03:00
|
|
|
free(s2);
|
|
|
|
break;
|
|
|
|
case ot_rect:
|
|
|
|
s1 = obj_base_name(obj->u.rect.other, prev);
|
|
|
|
s2 = unparse(obj->u.rect.width);
|
2009-08-12 13:45:52 +03:00
|
|
|
s = stralloc_printf("rect %s %s %s", base, s1, s2);
|
2009-08-05 13:35:48 +03:00
|
|
|
free(s2);
|
|
|
|
break;
|
|
|
|
case ot_pad:
|
|
|
|
s1 = obj_base_name(obj->u.pad.other, prev);
|
2009-08-27 12:45:57 +03:00
|
|
|
switch (obj->u.pad.type) {
|
|
|
|
case pt_normal:
|
|
|
|
s2 = "";
|
|
|
|
break;
|
|
|
|
case pt_bare:
|
|
|
|
s2 = " bare";
|
|
|
|
break;
|
2011-01-18 02:30:57 +02:00
|
|
|
case pt_trace:
|
|
|
|
s2 = " trace";
|
|
|
|
break;
|
2009-08-27 12:45:57 +03:00
|
|
|
case pt_paste:
|
|
|
|
s2 = " paste";
|
|
|
|
break;
|
2009-09-11 21:34:51 +03:00
|
|
|
case pt_mask:
|
|
|
|
s2 = " mask";
|
|
|
|
break;
|
2009-08-27 12:45:57 +03:00
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
s = stralloc_printf("%spad \"%s\" %s %s%s",
|
|
|
|
obj->u.pad.rounded ? "r" : "",
|
|
|
|
obj->u.pad.name, base, s1, s2);
|
2009-08-05 13:35:48 +03:00
|
|
|
break;
|
2010-04-25 13:58:07 +03:00
|
|
|
case ot_hole:
|
|
|
|
s1 = obj_base_name(obj->u.hole.other, prev);
|
|
|
|
s = stralloc_printf("hole %s %s", base, s1);
|
|
|
|
break;
|
2009-08-05 13:35:48 +03:00
|
|
|
case ot_arc:
|
|
|
|
s1 = obj_base_name(obj->u.arc.start, prev);
|
2009-11-27 21:55:25 +02:00
|
|
|
s2 = unparse(obj->u.arc.width);
|
2009-08-05 13:35:48 +03:00
|
|
|
if (obj->u.arc.start == obj->u.arc.end) {
|
2009-11-27 21:55:25 +02:00
|
|
|
s = stralloc_printf("circ %s %s %s", base, s1, s2);
|
2009-08-05 13:35:48 +03:00
|
|
|
} else {
|
2009-11-27 21:55:25 +02:00
|
|
|
s3 = obj_base_name(obj->u.arc.end, prev);
|
2009-08-12 13:45:52 +03:00
|
|
|
s = stralloc_printf("arc %s %s %s %s",
|
2009-11-27 21:55:25 +02:00
|
|
|
base, s1, s3, s2);
|
2009-08-05 13:35:48 +03:00
|
|
|
}
|
2009-11-27 21:55:25 +02:00
|
|
|
free(s2);
|
2009-08-05 13:35:48 +03:00
|
|
|
break;
|
2014-02-15 23:08:26 +02:00
|
|
|
case ot_iprint:
|
|
|
|
s2 = unparse(obj->u.iprint.expr);
|
|
|
|
s = stralloc_printf("%%iprint %s", s2);
|
|
|
|
free(s2);
|
|
|
|
break;
|
2009-08-05 13:35:48 +03:00
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
2009-08-12 13:45:52 +03:00
|
|
|
return s;
|
2009-08-05 13:35:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
/* ----- print measurement ------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
static const char *meas_type_name[mt_n] = {
|
|
|
|
"meas", "measx", "measy",
|
|
|
|
"meas", "measx", "measy",
|
|
|
|
};
|
|
|
|
|
2009-08-05 13:35:48 +03:00
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
static char *print_meas_base(struct vec *base, const struct frame_qual *qual)
|
2009-08-12 13:45:52 +03:00
|
|
|
{
|
2009-11-27 21:55:25 +02:00
|
|
|
const char *name;
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
size_t n;
|
|
|
|
const struct frame_qual *walk;
|
|
|
|
char *s, *p;
|
2009-08-16 01:06:51 +03:00
|
|
|
|
|
|
|
name = base_name(base, NULL);
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
n = strlen(name)+1; /* vec\0 */
|
|
|
|
for (walk = qual; walk; walk = walk->next)
|
|
|
|
n += strlen(walk->frame->name)+1; /* frame/ */
|
|
|
|
if (base->frame != frames)
|
|
|
|
n += strlen(base->frame->name)+1; /* frame. */
|
|
|
|
|
|
|
|
s = p = alloc_size(n);
|
|
|
|
for (walk = qual; walk; walk = walk->next) {
|
|
|
|
n = strlen(walk->frame->name);
|
|
|
|
memcpy(p, walk->frame->name, n);
|
|
|
|
p[n] = '/';
|
|
|
|
p += n+1;
|
|
|
|
}
|
|
|
|
if (base->frame != frames) {
|
|
|
|
n = strlen(base->frame->name);
|
|
|
|
memcpy(p, base->frame->name, n);
|
|
|
|
p[n] = '.';
|
|
|
|
p += n+1;
|
|
|
|
}
|
|
|
|
strcpy(p, name);
|
|
|
|
return s;
|
2009-08-12 13:45:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *print_meas(const struct obj *obj)
|
|
|
|
{
|
|
|
|
char *s, *t;
|
|
|
|
char *s1, *s2, *s3;
|
|
|
|
|
|
|
|
assert(obj->type == ot_meas);
|
|
|
|
|
|
|
|
s = stralloc_printf("%s ", meas_type_name[obj->u.meas.type]);
|
|
|
|
if (obj->u.meas.label) {
|
|
|
|
t = stralloc_printf("%s\"%s\" ", s, obj->u.meas.label);
|
|
|
|
free(s);
|
|
|
|
s = t;
|
|
|
|
}
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
s1 = print_meas_base(obj->base, obj->u.meas.low_qual);
|
2009-08-12 13:45:52 +03:00
|
|
|
s2 = stralloc_printf(" %s ",
|
|
|
|
obj->u.meas.type < 3 ? obj->u.meas.inverted ? "<-" : "->" :
|
|
|
|
obj->u.meas.inverted ? "<<" : ">>");
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
s3 = print_meas_base(obj->u.meas.high, obj->u.meas.high_qual);
|
2009-08-12 13:45:52 +03:00
|
|
|
t = stralloc_printf("%s%s%s%s", s, s1, s2, s3);
|
|
|
|
free(s);
|
|
|
|
free(s1);
|
|
|
|
free(s2);
|
|
|
|
free(s3);
|
|
|
|
s = t;
|
|
|
|
|
|
|
|
if (!obj->u.meas.offset)
|
|
|
|
return s;
|
|
|
|
|
|
|
|
s1 = unparse(obj->u.meas.offset);
|
|
|
|
t = stralloc_printf("%s %s", s, s1);
|
|
|
|
free(s);
|
|
|
|
free(s1);
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ----- print vector ------------------------------------------------------ */
|
|
|
|
|
|
|
|
|
2009-11-27 21:55:25 +02:00
|
|
|
const char *print_label(struct vec *vec)
|
2009-08-12 13:45:52 +03:00
|
|
|
{
|
2009-11-27 21:55:25 +02:00
|
|
|
if (!vec->name)
|
|
|
|
generate_name(vec);
|
|
|
|
return vec->name;
|
2009-08-12 13:45:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *print_vec(const struct vec *vec)
|
2009-08-05 13:35:48 +03:00
|
|
|
{
|
2009-11-27 21:55:25 +02:00
|
|
|
const char *base;
|
|
|
|
char *x, *y, *s;
|
2009-08-05 13:35:48 +03:00
|
|
|
|
2009-08-06 07:56:47 +03:00
|
|
|
base = base_name(vec->base, vec);
|
2009-08-05 13:35:48 +03:00
|
|
|
x = unparse(vec->x);
|
|
|
|
y = unparse(vec->y);
|
|
|
|
if (vec->name)
|
2009-08-12 13:45:52 +03:00
|
|
|
s = stralloc_printf("vec %s(%s, %s)", base, x, y);
|
2012-05-25 19:33:54 +03:00
|
|
|
else
|
2009-08-12 13:45:52 +03:00
|
|
|
s = stralloc_printf("vec %s(%s, %s)", base, x, y);
|
2009-08-05 13:35:48 +03:00
|
|
|
free(x);
|
|
|
|
free(y);
|
2009-08-12 13:45:52 +03:00
|
|
|
return s;
|
2009-08-05 13:35:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ----- frames ------------------------------------------------------------ */
|
|
|
|
|
|
|
|
|
2009-08-20 01:13:47 +03:00
|
|
|
static void dump_frame(FILE *file, struct frame *frame, const char *indent)
|
2009-08-05 13:35:48 +03:00
|
|
|
{
|
|
|
|
const struct table *table;
|
|
|
|
const struct loop *loop;
|
2009-08-06 07:56:47 +03:00
|
|
|
struct obj *obj;
|
2009-08-12 13:45:52 +03:00
|
|
|
struct order *order;
|
|
|
|
const struct order *item;
|
2009-11-27 21:55:25 +02:00
|
|
|
char *s;
|
|
|
|
const char *s1;
|
2009-08-05 13:35:48 +03:00
|
|
|
|
2009-08-20 01:13:47 +03:00
|
|
|
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);
|
|
|
|
|
2009-08-05 13:35:48 +03:00
|
|
|
for (table = frame->tables; table; table = table->next)
|
|
|
|
dump_table(file, table, indent);
|
|
|
|
for (loop = frame->loops; loop; loop = loop->next)
|
|
|
|
dump_loop(file, loop, indent);
|
2009-08-06 07:56:47 +03:00
|
|
|
|
2009-08-12 13:45:52 +03:00
|
|
|
order = order_frame(frame);
|
|
|
|
for (item = order; item->vec || item->obj; item++) {
|
|
|
|
if (item->obj) {
|
Added debugging directives to the fped language. They're describe at the end
of README.
- fpd.l, fpd.y, README: added debugging directives %del, %move, %print, %dump,
and %exit
- obj.h, fpd.y (find_obj, find_label, new_obj): objects can now be labeled
- obj.c (obj_anchors), inst.c (inst_anchors): gathering the list of anchors is
now a per-object function, not an instance "method". inst_anchors implements
the vector vs. object switch.
- inst.h, inst.c: removed all *_op_anchors functions
- expr.c (str_unit): in the past, we returned a malloc'ed string, but these
times are long gone. Thus, don't stralloc("").
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5919 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-19 17:39:57 +03:00
|
|
|
fprintf(file, "%s", indent);
|
|
|
|
if (item->obj->name)
|
|
|
|
fprintf(file, "%s: ", item->obj->name);
|
2009-08-12 13:45:52 +03:00
|
|
|
s = print_obj(item->obj, item->vec);
|
Added debugging directives to the fped language. They're describe at the end
of README.
- fpd.l, fpd.y, README: added debugging directives %del, %move, %print, %dump,
and %exit
- obj.h, fpd.y (find_obj, find_label, new_obj): objects can now be labeled
- obj.c (obj_anchors), inst.c (inst_anchors): gathering the list of anchors is
now a per-object function, not an instance "method". inst_anchors implements
the vector vs. object switch.
- inst.h, inst.c: removed all *_op_anchors functions
- expr.c (str_unit): in the past, we returned a malloc'ed string, but these
times are long gone. Thus, don't stralloc("").
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5919 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-19 17:39:57 +03:00
|
|
|
fprintf(file, "%s\n", s);
|
2009-08-12 13:45:52 +03:00
|
|
|
} else {
|
|
|
|
s1 = print_label(item->vec);
|
|
|
|
s = print_vec(item->vec);
|
|
|
|
fprintf(file, "%s%s: %s\n", indent, s1, s);
|
|
|
|
}
|
|
|
|
free(s);
|
|
|
|
}
|
|
|
|
free(order);
|
|
|
|
|
|
|
|
for (obj = frame->objs; obj; obj = obj->next) {
|
|
|
|
if (obj->dumped)
|
|
|
|
continue;
|
|
|
|
s = print_meas(obj);
|
|
|
|
fprintf(file, "%s%s\n", indent, s);
|
|
|
|
free(s);
|
|
|
|
}
|
2009-08-20 01:13:47 +03:00
|
|
|
|
|
|
|
if (frame->name)
|
|
|
|
fprintf(file, "}\n\n");
|
2009-08-05 13:35:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ----- file -------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
2009-08-22 18:58:58 +03:00
|
|
|
static void dump_unit(FILE *file)
|
|
|
|
{
|
|
|
|
switch (curr_unit) {
|
|
|
|
case curr_unit_mm:
|
|
|
|
fprintf(file, "unit mm\n");
|
|
|
|
break;
|
|
|
|
case curr_unit_mil:
|
|
|
|
fprintf(file, "unit mil\n");
|
|
|
|
break;
|
|
|
|
case curr_unit_auto:
|
|
|
|
fprintf(file, "unit auto\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Added relaxation of pad overlap checking. Not GUI-settable yet.
- README, fpd.l, fpd.y: added directives "allow touch" and "allow overlap" to
make overlap checking more permissive
- dump.c (dump_allow, dump): generate "allow" directive
- obj.h, obj.c (allow_overlap): added global variable for strictness of overlap
checking
- overlap.h, overlap.c (overlap, ...), layer.h, layer.c (refine_layers):
strictness of overlap checking is passed as an argument
- hole.c (check_through_hole), layer.h, layer.c (refine_copper), obj.c
(instantiate): updated callers of "overlap" to provide "allow" argument
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5974 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-08-09 07:16:37 +03:00
|
|
|
static void dump_allow(FILE *file)
|
|
|
|
{
|
|
|
|
switch (allow_overlap) {
|
|
|
|
case ao_none:
|
|
|
|
break;
|
|
|
|
case ao_touch:
|
|
|
|
fprintf(file, "allow touch\n");
|
|
|
|
break;
|
|
|
|
case ao_any:
|
|
|
|
fprintf(file, "allow overlap\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
2012-12-21 03:03:58 +02:00
|
|
|
if (!holes_linked)
|
|
|
|
fprintf(file, "allow holes\n");
|
Added relaxation of pad overlap checking. Not GUI-settable yet.
- README, fpd.l, fpd.y: added directives "allow touch" and "allow overlap" to
make overlap checking more permissive
- dump.c (dump_allow, dump): generate "allow" directive
- obj.h, obj.c (allow_overlap): added global variable for strictness of overlap
checking
- overlap.h, overlap.c (overlap, ...), layer.h, layer.c (refine_layers):
strictness of overlap checking is passed as an argument
- hole.c (check_through_hole), layer.h, layer.c (refine_copper), obj.c
(instantiate): updated callers of "overlap" to provide "allow" argument
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5974 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-08-09 07:16:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-28 03:34:32 +03:00
|
|
|
static void reverse_frames(FILE *file, struct frame *last)
|
|
|
|
{
|
|
|
|
if (last) {
|
|
|
|
reverse_frames(file, last->next);
|
|
|
|
dump_frame(file, last, "\t");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-23 09:14:13 +02:00
|
|
|
int dump(FILE *file, const char *one)
|
2009-08-05 13:35:48 +03:00
|
|
|
{
|
2009-08-20 01:13:47 +03:00
|
|
|
struct frame *frame;
|
2009-08-05 13:35:48 +03:00
|
|
|
|
2011-03-23 09:14:13 +02:00
|
|
|
assert(!one);
|
|
|
|
|
2010-04-20 04:11:45 +03:00
|
|
|
fprintf(file, "%s\n", MACHINE_GENERATED);
|
2009-08-20 01:13:47 +03:00
|
|
|
for (frame = frames; frame; frame = frame->next)
|
|
|
|
frame->dumped = 0;
|
2010-04-28 03:34:32 +03:00
|
|
|
|
|
|
|
reverse_frames(file, frames->next);
|
|
|
|
fprintf(file, "package \"%s\"\n", pkg_name);
|
|
|
|
dump_unit(file);
|
Added relaxation of pad overlap checking. Not GUI-settable yet.
- README, fpd.l, fpd.y: added directives "allow touch" and "allow overlap" to
make overlap checking more permissive
- dump.c (dump_allow, dump): generate "allow" directive
- obj.h, obj.c (allow_overlap): added global variable for strictness of overlap
checking
- overlap.h, overlap.c (overlap, ...), layer.h, layer.c (refine_layers):
strictness of overlap checking is passed as an argument
- hole.c (check_through_hole), layer.h, layer.c (refine_copper), obj.c
(instantiate): updated callers of "overlap" to provide "allow" argument
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5974 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-08-09 07:16:37 +03:00
|
|
|
dump_allow(file);
|
|
|
|
fprintf(file, "\n");
|
2010-04-28 03:34:32 +03:00
|
|
|
dump_frame(file, frames, "");
|
|
|
|
|
2009-08-05 13:35:48 +03:00
|
|
|
fflush(file);
|
|
|
|
return !ferror(file);
|
|
|
|
}
|