Re:GNU Parallel, where have you been all my life?
by lysium on Tuesday August 22, 2023 @05:22AM
(#37220364)
Thank you! Popen looks like what I was looking for!
Re:GNU Parallel, where have you been all my life?
by cb321 on Tuesday August 22, 2023 @06:08AM
(#37220662)
Sure. No problem.
While it may not be in any ANSI/ISO spec for C, even Windows has popen these days. There are some tiny popenr/popenw wrappers in https://github.com/c-blake/cligen/blob/master/cligen/osUt.ni...
Depending upon how balanced work is on either side of the pipe, you usually can even get parallel speed-up on multicore with almost no work. For example, there is no need to use quote-escaped CSV parsing libraries when you just read from a popen()d translator program producing an easier format: https://github.com/c-blake/nio/blob/main/utils/c2tsv.nim
You might also want to consider `rp` which is a program generator-compiler-runner along the lines of `awk` but with all the code just Nim snippets interpolated into a program template: https://github.com/c-blake/bu/blob/main/doc/rp.md . E.g.: