- Subject: Re: [slang-users] SLprep_set_eval_hook() usage
- From: "Gisle Vanem" <gvanem@xxxxxxxx>
- Date: Sun, 14 Sep 2014 14:11:00 +0200
"John E. Davis" <jed@xxxxxxxxxxx> wrote:
My idea was to map values from GetVersionEx() into '-D_WIN32_WINNT=0x??'
values (assuming the SDK match the OS-ver). How do I do this best?
...
By "@if (CFLAGS = -D_WIN32_WINNT=0x??)", are you checking to see if
CFLAGS is equal to "-D_WIN32_WINNT=0x??"?
No. I mean, I want some way to get the hook to return what OS-version
the preprocessing makefile is running on. On GNU make I could have
have used 'OSVER = $(shell uname)'. 'uname' produces "MINGW32_NT-5.1"
here. So I could use the "5.1" part to map into a CFLAGS value to use
for '_WIN32_WINNT' (and 'WINVER').
You're maybe aware of this hassle on Windows; i.e. to use new functions
(from the Win SDK headers) for lets say Windows 8, this '_WIN32_WINNT'
macro must be set to 0x0602. Similar for other OS-versions:
Win-XP; _WIN32_WINNT=0x0501,
Vista; _WIN32_WINNT=0x0600,
Win-7; _WIN32_WINNT=0x0601, etc.
Is CFLAGS an environment variable, or is it set in the makefile?
It's set in the makefile. But per the above I want it to be extended
by the hook. Is that possible? Do you have an example of what the
SLprep_set_eval_hook() can do?
If so, do I simply copy the '-DCFLAGS = _WIN32_WINNT=0x0x501'
back into the 'expr' buffer? The docs on this very dim IMHO.
I do not know what you mean. The slang preprocessor functions do the
working of placing expressions from the file into the buffer.
I fail to see why the hook cannot modify the buffer. Looking at
slprepr.c, the SLprep_line_ok () calls 'test = pt->eval_hook (pt, buf)'.
But I fail to get my modified 'buf' printed to stdout.
Perhaps, off-list, you should send me an example makefile that you
would like to preprocess. This will give me a better idea what you
are trying to do.
Something minimal:
@ifdef VISUALC
CC = cl
CFLAGS = -nologo -Zi -W3
...
CFLAGS = $(CFLAGS) -D_WIN32_WINNT=0x0501
@endif
Called as 'mkmake makefile.all VISUALC > visualc.mak'
So my problem boils down to; how can mkmake spit out the
correct '-D_WIN32_WINNT=??' value? If a SLprep_set_eval_hook()
cannot do it, I must use another way.
--gv
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.
[2014 date index]
[2014 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]