delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2018/07/24/11:27:01

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: <alpine.DEB.2.00.1807241715380.8169@igor2priv>
References: <CAGqyy=bsRdbA8r8q1MTX7pG9ASZiqpsw1-kbj=geTwLoWaz1sA AT mail DOT gmail DOT com> <20180723152807 DOT 13d27cadcd023b63aa3fd9c0 AT gmail DOT com> <CAGqyy=ZC68vU+8vpM4oai5=Mrfq_=QpyojzDwwW-50EV6P4q3A AT mail DOT gmail DOT com> <alpine DOT DEB DOT 2 DOT 00 DOT 1807231832560 DOT 8169 AT igor2priv>
<20180723174658 DOT 32979841DEBA AT turkos DOT aspodata DOT se> <alpine DOT DEB DOT 2 DOT 00 DOT 1807232013250 DOT 8169 AT igor2priv> <20180723195942 DOT 605CB841DEBA AT turkos DOT aspodata DOT se> <alpine DOT DEB DOT 2 DOT 00 DOT 1807240343390 DOT 8169 AT igor2priv> <20180724145646 DOT 1253D841DEC6 AT turkos DOT aspodata DOT se>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
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


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.

- Raw text -


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