Re: Need debugging help

2019-08-25 Thread napalu
Hi cdunn change your strlen wrapper in raptor_db.nim to proc strlen(a: var Headroom): int = let n = strlen(cast[cstring](a[0].addr)) echo " calc'd:", n return n Run You'll then get an assertion error in t_raptor_db.nim: : unhandle

Re: Need debugging help

2019-08-25 Thread cdunn2001
I've pushed a commit to `master` which completely drops all use of the **unittest** module. It still fails in GC, so it's not a result of any unittest-macro magic. There must be something fundamental that I'm doing wrong.

Need debugging help

2019-08-25 Thread cdunn2001
This fairly simple program will fail, and I cannot find my bug: git clone https://github.com/pb-cdunn/nim-help.git cd nim-help make # nim c -r t_raptor_db.nim Run (I am using the `devel` branch of **Nim** , but the problem happens on 0.20.2 also.)

[OT] curious why this forum lacks some Discourse features?

2019-08-25 Thread jiyinyiyong
this forum looks like Discourse and also seems to be developed with Nim(not very sure). But I do miss some features from Discourse or GitHub. 1. Markdown support. Being one of GitHub users I'm quite familiar with Markdown, this forum seems not supporting Markdown? 2. Linked topics has previe

Can I throw errors with custom fields?

2019-08-25 Thread jiyinyiyong
As mentioned in [https://forum.nim-lang.org/t/2863#17817](https://forum.nim-lang.org/t/2863#17817) we now throw errors with: type MyCustomError* = object of Exception ... proc doStuff(): int = raise newException(MyCustomError, "didn't do stuff")

Re: Recursive module dependency error

2019-08-25 Thread adokitkat
I have no problem with functions, it's objects... It doesn't work for me unfortunately.

possible in Nim to have a macro/template

2019-08-25 Thread ScottTorres
Hello everyone, Is it possible in Nim to have a macro/template that starts with a custom character? For example, a macro like: > #Declaration macro @myMacro() : ... ...

Re: Recursive module dependency error

2019-08-25 Thread adokitkat
So far I created a common file for type declaration stuff and separate files for bus and cpu functions ... Its working for now. Not really elegant tho.

Re: Recursive module dependency error

2019-08-25 Thread blmvxer
[https://github.com/blmvxerHax/randip/blob/master/snap/src/tools/randip_import.nim](https://github.com/blmvxerHax/randip/blob/master/snap/src/tools/randip_import.nim) This was my solution when I ran into the same problem, A "header" of sorts

Re: asyncnet and reading from multiple socks

2019-08-25 Thread blmvxer
I appreciate all the methods but I'm still not really achieving what I had hoped. I'm really trying to make a similar tool masscan but in Nim

Re: asyncnet and reading from multiple socks

2019-08-25 Thread blmvxer
Here's my first attempt in a Synchronous form [https://github.com/blmvxerHax/randip](https://github.com/blmvxerHax/randip)

Recursive module dependency error

2019-08-25 Thread adokitkat
Hello everyone, I am trying to work on emulating 6502 processor (very early stage, basically just started) and I am following tutorial in C++. I know Nim is not fully object-oriented, so how could I solve following please? I have a problem with recursive dependency, specifically where Olc6502 ob

Re: Nim vs. Python & Groovy (string splitting): Why is string splitting so slow in Nim?

2019-08-25 Thread cdunn2001
The slowness of the Nim **streams** library is frustrating, but I've learned to avoid `FileStream`. I simply readAll() into memory and then use `StringStream`, where the unbuffered implementation is fine.

What EXCACTLY is pure pragma in object declaration?

2019-08-25 Thread Stefan_Salewski
[https://nim-lang.github.io/Nim/manual.html#pragmas-pure-pragma](https://nim-lang.github.io/Nim/manual.html#pragmas-pure-pragma) type O {.pure.} = object i: int var o: O echo sizeof(o) Run Output is 8 with and without pure pragma for 64 bit Li

Re: Help me optimize this small Nim port to the speed of the original C version

2019-08-25 Thread Stefan_Salewski
Have you converted it by c2nim initially? I have no idea about your goal of course -- low level code is still low level even when coded in low level Nim... First a remark about your proc proc `toref`[T](x: var T): ref T = cast[ref typeof(x)](x.addr) Run that ca

Re: asyncnet and reading from multiple socks

2019-08-25 Thread adokitkat
I did timeout this way: let connectedSocket = socket.connect(serverAddress, port.Port) # : Future[void] waitFor connectedSocket or sleepAsync(1) if not connectedSocket.finished : quit("Timeout. Could not reach the server. Quitting...") echo "Connected!"

Help me optimize this small Nim port to the speed of the original C version

2019-08-25 Thread r3c
I'm almost finished with the porting of the original Quake map compiling tools from 1996, written in C. To be more precise, the tool that calculates the light for the map, nothing special, it a straight 1:1 port. After initial benchmarks i ran on various maps, it turned out that the Nim version

Re: embedded development tutorial

2019-08-25 Thread mikra
[https://wiki.osdev.org](https://wiki.osdev.org) . Generally speaking some sort of tutorial which is targeting C/C++.

Re: rumpkernel or baremetal runtime to run Nim program standalone

2019-08-25 Thread mikra
Hi, basically a RTOS is a some sort of scheduler around a big bunch of device-drivers, memory handling and chip-init/boot-routines around 'em hopefully well designed to service/process events within the time required :-). If you have a battery powered design you will face additional challenges i