Re: Compile Time Evaluation of Constants From C-Header Files

2017-08-29 Thread Araq
Minor change? Nim supports ~8 Posix-like OSes on ~5 different CPU architectures. I wrote a tool "detect.nim" to extract these values at build time (similar to what autoconf does) but it's not clear how to incorporate it into Nim's build system.

Re: Compile Time Evaluation of Constants From C-Header Files

2017-08-29 Thread ivanitto
Thanks Andreas. Would you consider such a minor change in stdlib as desirable?

Re: Compile Time Evaluation of Constants From C-Header Files

2017-08-29 Thread Araq
There is no solution but to patch posix.nim so that it knows the actual values for the popular OSes out there.

Re: Compile Time Evaluation of Constants From C-Header Files

2017-08-29 Thread ivanitto
Thank you @jlp765, I know about the static, but asking about a different thing: Is there a way in nim language to use values of S_IFREG and S_IFDIR in the 'of' clause of the 'case-of' statement? (for example, like in the post above)

Re: Compile Time Evaluation of Constants From C-Header Files

2017-08-29 Thread jlp765
Have a look at [static](https://nim-lang.org/docs/manual.html#statements-and-expressions-static-statement-expression) static: # compile time stuff here

Compile Time Evaluation of Constants From C-Header Files

2017-08-28 Thread ivanitto
Is there a way to make nim compiler to evaluate constants from C-header files at compile time? For example, symbols S_IFREG and S_IFDIR (from posix.nim <\- sys/stat.h) used in following code snippet: case x: of S_IFREG: echo "file" of S_IFDIR: echo "dir" else: