[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: attribute promotion query



On Fri, 2008-02-08 at 14:48 +0000, Peter Baxendale wrote:
> Having read the gschem user guide (on-line version) on attributes and
> attribute promotion (several times) I am even more confused, and I'd be
> grateful if someone could clarify things for me.
> 
> For investigation purposes I instantiate a 7400-1.sym on my gschem page.
> I have (attribute-promotion "enabled") in my gafrc file, and I don't
> have promote-invisible enabled. (Incidentally, the manual says to use
> gschemrc to set these - is this wrong or can it be either?)

Either I guess. gafrc means it happens for any tool which loads a
component via libgeda. In practise, this means gschem at present.

> I edit attributes for the 7400 component, and I see just device, refdes
> and footprint.
> 
> Q1 are these the "promoted" attributes?

Yes, they are visible, yet "floating" (unattached) attributes in the
7400-1.sym file, and will be "promoted" (attached to the instance of
7400-1.sym in your schematic, and saved in your .sch file.)

> Q2 the gschem user guide (on line) says "The device= attribute is not
> promoted." So why does it appear in the attributes list?

The user guide is lying I think. The code has no such special case.

> Q3 the gschem user guide says "if you place an unattached visible
> attribute inside a symbol and then instantiate that symbol, then that
> unattached attribute gets “promoted”; that is, it becomes an attached
> attribute." But the footprint attribute is not visible and seems to get
> promoted. Why? The slot attribute (and others) looks just the same (not
> visible) but is not promoted.

See system-gafrc:

; always-promote-attributes
;
; Set the list of attributes that are always promoted regardless of
; their visibility.
;
(always-promote-attributes "footprint device value model-name")

> Q4 How do I tell if an attribute is attached or unattached?

Unattached attributes show up in red.

> Is this just a case of documentation lagging development, or am I
> missing something?

Possibly poor documentation I guess.

There is indeed a bug though....

When attributes are promoted, it does so by moving the attribute from
being inside the symbol, to being _attached_ to it (subtle difference).

It turns out that the slotting code is broken, and only checks for SOME
of the necessary attributes _inside_ the symbol. (e.g. numslots).
Similarly, checks for "slot=.." are only made for attributes _attached_
to the symbol, so having a hidden attribute slot=?? does not have any
effect unless it is promoted.

The final piece in the puzzle, is that when reloading a schematic from
disk, libgeda behaves somewhat differently. It does not over-write the
attributes from your schematic with those it wants to promote from the
symbol file (correct), however since attribute promotion is disabled
when reading back from disk, the version _inside_ the symbol remains
(and slotting appears to work, since these attributes can be found).


So, is the correct fix:

1. Ensure when promotion is on, the "would-be" promoted attributes are
deleted on from the symbols when loaded, and fix the slotting code to
respond to attached attributes as well as internal ones.

2. Ensure when promoting attributes, they are copied, not moved from
inside the symbol to attached. For avoiding further bugs (where a user
wants to over-ride a slotting attribute such as numslots or slotdef),
fix the slotting code appropriately.


Both involve fixing the slotting code, the outstanding issue is really
whether attributes should be moved or copied when promoting them.

My money is on copied, since otherwise we are not faithfully
representing the symbol in memory (although we already fudge the
pinnumber attributes I guess).

Copied also avoids the question of how to deal with loading schematics
which may have been saved _without_ promote invisible on... in general
we can't tell whether an attribute saved in the .sch file came from
promotion or not, so we can't know to delete invisible attributes when
loading a symbol in a saved schematic. We can't blindly promote at this
point, otherwise it would over-write the attributes in the .sch file.


Best wishes,

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user