Mail Archives: geda-user/2023/03/20/07:43:55
This is a multipart MIME message.
--==_Exmh_1679311409_3450
Content-Type: text/plain
Karl:
> $ git branch -v
> * (HEAD detached at vzh/sch2pcb-rewrite-sch2pcb-add-elements-in-scheme) 60d7148f0 sch2pcb: Rewrite sch2pcb_add_elements() in Scheme.
...
> I get (after make install):
> $ lepton-sch2pcb styrkort.sch
> Unknown config key: "."
> Unknown config key: "/home/karl/git/openhw/share/pcb/"
> Unknown config key: "/usr/share/pcb/pcblib-newlib/"
> ...
Ok, I found the file:
$ cat ~/.config/lepton-eda/gsch2pcb
d .
d /home/karl/git/openhw/share/pcb/
d /usr/local/share/pcb/pcblib-newlib/
d /usr/local/share/pcb/newlib/
In geda-gaf, ~/.gEDA/gsch2pcb is one of three "default"
project files:
$ grep -B1 -A17 ^load_extra_project_files geda-gaf/utils/src/gsch2pcb.c
static void
load_extra_project_files (void)
{
gchar *path;
static gboolean done = FALSE;
if (done)
return;
load_project ("/etc/gsch2pcb");
load_project ("/usr/local/etc/gsch2pcb");
path = g_build_filename ((gchar *) g_get_home_dir (), ".gEDA",
"gsch2pcb", NULL);
load_project (path);
g_free (path);
done = TRUE;
}
load_project() reads lines, splitting it in a config and a arg variable,
and then calls parse_config() (line 1199-1576).
parse_config() strcmp's the config variable, it can be either a long or
a short string as in e.g. (line 1173-1180):
if (!strcmp (config, "elements-dir") || !strcmp (config, "d")) {
gchar *elements_dir = expand_dir (arg);
if (verbose > 1)
printf ("\tAdding directory to file element directory list: %s\n",
elements_dir);
element_directory_list =
g_list_prepend (element_directory_list, elements_dir);
} else if (!strcmp (config, "output-name") || !strcmp (config, "o"))
So the "d" in my file adds a directory where to search for footprint
(element) files.
///
The source of lepton-sch2pcb seems to be in:
./liblepton/include/liblepton/sch2pcb.h
./liblepton/scheme/lepton/ffi/sch2pcb.scm
./liblepton/src/sch2pcb.c
./tools/sch2pcb/lepton-sch2pcb.scm
Your parse-config is in tools/sch2pcb/lepton-sch2pcb.scm (line 322-360).
Line 359 has the error message:
(G_ "Unknown config key: ~S\n")
In line 335-341, you do the matching for elements-dir, but you
are ignoring the short, one letter keys:
("elements-dir"
(let ((elements-dir (expand-env-variables value)))
(when (> (sch2pcb_get_verbose_mode) 1)
(format #t
"\tAdding directory to file element directory list: ~A\n"
elements-dir))
(sch2pcb_element_directory_list_prepend (string->pointer elements-dir))))
Changing the line with the pattern to:
((or "elements-dir" "d")
solves it for the "d" key.
Patch attached.
Regards,
/Karl Hammar
--==_Exmh_1679311409_3450
Content-Type: text/plain; charset="utf-8" ; name="patch"
Content-Description: patch
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="patch"
diff --git a/tools/sch2pcb/lepton-sch2pcb.scm b/tools/sch2pcb/lepton-sch2=
pcb.scm
index 8114292bd..fb89b0a0c 100755
--- a/tools/sch2pcb/lepton-sch2pcb.scm
+++ b/tools/sch2pcb/lepton-sch2pcb.scm
@@ -326,20 +326,20 @@
(string->pointer ""))))
(match key
;; This is default behaviour.
- ("remove-unfound" (sch2pcb_set_remove_unfound_elements TRUE))
- ("keep-unfound" (sch2pcb_set_remove_unfound_elements FALSE))
- ("quiet" (set! %quiet-mode #t))
- ("preserve" (sch2pcb_set_preserve TRUE))
- ("use-files" (sch2pcb_set_force_element_files TRUE))
- ("skip-m4" (set! %use-m4 #f))
- ("elements-dir"
+ ((or "remove-unfound" "r") (sch2pcb_set_remove_unfound_elements TR=
UE))
+ ((or "keep-unfound" "k") (sch2pcb_set_remove_unfound_elements FALS=
E))
+ ((or "quiet" "q") (set! %quiet-mode #t))
+ ((or "preserve" "p") (sch2pcb_set_preserve TRUE))
+ ((or "use-files" "f") (sch2pcb_set_force_element_files TRUE))
+ ((or "skip-m4" "s") (set! %use-m4 #f))
+ ((or "elements-dir" "d")
(let ((elements-dir (expand-env-variables value)))
(when (> (sch2pcb_get_verbose_mode) 1)
(format #t
"\tAdding directory to file element directory list: ~=
A\n"
elements-dir))
(sch2pcb_element_directory_list_prepend (string->pointer elemen=
ts-dir))))
- ("output-name" (set! %schematic-basename value))
+ ((or "output-name" "o") (set! %schematic-basename value))
("schematics" (add-multiple-schematics *value))
("m4-pcbdir" (set! %m4-pcb-dir value))
("m4-file"
--==_Exmh_1679311409_3450--
- Raw text -