Re: Its a simple fix.

2017-06-21 Thread Hawkeye
Thank you all for the replies. The only reason they where returning strings was because It was a place holder I didn't think I could define a proc with out it actually containing something. I am coming from python and still transitioning so I was using python logic and was abit off I see. I see

Re: echo proper string in different consoles?

2017-06-21 Thread Tiberium
There's a simpler way to change the codepage import os discard execShellCmd("chcp 936")

Re: Isola game

2017-06-21 Thread Stefan_Salewski
> Is Nim enough mature for let a nim-newbie do that Nim is fine for that task. When you can do it in any other language, then doing it in Nim is no problem. When you have no idea how to do it at all, then it may take some time. A GTK3 board can be done with a few lines of code, for example see

Re: progress while binding libxl

2017-06-21 Thread oyster
thanks, and I found echo type("text") is string

Re: Its a simple fix.

2017-06-21 Thread zolern
I am just curious why chrome and doc procedures return strings. If you not need result of these procedures just not set type of return value. And yes, if you need these strings you should use them or discard them. And if you want to echo result of procedures I can suggest a variant with "case"

Isola game

2017-06-21 Thread swalf
Hi everybody, I'm very new in Nim and I would have a chance to try it. My idea is to implement a simple interface for an [isola-game](https://en.wikipedia.org/wiki/Isola_%28board_game%29) engine in Nim. Maybe in the future I could work for the AI of the engine but for now I think that it can

Re: progress while binding libxl

2017-06-21 Thread Stefan_Salewski
Sorry, no idea for your widecstring and unicode questions. How is that handled from C? Your cint conversion should be not necessary, the compiler will pass int literals correctly to library functions, so xlSheetWriteStrW(sheet, 2, 1, #xlSheetWriteStrW(sheet, cint(2), cint(1),

Re: progress while binding libxl

2017-06-21 Thread oyster
this is what I get currently. Most functions in libxl can be exposed in the same way But something still puzzled me, or I have not know yet in nim: 1. for xlBookAddSheetW, the last arg is SheetHandle initSheet actually. But I used int. How to cast a number to SheetHandle? 2. how to judge

Re: diagnosing GC safety warnings

2017-06-21 Thread Araq
Annotate the forwarded proc with `{.gcsafe.}`.

Re: Its a simple fix.

2017-06-21 Thread gokr
There are two errors one can say. First of all, you call chrome() and doc() but you don't do anything with the string that they return. Add echo before like echo chrome() at least. Secondly, the procs don't actually return the string, you just create a local var x and assign it, but you forgot

Re: Its a simple fix.

2017-06-21 Thread Stefan_Salewski
Well your proc chrome() returns a string. In Nim returned values are not silently discarded by default, unless you apply discardable pragma to the proc. So you can write in your code echo chrome() var myStr = chrome() discard chrome() Or, if you really intent to

Re: progress while binding libxl

2017-06-21 Thread Stefan_Salewski
> So I started this binding work on June 18th 2017. While c2nim does a very good job in binding generation, it is helpful if one has some C knowledge and additional has a basic understanding of the library to wrap, because it can be hard to guess what C header files really intent.

Its a simple fix.

2017-06-21 Thread Hawkeye
Cant for the life of me figure it out. Probably doesn't help I am little new to this. I know its simple but I cant see it. Help would be appreciated. Sorry in advance for the newbyness. import os, iup #Super Spy proc chrome(): string = var x: string

Re: progress while binding libxl

2017-06-21 Thread oyster
the first question, I translated typedef struct tagBookHandle * BookHandle; to type tagBookHandle* {.final, incompleteStruct, importc: "tagBookHandle".} = object BookHandle* {.importc: "BookHandle".} = ptr tagBookHandle Am I right?

progress while binding libxl

2017-06-21 Thread oyster
This post is related to [https://forum.nim-lang.org/t/2977/2](https://forum.nim-lang.org/t/2977/2), in which I said "For commercial products to read/write XLS/XLSX, I found [http://libxl.com/](http://libxl.com/)" So I started this binding work on June 18th 2017. However I am totally newbee in

diagnosing GC safety warnings

2017-06-21 Thread subsetpark
I have a nice long train of GC warnings, with the topmost one: /home/zax/.nimble/pkgs/magister-0.16.5/magister/game.nim(97, 6) Warning: 'initAvailabilityGame' is not GC-safe as it calls 'launchWorkers' [GcUnsafe2] However, I can't see any global variables being accessed in