unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: guile-user@gnu.org
Subject: Re: Lepton EDA 1.9.14 announce and misc questions
Date: Tue, 20 Apr 2021 06:46:27 -0700	[thread overview]
Message-ID: <510bfaf9-aa4f-50cd-deb3-7a15247a9bfa@gmail.com> (raw)
In-Reply-To: <d7b2f619-a282-9e6a-f4a7-5cdd69862526@gmail.com>



On 4/20/21 5:47 AM, Matt Wette wrote:
>
>
> On 4/20/21 2:29 AM, Vladimir Zhbanov wrote:
>> Hi Guile users and devs,
>>
>> I'm the current maintainer of Lepton EDA suite, an about five year
>> old fork of geda-gaf with accent to moving more functionality to
>> Scheme code.  I'm not sure if it is acceptable to advertise it
>> here, please let me know if not.  I just know several Guix
>> packagers are reading this mailing list and would like to announce
>> a new version of Lepton, 1.9.14 has been released on April, 7:
>>
>> https://github.com/lepton-eda/lepton-eda/releases/tag/1.9.14-20210407
>>
>>
>
> Sweet.  Thanks for posting this.   I will take a look at your problem.
> It'll require digging into the eda_..._dirs function.
>
>
>
The following should work as a complete program on a system w/ glib.
You need to first convert the result to a bytevector and then access the
elements (pointers) one at a time.  Note that we don't know how big the
array returned from the C function is.  I pick an oversized value of 100.

(use-modules (system foreign))
(use-modules (rnrs bytevectors))

(define glib (dynamic-link "libglib-2.0"))

(define g-get-system-data-dirs
   (let ((f (pointer->procedure
         '* (dynamic-func "g_get_system_data_dirs" glib) (list)))
     (bv-pointer-ref (cond
              ((= (sizeof '*) 8) bytevector-u64-native-ref )
              ((= (sizeof '*) 4) bytevector-u32-native-ref )
              (else (error "hmmm"))))
     (BIG 100))
     (lambda ()
       (let* ((r (f))
          (p (pointer->bytevector r (* BIG (sizeof '*)))))
         (let loop ((ix 0))
           (let* ((ad (bv-pointer-ref p ix))
              (sp (make-pointer ad)))
         (if (equal? %null-pointer sp)
             '()
             (cons (pointer->string sp) (loop (+ ix (sizeof '*)))))))))))

(simple-format #t "~S" (g-get-system-data-dirs))




  reply	other threads:[~2021-04-20 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  9:29 Lepton EDA 1.9.14 announce and misc questions Vladimir Zhbanov
2021-04-20 12:47 ` Matt Wette
2021-04-20 13:46   ` Matt Wette [this message]
2021-04-20 23:36     ` Vladimir Zhbanov
2021-04-21  0:34       ` Matt Wette
2021-04-21  7:53         ` Vladimir Zhbanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=510bfaf9-aa4f-50cd-deb3-7a15247a9bfa@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).