Return cstringArray from C functions in Nim

2022-03-14 Thread mros
I want to rewrite a C custom library in Nim to use in C code.

Isn't the TagInput in Singletags on htmlparser?

2022-03-14 Thread Araq
Please report issues or potential issues on github.

Return cstringArray from C functions in Nim

2022-03-14 Thread Araq
You don't have to rewrite the code in Nim, you can throw away your C code and use `strutils.split`.

How to debug segmentation fault memory issue??

2022-03-14 Thread Araq
Compile with `--mm:orc -d:useMalloc` and run it through `valgrind`. It's an interesting case -- I cannot spot memory-safety related issues either. Which OS are you on?

To have source file has been normalized

2022-03-14 Thread ynfle
Are you looking for `macros.expandMacros`?

How to debug segmentation fault memory issue??

2022-03-14 Thread Chubak
Hey guys! My code has a memory issue. Here's the code: It's a rather lengthy code so let me tell you what it's made up of: 1- The Pong game with SDL2. 2- The opponent AI with classical AI. 3- Q-learning player AI. Now it gives SIEGV error segment

To have source file has been normalized

2022-03-14 Thread mardiyah
How are we able to produce the source file which has all been normalized, i.e. evaluated/expanded all of the directives, templates, macros, etc.with their same arguments ?

Return cstringArray from C functions in Nim

2022-03-14 Thread planetis
Make a copy with cstringArrayToSeq and free the original

Return cstringArray from C functions in Nim

2022-03-14 Thread shirleyquirk
You'd call `deallocCStringArray` whenever you'd previously have `free`d the pointer returned by your `StringSplit` function.

Determine the last line of the template's insertion

2022-03-14 Thread shirleyquirk
It's quite difficult to understand what you want. What is the output you expect from your code?

Wrapping C++ iterators: {.nodecl.} for non-constructible iterators?

2022-03-14 Thread shirleyquirk
I'm trying to wrap ROS(robot operating system) which has iterators that yield non constructible objects, i.e. dereferencing the iterator returns an object which only has a private constructor. I've tried to use this format for wrapping c++ iterators in a nim iterator: type

Determine the last line of the template's insertion

2022-03-14 Thread mardiyah
How to ascertain the last line of the template's inserted argument ? on foo( insert : untyped) = if i < 5: echo "hello" elif i < 7: echo "world" insert var i while i < 9 : inc(i) foo() : echo "foo" ech

Return cstringArray from C functions in Nim

2022-03-14 Thread mros
I want to rewrite a C functions in Nim. This is the C signature: extern char **StringSplit(char sep, const char *str); Run I wrote this procedure: proc StringSplit*(sep: cchar, str: cstring): cstringArray {.cdecl, exportc.} = # something here

Blog post: Binding Nim to C++ std::list

2022-03-14 Thread Clonk
> Yes, I can send a PR once I have mapped a good amount of that library, and > also with doc-strings and tests added. I am this same person hehe. Ah I knew the name was familiar ! > You missed reading references section of that post! :D I'll admit that I indeed skipped this part. Bad habit of m

Blog post: Binding Nim to C++ std::list

2022-03-14 Thread kaushalmodi
> The main limitation is that Nim =destroy and =copy hooks for object do not > get called properly by the C++ container because they're not mapped to their > C++ equivalent. I do not yet understand the destroy/copy concept properly. The `toSeq` proc I show in the post seems to work. In what sce

Blog post: Binding Nim to C++ std::list

2022-03-14 Thread Clonk
If you need more C++ STL container you can check out : The main limitation is that Nim `=destroy` and `=copy` hooks for object do not get called properly by the C++ container because they're not mapped to their C++ equivalent. @kaushalmodi feel free to ma

Using arc with C types?

2022-03-14 Thread exelotl
Ah that's perfect, all makes sense, thanks!

Isn't the TagInput in Singletags on htmlparser?

2022-03-14 Thread MoonSea
About htmlparser. > Tag omission in text/html: No end tag. from : InlineTags = {..., tagInput,...} to: SingleTags = {..., tagInput,...} Please check.

Blog post: Binding Nim to C++ std::list

2022-03-14 Thread shirleyquirk
i ran into iterator problems at work recently, and this is great work, thank you. the next step i'm missing is how to iterate over iterator classes that have been defined using `boost::iterator_facade`. these are meant to be used with `foreach`, and don't work out of the box. i'll post a more d

Using arc with C types?

2022-03-14 Thread JPLRouge
Merci . I have to build something to keep some posts that are goldmines. Like what to read gives ideas.

Blog post: Binding Nim to C++ std::list

2022-03-14 Thread JPLRouge
Brilliant, it opened doors for me.