|
|
|
|
|
by theunamedguy
4071 days ago
|
|
Great tool, but too bad it can't handle code very well. An example (converting C++ to C): Input:
void FileStream::write(char* , int);
void VirtualMachine::cycle(int);
Example:
void FileStream_write(char* , int);
Output:
void FileStream_write(char* , int);
void VirtualMachine_cycle(int* , );
Also, is it open-source? |
|
I do it out of Vim. That is: first, select a range of text, then pipe it out:
Done. For example, when adding functions to TXR Lisp's library, I start with a declaration like: I pipe this through a script which will produce this: ("Intern a symbol called "foo" in the user_package, and register a two-argument function object with this symbol, hosted from the C function foo.")It's a little complicated:
I filter underscores to dashes, because I want a C function like foo_bar to look like foo-bar in the Lisp dialect. The (void) argument list is handled as a special case.I need to parse the arguments because the output part needs to know how many there are. Note how "func_n2" is generated, where the 2 comes from the argument count.