Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - AVC

#1
I've changed that line and recompiled. Bug solved! Thank you very much!
#2
Hello,



I love newLISP and I'm trying to use it for some graphics programming. So I'm writing a FFI module for the raylib library.



I've encountered an odd behavior of struct: If I define a 'struct' with one or more floats and pass it to 'pack', the float values are stored as zeroes. But surprisingly the same struct works well with 'unpack'. Here is an example:



(struct 'Vector2 "float" "float")

(pack Vector2 200 200) => returns "0000000000000000", which is wrong!

(pack "ff" 200 200) => returns "0000HC0000HC", which is what 'pack Vector2...' also should return

(unpack Vector2 (pack "ff" 200 200)) => returns (200 200) correctly!



I'm using newLISP 10.7.5 64-bit on Arch Linux with ffi and UTF-8 support enabled.



Is there a bug or am I doing something wrong?



Thanks in advance

Alfonso
#3
Hello,

is there a way to re-utilize a buffer created with "pack"? What I mean is:
[list=]
  • You create a buffer using "pack" with some values
  • [/list]

    [list=]
  • You keep the address of the buffer in a symbol (maybe a default functor) so it isn't deleted automatically
  • [/list]

    [list=]
  • You "repack" the existing buffer passing the symbol or the address stored in it, writing new values into the buffer, but without allocating new memory
  • [/list]

    I think this possibility would be useful f.eg. in working with C libraries that make heavy use of buffer pointers (OpenGL, SDL etc.) and could play nicely with "struct".

    Thanks and best regards

    Alfonso