guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #define SOMETHING some_value


From: Amirouche Boubekki
Subject: Re: #define SOMETHING some_value
Date: Sat, 10 Jun 2017 09:51:46 +0000

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 <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]