World: r3wp
[Red] Red language group
older newer | first last |
Kaj 1-Feb-2012 [4700x2] | Oldes, wrap it in a struct. I call those references |
If you mean a pointer to the string payload, that's what a c-string already is | |
Ladislav 1-Feb-2012 [4702] | I guess R3 is 2-byte head and 10-byte payload. - that is a wrong guess |
amacleod 1-Feb-2012 [4703] | Raspberrypi shipping any day now! http://www.raspberrypi.org/Lets see Red on it! |
PeterWood 1-Feb-2012 [4704] | Oldes: A c-string is a byte-ptr!. It can be cast to an int-ptr! if needed. |
Dockimbel 2-Feb-2012 [4705] | Kaj: I cannot compile GTK+ examples anymore using the latest GTK+ binding version...Where can I find the missing GLib.reds file? |
PeterWood 2-Feb-2012 [4706] | Here http://red.esperconsultancy.nl/Red-GLib/info/12c18cb30c? |
Dockimbel 2-Feb-2012 [4707x2] | Thanks Peter. |
Kaj: I gave a new try on making the GTK+ binding work on Linux/ARM, I was able to track the crash up to the call to `gtk-append-container` from `gtk-window` function. The argument values passed are: window: 0006C000 value: 12 which results in a Runtime Error 1: access violation (segfault) | |
Oldes 2-Feb-2012 [4709x2] | Kaj: my problem is, that I have a routine: MagickRelinquishMemory which should release memory from routines where some returns c-string, and some for example pointer to array values... So the best would be to accept pointer! with MagickRelinquishMemory, but still to be able return just c-string from some routines, if you understand me. I know there are workarounds, but it could be quite simple |
What about implementing any-pointer! type? | |
Dockimbel 2-Feb-2012 [4711] | Oldes: why can't use simply use type casting when required? |
Oldes 2-Feb-2012 [4712] | and is it possible to cast pointer from c-string? |
Dockimbel 2-Feb-2012 [4713x2] | Sure: p: declare int-ptr! s: as c-string! p ;-- or use `as-c-string` defined |
You can freely cast any pointer type to any other pointer type (struct and c-string are part of any-pointer! internal typeset). | |
Oldes 2-Feb-2012 [4715x2] | I would prefere to be able simply define: MagickRelinquishMemory: "MagickRelinquishMemory" [return: [any-pointer!]] which would accept c-string!, struct!, pointer! [byte!], pointer! [integer!] etc.. |
sorry.. MagickRelinquishMemory: "MagickRelinquishMemory" [resource [any-pointer!]] | |
Dockimbel 2-Feb-2012 [4717x2] | You can already have it: #define any-pointer! byte-ptr! |
Ah you want implicit casting...sorry. | |
Oldes 2-Feb-2012 [4719] | But it's true I can use: MagickRelinquishMemory as-c-string query where query is an array... just it's not so clear |
Dockimbel 2-Feb-2012 [4720x2] | You should rather use byte-ptr! (which is more "generic" than c-string!) as return type for MagickRelinquishMemory and cast values to byte-ptr! when required. |
Pull request #201: Oldes, thank you very much for your changes. It should be ok now for merging, I will just run a few more tests before that. | |
Kaj 2-Feb-2012 [4722x5] | Oldes, I had the same problem as you with the generic memory freeing routine in the C library, so I use this define: |
#define free-any [free as-binary ] | |
Which uses this in turn: | |
#define binary! [pointer! [byte!]] #define as-binary [as binary! ] | |
Instead of pointer! [byte!] you could use byte-ptr! now, as Doc said | |
Dockimbel 2-Feb-2012 [4727x2] | Enumeration branch from Oldes merged to float-partial branch. Thank to Oldes for this nice addition and quality work! |
I will update the language spec document to include #enum description. | |
Kaj 2-Feb-2012 [4729x3] | Kaj: I gave a new try on making the GTK+ binding work on Linux/ARM, I was able to track the crash up to the call to `gtk-append-container` from `gtk-window` function. The argument values passed are: window: 0006C000 value: 12 which results in a Runtime Error 1: access violation (segfault) |
Here's the code line: | |
gtk-append-container as gtk-container! window as gtk-widget! value | |
Dockimbel 2-Feb-2012 [4732] | Also, with this contribution comes an ImageMagick library binding! |
Kaj 2-Feb-2012 [4733x2] | Cool :-) |
value is supposed to be a widget object, so the 12 is bogus | |
Dockimbel 2-Feb-2012 [4735] | Good! At least we have a clue to follow. |
Kaj 2-Feb-2012 [4736] | What's the source code that generates this? |
Dockimbel 2-Feb-2012 [4737] | gtk-view label "Hello, Red/System GTK+ world!" |
Kaj 2-Feb-2012 [4738x3] | The code is executed in this case: |
either any-struct? type [ either as-logic value [ | |
That's correct, because the label generates the widget object to be added to the window container | |
Dockimbel 2-Feb-2012 [4741] | Right, I've added a lot of debug logs to GTK to follow the calls...(the planned stack trace feature for Red/System is climbing in priority) |
Kaj 2-Feb-2012 [4742x3] | So type seems to be correct, but value is not the label object. At a guess, could value = type ? |
They're set like this, so I expect a bug there: | |
type: list/type value: list/value | |
Dockimbel 2-Feb-2012 [4745] | Right, I need to check the generated code for that part... |
Kaj 2-Feb-2012 [4746] | Guessing further, did you maybe swap type and value in the struct when adding 64 bits floats? |
Dockimbel 2-Feb-2012 [4747x3] | Yes I have, but the bug is older than that change. |
And the swapping should be transparent. | |
I think there's definitely a stack offsetting bug in the ARM backend for typed/variadic functions. | |
older newer | first last |