From: Wolfgang T. <wth...@us...> - 2006-03-17 05:25:53
|
Update of /cvsroot/hoc/hoc/InterfaceGenerator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21646/InterfaceGenerator Modified Files: Headers.hs Log Message: A small hack: drop the "#else" part of "#if"s.. (but don't bother to check the condition or to get it right for nested #ifs). This helps dealing with things like #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 @interface NSLayoutManager : NSObject <NSCoding, NSGlyphStorage> { #else @interface NSLayoutManager : NSObject <NSCoding> { #endif until now, we just dropped the preprocessor directives, leaving BOTH alternatives, leading to a parse error later (symptom: class NSLayoutManager was absent) Index: Headers.hs =================================================================== RCS file: /cvsroot/hoc/hoc/InterfaceGenerator/Headers.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Headers.hs 3 Aug 2005 01:52:03 -0000 1.6 +++ Headers.hs 17 Mar 2006 05:25:51 -0000 1.7 @@ -17,6 +17,7 @@ stripPreprocessor = unlines . stripPP . lines where + stripPP (('#':'e':'l':'s':'e':_) : xs) = "" : dropElseHack xs stripPP (x@('#':_) : xs) = dropPreprocessorLine x xs stripPP (x : xs) = x : stripPP xs stripPP [] = [] @@ -24,6 +25,10 @@ | last x == '\\' = "" : dropPreprocessorLine (head xs) (tail xs) | otherwise = "" : stripPP xs + dropElseHack (('#':'e':'n':'d':'i':'f':_) : xs) = "" : stripPP xs + dropElseHack (x : xs) = "" : dropElseHack xs + dropElseHack [] = [] + findImports = mapMaybe checkImport . lines where checkImport line |