I'm continuing to experiment with the SymbolicC`
package, and it's crucial to be able to inspect the generated code in order to do, well, anything useful with it. The ToCCodeString
makes this possible, but as far as I can tell, produces code with sensible line breaks but no indentation. Reading unindented code is sort of possible, but not at all fun. Is there an option to turn indentation on?
Right now, I've set things up so I can use the "Artistic Style" package for this purpose, and while it looks like a pretty nice program, relying on it means one more dependency on top of Mathematica and Visual Studio.
UPDATE to add: I'm interested in inspecting code that I generate programmatically, and developing the program to do the generation interactively in a notebook. I'd prefer not to have to take manual steps like using ToCCodeString
to generate the string, and then copy'n'paste it to Visual Studio to inspect it unless I really have to.
Answer
ToCCodeString
has the "Indent"
option, which defaults to None
. Set it to the number of tabs you want for an indentation, and you should be fine.
Comments
Post a Comment