Mail Archives: geda-user/2018/07/24/11:27:01
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 -