delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/07/08/04:37:03

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on fly.srk.fer.hr
X-Spam-Level:
X-Spam-Status: No, score=-1.0 required=6.3 tests=ALL_TRUSTED
autolearn=disabled version=3.3.1
Date: Sun, 8 Jul 2012 10:36:38 +0200
From: Ivan Stankovic <pokemon AT fly DOT srk DOT fer DOT hr>
To: geda-developers AT lists DOT launchpad DOT net
Cc: geda-user AT delorie DOT com
Subject: [geda-user] [PATCH] gnetlist: allow net= attributes without a pin number
Message-ID: <20120708083638.GA5511@alpha2>
MIME-Version: 1.0
X-Operating-System: GNU/Linux
User-Agent: Mutt/1.5.21 (2010-09-15)
Reply-To: geda-user AT delorie DOT com

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

[Cc-ing geda-user as geda-developers seems to be dead these days]

Hello,

the attached patch allows one to specify the net= attribute
without a pin number, which is very convenient for components
with a single pin. The pin number defaults to 1 and a warning
is printed (it would be nicer if the warning were printed only
for components with multiple pins).

The patch is based on the original patch by Wojciech Kazubski,
but that never got applied. See the discussion at
http://ftp.sunet.se/geda/mailinglist/geda-dev68/msg00090.html.

Could someone please apply this?

-- 
Ivan Stankovic, pokemon AT fly DOT srk DOT fer DOT hr

"Protect your digital freedom and privacy, eliminate DRM, 
learn more at http://www.defectivebydesign.org/what_is_drm"

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="net_default_pinnumber.patch"

commit 75400cf8bccafb50a8a4fe67a7ed298112d181a0
Author: Ivan Stankovic <pokemon AT fly DOT srk DOT fer DOT hr>
Date:   Sat Jul 7 21:09:55 2012 +0200

    gnetlist: allow net= attributes without a pin number
    
    The pin number defaults to 1 and a warning is printed.
    Original patch by Wojciech Kazubski. See the discussion
    at http://ftp.sunet.se/geda/mailinglist/geda-dev68/msg00090.html.

diff --git a/gnetlist/src/s_netattrib.c b/gnetlist/src/s_netattrib.c
index 461458d..59f6e8a 100644
--- a/gnetlist/src/s_netattrib.c
+++ b/gnetlist/src/s_netattrib.c
@@ -235,10 +235,12 @@ char *s_netattrib_net_search (OBJECT * o_current, char *wanted_pin)
 
     char_ptr = strchr (value, ':');
     if (char_ptr == NULL) {
-      fprintf (stderr, "Got an invalid net= attrib [net=%s]\n"
-                       "Missing : in net= attrib\n", value);
-      g_free (value);
-      return NULL;
+      fprintf (stderr, "Warning: net= attrib [net=%s] without pin number, "
+                       "defaulting to 1\n", value);
+      char_ptr = value;
+      value = g_strdup_printf ("%s:1", value);
+      g_free (char_ptr);
+      char_ptr = strchr (value, ':');
     }
 
     net_name = s_netattrib_extract_netname (value);
@@ -266,10 +268,12 @@ char *s_netattrib_net_search (OBJECT * o_current, char *wanted_pin)
 
     char_ptr = strchr (value, ':');
     if (char_ptr == NULL) {
-      fprintf (stderr, "Got an invalid net= attrib [net=%s]\n"
-                       "Missing : in net= attrib\n", value);
-      g_free (value);
-      return NULL;
+      fprintf (stderr, "Warning: net= attrib [net=%s] without pin number, "
+                       "defaulting to 1\n", value);
+      char_ptr = value;
+      value = g_strdup_printf ("%s:1", value);
+      g_free (char_ptr);
+      char_ptr = strchr (value, ':');
     }
 
     net_name = s_netattrib_extract_netname (value);

--6TrnltStXW4iwmi0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019