Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-05 Thread John Doty

On Jan 5, 2011, at 11:49 AM, Peter TB Brett wrote:

> On Wednesday 05 January 2011 18:38:04 John Doty wrote:
>> 
>> They're not especially bad. In that project "make clean; make" generates
>> 2074 lines of chatter, only about 1/3 of them from gschem and gnetlist.
>> The worst offender is pdflatex.
>> 
>> You can see how a warning could easily be lost.
>> 
> 
> That doesn't make it okay to deliberately break designs which currently work, 
> even if you don't think they deserve to. ;-)

Is there any evidence that there are any? In any case, in other areas of 
computing it is considered OK for behavior to change between versions of a tool 
for cases when the input is ambiguous. It's not like changing the default 
attribute promotion policy: that wasn't ambiguous.

> 
> How about patching `gnetlist' to make less noise?

A good idea, but not a fix, because so many other things in an automated flow 
are chattery.

John Doty  Noqsi Aerospace, Ltd.
http://www.noqsi.com/
j...@noqsi.com




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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-05 Thread Peter TB Brett
On Wednesday 05 January 2011 18:38:04 John Doty wrote:
> 
> They're not especially bad. In that project "make clean; make" generates
> 2074 lines of chatter, only about 1/3 of them from gschem and gnetlist.
> The worst offender is pdflatex.
> 
> You can see how a warning could easily be lost.
> 

That doesn't make it okay to deliberately break designs which currently work, 
even if you don't think they deserve to. ;-)

How about patching `gnetlist' to make less noise?

Peter

-- 
Peter Brett 
Remote Sensing Research Group
Surrey Space Centre


signature.asc
Description: This is a digitally signed message part.


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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-05 Thread John Doty

On Jan 5, 2011, at 11:15 AM, Peter TB Brett wrote:

> On Wednesday 05 January 2011 17:49:50 John Doty wrote:
> 
>> WARNING: Trying to rename something twice:
>>  X2/GND and X2/GND
>> are both a src and dest name
>> This warning is okay if you have multiple levels of hierarchy!
> 
> I've never known this warning to actually indicate a problem with a design. 
> :-(
> 
> Both gnetlist and gschem generate a ridiculous quantity of useless chatter, 
> unfortunately.

They're not especially bad. In that project "make clean; make" generates 2074 
lines of chatter, only about 1/3 of them from gschem and gnetlist. The worst 
offender is pdflatex.

You can see how a warning could easily be lost.

John Doty  Noqsi Aerospace, Ltd.
http://www.noqsi.com/
j...@noqsi.com




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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-05 Thread Peter TB Brett
On Wednesday 05 January 2011 17:49:50 John Doty wrote:

> WARNING: Trying to rename something twice:
>   X2/GND and X2/GND
> are both a src and dest name
> This warning is okay if you have multiple levels of hierarchy!

I've never known this warning to actually indicate a problem with a design. 
:-(

Both gnetlist and gschem generate a ridiculous quantity of useless chatter, 
unfortunately.

Peter

-- 
Peter Brett 
Remote Sensing Research Group
Surrey Space Centre


signature.asc
Description: This is a digitally signed message part.


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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-05 Thread John Doty

On Jan 4, 2011, at 10:56 AM, Peter TB Brett wrote:

> On Tuesday 04 January 2011 17:45:29 Kai-Martin Knaak wrote:
>> Patrick Bernaud wrote:
>>> This commit introduces 'gnetlist:get-all-package-attributes' to
>>> retrieve every first attribute value for package consisting of
>>> multiple symbol instances.
>> 
>> So this resolves one of the more annoying warts with multiple symbol
>> components. :-)
>> 
>> However, a less severe wart remains: In case of multiple values for the
>> same attribute, the output still depends on the order the symbols were
>> added to the schematics. This may lead to unexpected, seemingly
>> unreproducible results.
> 
> Well, no, because you will now get a BIG FAT WARNING every time you run 
> gnetlist.

One problem with only issuing a warning is that gnetlist is so chattery. In one 
recent project of mine, every gnetlist run issues 26 "Loading schematic" 
messages and 80 "BIG FAT" warnings of the form:

WARNING: Trying to rename something twice:
X2/GND and X2/GND
are both a src and dest name
This warning is okay if you have multiple levels of hierarchy!

And, of course, I *do* have multiple levels of hierarchy.

Even if this was fixed, in my flows a "make" can produce a lot of chatter from 
a variety of tools, so gnetlist warnings would often still be lost. That 
doesn't make warnings useless, but they are only one line of defense.

My original patch yielded "attribute_conflict" for ambiguous attribute values. 
That's better behavior, I think. Simply picking one value by whatever means is 
surely wrong, as it is unpredictable to anyone except experts who know the 
inner workings of gEDA. The nice thing about a bad result in the output netlist 
or BOM is that the user is more likely to pick it up. Users already have to 
check for "unknown" in the relevant fields (and there's no warning in that 
case).

Realistically, in automated processing flows (not only gEDA), the user detects 
problems by encountering bad results. The chatter is only good for diagnosis 
after the problem is detected.

---
John Doty  Noqsi Aerospace, Ltd.

This message contains technical discussion involving difficult issues. No 
personal disrespect or malice is intended. If you perceive such, your 
perception is simply wrong. I'm a busy person, and in my business "go along to 
get along" causes mission failures and sometimes kills people, so I tend to be 
a bit blunt.



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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-05 Thread Peter TB Brett
On Wednesday 05 January 2011 16:32:48 Kai-Martin Knaak wrote:
> Peter TB Brett wrote:
> > Well, no, because you will now get a BIG FAT WARNING every time you run
> > gnetlist.
> 
> You mean, I will receive this big fat warning for every symbol I attach
> more than one comment to?

Why not try it and find out?

 Peter

-- 
Peter Brett 
Remote Sensing Research Group
Surrey Space Centre


signature.asc
Description: This is a digitally signed message part.


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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-05 Thread Kai-Martin Knaak
Peter TB Brett wrote:

> Well, no, because you will now get a BIG FAT WARNING every time you run 
> gnetlist.
> 
You mean, I will receive this big fat warning for every symbol I attach
more than one comment to?

---<)kaimartin(>---
-- 
Kai-Martin Knaak  tel: +49-511-762-2895
Universität Hannover, Inst. für Quantenoptik  fax: +49-511-762-2211 
Welfengarten 1, 30167 Hannover   http://www.iqo.uni-hannover.de
GPG key:http://pgp.mit.edu:11371/pks/lookup?search=Knaak+kmk&op=get



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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-04 Thread John Doty

On Jan 4, 2011, at 4:05 PM, Kai-Martin Knaak wrote:

> John Doty wrote:
> 
>> At least the "resolver" machinery here is accessible, so you can
>> create your own plug-in to repair the behavior.
> 
> Well, if you mean the gnetlist back-ends, I have to say, that they are 
> much less accessible to me than gnetlist itself. Wrong language, little 
> documentation, no manual, no tutorial --> no fun.
> 
> 
>> You could even sort the values, take the first one, 
> 
> How would a function that "retrieve(s) every first attribute value for 
> package consisting of multiple symbol instances" help me sort all 
> values and 

Because you can redefine that function now. It is no longer primitive. The 
primitive is (gnetlist:get-all-package-attributes) which yields a list you may 
sort or pick from.

John Doty  Noqsi Aerospace, Ltd.
http://www.noqsi.com/
j...@noqsi.com




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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-04 Thread John Doty

On Jan 4, 2011, at 3:45 PM, Kai-Martin Knaak wrote:

> Patrick Bernaud wrote:
> 
>>> However, a less severe wart remains: In case of multiple values for the
>>> same attribute, the output still depends on the order the symbols were
>>> added to the schematics.
>> 
>> This behaviour is intentional. 
> 
> What is the intention? I mean, should the order objects were entered in 
> gschem be allowed to make a difference whatsoever?

Good question.

I'm sure that those who mistakenly believe that disputes here are personal will 
be shocked that we agree ;-)

> 
> 
>> But you can change it locally.
> 
> Local to where? In my gafrc? In a gnetlist back-end?

In a gnetlist plug-in loaded with the -m flag, or in a gnetlist back end.

---
John Doty  Noqsi Aerospace, Ltd.

This message contains technical discussion involving difficult issues. No 
personal disrespect or malice is intended. If you perceive such, your 
perception is simply wrong. I'm a busy person, and in my business "go along to 
get along" causes mission failures and sometimes kills people, so I tend to be 
a bit blunt.



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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-04 Thread Kai-Martin Knaak
John Doty wrote:

> At least the "resolver" machinery here is accessible, so you can
> create your own plug-in to repair the behavior.

Well, if you mean the gnetlist back-ends, I have to say, that they are 
much less accessible to me than gnetlist itself. Wrong language, little 
documentation, no manual, no tutorial --> no fun.


> You could even sort the values, take the first one, 

How would a function that "retrieve(s) every first attribute value for 
package consisting of multiple symbol instances" help me sort all 
values and 


> as you once advocated.

I did (and do) advocate sort, but not pick. I did not even touch the 
pick topic. 

---<)kaimartin(>---
-- 
Kai-Martin Knaak
Email: k...@familieknaak.de
Öffentlicher PGP-Schlüssel:
http://pool.sks-keyservers.net:11371/pks/lookup?search=0x6C0B9F53



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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-04 Thread Kai-Martin Knaak
Patrick Bernaud wrote:

>  > However, a less severe wart remains: In case of multiple values for the
>  > same attribute, the output still depends on the order the symbols were
>  > added to the schematics.
> 
> This behaviour is intentional. 

What is the intention? I mean, should the order objects were entered in 
gschem be allowed to make a difference whatsoever?


> But you can change it locally.

Local to where? In my gafrc? In a gnetlist back-end?

---<)kaimartin(>---
-- 
Kai-Martin Knaak
Email: k...@familieknaak.de
Öffentlicher PGP-Schlüssel:
http://pool.sks-keyservers.net:11371/pks/lookup?search=0x6C0B9F53



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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-04 Thread John Doty

On Jan 4, 2011, at 10:45 AM, Kai-Martin Knaak wrote:

> Patrick Bernaud wrote:
> 
>> This commit introduces 'gnetlist:get-all-package-attributes' to
>> retrieve every first attribute value for package consisting of
>> multiple symbol instances.
> 
> So this resolves one of the more annoying warts with multiple symbol
> components. :-) 
> 
> However, a less severe wart remains: In case of multiple values for the
> same attribute, the output still depends on the order the symbols were
> added to the schematics. This may lead to unexpected, seemingly 
> unreproducible results. 

Yes. This patch got pretty thoroughly mangled in the review and revision 
process. The original that Bas and I came up with yielded either the unique 
attribute, or "attribute_conflict". I think that's better behavior, but Patrick 
has other ideas. At least the "resolver" machinery here is accessible, so you 
can create your own plug-in to repair the behavior. You could even sort the 
values, take the first one, as you once advocated.

---
John Doty  Noqsi Aerospace, Ltd.

This message contains technical discussion involving difficult issues. No 
personal disrespect or malice is intended. If you perceive such, your 
perception is simply wrong. I'm a busy person, and in my business "go along to 
get along" causes mission failures and sometimes kills people, so I tend to be 
a bit blunt.



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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-04 Thread Patrick Bernaud
Hi Kai-Martin,

Kai-Martin Knaak writes:
 > [...]
 > However, a less severe wart remains: In case of multiple values for the
 > same attribute, the output still depends on the order the symbols were
 > added to the schematics.

This behaviour is intentional. But you can change it locally.

Regards,


Patrick


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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-04 Thread Peter TB Brett
On Tuesday 04 January 2011 17:45:29 Kai-Martin Knaak wrote:
> Patrick Bernaud wrote:
> > This commit introduces 'gnetlist:get-all-package-attributes' to
> > retrieve every first attribute value for package consisting of
> > multiple symbol instances.
> 
> So this resolves one of the more annoying warts with multiple symbol
> components. :-)
> 
> However, a less severe wart remains: In case of multiple values for the
> same attribute, the output still depends on the order the symbols were
> added to the schematics. This may lead to unexpected, seemingly
> unreproducible results.

Well, no, because you will now get a BIG FAT WARNING every time you run 
gnetlist.

   Peter

-- 
Peter Brett 
Remote Sensing Research Group
Surrey Space Centre


signature.asc
Description: This is a digitally signed message part.


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


Re: gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-04 Thread Kai-Martin Knaak
Patrick Bernaud wrote:

> This commit introduces 'gnetlist:get-all-package-attributes' to
> retrieve every first attribute value for package consisting of
> multiple symbol instances.

So this resolves one of the more annoying warts with multiple symbol
components. :-) 

However, a less severe wart remains: In case of multiple values for the
same attribute, the output still depends on the order the symbols were
added to the schematics. This may lead to unexpected, seemingly 
unreproducible results. 

---<)kaimartin(>---
-- 
Kai-Martin Knaak  tel: +49-511-762-2895
Universität Hannover, Inst. für Quantenoptik  fax: +49-511-762-2211 
Welfengarten 1, 30167 Hannover   http://www.iqo.uni-hannover.de
GPG key:http://pgp.mit.edu:11371/pks/lookup?search=Knaak+kmk&op=get



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


gEDA-user: [PATCH 1/2] gnetlist: Add access to all attributes from components with multiple symbol instances.

2011-01-03 Thread Patrick Bernaud
This commit introduces 'gnetlist:get-all-package-attributes' to
retrieve every first attribute value for package consisting of
multiple symbol instances.

'gnetlist:get-package-attribute' gets redefined to use the above
procedure. To preserve backward compatibility, it returns the first
value found in file order and warns when detecting different, possibly
conflicting values. This behavior is configurable.

Derived from patch #3071482, C code by Sebastian Gieltjes.
---

 gnetlist/include/prototype.h |2 +-
 gnetlist/scheme/gnetlist.scm |   41 ++
 gnetlist/src/g_netlist.c |   45 +-
 gnetlist/src/g_register.c|2 +-
 4 files changed, 70 insertions(+), 20 deletions(-)

diff --git a/gnetlist/include/prototype.h b/gnetlist/include/prototype.h
index d37d397..3a976c2 100644
--- a/gnetlist/include/prototype.h
+++ b/gnetlist/include/prototype.h
@@ -11,7 +11,7 @@ SCM g_get_all_unique_nets(SCM scm_level);
 SCM g_get_all_connections(SCM scm_netname);
 SCM g_get_nets(SCM scm_uref, SCM scm_pin);
 SCM g_get_pins_nets(SCM scm_uref);
-SCM g_get_package_attribute(SCM scm_uref, SCM scm_wanted_attrib);
+SCM g_get_all_package_attributes(SCM scm_uref, SCM scm_wanted_attrib);
 SCM g_get_attribute_by_pinseq(SCM scm_uref, SCM scm_pinseq, SCM 
scm_wanted_attrib);
 SCM g_get_attribute_by_pinnumber(SCM scm_uref, SCM scm_pin, SCM 
scm_wanted_attrib);
 SCM g_get_toplevel_attribute(SCM scm_wanted_attrib);
diff --git a/gnetlist/scheme/gnetlist.scm b/gnetlist/scheme/gnetlist.scm
index d798259..a58ec79 100644
--- a/gnetlist/scheme/gnetlist.scm
+++ b/gnetlist/scheme/gnetlist.scm
@@ -17,6 +17,8 @@
 ;;; along with this program; if not, write to the Free Software
 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+(use-modules (srfi srfi-1))
+
 ;;--
 ;; The below functions added by SDB in Sept 2003 to support command-line flag
 ;; processing.
@@ -94,6 +96,45 @@
   )
 )
 
+;; Default resolver: returns value associated with first symbol instance
+;; in file order and warns if instances have different values.
+(define (unique-attribute refdes name values)
+(let ((value (car values)))
+  (or (every (lambda (x) (equal? x value)) values)
+  (format (current-error-port) "\
+Possible attribute conflict for refdes: ~A
+name: ~A
+values: ~A
+" refdes name values))
+  value))
+
+(define (gnetlist:get-package-attribute refdes name)
+  "Return the value associated with attribute NAME on package
+identified by REFDES.
+
+It actually computes a single value from the full list of values
+produced by 'gnetlist:get-all-package-attributes' as that list is
+passed through 'unique-attribute'.
+
+For backward compatibility, the default behavior is to return the
+value associated with the first symbol instance for REFDES. If all
+instances of REFDES do not have the same value for NAME, it prints a
+warning.
+
+This can be modified by redefining 'unique-attribute' that is a
+procedure that gets provided a non-empty list of attribute values, the
+REFDES and the NAME used for the search. It is expected to return a
+single value as a string or #f for an empty or non-existent attribute
+value.
+
+Note that given the current load sequence of gnetlist, this
+customization can only happen in the backend itself or in a file
+loaded after the backend ('-m' option of gnetlist)."
+  (let* ((values (gnetlist:get-all-package-attributes refdes name))
+ (value  (and (not (null? values))
+  (unique-attribute refdes name values
+(or value "unknown")))
+
 ;;
 ;; Given a uref, returns the device attribute value (unknown if not defined)
 ;;
diff --git a/gnetlist/src/g_netlist.c b/gnetlist/src/g_netlist.c
index 14441cc..ef8d5fe 100644
--- a/gnetlist/src/g_netlist.c
+++ b/gnetlist/src/g_netlist.c
@@ -472,19 +472,34 @@ SCM g_get_pins_nets(SCM scm_uref)
 }
 
 
-SCM g_get_package_attribute(SCM scm_uref, SCM scm_wanted_attrib)
+/*! \brief Get attribute value(s) from a package with given uref.
+ *  \par Function Description
+ *  This function returns the values of a specific attribute type
+ *  attached to the symbol instances with the given refdes.
+ *
+ *  Every first attribute value found is added to the return list. A
+ *  Scheme false value is added if the instance has no such attribute.
+ *
+ *  \note The order of the values in the return list is the order of
+ *  symbol instances within gnetlist (the first element is the value
+ *  associated with the first symbol instance).
+ *
+ *  \param [in] scm_uref   Package reference.
+ *  \param [in] scm_wanted_attrib  Attribute name.
+ *  \return A list of attribute values as strings and #f.
+ */
+SCM g_get_all_package_attributes(SCM scm_uref, SCM scm_wanted_attrib)
 {
-SCM scm_return_value;
+SCM ret = SCM_EOL;
 NETLIST *nl_current;
 char *uref;
 char *wanted_attrib;
-char *return_value = N