Re: cpp state
Henrik Grubbström <[email protected]> Mon, 14 Apr 2025 10:09:46 +0200 (CEST)
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Organization | Roxen Internet Software AB |
| Message-ID | <[email protected]> |
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-2094895527-1744618186=:20628 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8BIT On Sun, 13 Apr 2025, [email protected] 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 [email protected] Roxen Internet Software AB --8323328-2094895527-1744618186=:20628--