From: <cod...@go...> - 2008-10-25 20:25:07
|
Author: wol...@gm... Date: Sat Oct 25 13:24:01 2008 New Revision: 343 Modified: trunk/hoc/InterfaceGenerator2/Parser.hs trunk/hoc/InterfaceGenerator2/Preprocessor.hs Log: Improve GNUstep compatibility (doesn't work currently) Modified: trunk/hoc/InterfaceGenerator2/Parser.hs ============================================================================== --- trunk/hoc/InterfaceGenerator2/Parser.hs (original) +++ trunk/hoc/InterfaceGenerator2/Parser.hs Sat Oct 25 13:24:01 2008 @@ -350,17 +350,14 @@ firstVar <- one_var t let single_declaration_end = do - availability semi objc return [firstVar] multiple_declaration_end = do comma objc moreVars <- commaSep objc (one_var t) - availability semi objc return $ firstVar : moreVars function_definition = do - availability skipBlock return [] @@ -368,6 +365,8 @@ where one_var t = do (n, typeOperators) <- id_declarator + availability + optional initializer return $ case typeOperators t of CTFunction retval args varargs -> ExternFun (Selector n retval args varargs) @@ -377,12 +376,17 @@ carbon_extern_api = (reserved objc "EXTERN_API" <|> reserved objc "EXTERN_API_C") >> parens objc simple_type +initializer = do + symbol objc "=" + (const_int_expr >> return ()) <|> (skipBlock >> return ()) + return () + extern_keyword = reserved objc "extern" - <|> definedKeyword (\x -> "EXTERN" `isSuffixOf` x || "EXPORT" `isSuffixOf` x) + <|> definedKeyword (\x -> "EXTERN" `isSuffixOf` x || "EXPORT" `isSuffixOf` x || "_SCOPE" `isSuffixOf` x) inline_keyword = - reserved objc "inline" <|> definedKeyword ("_INLINE" `isSuffixOf`) + reserved objc "inline" <|> definedKeyword ("INLINE" `isSuffixOf`) storage_class = extern_keyword <|> inline_keyword <|> reserved objc "static" Modified: trunk/hoc/InterfaceGenerator2/Preprocessor.hs ============================================================================== --- trunk/hoc/InterfaceGenerator2/Preprocessor.hs (original) +++ trunk/hoc/InterfaceGenerator2/Preprocessor.hs Sat Oct 25 13:24:01 2008 @@ -59,6 +59,9 @@ return (return i) <|> do reserved cpp "defined" parens cpp definedMacroCondition + <|> do reserved cpp "OS_API_VERSION" + parens cpp (identifier cpp >> comma cpp >> identifier cpp) + return (return 1) <|> do reservedOp cpp "!" x <- basic return (x >>= return . (\xx -> if xx /= 0 then 0 else 1)) @@ -179,4 +182,4 @@ -- putStrLn $ putStrLn fn print $ length $ execute fn $ parseDirectives f --} \ No newline at end of file +-} |