www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2021/07/05/08:21:06

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7+dev
X-Exmh-Isig-CompType: comp
X-Exmh-Isig-Folder: inbox
From: "karl AT aspodata DOT se [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
To: geda-user AT delorie DOT com
Subject: [geda-user] lepton/geda: problem with () in fp name
Mime-Version: 1.0
Message-Id: <20210705121938.854E483B0DD5@turkos.aspodata.se>
Date: Mon, 5 Jul 2021 14:19:38 +0200 (CEST)
X-Virus-Scanned: ClamAV using ClamSMTP
Reply-To: geda-user AT delorie DOT com

 Files as in:
http://aspodata.se/tmp/Test/sch2pcb-paren/

 This fails:
$ lepton-sch2pcb conn.sch
cX1: can't find PCB element for footprint 05)_b.fp(Hirose_FH41-28S-0.5SH(05)_b.fp (value=FH41-28S-0.5SH(05)
So device cX1 will not be in the layout.
No elements found, so nothing to do.

Same for gsch2pcb.

///
 this diff solves that problem, i.e. instead of just searching for the
 opening parenthesis in the PKG_xxx line, i.e. a line such as:
PKG_Hirose_FH41-28S-0.5SH(05)_b.fp(Hirose_FH41-28S-0.5SH(05)_b.fp,cX1,FH41-28S-0.5SH(05)
 writtin by (I guess) the command
lepton-netlist -g gsch2pcb -o conn.pcb -m gnet-gsch2pcb-tmp.scm conn.sch
 find the first "(" preceded by ".fp" which is the end of the footprint
 name. Now ".fp" isn't always specified by the user in the sch file, so
 one could possible find the longest string after "PKG_", that matches
 the first arguement, i.e. in PKG_yyy(zzz,arg2,arg3), find the longest
 yyy's that is equal to zzz. All of this mess is to cooperate with 
 m4-footprints. But I guess, requiring users using "()" in footprint
 file names to include the ".fp", is no big deal.

diff --git a/utils/sch2pcb/src/lepton-sch2pcb.c b/utils/sch2pcb/src/lepton-sch2pcb.c
index 2c8d0842b..5a7df9a2f 100644
--- a/utils/sch2pcb/src/lepton-sch2pcb.c
+++ b/utils/sch2pcb/src/lepton-sch2pcb.c
@@ -750,6 +750,13 @@ pkg_to_element (FILE * f, gchar * pkg_line)
       || (s = strchr (pkg_line, (gint) '(')) == NULL)
     return NULL;
 
+  {
+    gchar *tst;
+    if ( (tst = strstr(pkg_line, ".fp(")) != NULL) {
+      s = tst+3;
+    }
+  }
+
   args = g_strsplit (s + 1, ",", 12);
   if (!args[0] || !args[1] || !args[2]) {
     fprintf (stderr, "Bad package line: %s\n", pkg_line);

Same diff for geda, but at a different offset:

diff --git a/utils/src/gsch2pcb.c b/utils/src/gsch2pcb.c
index 4bded6b95..df435d4ae 100644
--- a/utils/src/gsch2pcb.c
+++ b/utils/src/gsch2pcb.c
@@ -727,6 +727,13 @@ pkg_to_element (FILE * f, gchar * pkg_line)
       || (s = strchr (pkg_line, (gint) '(')) == NULL)
     return NULL;
 
+  {
+    gchar *tst;
+    if ( (tst = strstr(pkg_line, ".fp(")) != NULL) {
+      s = tst+3;
+    }
+  }
+
   args = g_strsplit (s + 1, ",", 12);
   if (!args[0] || !args[1] || !args[2]) {
     fprintf (stderr, "Bad package line: %s\n", pkg_line);

Regards,
/Karl Hammar



- Raw text -


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