--- Begin Message ---
Author: werner
Date: 2009-08-13 02:33:49 +0200 (Thu, 13 Aug 2009)
New Revision: 5431
Removed:
trunk/gta02-core/kicad-patches/auto-overline-config.patch
trunk/gta02-core/kicad-patches/auto-overline-screen.patch
Log:
The auto-overline idea was a very complex approach for solving a simple
problem. Worse yet, KiCad can already do this without all the complexity.
Begone ...
Deleted: trunk/gta02-core/kicad-patches/auto-overline-config.patch
===================================================================
--- trunk/gta02-core/kicad-patches/auto-overline-config.patch 2009-08-13
00:29:47 UTC (rev 5430)
+++ trunk/gta02-core/kicad-patches/auto-overline-config.patch 2009-08-13
00:33:49 UTC (rev 5431)
@@ -1,194 +0,0 @@
-Work in progress.
-
-Add auto-overline configuration options.
-
-Index: kicad/eeschema/dialog_options.cpp
-===================================================================
---- kicad.orig/eeschema/dialog_options.cpp 2009-05-16 19:19:14.000000000
-0300
-+++ kicad/eeschema/dialog_options.cpp 2009-05-19 17:52:42.000000000 -0300
-@@ -146,6 +146,13 @@
- m_DeltaStepYTitle->SetLabel( title );
-
- m_DeltaLabelCtrl->SetValue( g_RepeatDeltaLabel );
-+
-+ m_AutoOverlinePins->SetValue(g_AutoOverlinePins);
-+ m_AutoOverlineNetsLabels->SetValue(g_AutoOverlineNetsLabels);
-+ m_AutoOverlineText->SetValue(g_AutoOverlineText);
-+ m_AutoOverlinePrefixes->SetValue(g_AutoOverlinePrefixes);
-+ m_AutoOverlineSeparators->SetValue(g_AutoOverlineSeparators);
-+ m_AutoOverlineKeepPrefix->SetValue(g_AutoOverlineKeepPrefix);
- }
-
-
-@@ -177,6 +184,12 @@
- m_DeltaStepCtrl_Y = NULL;
- m_DeltaIncTitle = NULL;
- m_DeltaLabelCtrl = NULL;
-+ m_AutoOverlinePins = NULL;
-+ m_AutoOverlineNetsLabels = NULL;
-+ m_AutoOverlineText = NULL;
-+ m_AutoOverlinePrefixes = NULL;
-+ m_AutoOverlineSeparators = NULL;
-+ m_AutoOverlineKeepPrefix = NULL;
- ////@end WinEDA_SetOptionsFrame member initialisation
-
- ////@begin WinEDA_SetOptionsFrame creation
-@@ -268,6 +281,58 @@
- m_Show_Page_Limits->SetSelection(0);
- itemBoxSizer8->Add(m_Show_Page_Limits, 0, wxGROW|wxALL, 5);
-
-+
-+ wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxVERTICAL);
-+ itemBoxSizer2->Add(itemBoxSizer19, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
-+
-+ wxStaticBox* itemStaticBoxSizer20Static = new wxStaticBox(itemDialog1,
-+ wxID_ANY, _("Auto-overline"));
-+ wxStaticBoxSizer* itemStaticBoxSizer20 = new
-+ wxStaticBoxSizer(itemStaticBoxSizer20Static, wxVERTICAL);
-+ itemBoxSizer19->Add(itemStaticBoxSizer20, 0,
-+ wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
-+
-+ m_AutoOverlinePins = new wxCheckBox( itemDialog1, ID_CHECKBOX1,
-+ _("Pins"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
-+ m_AutoOverlinePins->SetValue(FALSE);
-+ itemStaticBoxSizer20->Add(m_AutoOverlinePins, 0,
-+ wxALIGN_LEFT | wxALL, 5);
-+
-+ m_AutoOverlineNetsLabels = new wxCheckBox( itemDialog1, ID_CHECKBOX1,
-+ _("Nets and labels"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
-+ m_AutoOverlineNetsLabels->SetValue(FALSE);
-+ itemStaticBoxSizer20->Add(m_AutoOverlineNetsLabels, 0,
-+ wxALIGN_LEFT | wxALL, 5);
-+
-+ m_AutoOverlineText = new wxCheckBox( itemDialog1, ID_CHECKBOX1,
-+ _("Text"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
-+ m_AutoOverlineText->SetValue(FALSE);
-+ itemStaticBoxSizer20->Add(m_AutoOverlineText, 0,
-+ wxALIGN_LEFT | wxALL, 5);
-+
-+ itemStaticBoxSizer20->Add(new wxStaticText( itemDialog1, wxID_STATIC,
-+ _("Prefixes"), wxDefaultPosition, wxDefaultSize, 0 ),
-+ 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5);
-+
-+ m_AutoOverlinePrefixes = new wxTextCtrl( itemDialog1, ID_TEXTCTRL,
-+ _T("n#"), wxDefaultPosition, wxDefaultSize, 0 );
-+ itemStaticBoxSizer20->Add(m_AutoOverlinePrefixes, 0, wxGROW | wxALL, 5);
-+
-+ itemStaticBoxSizer20->Add(new wxStaticText( itemDialog1, wxID_STATIC,
-+ _("Separators"), wxDefaultPosition, wxDefaultSize, 0 ),
-+ 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5);
-+
-+ m_AutoOverlineSeparators = new wxTextCtrl( itemDialog1, ID_TEXTCTRL,
-+ _T("/,"), wxDefaultPosition, wxDefaultSize, 0 );
-+ itemStaticBoxSizer20->Add(m_AutoOverlineSeparators, 0, wxGROW | wxALL, 5);
-+
-+ m_AutoOverlineKeepPrefix = new wxCheckBox( itemDialog1, ID_CHECKBOX1,
-+ _("Keep prefix"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
-+ m_AutoOverlineKeepPrefix->SetValue(TRUE);
-+ itemStaticBoxSizer20->Add(m_AutoOverlineKeepPrefix, 0,
-+ wxALIGN_LEFT | wxALL, 5);
-+
-+
- wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL);
- itemBoxSizer2->Add(itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
-@@ -302,6 +367,11 @@
- m_DeltaLabelCtrl = new wxSpinCtrl( itemDialog1, ID_SPINCTRL, _T("0"),
wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -16, 16, 0 );
- itemStaticBoxSizer18->Add(m_DeltaLabelCtrl, 0, wxGROW|wxALL, 5);
-
-+
-+ m_DeltaStepXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta
Step X"), wxDefaultPosition, wxDefaultSize, 0 );
-+ itemStaticBoxSizer18->Add(m_DeltaStepXTitle, 0,
wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
-+
-+
- ////@end WinEDA_SetOptionsFrame content construction
-
- m_btClose->SetFocus();
-@@ -474,4 +544,11 @@
- m_Parent->GetBaseScreen()->SetGrid( grid );
- m_Parent->GetBaseScreen()->SetRefreshReq();
- }
-+
-+ g_AutoOverlinePins = m_AutoOverlinePins->GetValue();
-+ g_AutoOverlineNetsLabels = m_AutoOverlineNetsLabels->GetValue();
-+ g_AutoOverlineText = m_AutoOverlineText->GetValue();
-+ g_AutoOverlinePrefixes = m_AutoOverlinePrefixes->GetValue();
-+ g_AutoOverlineSeparators = m_AutoOverlineSeparators->GetValue();
-+ g_AutoOverlineKeepPrefix= m_AutoOverlineKeepPrefix->GetValue();
- }
-Index: kicad/eeschema/dialog_options.h
-===================================================================
---- kicad.orig/eeschema/dialog_options.h 2009-05-16 19:19:14.000000000
-0300
-+++ kicad/eeschema/dialog_options.h 2009-05-19 17:52:42.000000000 -0300
-@@ -129,6 +129,12 @@
- wxTextCtrl* m_DeltaStepCtrl_Y;
- wxStaticText* m_DeltaIncTitle;
- wxSpinCtrl* m_DeltaLabelCtrl;
-+ wxCheckBox* m_AutoOverlinePins;
-+ wxCheckBox* m_AutoOverlineNetsLabels;
-+ wxCheckBox* m_AutoOverlineText;
-+ wxTextCtrl* m_AutoOverlinePrefixes;
-+ wxTextCtrl* m_AutoOverlineSeparators;
-+ wxCheckBox* m_AutoOverlineKeepPrefix;
- ////@end WinEDA_SetOptionsFrame member variables
-
- WinEDA_ValueCtrl * m_DefaultDrawLineWidthCtrl;
-Index: kicad/eeschema/eeconfig.cpp
-===================================================================
---- kicad.orig/eeschema/eeconfig.cpp 2009-05-16 19:19:14.000000000 -0300
-+++ kicad/eeschema/eeconfig.cpp 2009-05-19 17:52:42.000000000 -0300
-@@ -20,6 +20,14 @@
- #include "hotkeys.h"
-
-
-+bool g_AutoOverlinePins;
-+bool g_AutoOverlineNetsLabels;
-+bool g_AutoOverlineText;
-+wxString g_AutoOverlinePrefixes;
-+wxString g_AutoOverlineSeparators;
-+bool g_AutoOverlineKeepPrefix;
-+
-+
- /* Variables locales */
-
-
-@@ -219,6 +227,19 @@
- &g_DefaultTextLabelSize,
- DEFAULT_SIZE_TEXT, 0, 1000 )
);
-
-+ m_projectFileParams.Add( new PARAM_CFG_BOOL(
-+ wxT( "AutoOverlinePins" ), &g_AutoOverlinePins ) );
-+ m_projectFileParams.Add( new PARAM_CFG_BOOL(
-+ wxT( "AutoOverlineNetsLabels" ), &g_AutoOverlineNetsLabels ) );
-+ m_projectFileParams.Add( new PARAM_CFG_BOOL(
-+ wxT( "AutoOverlineText" ), &g_AutoOverlineText ) );
-+ m_projectFileParams.Add( new PARAM_CFG_WXSTRING(
-+ wxT( "AutoOverlinePrefixes" ), &g_AutoOverlinePrefixes ) );
-+ m_projectFileParams.Add( new PARAM_CFG_WXSTRING(
-+ wxT( "AutoOverlineSeparators" ), &g_AutoOverlineSeparators) );
-+ m_projectFileParams.Add( new PARAM_CFG_BOOL(
-+ wxT( "AutoOverlineKeepPrefix" ), &g_AutoOverlineKeepPrefix ) );
-+
- return m_projectFileParams;
- }
-
-Index: kicad/eeschema/general.h
-===================================================================
---- kicad.orig/eeschema/general.h 2009-05-16 19:19:14.000000000 -0300
-+++ kicad/eeschema/general.h 2009-05-19 17:52:42.000000000 -0300
-@@ -120,6 +120,15 @@
- extern int g_PlotPSColorOpt; // True = plot postcript color (see
plotps.cpp)
-
-
-+// Auto-overline
-+
-+extern bool g_AutoOverlinePins;
-+extern bool g_AutoOverlineNetsLabels;
-+extern bool g_AutoOverlineText;
-+extern wxString g_AutoOverlinePrefixes;
-+extern wxString g_AutoOverlineSeparators;
-+extern bool g_AutoOverlineKeepPrefix;
-+
- // Gestion de diverses variables, options... devant etre memorisees mais
- // Remises a 0 lors d'un rechargement de projetc
- struct EESchemaVariables
Deleted: trunk/gta02-core/kicad-patches/auto-overline-screen.patch
===================================================================
--- trunk/gta02-core/kicad-patches/auto-overline-screen.patch 2009-08-13
00:29:47 UTC (rev 5430)
+++ trunk/gta02-core/kicad-patches/auto-overline-screen.patch 2009-08-13
00:33:49 UTC (rev 5431)
@@ -1,130 +0,0 @@
-Work in progress.
-
-Auto-overline string processing for pins. Note the the logic only works
-if the pin is not multi-purpose. Doesn't draw the overline.
-
-Index: kicad/eeschema/class_pin.cpp
-===================================================================
---- kicad.orig/eeschema/class_pin.cpp 2009-05-16 19:19:14.000000000 -0300
-+++ kicad/eeschema/class_pin.cpp 2009-05-19 17:52:42.000000000 -0300
-@@ -435,6 +435,39 @@
- }
-
-
-+static bool do_overline(const wchar_t **res, const wchar_t *s)
-+{
-+ const wchar_t *sep, *next;
-+
-+ *res = s;
-+ if (!g_AutoOverlinePins || !g_AutoOverlinePrefixes)
-+ return FALSE;
-+
-+ while (1) {
-+ /* see if we have a prefix match */
-+ if (wcsrchr(g_AutoOverlinePrefixes, *s))
-+ break;
-+
-+ /* skip to the next separator */
-+ for (sep = g_AutoOverlineSeparators; sep && *sep; sep++) {
-+ next = wcsrchr(s, *sep);
-+ if (next)
-+ break;
-+ }
-+ if (!next)
-+ return FALSE;
-+ s = next+1;
-+ if (!*s)
-+ return FALSE; /* name ends with a separator */
-+ }
-+
-+ /* we have a prefix match */
-+ if (!g_AutoOverlineKeepPrefix)
-+ *res = s[1] ? s+1 : L"?";
-+ return TRUE;
-+}
-+
-+
- /*****************************************************************************
- * Put out pin number and pin text info, given the pin line coordinates.
- * The line must be vertical or horizontal.
-@@ -500,6 +533,10 @@
- DrawPinName = FALSE;
- PinTxtLen = (int) ( fPinTextPitch * PinTxtLen );
-
-+ const wchar_t *name;
-+
-+ do_overline(&name, m_PinName);
-+
- if( TextInside ) /* Draw the text inside, but the pin numbers outside. */
- {
- if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
-@@ -511,7 +548,7 @@
- {
- x = x1 + TextInside;
- DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor,
-- m_PinName,
-+ name,
- TEXT_ORIENT_HORIZ,
- PinNameSize,
- GR_TEXT_HJUSTIFY_LEFT,
-@@ -522,7 +559,7 @@
- {
- x = x1 - TextInside;
- DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor,
-- m_PinName,
-+ name,
- TEXT_ORIENT_HORIZ,
- PinNameSize,
- GR_TEXT_HJUSTIFY_RIGHT,
-@@ -551,7 +588,7 @@
-
- if( DrawPinName )
- DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor,
-- m_PinName,
-+ name,
- TEXT_ORIENT_VERT, PinNameSize,
- GR_TEXT_HJUSTIFY_RIGHT,
- GR_TEXT_VJUSTIFY_CENTER, LineWidth,
-@@ -571,7 +608,7 @@
-
- if( DrawPinName )
- DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor,
-- m_PinName,
-+ name,
- TEXT_ORIENT_VERT, PinNameSize,
- GR_TEXT_HJUSTIFY_LEFT,
- GR_TEXT_VJUSTIFY_CENTER, LineWidth,
-@@ -597,7 +634,7 @@
- x = (x1 + pin_pos.x) / 2;
- DrawGraphicText( panel, DC, wxPoint( x,
- y1 - TXTMARGE ),
-- NameColor, m_PinName,
-+ NameColor, name,
- TEXT_ORIENT_HORIZ, PinNameSize,
- GR_TEXT_HJUSTIFY_CENTER,
- GR_TEXT_VJUSTIFY_BOTTOM, LineWidth,
-@@ -622,7 +659,7 @@
- y = (y1 + pin_pos.y) / 2;
- DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE,
- y ),
-- NameColor, m_PinName,
-+ NameColor, name,
- TEXT_ORIENT_VERT, PinNameSize,
- GR_TEXT_HJUSTIFY_CENTER,
- GR_TEXT_VJUSTIFY_BOTTOM, LineWidth, false,
true );
-Index: kicad/eeschema/classes_body_items.cpp
-===================================================================
---- kicad.orig/eeschema/classes_body_items.cpp 2009-05-16 19:19:14.000000000
-0300
-+++ kicad/eeschema/classes_body_items.cpp 2009-05-19 17:52:42.000000000
-0300
-@@ -562,7 +562,10 @@
- * transformation matrix causes xy axes to be flipped. */
- int t1 = ( aTransformMatrix[0][0] != 0 ) ^ ( m_Orient != 0 );
-
-- DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text,
-+// wxString foo = mText;
-+ wxString foo = wxT( "BAEH" );
-+
-+ DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, foo,
- t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
- m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
- linewidth, m_Italic );
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-08-13 11:30:16 +0200 (Thu, 13 Aug 2009)
New Revision: 5432
Modified:
trunk/eda/fped/gui_canvas.c
trunk/eda/fped/gui_frame.c
trunk/eda/fped/gui_style.h
trunk/eda/fped/gui_tool.c
trunk/eda/fped/gui_util.c
trunk/eda/fped/gui_util.h
trunk/eda/fped/meas.c
trunk/eda/fped/obj.c
trunk/eda/fped/obj.h
Log:
- added the usual COLOR_ prefix also to TOOL_SELECTED/TOOL_UNSELECTED
- instantiate_meas if a mesurements has no samples, do the next one, don't stop
completely
- when instantiation fails, the corresponding vector, object, or loop is now
marked red in the variables/items list.
Modified: trunk/eda/fped/gui_canvas.c
===================================================================
--- trunk/eda/fped/gui_canvas.c 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/gui_canvas.c 2009-08-13 09:30:16 UTC (rev 5432)
@@ -111,7 +111,7 @@
aw = draw_ctx.widget->allocation.width;
ah = draw_ctx.widget->allocation.height;
gdk_draw_rectangle(draw_ctx.widget->window,
- instantiation_ok ? gc_bg : gc_bg_error, TRUE, 0, 0, aw, ah);
+ instantiation_error ? gc_bg_error : gc_bg, TRUE, 0, 0, aw, ah);
inst_draw();
if (highlight)
Modified: trunk/eda/fped/gui_frame.c
===================================================================
--- trunk/eda/fped/gui_frame.c 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/gui_frame.c 2009-08-13 09:30:16 UTC (rev 5432)
@@ -852,6 +852,8 @@
field = label_in_box_new(loop->var.name);
gtk_box_pack_start(GTK_BOX(hbox), box_of_label(field), FALSE, FALSE, 0);
label_in_box_bg(field, COLOR_VAR_PASSIVE);
+ if (instantiation_error == loop)
+ label_in_box_fg(field, COLOR_ITEM_ERROR);
g_signal_connect(G_OBJECT(box_of_label(field)),
"button_press_event",
G_CALLBACK(loop_var_select_event), loop);
@@ -1037,6 +1039,9 @@
s = print_obj(item->obj, item->vec);
item->obj->list_widget = item_label(tab, s, 1, n,
item_select_obj, item->obj);
+ if (item->obj == instantiation_error)
+ label_in_box_fg(item->obj->list_widget,
+ COLOR_ITEM_ERROR);
} else {
s = print_label(item->vec);
t = stralloc_printf("%s: ", s);
@@ -1046,6 +1051,9 @@
s = print_vec(item->vec);
item->vec->list_widget = item_label(tab, s, 1, n,
item_select_vec, item->vec);
+ if (item->vec == instantiation_error)
+ label_in_box_fg(item->vec->list_widget,
+ COLOR_ITEM_ERROR);
}
n++;
}
@@ -1083,6 +1091,8 @@
s = print_meas(obj);
obj->list_widget = item_label(tab, s, 0, n,
item_select_obj, obj);
+ if (obj == instantiation_error)
+ label_in_box_fg(obj->list_widget, COLOR_ITEM_ERROR);
n++;
}
Modified: trunk/eda/fped/gui_style.h
===================================================================
--- trunk/eda/fped/gui_style.h 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/gui_style.h 2009-08-13 09:30:16 UTC (rev 5432)
@@ -83,11 +83,12 @@
#define COLOR_VAR_TABLE_SEP "black"
-#define TOOL_UNSELECTED "#dcdad5"
-#define TOOL_SELECTED "red"
+#define COLOR_TOOL_UNSELECTED "#dcdad5"
+#define COLOR_TOOL_SELECTED "red"
#define COLOR_ITEM_NORMAL "#dcdad5"
#define COLOR_ITEM_SELECTED COLOR_FRAME_SELECTED
+#define COLOR_ITEM_ERROR "red"
/* ----- canvas drawing styles --------------------------------------------- */
Modified: trunk/eda/fped/gui_tool.c
===================================================================
--- trunk/eda/fped/gui_tool.c 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/gui_tool.c 2009-08-13 09:30:16 UTC (rev 5432)
@@ -926,11 +926,11 @@
if (active_tool) {
if (active_ops && active_ops->tool_deselected)
active_ops->tool_deselected();
- col = get_color(TOOL_UNSELECTED);
+ col = get_color(COLOR_TOOL_UNSELECTED);
gtk_widget_modify_bg(active_tool, GTK_STATE_NORMAL, &col);
active_tool = NULL;
}
- col = get_color(TOOL_SELECTED);
+ col = get_color(COLOR_TOOL_SELECTED);
gtk_widget_modify_bg(evbox, GTK_STATE_NORMAL, &col);
active_tool = evbox;
active_ops = ops;
Modified: trunk/eda/fped/gui_util.c
===================================================================
--- trunk/eda/fped/gui_util.c 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/gui_util.c 2009-08-13 09:30:16 UTC (rev 5432)
@@ -151,6 +151,14 @@
}
+void label_in_box_fg(GtkWidget *label, const char *color)
+{
+ GdkColor col = get_color(color);
+
+ gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &col);
+}
+
+
void label_in_box_bg(GtkWidget *label, const char *color)
{
GtkWidget *box;
Modified: trunk/eda/fped/gui_util.h
===================================================================
--- trunk/eda/fped/gui_util.h 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/gui_util.h 2009-08-13 09:30:16 UTC (rev 5432)
@@ -54,6 +54,7 @@
GtkWidget *label_in_box_new(const char *s);
GtkWidget *box_of_label(GtkWidget *label);
+void label_in_box_fg(GtkWidget *box, const char *color);
void label_in_box_bg(GtkWidget *box, const char *color);
GtkWidget *make_image(GdkDrawable *drawable, char **xpm);
Modified: trunk/eda/fped/meas.c
===================================================================
--- trunk/eda/fped/meas.c 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/meas.c 2009-08-13 09:30:16 UTC (rev 5432)
@@ -232,7 +232,7 @@
continue;
meas = &obj->u.meas;
if (!obj->base->samples || !meas->high->samples)
- return 1;
+ continue;
lt = lt_op[meas->type];
a0 = meas_find_min(lt, obj->base->samples);
@@ -245,8 +245,10 @@
offset.n = 0;
else {
offset = eval_unit(meas->offset, root_frame);
- if (is_undef(offset))
+ if (is_undef(offset)) {
+ instantiation_error = obj;
return 0;
+ }
}
inst_meas(obj,
meas->inverted ? b0 : a0, meas->inverted ? a0 : b0,
Modified: trunk/eda/fped/obj.c
===================================================================
--- trunk/eda/fped/obj.c 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/obj.c 2009-08-13 09:30:16 UTC (rev 5432)
@@ -32,7 +32,7 @@
struct frame *frames = NULL;
struct frame *root_frame = NULL;
struct frame *active_frame = NULL;
-int instantiation_ok;
+void *instantiation_error = NULL;
static int generate_frame(struct frame *frame, struct coord base,
@@ -71,19 +71,23 @@
for (vec = frame->vecs; vec; vec = vec->next) {
x = eval_unit(vec->x, frame);
if (is_undef(x))
- return 0;
+ goto error;
y = eval_unit(vec->y, frame);
if (is_undef(y))
- return 0;
+ goto error;
vec_base = vec->base ? vec->base->pos : base;
vec->pos = vec_base;
vec->pos.x += x.n;
vec->pos.y += y.n;
if (!inst_vec(vec, vec_base))
- return 0;
+ goto error;
meas_post(vec, vec->pos);
}
return 1;
+
+error:
+ instantiation_error = vec;
+ return 0;
}
@@ -106,43 +110,43 @@
width = eval_unit_default(obj->u.line.width, frame,
DEFAULT_SILK_WIDTH);
if (is_undef(width))
- return 0;
+ goto error;
if (!inst_line(obj, obj->base ? obj->base->pos : base,
obj->u.line.other ? obj->u.line.other->pos : base,
width.n))
- return 0;
+ goto error;
break;
case ot_rect:
width = eval_unit_default(obj->u.rect.width, frame,
DEFAULT_SILK_WIDTH);
if (is_undef(width))
- return 0;
+ goto error;
if (!inst_rect(obj, obj->base ? obj->base->pos : base,
obj->u.rect.other ? obj->u.rect.other->pos : base,
width.n))
- return 0;
+ goto error;
break;
case ot_pad:
name = expand(obj->u.pad.name, frame);
if (!name)
- return 0;
+ goto error;
ok = inst_pad(obj, name,
obj->base ? obj->base->pos : base,
obj->u.pad.other ? obj->u.pad.other->pos : base);
free(name);
if (!ok)
- return 0;
+ goto error;
break;
case ot_arc:
width = eval_unit_default(obj->u.arc.width, frame,
DEFAULT_SILK_WIDTH);
if (is_undef(width))
- return 0;
+ goto error;
if (!inst_arc(obj, obj->base ? obj->base->pos : base,
obj->u.arc.start ? obj->u.arc.start->pos : base,
obj->u.arc.end ? obj->u.arc.end->pos : base,
width.n))
- return 0;
+ goto error;
break;
case ot_meas:
break;
@@ -150,6 +154,10 @@
abort();
}
return 1;
+
+error:
+ instantiation_error = obj;
+ return 0;
}
@@ -175,22 +183,26 @@
from = eval_num(loop->from.expr, frame);
if (is_undef(from)) {
fail_expr(loop->from.expr);
+ instantiation_error = loop;
return 0;
}
if (!is_dimensionless(from)) {
fail("incompatible type for start value");
fail_expr(loop->from.expr);
+ instantiation_error = loop;
return 0;
}
to = eval_num(loop->to.expr, frame);
if (is_undef(to)) {
fail_expr(loop->to.expr);
+ instantiation_error = loop;
return 0;
}
if (!is_dimensionless(to)) {
fail("incompatible type for end value");
fail_expr(loop->to.expr);
+ instantiation_error = loop;
return 0;
}
@@ -203,6 +215,7 @@
if (n >= MAX_ITERATIONS) {
fail("%s: too many iterations (%d)", loop->var.name,
MAX_ITERATIONS);
+ instantiation_error = loop;
goto fail;
}
if (!run_loops(frame, loop->next, base,
@@ -259,6 +272,7 @@
inst_start();
meas_start();
+ instantiation_error = NULL;
ok = generate_frame(root_frame, zero, NULL, NULL, 1);
if (ok)
ok = instantiate_meas();
@@ -266,6 +280,5 @@
inst_commit();
else
inst_revert();
- instantiation_ok = ok;
return ok;
}
Modified: trunk/eda/fped/obj.h
===================================================================
--- trunk/eda/fped/obj.h 2009-08-13 00:33:49 UTC (rev 5431)
+++ trunk/eda/fped/obj.h 2009-08-13 09:30:16 UTC (rev 5432)
@@ -183,7 +183,7 @@
extern struct frame *frames;
extern struct frame *root_frame;
extern struct frame *active_frame;
-extern int instantiation_ok;
+extern void *instantiation_error;
int instantiate(void);
--- End Message ---