unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Amirouche Boubekki <amirouche.boubekki@gmail.com>
To: Catonano <catonano@gmail.com>, guile-user@gnu.org
Subject: Re: #define SOMETHING some_value
Date: Sat, 10 Jun 2017 09:51:46 +0000	[thread overview]
Message-ID: <CAL7_Mo_A-mh++n=Yy_yCG-haPdLBTpAwviqEXF3Ah-4JCp5vWQ@mail.gmail.com> (raw)
In-Reply-To: <CAJ98PDxa0zZtzbmuaBJHRiaQKxMkpLBHTkrDnsUppuS4kxzSKg@mail.gmail.com>

What I do is that I hardcode the define in scheme using simple define form

for instance, the following:

#define SOMETHING some_value

Becomes:

(define SOMETHING some_value)

I do that even for enums. But guile-squee has another point of view on this.



On Sat, Jun 10, 2017 at 10:31 AM Catonano <catonano@gmail.com> wrote:

> The Freexl documentation states that I should call freexl_get_info like
> this
>
> freexl_get_info(&handler, FREEXL_BIFF_SHEET_COUNT, &outcome);
>
> Now, FREEXL_BIFF_SHEET_COUNT is defined in the header file like this
>
> /** Information query for BIFF sheet count */
> #define FREEXL_BIFF_SHEET_COUNT        32010
>
> But at the REPL, when I call my procedure like this
>
> scheme@(freexl common)> (freexl-open "resources/Lavoro_P.xls")
> $1 = #<pointer 0x1227f50>
> scheme@(freexl common)> (freexl-get-info $1 32010)
>
> I get
>
> ERROR: Throw to key `get-info-error' with args `(error-code -3)'.
>
> That is, an exception is being raised, as you can see in this excerpt of my
> code
>
> (define freexl-get-info
>   (let* ((ptr     (freexl-func "freexl_get_info"))
>          (proc    (pointer->procedure int ptr (list '* unsigned-int '*))))
>     (lambda (handle-ptr what)
>       (let* ((outcome-ptr (bytevector->pointer (make-bytevector (sizeof
> unsigned-int))))
>          (result (proc handle-ptr what outcome-ptr)))
>     (if (not (= result 0))
>         (throw 'get-info-error 'error-code result) <-- THIS IS THE
> EXCEPTION BEING RAISED
>         outcome-ptr)
>     ))))
>
> How do I deal with these #define'd things ?
>
> I tried with both unsigned-int and uint16
>
> Thanks in advance
>


  reply	other threads:[~2017-06-10  9:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-10  8:31 #define SOMETHING some_value Catonano
2017-06-10  9:51 ` Amirouche Boubekki [this message]
2017-06-11 19:42   ` Mark H Weaver
2017-06-11 20:07     ` Matt Wette
2017-06-15 19:21     ` Matt Wette
2017-06-16 16:37       ` Catonano
2017-06-10 15:55 ` Matt Wette
2017-06-11 17:08   ` Catonano
2017-06-11 20:06     ` Mark H Weaver
2017-06-11 20:32       ` Catonano

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='CAL7_Mo_A-mh++n=Yy_yCG-haPdLBTpAwviqEXF3Ah-4JCp5vWQ@mail.gmail.com' \
    --to=amirouche.boubekki@gmail.com \
    --cc=catonano@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).