Re: gEDA-user: An opportunity to fix the symbol library
Kai-Martin: Stephen Trier wrote: Kai, try (component-library-search/home/..snip../symbols Unfortunately, it works only for the first layer. Symbols in ../symbols/analog/diode are still ignored. In other words: gschem does not descend recursively into sub dirs. If you are brave, you can try the attached patch. Regards, /Karl Hammar --- Aspö Data Lilla Aspö 148 S-742 94 Östhammar Sweden +46 173 140 57 diff --git a/libgeda/src/g_rc.c b/libgeda/src/g_rc.c index e287da7..588a582 100644 --- a/libgeda/src/g_rc.c +++ b/libgeda/src/g_rc.c @@ -541,13 +541,14 @@ SCM g_rc_component_library_funcs (SCM listfunc, SCM getfunc, SCM name) * \param [in] path * \return SCM_BOOL_T on success, SCM_BOOL_F otherwise. */ -SCM g_rc_component_library_search(SCM path) -{ +int C_g_rc_component_library_search(gchar *string, gchar *name, GRegex *regex); +SCM g_rc_component_library_search(SCM path) { gchar *string; char *temp; - GDir *dir; - const gchar *entry; - + int ix; + const char pattern[] = \\.sym$; + GRegex *regex; + SCM_ASSERT (scm_is_string (path), path, SCM_ARG1, component-library-search); @@ -556,13 +557,29 @@ SCM g_rc_component_library_search(SCM path) string = s_expand_env_variables (temp); free (temp); + regex = g_regex_new (pattern, G_REGEX_CASELESS | G_REGEX_OPTIMIZE, 0, NULL); + ix = C_g_rc_component_library_search(string, NULL, regex); + g_regex_unref (regex); + + g_free(string); + + if (ix 0) return SCM_BOOL_F; + else return SCM_BOOL_T; +} + +int C_g_rc_component_library_search(gchar *string, gchar *name, GRegex *regex) +{ + GDir *dir; + const gchar *entry; + int have_sym = 0; + /* invalid path? */ if (!g_file_test (string, G_FILE_TEST_IS_DIR)) { fprintf (stderr, Invalid path [%s] passed to component-library-search\n, string); -g_free(string); -return SCM_BOOL_F; +//g_free(string); +return -1; } dir = g_dir_open (string, 0, NULL); @@ -570,37 +587,48 @@ SCM g_rc_component_library_search(SCM path) fprintf (stderr, Invalid path [%s] passed to component-library-search\n, string); -g_free(string); -return SCM_BOOL_F; +//g_free(string); +return -1; } while ((entry = g_dir_read_name (dir))) { /* don't do . and .. and special case font */ -if ((g_strcasecmp (entry, .)!= 0) -(g_strcasecmp (entry, ..) != 0) -(g_strcasecmp (entry, font) != 0)) -{ +if ((g_strcasecmp (entry, .)== 0) +(g_strcasecmp (entry, ..) == 0) +(g_strcasecmp (entry, CVS) == 0) +(g_strcasecmp (entry, font) == 0)) continue; + +if ( g_regex_match (regex, entry, 0, NULL) == TRUE ) { + have_sym++; +} else { gchar *fullpath = g_build_filename (string, entry, NULL); + gchar *entry_name; + + if (name == NULL) entry_name = g_strconcat(cvs_, entry, NULL); + else entry_name = g_strconcat(name, _, entry, NULL); if (g_file_test (fullpath, G_FILE_TEST_IS_DIR)) { if (g_path_is_absolute (fullpath)) { - s_clib_add_directory (fullpath, NULL); + if (C_g_rc_component_library_search(fullpath, entry_name, regex) 0) + s_clib_add_directory (fullpath, entry_name); } else { gchar *cwd = g_get_current_dir (); gchar *temp; temp = g_build_filename (cwd, fullpath, NULL); - s_clib_add_directory (temp, NULL); + if (C_g_rc_component_library_search(temp, entry_name, regex) 0) + s_clib_add_directory (temp, entry_name); g_free(temp); g_free(cwd); } } g_free(fullpath); + g_free(entry_name); } } - g_free(string); + //g_free(string); - return SCM_BOOL_T; + return have_sym; } /*! \todo Finish function description!!! ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: An opportunity to fix the symbol library
On May 21, 2011, at 8:30 PM, Kai-Martin Knaak wrote: Unfortunately, gschem does not descend into subdirectories. So you have to give each and every dir in the config. Ah, but it can. I've been using lines like: (component-library-search Components) for years in my gafrc files. Components is a directory containing directories of symbols. I can't remember where I learned about this. 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: An opportunity to fix the symbol library
John Doty wrote: On May 21, 2011, at 8:30 PM, Kai-Martin Knaak wrote: Unfortunately, gschem does not descend into subdirectories. So you have to give each and every dir in the config. Ah, but it can. I've been using lines like: (component-library-search Components) for years in my gafrc files. Just tried again and it didn't work on on my box. I tried this line: (component-library /home/kmk/geda/gedasymbols/www/user/kai_martin_knaak/symbols) In the choose-Dialog of gschem this got me none of the symbols in the various directories beyond .../symbols . Maybe a setting in system-gafrc or system-gschemrc? ---)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: An opportunity to fix the symbol library
It worked for me in gschem 1.6.1.20100214. Thanks for the tip, John! Kai, try (component-library-search /home/kmk/geda/gedasymbols/www/user/kai_martin_knaak/symbols) instead of (component-library ...). Stephen ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: An opportunity to fix the symbol library
Stephen Trier wrote: Kai, try (component-library-search Oh, now I see! Must have been blind before. I'll add this to the wiki and to the tutorial, too. ---)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: An opportunity to fix the symbol library
On May 23, 2011, at 7:30 AM, Kai-Martin Knaak wrote: (component-library-search Components) Just tried again and it didn't work on on my box. I tried this line: (component-library /home/kmk/geda/gedasymbols/www/user/kai_martin_knaak/symbols) ^ Should be: (component-library-search /home/kmk/geda/gedasymbols/www/user/kai_martin_knaak/symbols) 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: An opportunity to fix the symbol library
Stephen Trier wrote: Kai, try (component-library-search/home/..snip../symbols Unfortunately, it works only for the first layer. Symbols in ../symbols/analog/diode are still ignored. In other words: gschem does not descend recursively into sub dirs. ---)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: An opportunity to fix the symbol library
Feel free to post a tarball or other installer, so that the users can replace geda's library with yours. John Luciani did that on his site, you can do it on gedasymbols if you want. Make it a copy of the library you actually use, doesn't require much work, just make it available to others. Is there any chance of tarring up -all- of the the symbols and footprints on gedasymbols.org? For all but the largest pin-count chips, I find manually searching for components takes longer than just creating them from scratch. Regards, Tom Pope ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: An opportunity to fix the symbol library
Tom Pope wrote: Is there any chance of tarring up -all- of the the symbols and footprints on gedasymbols.org? You can do a wholesale anonymous cvs download. While this is technically not a tar ball, it serves the same purpose to create copy of the repository on the local hard disk. As an added benefit, you can cvs update later to, well, update your local copy of the repository. Details on cvs access are given on this page: http://www.gedasymbols.org/cvs.html ---)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: An opportunity to fix the symbol library
Ales: Kai-Martin Knaak, [snip] No size fits all. That does not preclude improvement over the current situation. DJ and I are asking you to improve the current situation by creating, distributing, and maintaining a better default symbol library than the one that is currently shipped with gEDA/gaf. I already have checked out cvs.gedasymbols.org, how do I integrate it withing gschem and pcb? Regards, /Karl Hammar --- Aspö Data Lilla Aspö 148 S-742 94 Östhammar Sweden +46 173 140 57 ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: An opportunity to fix the symbol library
Karl Hammar wrote: I already have checked out cvs.gedasymbols.org, how do I integrate it withing gschem and pcb? Let the config files point to where your preferred symbols and footprints are stored. Unfortunately, gschem does not descend into subdirectories. So you have to give each and every dir in the config. Snippet from my $HOME/.gEDA/gafrc: / ; Allow to source symbols from the local copy of geda-symbols (define gedasymbols /home/kmk/geda/gedasymbols/www/user/kai_martin_knaak/symbols) (component-library (build-path gedasymbols titleblock)) (component-library (build-path gedasymbols power)) (component-library (build-path gedasymbols misc)) (component-library (build-path gedasymbols digital)) (component-library (build-path gedasymbols connector)) (component-library (build-path gedasymbols block)) (component-library (build-path gedasymbols analog/diode)) (component-library (build-path gedasymbols analog)) \- When searching for footprint files, gnetlist does descend into subdirs. So you only need to give the path of the top dir of the footprints. For some reason xgsch2pcb does not read the footprint search path from gafrc files (maybe I did not understand how to set it up properly). I tell it about my preferred footprints with an option in the project file. A project file of mine looks like this: /-- schematics pidpeltier.sch output-name pidpeltier elements-dir /home/kmk/geda/footprints skip-m4 use-files \-- Note, that this still falls back to the default lib of footprints if a search at the path given by elements-dir fails. I found no way to disable this potentially detrimental fall-back short of moving the default lib out of sight. Also note, that there can be only one elements-dir. (Please enlighten me, if there is a way to give more) If you want to browse the local footprints in PCB, you can tell the GUI where to look for them. From $HOME/.pcb/preferences / library-newlib = ~/geda/footprints:/usr/local/lib/luciani:./packages:. \ The path ~/geda/footprints is a symlink to my section of the local gedasymbols repository. This search path can be set in the GUI of PCB in the preferences dialog. I am not sure, where the import function of PCB can be configured. Last time I checked, it seemed to use the paths given in $HOME/.pcb/preferences But schematic import did not play nice with hierarchical layout. So I still stick with gsch2pcb. ---)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: An opportunity to fix the symbol library
I am not sure, where the import function of PCB can be configured. Last time I checked, it seemed to use the paths given in $HOME/.pcb/preferences It uses PCB's internal paths, yes, so whatever works in the Window-Library dialog works for import. But schematic import did not play nice with hierarchical layout. hmmm... it uses gnetlist still, should do the same as gsch2pcb. ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: An opportunity to fix the symbol library
Ales Hvezda wrote: The symbols in the current default lib fail for both. Why don't you use gedasymbols.org to show us how you would fix the current gEDA/gaf shipped symbol library. In a way, I already do ;-) See my section at gedasymbols.org. Of course, the actual choice of components was guided by the kind of projects I do. And I did not strive for completeness beyond what I actually need. Create your ideal library, IMHO, we all agree, that there is no such thing in a general sense. No size fits all. That does not preclude improvement over the current situation. no limits, or restrictions. Also, feel free to use as much disk space on gedasymbols.org (I have explicit permission from DJ) as you need. Size wouldn't be an issue, anyway. In fact, I believe, the default libs should be cut down to essentials -- Few instances, but excellent quality, ready to use. Given the availability of gedasymbols.org, there is no point to have several GND symbols and three kinds of BC247. Such a lib can act as a starting point for first projects and for a localized set of libs. Let people know it exists, use it, and comment on it. Then, we can compare your symbol library to the broken shipped symbol library and see if it makes sense to switch. I consider to bite... ---)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: An opportunity to fix the symbol library
In a way, I already do ;-) See my section at gedasymbols.org. Feel free to post a tarball or other installer, so that the users can replace geda's library with yours. John Luciani did that on his site, you can do it on gedasymbols if you want. Make it a copy of the library you actually use, doesn't require much work, just make it available to others. Create your ideal library, IMHO, we all agree, that there is no such thing in a general sense. No size fits all. That does not preclude improvement over the current situation. Surely, you could come up with a library that at least fits *your* needs? ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: An opportunity to fix the symbol library
Kai-Martin Knaak, [snip] No size fits all. That does not preclude improvement over the current situation. DJ and I are asking you to improve the current situation by creating, distributing, and maintaining a better default symbol library than the one that is currently shipped with gEDA/gaf. -Ales ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user