guile-devel
[Top][All Lists]
Advanced

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

Re: make-c-struct and pointer->string


From: David Pirotte
Subject: Re: make-c-struct and pointer->string
Date: Thu, 28 Mar 2019 12:48:25 -0300

Hi Amirouche,

I should add to your own answer that you actually were unable to reproduce the
problem while using the latest 2.2 release tarball (the one that Ubuntu 
packages to
be (even) more precise), as one can see on your gnome paste earlier today [1]

So, if this is corect, there must be a commit out there that 'broke it'

Cheers,
David

        here below, a copy/paste of
        https://paste.gnome.org/pbm5ok3pd#line-7
        [ not sure how long gnome pastes remains visible ..

        [ in the paste below, which is not mine, I have no idea why, starting 
from
        [ line 15, guile entered a raised exception mode

[1]     amirouche  ~  12:59:20  guile
GNU Guile 2.2.4
Copyright (C) 1995-2017 Free Software Foundation, Inc.
 
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
 
Enter `,help' for help.
scheme@(guile-user)> (use-modules (system foreign))
scheme@(guile-user)> (define str-1 (string->pointer "Hello"))
scheme@(guile-user)> (define str-2 (string->pointer "there!"))
scheme@(guile-user)> (make-c-struct (list '* '*) (list str-1 str-2))
$1 = #<pointer 0x55f30df62dd0>
scheme@(guile-user) [1]> (parse-c-struct $1 (list '* '*))
$2 = (#<pointer 0x55f30de21510> #<pointer 0x55f30de21f90>)
scheme@(guile-user) [1]> str-1
$3 = #<pointer 0x55f30de21510>
scheme@(guile-user) [1]> (map pointer->string $2)
$4 = ("Hello" "there!")
scheme@(guile-user) [1]> (make-c-struct (list '* '*) (list (string->pointer 
"hello
 ") (string->pointer "there!"))) $5 = #<pointer 0x55f30e235aa0>
scheme@(guile-user) [1]> (parse-c-struct $5 (list '* '*))
$6 = (#<pointer 0x55f30de25e80> #<pointer 0x55f30de26a30>)
scheme@(guile-user) [1]> (map pointer->string $6)
$7 = ("hello " "there!")
scheme@(guile-user) [1]> (make-c-struct (list '* '*) (list (string->pointer 
"hello")
 (string->pointer "there!"))) $8 = #<pointer 0x55f30e076470>
scheme@(guile-user) [1]> (parse-c-struct $8 (list '* '*))
$9 = (#<pointer 0x55f30de28020> #<pointer 0x55f30de28bd0>)
scheme@(guile-user) [1]> (map pointer->string $9)
$10 = ("hello" "there!")
scheme@(guile-user) [1]> (make-c-struct (list '* '*) (list (string->pointer 
"hello")
 (string->pointer "there!"))) $11 = #<pointer 0x55f30e0453e0>
scheme@(guile-user) [1]> (parse-c-struct $11 (list '* '*))
$12 = (#<pointer 0x55f30de2a170> #<pointer 0x55f30de28bd0>)
scheme@(guile-user) [1]> (map pointer->string $12)
$13 = ("hello" "there!")
scheme@(guile-user) [1]>
Posted by Anonymous at 28 Mar 2019, 12:33:15 UTC Language: scheme • Views: 4
© The GNOME Project

GNOME Pastebin. Hosted by Red Hat. Powered by Sticky Notes © 2014 Sayak 
Banerjee.

Attachment: pgp92Gt2mzrUQ.pgp
Description: OpenPGP digital signature


reply via email to

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