On Sun, 13 Apr 2025, will...@welliver.org wrote:

Hi-

Hi Bill.

I don't suppose there's any way to access the state of the preprocessor following an invocation? I'm looking for a way to read a header file (for example) and determine what defines are present and their values. I suppose I can append some pike-code to the string in question and use that to populate variables which can then be evaluated, but what would only work if I already know the name of the define I'm looking for.

I don't recall this being available, but thought I'd ask. Happy to hear any suggestions!

It is almost available. The variable holding the mapping with the active
macros is currently declared private, and there is no accessor or getter
for it.

Otherwise something like:

  CompilerEnvironment.CPP my_cpp = DefaultCompilerEnvironment.CPP();
  my_cpp->init_pike_cpp();
  string out = my_cpp->high_cpp(in);
  // Access the private mapping cpp->defines here.

could work.

Bill

        /grubba

Hmm... Looks like some of the symbols in CPP are still undocumented.

--
Henrik Grubbström                                       gru...@roxen.com
Roxen Internet Software AB
  • cpp state william
    • Re: cpp state Henrik Grubbström

Reply via email to