Re: Physical processes modeling --- libs recommendations?

2018-03-09 Thread Araq
We have a github repo that is dedicated for tracking these things: [https://github.com/nim-lang/needed-libraries/issues?q=is%3Aissue+is%3Aclosed](https://github.com/nim-lang/needed-libraries/issues?q=is%3Aissue+is%3Aclosed)

Re: Full nimble support for gintro package (high level GTK3 GUI) available

2018-03-09 Thread Stefan_Salewski
Well, basically we can use Vte. Have just hacked together a minimal test: # https://vincent.bernat.im/en/blog/2017-write-own-terminal import gintro/[gtk, glib, gobject, gio, vte] var cmd: array[2, cstring] = ["/bin/bash".cstring, cast[cstring](0)] proc

Physical processes modeling --- libs recommendations?

2018-03-09 Thread Udiknedormin
Hi folks! I've been more or less active on forum for quite a long time but to tell you the truth, I haven't really used Nim for any "serious" stuff. Now when I started Physical Processes Modeling course as a part of my studies, a friend of my asked me: "Will you use Matlab or Python?". It was

Re: c2nim fails for struct with function pointer containing reference argument, how to convert manually?

2018-03-09 Thread cmc
If you include the header in the top of the generated file, wouldn't you have two structs, causing a "redefinition of 'struct Foo'" error? \--- begin of file --- #foo.h code struct foo... # original from header #generated code struct foo... # generated from type statement

Re: How to rewrite this C++ code to Nim properly

2018-03-09 Thread boia01
I think you could find inspiration in the implementation of BitSets and IntSets since they both do low-level bit manipulation and operate on arrays of bytes. BitSets have a fixed memory size while IntSets are dynamically allocated/resized and use refs (GC'ed memory).

Re: "multiple definition" Problem

2018-03-09 Thread DTxplorer
I solved this by adding the "stb_image.nimble" file in my project folder (I had just the "stb_image" folder). I haven't the motivation to investigate what happened exactly, but anyway, that works.

Re: How do I read BMP file header directly to type?

2018-03-09 Thread Parashurama
You should probably also use the `packed` pragma on your type since depending on platform and compiler there could be some padding between the fields of your struct. (ex: between signature and size )

Re: How to cross-compile a Nim executable for Android

2018-03-09 Thread mashingan
Thank you, I did different approach. I followed from this stackoverflow thread about cross compiling

Re: How do I read BMP file header directly to type?

2018-03-09 Thread Araq
Certainly, but you need to assign to `result`: proc loadBitmapFileHeader*(bitmap: Bitmap, file: FileStream): BitmapFileHeader = static: doAssert(cpuEndian == littleEndian) discard file.readData(result.addr, 14) bitmap.fileHeader = result

Re: How to rewrite this C++ code to Nim properly

2018-03-09 Thread mashingan
The use of `ptr` in Nim is always not safe. For pointer math operation, check this post: [https://forum.nim-lang.org/t/1188#7366](https://forum.nim-lang.org/t/1188#7366) If it's sequence of bytes, you can use `seq[Byte]` or simply use `cstring` together with `cast`

Re: The Nim way to do this

2018-03-09 Thread jzakiya
Thanks! Where in the docs are these methods?

Re: The Nim way to do this

2018-03-09 Thread JohnS
let primes = [7, 11, 13, 17, 19, 23, 29, 31] #1 if 7 in primes: echo("Found it!") #2 echo primes.find(13) I don't think count does what you think it does. According to [the docs](https://nim-lang.org/docs/sequtils.html#count,openArray%5BT%5D,T) it "Returns

The Nim way to do this

2018-03-09 Thread jzakiya
I've looked through the docs but haven't found the answer to this. I have an array of integers (prime numbers) and I want to: 1) determine if some number is included in the array and 2) return the index value of the number in the array. In Ruby/Crystal I can do the following. What are the