Re: Best way to convert sequence of bytes to uint32

2016-11-19 Thread jlindsay
Ar, I believe that I do need the seq since I am reading the bytes in from a file. lucian, your solution looks quite interesting. I'll have to explore this option further. Thanks.

Converting a nim string to a ptr GlChar

2016-11-19 Thread def_pri_pub
Right now I'm trying to get a simple OpenGL ES example working with Nimious' GL ES bindings. I'm hitting a bit of a wall when trying to get the proc glShaderSource() to accept my shader's source code (which is gotten through the readFile() proc, which outputs a nim string). Here is a link to tha

Re: "Error: expression has no address" issue with an array type

2016-11-19 Thread def_pri_pub
Oh, did not know that. Thanks! I didn't find any mention of that in the Nim manual, it might be something to add here: [http://nim-lang.org/docs/manual.html#statements-and-expressions-the-addr-operator](http://forum.nim-lang.org///nim-lang.org/docs/manual.html#statements-and-expressions-the-addr-

Re: Best way to convert sequence of bytes to uint32

2016-11-19 Thread lucian
I think this question has popped before. I have used [http://nim-lang.org/docs/endians.html](http://forum.nim-lang.org///nim-lang.org/docs/endians.html). Just get the generic pointers to source and target and pass them to the standard lib, that will do. Something along these lines:

Re: templates generated from an enum?

2016-11-19 Thread Arrrrrrrrr
This is an example using macros: import macros, strutils macro def*(myEnum: untyped): untyped = result = newStmtList() add result, myEnum # StmtList # TypeSection # 0 # TypeDef # 0 0 # Ident !"Level

Re: Best way to convert sequence of bytes to uint32

2016-11-19 Thread Arrrrrrrrr
The dereferencing is necessary because is interpreting the address of s[p] as a pointer of uint32. Also, if you don't actually need a sequence, just use plain arrays. doAssert 257u == cast[uint32]([1u8, 1, 0, 0])

Re: gtk_entry_get_buffer

2016-11-19 Thread Arrrrrrrrr
Unless i'm mistaken, the nimble package uses the version 2.0: when defined(win32): const lib = "libgtk-win32-2.0-0.dll" elif defined(macosx): const lib = "(libgtk-quartz-2.0.0.dylib|libgtk-x11-2.0.dylib)" # linklib gtk-x11-2.0 # linklib gdk

Re: gtk_entry_get_buffer

2016-11-19 Thread Stefan_Salewski
gtk_entry_get_buffer() is available since GTK 2.18 only. When you try to add that declaration inside your own module, of course you have to ensure that const lib is set to valid library name. That may be not easy, because const lib may be not exported from GTK2 module. Maybe try to patch that m

Re: "Error: expression has no address" issue with an array type

2016-11-19 Thread Arrrrrrrrr
You can do it with unsafeAddr. When you declare variables with the keyboard let, you are telling the compiller that you want to protect it against any change. And having its address can potentially alter the variable.

Re: "Error: expression has no address" issue with an array type

2016-11-19 Thread def_pri_pub
Alright, I figured out my own solution. I had to change that let points to a var points. Can I get some insight into why I can't call addr on a let'd variable?

gtk_entry_get_buffer

2016-11-19 Thread geezer9
The web page: **https://developer.gnome.org/gtk2/stable/GtkEntry.html** shows the procedure **gtk_entry_get_buffer** being declared. However this is not in the nimble package **gtk2-1.1/gtk.nim** and when I try to add this declaration: > proc get_buffer*(entry: PEntry): PTextBuffer{.cdecl, >

"Error: expression has no address" issue with an array type

2016-11-19 Thread def_pri_pub
Right now I'm trying to do a very tiny OpenGL in nim. I'm at the stage where I need to bind my buffer data. The compiler is giving me this error: Error: expression has no address Here is the C code I'm trying to port: float points = [ 0.0, 0.5, 0.0, 0