X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Date: Tue, 24 Jul 2018 17:33:01 +0200 (CEST) X-X-Sender: igor2 AT igor2priv To: geda-user AT delorie DOT com X-Debug: to=geda-user AT delorie DOT com from="gedau AT igor2 DOT repo DOT hu" From: gedau AT igor2 DOT repo DOT hu Subject: lihata in perl (was Re: [geda-user] Re: Project file) In-Reply-To: <20180724145646.1253D841DEC6@turkos.aspodata.se> Message-ID: References: <20180723152807 DOT 13d27cadcd023b63aa3fd9c0 AT gmail DOT com> <20180723174658 DOT 32979841DEBA AT turkos DOT aspodata DOT se> <20180723195942 DOT 605CB841DEBA AT turkos DOT aspodata DOT se> <20180724145646 DOT 1253D841DEC6 AT turkos DOT aspodata DOT se> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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 Precedence: bulk On Tue, 24 Jul 2018, karl AT aspodata DOT se wrote: > Igor2: >> On Mon, 23 Jul 2018, karl AT aspodata DOT se wrote: > ... >>> I guess it is this: >>> http://repo.hu/projects/pcb-rnd/developer/lihata_format/tree.html#/lht_tree_doc/roots/geda-project-v1 >> >> Yes, that one. > ... > > Is there any support for reading that kind of file from perl ? > I could perhaps make a script that generates gafrc etc. files > from it, it could be useful that way, and for my own small scripts. Not yet. However it wouldn't be too hard to do (contribution is welcome!). Liblihata is implemented in 2 main layers (both in plain C89): - a tiny stream parser (if you know libexpat, it's similar in domain); the API consists of 4 functions total; this is enough if you want to parse the format then store/process the data however you want - a much bigger, optional high level 'dom' part (if you know libxml2, it's similar in domain), that can run the low level and build an in-memory tree of hashes and lists for you; this is useful if you want to traverse a tree forth-and-back but you don't want to build it youself or if you want ready-to-use tree split/merge/grow/cut functionality. Now the bindings: We have a php binding for the low level part and some php code in the same lib that builds high level trees of the data within php. We also have a fungw binding for (some parts of) the high level. How to go from this to perl: - In theory it would be possible to write a small executable that uses the fungw binding together with any scritping language fungw supports (includes perl). The main risk is that this binding didn't get _any_ testing yet. You are welcome to test and extend this code. - Alternatively you can write a perl binding for the low level lihata lib from scratch; with 4 calls to cover, it probably won't be large (the php binding+lib+tests+examples is 460 sloc total), and most of the ideas and some generator scripts could be copied from the php binding. Regards, Igor2 P.S. of course this all is true not only for perl but for any other language as well. The lihata project is as open and as simple as the pcb-rnd project: you say you want to work on a binding to your favorite scripting lang, you get svn write access and support.