It is not possible to detect if a prolog process is running as an embedded prolog (i.e., not swipl), or is it? I can create a prolog flag myself on startup using -Dembedded, but it would be nice to have an “official” prolog flag (which could be used in the code).
My use case are unit tests again. The unit tests for saved states determine swipl from “me(X)” and use it to create a saved state. In my case, me(X) returns the R statistics program which cannot, of course, create these states. So these tests would be skipped if current_prolog_flag(embedded, true)
.
I admit that this is a bit of a special use case; on the other hand, unit tests are a nice thing, also for embedded prolog programs. It would probably still be necessary to add this flag manually at startup. Autodetection from the filename of the executable seems a bit dirty.