If I understand well, you want to partially evaluate the preprocessor
directives. I've seen some literature about it, there are already perl
scripts around that can do it, but the simplest thing to do is imo the
following.

copy the c file in a directory by itself, so that includes do not find
the other files then run:
perl -npe 's/\t/        /' < sn9c20x-v4l2.c | cpp -C -P -nostdinc -dI
-DLINUX_VERSION_CODE=2629 -D'KERNEL_VERSION(X,Y,Z)=X##Y##Z' -
2>/dev/null > sn9c20x-v4l2.c.pp

This will provide the desired output, no need to write fancy scripts
nor to restrict to a subset of the valid preprocessor input.

Corrado

On Sun, Feb 22, 2009 at 11:20 PM, Vasily Khoruzhick <[email protected]> wrote:
> On Monday 23 February 2009 00:06:47 Corrado Zoccolo wrote:
>> On Sun, Feb 22, 2009 at 10:34 PM, Vasily Khoruzhick <[email protected]>
> wrote:
>> > On Sunday 22 February 2009 23:24:34 GWater wrote:
>> >
>> >
>> > Just want to note that this patch breaks compatibility with older
>> > kernels.
>>
>> I changed my patch to make it backward compatible using conditional
>> compilation (attached).
>> Currently it is tested only on x86-32, on kernels 2.6.28 and 2.6.29-rc4
>>
>> Feedback is welcome.
>>
>> Corrado
>
> Looks cool, but it is not style we're using (look at sn9c20x-sysfs.c).
> The thing is that it will be easy to remove our #ifdefs when we'll prepare
> driver for including in mainline kernel (it's easy to create script that will
> do this job). It will be harder to clean up your V4L2_PREFIX and V4L2_ARGS ;)
>
> Please use only ifdefs like this one:
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
> somecode
> #endif
>
> Regads
> Vasily
>
>
>



-- 
__________________________________________________________________________

dott. Corrado Zoccolo                          mailto:[email protected]
PhD - Department of Computer Science - University of Pisa, Italy
--------------------------------------------------------------------------
The self-confidence of a warrior is not the self-confidence of the average
man. The average man seeks certainty in the eyes of the onlooker and calls
that self-confidence. The warrior seeks impeccability in his own eyes and
calls that humbleness.
                               Tales of Power - C. Castaneda

--~--~---------~--~----~------------~-------~--~----~
Lets make microdia webcams plug'n play, (currently plug'n pray)
To post to this group, send email to [email protected]
Visit us online https://groups.google.com/group/microdia
-~----------~----~----~----~------~----~------~--~---

Reply via email to