I played with Lucian Grigore's idea to identify invalid file names, and I found a (almost) general solution to this problem:
including "define.file" at the beginning of the conventions and "undefine.file" after this condition.
Thus, the problem boils down to two macro names that must remain: DEFINEFILE and UNDEFINEFILE. But these two macros can be encrypted with their own hash code or with a random name to avoid using these names in conditional text.
"define.file":
#define height 480 #define os 1
"undefine.file"
#undef height #undef os
"conditionalcss.ccss"
some rootcode #include __DEFINEFILENAMEPATH__ #if height==480 #include __UNDEFINEFILENAMEPATH__ .page { line-height:23px; } #include __DEFINEFILENAMEPATH__ #elif height<480 #include __UNDEFINEFILENAMEPATH__ /* height > 480 */ .page { line-height:46px; } #include __DEFINEFILENAMEPATH__ #endif #if os==1 #include __UNDEFINEFILENAMEPATH__ os is windows (if 1 refers to windows) and height also undefined i hope #endif
Finally, cppcall with parametric definition and file definition:
cpp -P -D __DEFINEFILENAMEPATH__="\"define.file\"" -D __UNDEFINEFILENAMEPATH__="\"undefine.file\"" -oout.css css.ccss
With this idea, the desired "out.css" looks like this:
some rootcode .page { line-height:23px; } os is windows (if 1 refers to windows) and height also undefined i hope
This solution has only the drawbacks of the two macros and the possible poor quality due to multiple imports.
I hope this helps other people solve their problems.
Greetz adreamus
source share