Is there a way to tell what chaiscript file is being evaluated with the "eval_file" or "use" functions from inside the file?


I have my own print function that replaces Chaiscript’s. I’m wondering if I can add a feature here to show the context of a print statement being triggered.

For example, my C++ logging system uses this “info” macro.
#define info(string) diagnosticLog(p::INFO, __FILE__, __FUNCTION__, __LINE__, string);
Which uses compiler-defined values to work out where the print statement happened during compilation to produce:
“INFO[fake/path/file.cpp (fakeFunction:12)]: string”

Does chaiscript have anything that I can use like I used __FILE__, __FUNCTION__ and __LINE__ in MSC? Or are there any alternative methods of getting the evaluation context that I can use from the C++ side?

Thanks for any help.


No… I don’t currently have anything like that. I mean technically you could throw, the catch, then look at the eval stack, then continue, but that’s not really what you want I’m guessing.

Please add a feature request to the bug tracker.


Throwing then catching would work. How would I do that and get an eval stack?


I’ve just tried several methods that I thought would work and was unable to come up with an actual viable option - sorry. I’ll see about addressing it as a new feature.