www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2016/01/02/12:40:54

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 (debian 1:2.8.0~rc1-2) with nmh-1.5
X-Exmh-Isig-CompType: repl
X-Exmh-Isig-Folder: inbox
From: karl AT aspodata DOT se
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] should we broaden scope of libgeda
In-reply-to: <FDCB1EE7-7DD9-4C6F-A212-E1304BEC0E5F@noqsi.com>
References: <20160102091556 DOT BBC6D809D79B AT turkos DOT aspodata DOT se> <CAJXU7q_Zwyfpcb4g00QCFNTjQ9Le2Tm8WjKz3CKMnNXb7gMceg AT mail DOT gmail DOT com> <20160102131252 DOT F383A809D79A AT turkos DOT aspodata DOT se> <FDCB1EE7-7DD9-4C6F-A212-E1304BEC0E5F AT noqsi DOT com>
Comments: In-reply-to John Doty <jpd AT noqsi DOT com>
message dated "Sat, 02 Jan 2016 08:31:02 -0700."
Mime-Version: 1.0
Message-Id: <20160102174036.32CAB809D79A@turkos.aspodata.se>
Date: Sat, 2 Jan 2016 18:40:35 +0100 (CET)
X-Virus-Scanned: ClamAV using ClamSMTP
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

John Doty:
> On Jan 2, 2016, at 6:12 AM, karl AT aspodata DOT se wrote:
...
> > So currently, if I want to write an "get all syms that this sch file
> > referencs"-program I have to do it in c or don't use libgeda at all.
> > 
> > I thought that kind of program could be a nice way to learn a
> > little scheme, but the infrastructure wasn't there.
> 
> What does the gaf Scheme API look like?

$ ldd `which gaf ` | grep geda
        libgedacairo.so.1 => /usr/local/lib/libgedacairo.so.1 (0xb6ab9000)
        libgeda.so.43 => /usr/local/lib/libgeda.so.43 (0xb6a6b000)

where libgedacairo is for image generation.

///

geda-gaf/gaf/shell.c says:

...
 #include <libgeda/libgeda.h>
 #include <libgeda/libgedaguile.h>
...
 scm_boot_guile (argc, argv, cmd_shell_impl, NULL); /* Doesn't return */
...

///

libgeda/include/libgeda/libgedaguile.h
 * Scheme API public declarations and definitions.
 * \warning Don't include from libgeda.h: should only be included
 * by source files that need to use the Scheme API.

so this one seems to be for c programmers to acess scheme functions.

///

$ grep '^  { ' libgeda/src/g_register.c 
  { "eval-protected",           1, 1, 0, g_scm_eval_protected },
  { "eval-string-protected",    1, 0, 0, g_scm_eval_string_protected },
  { "component-library",        1, 1, 0, g_rc_component_library },
  { "component-library-command", 3, 0, 0, g_rc_component_library_command },
  { "component-library-funcs",  3, 0, 0, g_rc_component_library_funcs },
  { "source-library",           1, 0, 0, g_rc_source_library },
  { "source-library-search",    1, 0, 0, g_rc_source_library_search },
  { "world-size",               3, 0, 0, g_rc_world_size },
  { "reset-component-library",  0, 0, 0, g_rc_reset_component_library },
  { "reset-source-library",     0, 0, 0, g_rc_reset_source_library },
  { "scheme-directory",         1, 0, 0, g_rc_scheme_directory },
  { "bitmap-directory",         1, 0, 0, g_rc_bitmap_directory },
  { "bus-ripper-symname",       1, 0, 0, g_rc_bus_ripper_symname },
  { "attribute-promotion",       1, 0, 0, g_rc_attribute_promotion },
  { "promote-invisible",         1, 0, 0, g_rc_promote_invisible },
  { "keep-invisible",            1, 0, 0, g_rc_keep_invisible },
  { "always-promote-attributes",1, 0, 0, g_rc_always_promote_attributes },
  { "make-backup-files",        1, 0, 0, g_rc_make_backup_files },
  { "print-color-map", 0, 1, 0, g_rc_print_color_map },
  { "rc-filename",              0, 0, 0, g_rc_rc_filename },
  { "rc-config",                0, 0, 0, g_rc_rc_config },
  { NULL,                       0, 0, 0, NULL } };

so the above is available for gaf.

///

Scm files geda-gaf/libgeda/scheme seems to be available:

$ gaf shell
...
guile> (component-library "/home/karl")
#t
guile>
$

where geda.scm seems to be the useful one:

$ grep '^(define' geda.scm 
(define path-sep file-name-separator-string)
(define geda-data-path (car (sys-data-dirs)))
(define geda-rc-path (car (sys-config-dirs)))
(define (build-path first . rest)
(define regular-file?
(define directory?
(define has-suffix?
(define load-scheme-dir
(define* (component-library-search rootdir  #:optional prefix)
$

///

So it seems libgeda doesn't provide much at all.
gnetlist adds a few to the list

$ grep '^  { ' gnetlist/src/g_register.c 
  { "quit",                         0, 0, 0, g_quit },
  { "exit",                         0, 0, 0, g_quit },
  { "gnetlist-version",             1, 0, 0, g_rc_gnetlist_version },
  { "hierarchy-uref-mangle",        1, 0, 0, g_rc_hierarchy_uref_mangle },
  { "hierarchy-netname-mangle",     1, 0, 0, g_rc_hierarchy_netname_mangle },
  { "hierarchy-netattrib-mangle",   1, 0, 0, g_rc_hierarchy_netattrib_mangle },
  { "hierarchy-uref-separator",     1, 0, 0, g_rc_hierarchy_uref_separator },
  { "hierarchy-netname-separator",  1, 0, 0, g_rc_hierarchy_netname_separator },
  { "hierarchy-netattrib-separator", 1, 0, 0, g_rc_hierarchy_netattrib_separator },
  { "hierarchy-netattrib-order",    1, 0, 0, g_rc_hierarchy_netattrib_order },
  { "hierarchy-netname-order",      1, 0, 0, g_rc_hierarchy_netname_order },
  { "hierarchy-uref-order",         1, 0, 0, g_rc_hierarchy_uref_order },
  { "gnetlist:get-packages",        1, 0, 0, g_get_packages },
  { "gnetlist:get-non-unique-packages", 1, 0, 0, g_get_non_unique_packages },
  { "gnetlist:get-pins",            1, 0, 0, g_get_pins },
  { "gnetlist:get-all-nets",        1, 0, 0, g_get_all_nets },
  { "gnetlist:get-all-unique-nets", 1, 0, 0, g_get_all_unique_nets },
  { "gnetlist:get-all-connections", 1, 0, 0, g_get_all_connections },
  { "gnetlist:get-nets",            2, 0, 0, g_get_nets },
  { "gnetlist:get-pins-nets",       1, 0, 0, g_get_pins_nets },
  { "gnetlist:get-all-package-attributes", 2, 0, 0, g_get_all_package_attributes },
  { "gnetlist:get-toplevel-attribute", 1, 0, 0, g_get_toplevel_attribute },
  { "gnetlist:get-renamed-nets",    1, 0, 0, g_get_renamed_nets },
  { "gnetlist:get-attribute-by-pinseq",    3, 0, 0, g_get_attribute_by_pinseq },
  { "gnetlist:get-attribute-by-pinnumber", 3, 0, 0, g_get_attribute_by_pinnumber },
  { "gnetlist:vams-get-package-attributes", 1, 0, 0, vams_get_package_attributes },
  { "gnetlist:graphical-objs-in-net-with-attrib-get-attrib",
  { "gnetlist:get-backend-arguments", 0, 0, 0, g_get_backend_arguments },
  { "gnetlist:get-input-files",     0, 0, 0, g_get_input_files },
  { "gnetlist:get-verbosity", 0, 0, 0, g_get_verbosity },
  { NULL,                           0, 0, 0, NULL } };

but nothing that be used for an archive tool.

///

> A tricky part of doing gnetlist-like things in gschem is that gnetlist
> takes a global view of the thing you're netlisting (simulation,
> board, cell, Â…) while gschem takes a page-level view. Gnetlist
> knows, from its command line, exactly which pages are the top
> level pages representing the netlist. Gschem does not know which
> open pages represent what in any broad sense. One consequence of
> this is that broken hierarchy can throw gnetlist into an infinite
> loop (acceptable since ^C gets you out). Gschem  must avoid this,
> as recovery is trickier (open modified pages) and itÂ’s usually
> the tool youÂ’ll want to use to repair the problem. There are
> undoubtedly other ways where making gschem too smart about
> semantics would interfere with the ability to use it to fix a
> broken schematic.

Ahaa...

> For incorporating gschem-like things in gnetlist there are problems
> of navigation and hierarchy. Which U1 do you mean?

Isn't that what (hierarchy-uref-separator "/") is for ?

> The one on the current page? There is no current page.

But you have a top page, and there is some scanning code.
And while scanning the scan code has a "current page", though
that is not available for the scheme side.
The scanning seems be done in geda-gaf/gnetlist/src/s_traverse.c

> I donÂ’t know about anybody else, but I often have a crazy mishmash
> of pages open in gschem. Simulation “test fixtures”, pages from
> different boards (so I can look at both sides of interfaces),
> pages from different projects (how did I solve this last time?
> Can I copy/paste?), and often not a complete set of anything.
> Gnetlist-like processing is not sensible in that circumstance.

Ok.

> I like the idea of having more Scheme in the libgeda layer for
> gschem, gnetlist, and gaf to use, but I think the implementation
> of cross functionality is more difficult and prone to serious bugs
> than you might expect.

I didn't exspect anything so that sentence more true than you think:>

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57


- Raw text -


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