gtk2hs-buildtools 0.13.2.0 → 0.13.2.1
raw patch · 27 files changed
+279/−279 lines, 27 files
Files
- c2hs/base/errors/Errors.hs +3/−3
- c2hs/base/general/FileOps.hs +5/−5
- c2hs/base/state/State.hs +11/−11
- c2hs/base/state/StateBase.hs +1/−1
- c2hs/base/state/StateTrans.hs +9/−9
- c2hs/base/syms/Attributes.hs +9/−9
- c2hs/base/syms/Idents.hs +3/−3
- c2hs/base/syms/NameSpaces.hs +9/−9
- c2hs/base/syntax/Lexers.hs +9/−9
- c2hs/c/C.hs +1/−1
- c2hs/c/CAST.hs +21/−21
- c2hs/c/CAttrs.hs +6/−6
- c2hs/c/CLexer.x +7/−7
- c2hs/c/CNames.hs +4/−4
- c2hs/c/CParser.y +28/−28
- c2hs/c/CTrav.hs +42/−42
- c2hs/chs/CHS.hs +16/−16
- c2hs/chs/CHSLexer.hs +6/−6
- c2hs/gen/CInfo.hs +8/−8
- c2hs/gen/GBMonad.hs +10/−10
- c2hs/gen/GenBind.hs +45/−45
- c2hs/gen/GenHeader.hs +7/−7
- c2hs/state/Switches.hs +1/−1
- c2hs/toplevel/C2HSConfig.hs +5/−5
- c2hs/toplevel/Gtk2HsC2Hs.hs +11/−11
- callbackGen/HookGenerator.hs +1/−1
- gtk2hs-buildtools.cabal +1/−1
c2hs/base/errors/Errors.hs view
@@ -103,9 +103,9 @@ -- converts an error into a string using a fixed format (EXPORTED) ----- * the list of lines of the error message must not be empty+-- * the list of lines of the error message must not be empty ----- * the format is+-- * the format is -- -- <fname>:<row>: (column <col>) [<err lvl>] -- >>> <line_1>@@ -113,7 +113,7 @@ -- ... -- <line_n> ----- * internal errors (identified by a special position value) are formatted as+-- * internal errors (identified by a special position value) are formatted as -- -- INTERNAL ERROR! -- >>> <line_1>
c2hs/base/general/FileOps.hs view
@@ -45,9 +45,9 @@ -- search for the given file in the given list of directories (EXPORTED) ----- * if the file does not exist, an exception is raised+-- * if the file does not exist, an exception is raised ----- * if the given file name is absolute, it is first tried whether this file+-- * if the given file name is absolute, it is first tried whether this file -- exists, afterwards the path component is stripped and the given -- directories are searched; otherwise, if the file name is not absolute, -- the path component is retained while searching the directories@@ -68,15 +68,15 @@ -- |Create a temporary file with a unique name. ----- * A unique sequence of at least six characters and digits is added+-- * A unique sequence of at least six characters and digits is added -- inbetween the two given components (the latter of which must include the -- file suffix if any is needed) ----- * Default permissions are used, which might not be optimal, but+-- * Default permissions are used, which might not be optimal, but -- unfortunately the Haskell standard libs don't support proper permission -- management. ----- * We make 100 attempts on getting a unique filename before giving up.+-- * We make 100 attempts on getting a unique filename before giving up. -- mktemp :: FilePath -> FilePath -> IO (Handle, FilePath) mktemp pre post =
c2hs/base/state/State.hs view
@@ -96,7 +96,7 @@ -- initialization ----- * it gets the version information and the initial extra state as arguments+-- * it gets the version information and the initial extra state as arguments -- initialBaseState :: (String, String, String) -> e -> BaseState e initialBaseState vcd es = BaseState {@@ -114,7 +114,7 @@ -- initiate a complete run of the ToolKit represented by a PreCST with a void -- generic component (type `()') (EXPORTED) ----- * fatals errors are explicitly caught and reported (instead of letting them+-- * fatals errors are explicitly caught and reported (instead of letting them -- through to the runtime system) -- run :: (String, String, String) -> e -> PreCST e () a -> IO a@@ -147,7 +147,7 @@ -- raise a fatal user-defined error (EXPORTED) ----- * such an error my be caught and handled using `fatalsHandeledBy'+-- * such an error my be caught and handled using `fatalsHandeledBy' -- fatal :: String -> PreCST e s a fatal = CST . StateTrans.fatal@@ -156,7 +156,7 @@ -- are caught using the provided handler, which expects to get the exception -- message (EXPORTED) ----- * the state observed by the exception handler is *modified* by the failed+-- * the state observed by the exception handler is *modified* by the failed -- state transformer upto the point where the exception was thrown (this -- semantics is the only reasonable when it should be possible to use -- updating for maintaining the state)@@ -170,10 +170,10 @@ -- for fatal errors, execute the state transformer and apply the error handler -- when a fatal error occurs (EXPORTED) ----- * fatal errors are IO monad errors and errors raised by `fatal' as well as+-- * fatal errors are IO monad errors and errors raised by `fatal' as well as -- uncaught exceptions ----- * the base and generic state observed by the error handler is *in contrast+-- * the base and generic state observed by the error handler is *in contrast -- to `catch'* the state *before* the state transformer is applied -- fatalsHandledBy :: PreCST e s a -> (IOError -> PreCST e s a) -> PreCST e s a@@ -218,7 +218,7 @@ -- raise an error (EXPORTED) ----- * a fatal error is reported immediately; see `raiseFatal'+-- * a fatal error is reported immediately; see `raiseFatal' -- raise :: Error -> PreCST e s () raise err = case errorLvl err of@@ -238,13 +238,13 @@ -- raise a fatal compilation error (EXPORTED) ----- * the error is together with the up-to-now accumulated errors are reported+-- * the error is together with the up-to-now accumulated errors are reported -- as part of the error message of the fatal error exception ----- * the current thread of control is discarded and control is passed to the+-- * the current thread of control is discarded and control is passed to the -- innermost handler for fatal errors ----- * the first argument must contain a short description of the error, while+-- * the first argument must contain a short description of the error, while -- the second and third argument are like the two arguments to `raise' -- raiseFatal :: String -> Position -> [String] -> PreCST e s a@@ -260,7 +260,7 @@ -- raise an error; internal version, doesn't check whether the error is fatal ----- * the error is entered into the compiler state and a fatal error is+-- * the error is entered into the compiler state and a fatal error is -- triggered if the `errorLimit' is reached -- raise0 :: Error -> PreCST e s ()
c2hs/base/state/StateBase.hs view
@@ -77,7 +77,7 @@ -- form of the error state ----- * when no error was raised yet, the error level is the lowest possible one+-- * when no error was raised yet, the error level is the lowest possible one -- data ErrorState = ErrorState ErrorLvl -- worst error level that was raised Int -- number of errors (excl warnings)
c2hs/base/state/StateTrans.hs view
@@ -135,7 +135,7 @@ -- the monad's bind ----- * exceptions are propagated+-- * exceptions are propagated -- (+>=) :: STB bs gs a -> (a -> STB bs gs b) -> STB bs gs b m +>= k = let@@ -234,7 +234,7 @@ -- `IO' state transformer that must be placed into the context of the external -- IO ----- * uncaught exceptions become fatal errors+-- * uncaught exceptions become fatal errors -- runSTB :: STB bs gs a -> bs -> gs -> IO a runSTB m bs gs = let@@ -264,9 +264,9 @@ -- error and exception handling -- ---------------------------- --- * we exploit the `UserError' component of `IOError' for fatal errors+-- * we exploit the `UserError' component of `IOError' for fatal errors ----- * we distinguish exceptions and user-defined fatal errors+-- * we distinguish exceptions and user-defined fatal errors -- -- - exceptions are meant to be caught in order to recover the currently -- executed operation; they turn into fatal errors if they are not caught;@@ -277,7 +277,7 @@ -- to invoke another operation; there is no special support for different -- handling of different kinds of fatal-errors ----- * the costs for fatal error handling are already incurred by the `IO' monad;+-- * the costs for fatal error handling are already incurred by the `IO' monad; -- the costs for exceptions mainly is the case distinction in the definition -- of `+>=' --@@ -289,7 +289,7 @@ -- raise a fatal user-defined error (EXPORTED) ----- * such an error my be caught and handled using `fatalsHandeledBy'+-- * such an error my be caught and handled using `fatalsHandeledBy' -- fatal :: String -> STB bs gs a fatal s = liftIO (ioError (userError s))@@ -298,7 +298,7 @@ -- are caught using the provided handler, which expects to get the exception -- message (EXPORTED) ----- * the base and generic state observed by the exception handler is *modified*+-- * the base and generic state observed by the exception handler is *modified* -- by the failed state transformer upto the point where the exception was -- thrown (this semantics is the only reasonable when it should be possible -- to use updating for maintaining the state)@@ -327,10 +327,10 @@ -- for fatal errors, execute the state transformer and apply the error handler -- when a fatal error occurs (EXPORTED) ----- * fatal errors are IO monad errors and errors raised by `fatal' as well as+-- * fatal errors are IO monad errors and errors raised by `fatal' as well as -- uncaught exceptions ----- * the base and generic state observed by the error handler is *in contrast+-- * the base and generic state observed by the error handler is *in contrast -- to `catch'* the state *before* the state transformer is applied -- fatalsHandledBy :: STB bs gs a -> (IOError -> STB bs gs a) -> STB bs gs a
c2hs/base/syms/Attributes.hs view
@@ -168,13 +168,13 @@ -- the type class `Attr' determines which types may be used as attributes -- (EXPORTED) ----- * such types have to provide values representing an undefined and a don't+-- * such types have to provide values representing an undefined and a don't -- care state, together with two functions to test for these values ----- * an attribute in an attribute table is initially set to `undef' (before+-- * an attribute in an attribute table is initially set to `undef' (before -- some value is assigned to it) ----- * an attribute with value `dontCare' participated in an already detected+-- * an attribute with value `dontCare' participated in an already detected -- error, it's value may not be used for further computations in order to -- avoid error avalanches --@@ -194,13 +194,13 @@ -- attribute tables map attribute identifiers to attribute values -- (EXPORTED ABSTRACT) ----- * the attributes within a table can be soft or frozen, the former may by be+-- * the attributes within a table can be soft or frozen, the former may by be -- updated, but the latter can not be changed ----- * the attributes in a frozen table are stored in an array for fast+-- * the attributes in a frozen table are stored in an array for fast -- lookup; consequently, the attribute identifiers must be *dense* ----- * the table description string is used to emit better error messages (for+-- * the table description string is used to emit better error messages (for -- internal errors) -- data Attr a =>@@ -265,7 +265,7 @@ -- copy the value of an attribute to another one (EXPORTED) ----- * undefined attributes are not copied, to avoid filling the table+-- * undefined attributes are not copied, to avoid filling the table -- copyAttr :: Attr a => AttrTable a -> Attrs -> Attrs -> AttrTable a copyAttr at ats ats'@@ -338,7 +338,7 @@ -- get an attribute value from a standard attribute table (EXPORTED) ----- * if the attribute can be "don't care", this should be checked before+-- * if the attribute can be "don't care", this should be checked before -- calling this function (using `isDontCareStdAttr') -- getStdAttr :: AttrTable (StdAttr a) -> Attrs -> a@@ -365,7 +365,7 @@ -- check if the attribue value is still undefined (EXPORTED) ----- * we also regard "don't care" attributes as undefined+-- * we also regard "don't care" attributes as undefined -- isUndefStdAttr :: AttrTable (StdAttr a) -> Attrs -> Bool isUndefStdAttr atab at = isUndef (getAttr atab at)
c2hs/base/syms/Idents.hs view
@@ -191,15 +191,15 @@ -- given the lexeme of an identifier, yield the abstract identifier (EXPORTED) ----- * the only attribute of the resulting identifier is its source text+-- * the only attribute of the resulting identifier is its source text -- position; as provided in the first argument of this function ----- * only minimal error checking, e.g., the characters of the identifier are+-- * only minimal error checking, e.g., the characters of the identifier are -- not checked for being alphanumerical only; the correct lexis of the -- identifier should be ensured by the caller, e.g., the scanner or -- `isLegalIdent' ----- * for reasons of simplicity the complete lexeme is hashed (with `quad')+-- * for reasons of simplicity the complete lexeme is hashed (with `quad') -- lexemeToIdent :: Position -> String -> Name -> Ident lexemeToIdent pos l name = Ident s k (quad s) (newAttrs pos name)
c2hs/base/syms/NameSpaces.hs view
@@ -50,11 +50,11 @@ -- name space (EXPORTED ABSTRACT) ----- * the definitions in the global ranges are stored in a finite map, because+-- * the definitions in the global ranges are stored in a finite map, because -- they tend to be a lot and are normally not updated after the global range -- is constructed ----- * the definitions of the local ranges are stored in a single list, usually+-- * the definitions of the local ranges are stored in a single list, usually -- they are not very many and the definitions entered last are the most -- frequently accessed ones; the list structure naturally hides older -- definitions, i.e., definitions from outer ranges; adding new definitions@@ -76,9 +76,9 @@ -- add global definition (EXPORTED) ----- * returns the modfied name space+-- * returns the modfied name space ----- * if the identfier is already declared, the resulting name space contains+-- * if the identfier is already declared, the resulting name space contains -- the new binding and the second component of the result contains the -- definition declared previosuly (which is henceforth not contained in the -- name space anymore)@@ -101,11 +101,11 @@ -- add local definition (EXPORTED) ----- * returns the modfied name space+-- * returns the modfied name space ----- * if there is no local range, the definition is entered globally+-- * if there is no local range, the definition is entered globally ----- * if the identfier is already declared, the resulting name space contains+-- * if the identfier is already declared, the resulting name space contains -- the new binding and the second component of the result contains the -- definition declared previosuly (which is henceforth not contained in the -- name space anymore)@@ -122,7 +122,7 @@ -- search for a definition (EXPORTED) ----- * the definition from the innermost range is returned, if any+-- * the definition from the innermost range is returned, if any -- find :: NameSpace a -> Ident -> Maybe a find (NameSpace gs lss) id = case (lookup lss) of@@ -141,7 +141,7 @@ -- dump a name space into a list (EXPORTED) ----- * local ranges are concatenated+-- * local ranges are concatenated -- nameSpaceToList :: NameSpace a -> [(Ident, a)] nameSpaceToList (NameSpace gs lss) = Map.toList gs ++ concat lss
c2hs/base/syntax/Lexers.hs view
@@ -182,7 +182,7 @@ -- Lexical actions take a lexeme with its position and may return a token; in -- a variant, an error can be returned (EXPORTED) ----- * if there is no token returned, the current lexeme is discarded lexing+-- * if there is no token returned, the current lexeme is discarded lexing -- continues looking for a token -- type Action t = String -> Position -> Maybe t@@ -200,7 +200,7 @@ -- tree structure used to represent the lexer table (EXPORTED ABSTRACTLY) ----- * each node in the tree corresponds to a state of the lexer; the associated +-- * each node in the tree corresponds to a state of the lexer; the associated -- actions are those that apply when the corresponding state is reached -- data Lexer s t = Lexer (LexAction s t) (Cont s t)@@ -254,7 +254,7 @@ -- Close a regular expression with an action that converts the lexeme into a -- token (EXPORTED) ----- * Note: After the application of the action, the position is advanced+-- * Note: After the application of the action, the position is advanced -- according to the length of the lexeme. This implies that normal -- actions should not be used in the case where a lexeme might contain -- control characters that imply non-standard changes of the position, @@ -282,7 +282,7 @@ -- Close a regular expression with a meta action (EXPORTED) ----- * Note: Meta actions have to advance the position in dependence of the+-- * Note: Meta actions have to advance the position in dependence of the -- lexeme by themselves. -- lexmeta :: Regexp s t -> Meta s t -> Lexer s t@@ -359,7 +359,7 @@ -- control lexer (EXPORTED) ----- * implements proper `Position' management in the presence of the standard+-- * implements proper `Position' management in the presence of the standard -- layout control characters -- ctrlLexer :: Lexer s t@@ -435,16 +435,16 @@ -- apply a lexer, yielding a token sequence and a list of errors (EXPORTED) ----- * Currently, all errors are fatal; thus, the result is undefined in case of +-- * Currently, all errors are fatal; thus, the result is undefined in case of -- an error (this changes when error correction is added). ----- * The final lexer state is returned.+-- * The final lexer state is returned. ----- * The order of the error messages is undefined.+-- * The order of the error messages is undefined. -- execLexer :: Lexer s t -> LexerState s -> ([t], LexerState s, [Error]) ----- * the following is moderately tuned+-- * the following is moderately tuned -- execLexer l state@([], _, _) = ([], state, []) execLexer l state =
c2hs/c/C.hs view
@@ -95,7 +95,7 @@ -- given a file name (with suffix), parse that file as a C header and do the -- static analysis (collect defined names) (EXPORTED) ----- * currently, lexical and syntactical errors are reported immediately and +-- * currently, lexical and syntactical errors are reported immediately and -- abort the program; others are reported as part of the fatal error message; -- warnings are returned together with the read unit --
c2hs/c/CAST.hs view
@@ -83,14 +83,14 @@ -- C function definition (K&R A10.1) (EXPORTED) ----- * The only type specifiers allowed are `extern' and `static'.+-- * The only type specifiers allowed are `extern' and `static'. ----- * The declarator must specify explicitly that the declared identifier has+-- * The declarator must specify explicitly that the declared identifier has -- function type. ----- * The optional declaration list is for old-style function declarations.+-- * The optional declaration list is for old-style function declarations. ----- * The statement must be a compound statement.+-- * The statement must be a compound statement. -- data CFunDef = CFunDef [CDeclSpec] -- type specifier and qualifier CDeclr -- declarator@@ -205,7 +205,7 @@ -- C declaration (K&R A8), structure declaration (K&R A8.3), parameter -- declaration (K&R A8.6.3), and type name (K&R A8.8) (EXPORTED) ----- * Toplevel declarations (K&R A8): +-- * Toplevel declarations (K&R A8): -- -- - they require that the type specifier and qualifier list is not empty, -- but gcc allows it and just issues a warning; for the time being, we@@ -217,7 +217,7 @@ -- `Nothing' or `Just init'; and -- - abstract declarators are not allowed. ----- * Structure declarations (K&R A8.3):+-- * Structure declarations (K&R A8.3): -- -- - do not allow storage specifiers; -- - do not allow initializers; @@ -228,14 +228,14 @@ -- Nothing)', `(Nothing, Nothing, Just size)', or `(Just decl, Nothing, -- Just size)'. ----- * Parameter declarations (K&R A8.6.3):+-- * Parameter declarations (K&R A8.6.3): -- -- - allow neither initializers nor size expressions; -- - allow at most one declarator triple of the form `(Just declr, Nothing, -- Nothing)' (in case of an empty declarator, the list must be empty); and -- - allow abstract declarators. ----- * Type names (A8.8):+-- * Type names (A8.8): -- -- - do not allow storage specifiers; -- - allow neither initializers nor size expressions; and@@ -355,7 +355,7 @@ -- C type qualifier (K&R A8.2) (EXPORTED) ----- * plus `restrict' from C99 and `inline'+-- * plus `restrict' from C99 and `inline' -- data CTypeQual = CConstQual Attrs | CVolatQual Attrs@@ -376,12 +376,12 @@ -- C structure of union declaration (K&R A8.3) (EXPORTED) ----- * in both case, either the identifier is present or the list must be+-- * in both case, either the identifier is present or the list must be -- non-empty -- data CStructUnion = CStruct CStructTag (Maybe Ident)- [CDecl] -- *structure* declaration+ [CDecl] -- *structure* declaration Attrs instance Pos CStructUnion where@@ -411,28 +411,28 @@ -- C declarator (K&R A8.5) and abstract declarator (K&R A8.8) (EXPORTED) ----- * We have one type qualifer list `[CTypeQual]' for each indirection (ie,+-- * We have one type qualifer list `[CTypeQual]' for each indirection (ie, -- each occurrence of `*' in the concrete syntax). ----- * We unfold K&R's direct-declarators nonterminal into declarators. Note+-- * We unfold K&R's direct-declarators nonterminal into declarators. Note -- that `*(*x)' is equivalent to `**x'. ----- * Declarators (A8.5) and abstract declarators (A8.8) are represented in the +-- * Declarators (A8.5) and abstract declarators (A8.8) are represented in the -- same structure. In the case of a declarator, the identifier in -- `CVarDeclr' must be present; in an abstract declarator it misses. -- `CVarDeclr Nothing ...' on its own is meaningless, it may only occur as -- part of a larger type (ie, there must be a pointer, an array, or function -- declarator around). ----- * The qualifiers list in a `CPtrDeclr' may not be empty.+-- * The qualifiers list in a `CPtrDeclr' may not be empty. ----- * Old and new style function definitions are merged into a single case+-- * Old and new style function definitions are merged into a single case -- `CFunDeclr'. In case of an old style definition, the parameter list is -- empty and the variadic flag is `False' (ie, the parameter names are not -- stored in the tree). Remember, a new style definition with no parameters -- requires a single `void' in the argument list (according to the standard). ----- * We unfold K&R's parameter-type-list nonterminal into the declarator+-- * We unfold K&R's parameter-type-list nonterminal into the declarator -- variant for functions. -- data CDeclr = CVarDeclr (Maybe Ident) -- declared identifier@@ -445,7 +445,7 @@ (Maybe CExpr) -- array size Attrs | CFunDeclr CDeclr- [CDecl] -- *parameter* declarations+ [CDecl] -- *parameter* declarations Bool -- is variadic? Attrs @@ -500,10 +500,10 @@ -- C expression (K&R A7) (EXPORTED) ----- * these can be arbitrary expression, as the argument of `sizeof' can be+-- * these can be arbitrary expression, as the argument of `sizeof' can be -- arbitrary, even if appearing in a constant expression ----- * GNU C extension: `alignof'+-- * GNU C extension: `alignof' -- data CExpr = CComma [CExpr] -- comma expression list, n >= 2 Attrs@@ -651,7 +651,7 @@ -- C constant (K&R A2.5 & A7.2) (EXPORTED) ----- * we do not list enumeration constants here, as they are identifiers+-- * we do not list enumeration constants here, as they are identifiers -- data CConst = CIntConst Integer Attrs
c2hs/c/CAttrs.hs view
@@ -150,7 +150,7 @@ -- add another definitions to the object name space (EXPORTED) ----- * if a definition of the same name was already present, it is returned+-- * if a definition of the same name was already present, it is returned -- addDefObjC :: AttrC -> Ident -> CObj -> (AttrC, Maybe CObj) addDefObjC ac ide obj = let om = defObjsAC ac@@ -166,7 +166,7 @@ -- lookup an identifier in the object name space; if nothing found, try -- whether there is a shadow identifier that matches (EXPORTED) ----- * the returned identifier is the _real_ identifier of the object+-- * the returned identifier is the _real_ identifier of the object -- lookupDefObjCShadow :: AttrC -> Ident -> Maybe (CObj, Ident) lookupDefObjCShadow ac ide = @@ -180,7 +180,7 @@ -- add another definition to the tag name space (EXPORTED) ----- * if a definition of the same name was already present, it is returned +-- * if a definition of the same name was already present, it is returned -- addDefTagC :: AttrC -> Ident -> CTag -> (AttrC, Maybe CTag) addDefTagC ac ide obj = let tm = defTagsAC ac@@ -196,7 +196,7 @@ -- lookup an identifier in the tag name space; if nothing found, try -- whether there is a shadow identifier that matches (EXPORTED) ----- * the returned identifier is the _real_ identifier of the tag+-- * the returned identifier is the _real_ identifier of the tag -- lookupDefTagCShadow :: AttrC -> Ident -> Maybe (CTag, Ident) lookupDefTagCShadow ac ide = @@ -212,9 +212,9 @@ -- the given prefix from the identifiers already in the object or tag name -- space (EXPORTED) ----- * in case of a collisions, a random entry is selected+-- * in case of a collisions, a random entry is selected -- --- * case is not relevant in the prefix and underscores between the prefix and+-- * case is not relevant in the prefix and underscores between the prefix and -- the stem of an identifier are also dropped -- applyPrefix :: AttrC -> String -> AttrC
c2hs/c/CLexer.x view
@@ -100,7 +100,7 @@ -- character escape sequence (follows K&R A2.5.2) ----- * also used for strings+-- * also used for strings -- @charesc = \\([ntvbrfae\\\?\'\"]|$octdigit{1,3}|x$hexdigit+) @@ -118,16 +118,16 @@ -- whitespace (follows K&R A2.1) ----- * horizontal and vertical tabs, newlines, and form feeds are filter out by+-- * horizontal and vertical tabs, newlines, and form feeds are filter out by -- `Lexers.ctrlLexer' ----- * comments are not handled, as we assume the input already went through cpp+-- * comments are not handled, as we assume the input already went through cpp -- $white+ ; -- #line directive (K&R A12.6) ----- * allows further ints after the file name a la GCC; as the GCC CPP docu+-- * allows further ints after the file name a la GCC; as the GCC CPP docu -- doesn't say how many ints there can be, we allow an unbound number -- \#$space*@int$space*(\"($infname|@charesc)*\"$space*)?(@int$space*)*$eol@@ -135,14 +135,14 @@ -- #pragma directive (K&R A12.8) ----- * we simply ignore any #pragma (but take care to update the position+-- * we simply ignore any #pragma (but take care to update the position -- information) -- \#$space*pragma$anyButNL*$eol ; -- #itent directive, eg used by rcs/cvs ----- * we simply ignore any #itent (but take care to update the position+-- * we simply ignore any #itent (but take care to update the position -- information) -- \#$space*ident$anyButNL*$eol ;@@ -153,7 +153,7 @@ -- constants (follows K&R A2.5) ----- * K&R explicit mentions `enumeration-constants'; however, as they are+-- * K&R explicit mentions `enumeration-constants'; however, as they are -- lexically identifiers, we do not have an extra case for them --
c2hs/c/CNames.hs view
@@ -30,7 +30,7 @@ -- --- TODO ---------------------------------------------------------------------- ----- * `defObjOrErr': currently, repeated declarations are completely ignored;+-- * `defObjOrErr': currently, repeated declarations are completely ignored; -- eventually, the consistency of the declarations should be checked -- @@ -71,7 +71,7 @@ -- traverse a complete header file ----- * in case of an error, back off the current declaration+-- * in case of an error, back off the current declaration -- naCHeader :: NA () naCHeader = do@@ -86,7 +86,7 @@ -- Processing of toplevel declarations ----- * We turn function definitions into prototypes, as we are not interested in+-- * We turn function definitions into prototypes, as we are not interested in -- function bodies. -- naCExtDecl :: CExtDecl -> NA ()@@ -194,7 +194,7 @@ -- associate an object with a referring identifier ----- * currently, repeated declarations are completely ignored; eventually, the+-- * currently, repeated declarations are completely ignored; eventually, the -- consistency of the declarations should be checked -- defObjOrErr :: Ident -> CObj -> NA ()
c2hs/c/CParser.y view
@@ -241,7 +241,7 @@ -- parse a complete C translation unit (C99 6.9) ----- * GNU extensions:+-- * GNU extensions: -- allow empty translation_unit -- allow redundant ';' --@@ -254,7 +254,7 @@ -- parse external C declaration (C99 6.9) ----- * GNU extensions:+-- * GNU extensions: -- allow extension keyword before external declaration -- asm definitions --@@ -315,7 +315,7 @@ -- parse C statement (C99 6.8) ----- * GNU extension: ' __asm__ (...); ' statements+-- * GNU extension: ' __asm__ (...); ' statements -- statement :: { CStat } statement@@ -330,7 +330,7 @@ -- parse C labeled statement (C99 6.8.1) ----- * GNU extension: case ranges+-- * GNU extension: case ranges -- labeled_statement :: { CStat } labeled_statement@@ -343,7 +343,7 @@ -- parse C compound statement (C99 6.8.2) ----- * GNU extension: '__label__ ident;' declarations+-- * GNU extension: '__label__ ident;' declarations -- compound_statement :: { CStat } compound_statement@@ -445,7 +445,7 @@ -- parse C jump statement (C99 6.8.6) ----- * GNU extension: computed gotos+-- * GNU extension: computed gotos -- jump_statement :: { CStat } jump_statement@@ -569,7 +569,7 @@ -- parse C declaration specifiers (C99 6.7) ----- * summary:+-- * summary: -- [ type_qualifier | storage_class -- | basic_type_name | elaborated_type_name | tyident ]{ -- ( 1 >= basic_type_name@@ -588,10 +588,10 @@ -- A mixture of type qualifiers and storage class specifiers in any order, but -- containing at least one storage class specifier. ----- * summary:+-- * summary: -- [type_qualifier | storage_class]{ 1 >= storage_class } ----- * detail:+-- * detail: -- [type_qualifier] storage_class [type_qualifier | storage_class] -- declaration_qualifier_list :: { Reversed [CDeclSpec] }@@ -617,7 +617,7 @@ -- parse C storage class specifier (C99 6.7.1) ----- * GNU extensions: '__thread' thread local storage+-- * GNU extensions: '__thread' thread local storage -- storage_class :: { CStorageSpec } storage_class@@ -634,7 +634,7 @@ -- This recignises a whole list of type specifiers rather than just one -- as in the C99 grammar. ----- * summary:+-- * summary: -- [type_qualifier | basic_type_name | elaborated_type_name | tyident]{ -- 1 >= basic_type_name -- |x| 1 == elaborated_type_name@@ -667,7 +667,7 @@ -- order, but containing at least one basic type name and at least one storage -- class specifier. ----- * summary:+-- * summary: -- [type_qualifier | storage_class | basic_type_name]{ -- 1 >= storage_class && 1 >= basic_type_name -- }@@ -693,7 +693,7 @@ -- A mixture of type qualifiers and basic type names in any order, but -- containing at least one basic type name. ----- * summary:+-- * summary: -- [type_qualifier | basic_type_name]{ 1 >= basic_type_name } -- basic_type_specifier :: { Reversed [CDeclSpec] }@@ -718,7 +718,7 @@ -- A named or anonymous struct, union or enum type along with at least one -- storage class and any mix of type qualifiers. -- --- * summary:+-- * summary: -- [type_qualifier | storage_class | elaborated_type_name]{ -- 1 == elaborated_type_name && 1 >= storage_class -- }@@ -741,7 +741,7 @@ -- A struct, union or enum type (named or anonymous) with optional leading and -- trailing type qualifiers. ----- * summary:+-- * summary: -- [type_qualifier] elaborated_type_name [type_qualifier] -- sue_type_specifier :: { Reversed [CDeclSpec] }@@ -763,12 +763,12 @@ -- A typedef'ed type identifier with at least one storage qualifier and any -- number of type qualifiers ----- * Summary:+-- * Summary: -- [type_qualifier | storage_class | tyident]{ -- 1 == tyident && 1 >= storage_class -- } ----- * Note:+-- * Note: -- the tyident can also be a: typeof '(' ... ')' -- typedef_declaration_specifier :: { Reversed [CDeclSpec] }@@ -794,7 +794,7 @@ -- typedef'ed type identifier with optional leading and trailing type qualifiers ----- * Summary:+-- * Summary: -- [type_qualifier] ( tyident | typeof '('...')' ) [type_qualifier] -- typedef_type_specifier :: { Reversed [CDeclSpec] }@@ -826,7 +826,7 @@ -- A named or anonymous struct, union or enum type. ----- * summary:+-- * summary: -- (struct|union|enum) (identifier? '{' ... '}' | identifier) -- elaborated_type_name :: { CTypeSpec }@@ -837,7 +837,7 @@ -- parse C structure or union declaration (C99 6.7.2.1) ----- * summary:+-- * summary: -- (struct|union) (identifier? '{' ... '}' | identifier) -- struct_or_union_specifier :: { CStructUnion }@@ -891,7 +891,7 @@ (d,s) -> CDecl declspecs ((d,Nothing,s) : dies) attr } --- * GNU extensions:+-- * GNU extensions: -- allow anonymous nested structures and unions -- struct_declaring_list :: { CDecl }@@ -932,7 +932,7 @@ -- parse C enumeration declaration (C99 6.7.2.2) ----- * summary:+-- * summary: -- enum (identifier? '{' ... '}' | identifier) -- enum_specifier :: { CEnum }@@ -1285,9 +1285,9 @@ (params, variadic) -> CFunDeclr declr params variadic attrs } --- * Note that we recognise but ignore the C99 static keyword (see C99 6.7.5.3)+-- * Note that we recognise but ignore the C99 static keyword (see C99 6.7.5.3) ----- * We do not distinguish in the AST between incomplete array types and+-- * We do not distinguish in the AST between incomplete array types and -- complete variable length arrays ([ '*' ] means the latter). (see C99 6.7.5.2) -- array_abstract_declarator :: { CDeclr -> CDeclr }@@ -1389,7 +1389,7 @@ -- designation ----- * GNU extensions:+-- * GNU extensions: -- old style member designation: 'ident :' -- array range designation --@@ -1423,7 +1423,7 @@ -- -- We cannot use a typedef name as a variable ----- * GNU extensions:+-- * GNU extensions: -- allow a compound statement as an expression -- various __builtin_* forms that take type parameters --@@ -1496,7 +1496,7 @@ -- parse C unary expression (C99 6.5.3) ----- * GNU extensions:+-- * GNU extensions: -- 'alignof' expression or type -- '__extension__' to suppress warnings about extensions -- allow taking address of a label with: && label@@ -1669,7 +1669,7 @@ -- parse C conditional expression (C99 6.5.15) ----- * GNU extensions:+-- * GNU extensions: -- omitting the `then' part -- conditional_expression :: { CExpr }
c2hs/c/CTrav.hs view
@@ -56,7 +56,7 @@ -- --- TODO ---------------------------------------------------------------------- ----- * `extractStruct' doesn't account for forward declarations that have no+-- * `extractStruct' doesn't account for forward declarations that have no -- full declaration yet; if `extractStruct' is called on such a declaration, -- we have a user error, but currently an internal error is raised --@@ -148,7 +148,7 @@ -- execute a traversal monad (EXPORTED) ----- * given a traversal monad, an attribute structure tree, and a user+-- * given a traversal monad, an attribute structure tree, and a user -- state, the transformed structure tree and monads result are returned -- runCT :: CT s a -> AttrC -> s -> CST t (AttrC, a)@@ -212,7 +212,7 @@ -- enter an object definition into the object name space (EXPORTED) ----- * if a definition of the same name was already present, it is returned +-- * if a definition of the same name was already present, it is returned -- defObj :: Ident -> CObj -> CT s (Maybe CObj) defObj ide obj = transAttrCCT $ \ac -> addDefObjC ac ide obj@@ -230,14 +230,14 @@ -- enter a tag definition into the tag name space (EXPORTED) ----- * empty definitions of structures get overwritten with complete ones and a+-- * empty definitions of structures get overwritten with complete ones and a -- forward reference is added to their tag identifier; furthermore, both -- structures and enums may be referenced using an empty definition when -- there was a full definition earlier and in this case there is also an -- object association added; otherwise, if a definition of the same name was -- already present, it is returned (see DOCU section) ----- * it is checked that the first occurence of an enumeration tag is+-- * it is checked that the first occurence of an enumeration tag is -- accompanied by a full definition of the enumeration -- defTag :: Ident -> CTag -> CT s (Maybe CTag)@@ -259,13 +259,13 @@ -- definition, and if so, return the full definition and the foreward -- definition's tag identifier --- -- * the first argument contains the _previous_ definition+ -- * the first argument contains the _previous_ definition --- -- * in the case of a structure, a foreward definition after a full+ -- * in the case of a structure, a foreward definition after a full -- definition is allowed, so we have to handle this case; enumerations -- don't allow foreward definitions --- -- * there may also be multiple foreward definition; if we have two of+ -- * there may also be multiple foreward definition; if we have two of -- them here, one is arbitrarily selected to take the role of the full -- definition --@@ -294,7 +294,7 @@ -- enrich the object and tag name space with identifiers obtained by dropping -- the given prefix from the identifiers already in the name space (EXPORTED) ----- * if a new identifier would collides with an existing one, the new one is+-- * if a new identifier would collides with an existing one, the new one is -- discarded, ie, all associations that existed before the transformation -- started are still in effect after the transformation -- @@ -307,7 +307,7 @@ -- get the definition of an identifier (EXPORTED) ----- * the attribute must be defined, ie, a definition must be associated with+-- * the attribute must be defined, ie, a definition must be associated with -- the given identifier -- getDefOf :: Ident -> CT s CDef@@ -367,7 +367,7 @@ -- find a type object in the object name space; returns `nothing' if the -- identifier is not defined (EXPORTED) ----- * if the second argument is `True', use `findObjShadow'+-- * if the second argument is `True', use `findObjShadow' -- findTypeObjMaybe :: Ident -> Bool -> CT s (Maybe (CObj, Ident)) findTypeObjMaybe ide useShadows = @@ -384,7 +384,7 @@ -- find a type object in the object name space; raises an error and exception -- if the identifier is not defined (EXPORTED) ----- * if the second argument is `True', use `findObjShadow'+-- * if the second argument is `True', use `findObjShadow' -- findTypeObj :: Ident -> Bool -> CT s (CObj, Ident) findTypeObj ide useShadows = do@@ -396,7 +396,7 @@ -- find an object, function, or enumerator in the object name space; raises an -- error and exception if the identifier is not defined (EXPORTED) ----- * if the second argument is `True', use `findObjShadow'+-- * if the second argument is `True', use `findObjShadow' -- findValueObj :: Ident -> Bool -> CT s (CObj, Ident) findValueObj ide useShadows = @@ -413,7 +413,7 @@ -- find a function in the object name space; raises an error and exception if -- the identifier is not defined (EXPORTED) ----- * if the second argument is `True', use `findObjShadow'+-- * if the second argument is `True', use `findObjShadow' -- findFunObj :: Ident -> Bool -> CT s (CObj, Ident) findFunObj ide useShadows = @@ -439,7 +439,7 @@ -- discard all declarators but the one declaring the given identifier -- (EXPORTED) ----- * the declaration must contain the identifier+-- * the declaration must contain the identifier -- simplifyDecl :: Ident -> CDecl -> CDecl ide `simplifyDecl` (CDecl specs declrs at) =@@ -456,7 +456,7 @@ -- extract the declarator that declares the given identifier (EXPORTED) ----- * the declaration must contain the identifier+-- * the declaration must contain the identifier -- declrFromDecl :: Ident -> CDecl -> CDeclr ide `declrFromDecl` decl = @@ -487,7 +487,7 @@ -- obtains the member definitions and the tag of a struct (EXPORTED) ----- * member definitions are expanded+-- * member definitions are expanded -- structMembers :: CStructUnion -> ([CDecl], CStructTag) structMembers (CStruct tag _ members _) = (concat . map expandDecl $ members,@@ -512,7 +512,7 @@ -- get a tag's name (EXPORTED) ----- * fail if the tag is anonymous+-- * fail if the tag is anonymous -- tagName :: CTag -> Ident tagName tag =@@ -525,7 +525,7 @@ -- checks whether the given declarator defines an object that is a pointer to -- some other type (EXPORTED) ----- * as far as parameter passing is concerned, arrays are also pointer+-- * as far as parameter passing is concerned, arrays are also pointer -- isPtrDeclr :: CDeclr -> Bool isPtrDeclr (CPtrDeclr _ (CVarDeclr _ _) _) = True@@ -538,7 +538,7 @@ -- checks whether the given declarator defines an object that is an array of -- some other type (EXPORTED) ----- * difference between arrays and pure pointers is important for size+-- * difference between arrays and pure pointers is important for size -- calculations -- isArrDeclr :: CDeclr -> Bool@@ -547,7 +547,7 @@ -- drops the first pointer level from the given declarator (EXPORTED) ----- * the declarator must declare a pointer object+-- * the declarator must declare a pointer object -- -- FIXME: this implementation isn't nice, because we retain the `CVarDeclr' -- unchanged; as the declarator is changed, we should maybe make this@@ -573,7 +573,7 @@ -- checks whether the given declaration defines a pointer object (EXPORTED) ----- * there may only be a single declarator in the declaration+-- * there may only be a single declarator in the declaration -- isPtrDecl :: CDecl -> Bool isPtrDecl (CDecl _ [] _) = False@@ -602,7 +602,7 @@ -- declarator) and constructs a declaration for the result of the function -- (EXPORTED) ----- * the boolean result indicates whether the function is variadic+-- * the boolean result indicates whether the function is variadic -- funResultAndArgs :: CDecl -> ([CDecl], CDecl, Bool) funResultAndArgs (CDecl specs [(Just declr, _, _)] _) =@@ -637,13 +637,13 @@ -- the declarator associated with that name (this is called ``typedef -- chasing'') (EXPORTED) ----- * if `ind = True', we have to hop over one indirection+-- * if `ind = True', we have to hop over one indirection ----- * remove all declarators except the one we just looked up+-- * remove all declarators except the one we just looked up -- chaseDecl :: Ident -> Bool -> CT s CDecl ----- * cycles are no issue, as they cannot occur in a correct C header (we would +-- * cycles are no issue, as they cannot occur in a correct C header (we would -- have spotted the problem during name analysis) -- chaseDecl ide ind = @@ -662,12 +662,12 @@ -- find type object in object name space and then chase it (EXPORTED) ----- * see also `chaseDecl'+-- * see also `chaseDecl' ----- * also create an object association from the given identifier to the object+-- * also create an object association from the given identifier to the object -- that it _directly_ represents ----- * if the third argument is `True', use `findObjShadow'+-- * if the third argument is `True', use `findObjShadow' -- findAndChaseDecl :: Ident -> Bool -> Bool -> CT s CDecl findAndChaseDecl ide ind useShadows =@@ -700,7 +700,7 @@ -- or a type definition referring to an enumeration in the object name space; -- raises an error and exception if the identifier is not defined (EXPORTED) ----- * if the second argument is `True', use `findTagShadow'+-- * if the second argument is `True', use `findTagShadow' -- lookupEnum :: Ident -> Bool -> CT s CEnum lookupEnum ide useShadows =@@ -721,15 +721,15 @@ -- or a type definition referring to a struct/union in the object name space; -- raises an error and exception if the identifier is not defined (EXPORTED) ----- * if `ind = True', the identifier names a reference type to the searched+-- * if `ind = True', the identifier names a reference type to the searched -- for struct/union ----- * typedef chasing is used only if there is no tag of the same name or an+-- * typedef chasing is used only if there is no tag of the same name or an -- indirection (ie, `ind = True') is explicitly required ----- * if the third argument is `True', use `findTagShadow'+-- * if the third argument is `True', use `findTagShadow' ----- * when finding a forward definition of a tag, follow it to the real+-- * when finding a forward definition of a tag, follow it to the real -- definition -- lookupStructUnion :: Ident -> Bool -> Bool -> CT s CStructUnion@@ -750,11 +750,11 @@ -- for the given identifier, check for the existance of both a type definition -- or a struct, union, or enum definition (EXPORTED) ----- * if a typedef and a tag exists, the typedef takes precedence+-- * if a typedef and a tag exists, the typedef takes precedence ----- * typedefs are chased+-- * typedefs are chased ----- * if the second argument is `True', look for shadows, too+-- * if the second argument is `True', look for shadows, too -- lookupDeclOrTag :: Ident -> Bool -> CT s (Either CDecl CTag) lookupDeclOrTag ide useShadows = do@@ -777,7 +777,7 @@ -- if the given declaration (which may have at most one declarator) is a -- `typedef' alias, yield the referenced name ----- * a `typedef' alias has one of the following forms+-- * a `typedef' alias has one of the following forms -- -- <specs> at x, ...; -- <specs> at *x, ...;@@ -787,12 +787,12 @@ -- variable, a type name (if `typedef' is in <specs>), or be entirely -- omitted. ----- * if `ind = True', the alias may be via an indirection+-- * if `ind = True', the alias may be via an indirection ----- * if `ind = True' and the alias is _not_ over an indirection, yield `True'; +-- * if `ind = True' and the alias is _not_ over an indirection, yield `True'; -- otherwise `False' (ie, the ability to hop over an indirection is consumed) ----- * this may be an anonymous declaration, ie, the name in `CVarDeclr' may be+-- * this may be an anonymous declaration, ie, the name in `CVarDeclr' may be -- omitted or there may be no declarator at all -- extractAlias :: CDecl -> Bool -> Maybe (Ident, Bool)@@ -811,7 +811,7 @@ -- if the given tag is a forward declaration of a structure, follow the -- reference to the full declaration ----- * the recursive call is not dangerous as there can't be any cycles+-- * the recursive call is not dangerous as there can't be any cycles -- extractStruct :: Position -> CTag -> CT s CStructUnion extractStruct pos (EnumCT _ ) = structExpectedErr pos
c2hs/chs/CHS.hs view
@@ -122,17 +122,17 @@ -- a CHS code fragament (EXPORTED) ----- * `CHSVerb' fragments are present throughout the compilation and finally+-- * `CHSVerb' fragments are present throughout the compilation and finally -- they are the only type of fragment (describing the generated Haskell -- code) ----- * `CHSHook' are binding hooks, which are being replaced by Haskell code by+-- * `CHSHook' are binding hooks, which are being replaced by Haskell code by -- `GenBind.expandHooks' ----- * `CHSCPP' and `CHSC' are fragements of C code that are being removed when+-- * `CHSCPP' and `CHSC' are fragements of C code that are being removed when -- generating the custom C header in `GenHeader.genHeader' ----- * `CHSCond' are strutured conditionals that are being generated by+-- * `CHSCond' are strutured conditionals that are being generated by -- `GenHeader.genHeader' from conditional CPP directives (`CHSCPP') -- data CHSFrag = CHSVerb String -- Haskell code@@ -258,7 +258,7 @@ -- marshalling descriptor for function hooks (EXPORTED) ----- * a marshaller consists of a function name and flag indicating whether it+-- * a marshaller consists of a function name and flag indicating whether it -- has to be executed in the IO monad -- data CHSParm = CHSParm (Maybe (Ident, CHSArg)) -- "in" marshaller@@ -335,7 +335,7 @@ -- parse a CHS module (EXPORTED) ----- * in case of a syntactical or lexical error, a fatal error is raised;+-- * in case of a syntactical or lexical error, a fatal error is raised; -- warnings are returned together with the module -- loadCHS :: FilePath -> CST s (CHSModule, String)@@ -377,9 +377,9 @@ -- given a file name (no suffix) and a CHS module, the module is printed -- into that file (EXPORTED) -- --- * the module can be flagged as being pure Haskell+-- * the module can be flagged as being pure Haskell -- --- * the correct suffix will automagically be appended+-- * the correct suffix will automagically be appended -- dumpCHS :: String -> CHSModule -> Bool -> CST s () dumpCHS fname mod pureHaskell =@@ -405,7 +405,7 @@ -- convert a CHS module into a string ----- * if the second argument is `True', all fragments must contain Haskell code+-- * if the second argument is `True', all fragments must contain Haskell code -- showCHSModule :: CHSModule -> Bool -> String showCHSModule (CHSModule frags) pureHaskell = @@ -625,11 +625,11 @@ -- load a CHI file (EXPORTED) ----- * the file suffix is automagically appended+-- * the file suffix is automagically appended ----- * any error raises a syntax exception (see below)+-- * any error raises a syntax exception (see below) ----- * the version of the .chi file is checked against the version of the current+-- * the version of the .chi file is checked against the version of the current -- executable; they must match in the major and minor version -- loadCHI :: FilePath -> CST s String@@ -692,7 +692,7 @@ -- given a file name (no suffix) and a CHI file, the information is printed -- into that file (EXPORTED) -- --- * the correct suffix will automagically be appended+-- * the correct suffix will automagically be appended -- dumpCHI :: String -> String -> CST s () dumpCHI fname contents =@@ -728,7 +728,7 @@ -- parse a complete module ----- * errors are entered into the compiler state+-- * errors are entered into the compiler state -- parseCHSModule :: Position -> String -> CST s CHSModule parseCHSModule pos cs = do@@ -738,10 +738,10 @@ -- parsing of code fragments ----- * in case of an error, all tokens that are neither Haskell nor control+-- * in case of an error, all tokens that are neither Haskell nor control -- tokens are skipped; afterwards parsing continues ----- * when encountering inline-C code we scan forward over all inline-C and+-- * when encountering inline-C code we scan forward over all inline-C and -- control tokens to avoid turning the control tokens within a sequence of -- inline-C into Haskell fragments --
c2hs/chs/CHSLexer.hs view
@@ -568,7 +568,7 @@ -- control code in the base lexer (is turned into a token) ----- * this covers exactly the same set of characters as contained in `ctrlSet'+-- * this covers exactly the same set of characters as contained in `ctrlSet' -- and `Lexers.ctrlLexer' and advances positions also like the `ctrlLexer' -- ctrl :: CHSLexer@@ -594,9 +594,9 @@ -- pre-processor directives and `#c' ----- * we lex `#c' as a directive and special case it in the action+-- * we lex `#c' as a directive and special case it in the action ----- * we lex C line number pragmas and special case it in the action+-- * we lex C line number pragmas and special case it in the action -- cpp :: CHSLexer cpp = directive@@ -669,7 +669,7 @@ -- whitespace ----- * horizontal and vertical tabs, newlines, and form feeds are filter out by+-- * horizontal and vertical tabs, newlines, and form feeds are filter out by -- `Lexers.ctrlLexer' -- whitespace :: CHSLexer@@ -777,9 +777,9 @@ -- generate a token sequence out of a string denoting a CHS file -- (EXPORTED) ----- * the given position is attributed to the first character in the string+-- * the given position is attributed to the first character in the string ----- * errors are entered into the compiler state+-- * errors are entered into the compiler state -- lexCHS :: String -> Position -> CST s [CHSToken] lexCHS cs pos =
c2hs/gen/CInfo.hs view
@@ -77,7 +77,7 @@ -- C's primitive types (EXPORTED) ----- * `CFunPtrPT' doesn't occur in Haskell representations of C types, but we+-- * `CFunPtrPT' doesn't occur in Haskell representations of C types, but we -- need to know their size, which may be different from `CPtrPT' -- data CPrimType = CPtrPT -- void *@@ -102,7 +102,7 @@ -- size of primitive type of C (EXPORTED) ----- * negative size implies that it is a bit, not an octet size+-- * negative size implies that it is a bit, not an octet size -- size :: CPrimType -> Int size CPtrPT = Storable.sizeOf (undefined :: Ptr ())@@ -126,7 +126,7 @@ -- alignment of C's primitive types (EXPORTED) ----- * more precisely, the padding put before the type's member starts when the+-- * more precisely, the padding put before the type's member starts when the -- preceding component is a char -- alignment :: CPrimType -> Int@@ -151,20 +151,20 @@ -- alignment constraint for a C bitfield ----- * gets the bitfield size (in bits) as an argument+-- * gets the bitfield size (in bits) as an argument ----- * alignments constraints smaller or equal to zero are reserved for bitfield+-- * alignments constraints smaller or equal to zero are reserved for bitfield -- alignments ----- * bitfields of size 0 always trigger padding; thus, they get the maximal+-- * bitfields of size 0 always trigger padding; thus, they get the maximal -- size ----- * if bitfields whose size exceeds the space that is still available in a+-- * if bitfields whose size exceeds the space that is still available in a -- partially filled storage unit trigger padding, the size of a storage unit -- is provided as the alignment constraint; otherwise, it is 0 (meaning it -- definitely starts at the current position) ----- * here, alignment constraint /= 0 are somewhat subtle; they mean that is+-- * here, alignment constraint /= 0 are somewhat subtle; they mean that is -- the given number of bits doesn't fit in what's left in the current -- storage unit, alignment to the start of the next storage unit has to be -- triggered
c2hs/gen/GBMonad.hs view
@@ -117,10 +117,10 @@ -- takes an identifier association table to a translation function ----- * if first argument is `True', identifiers that are not found in the+-- * if first argument is `True', identifiers that are not found in the -- translation table are subjected to `underscoreToCase' ----- * the details of handling the prefix are given in the DOCU section at the+-- * the details of handling the prefix are given in the DOCU section at the -- beginning of this file -- transTabToTransFun :: String -> CHSTrans -> TransFun@@ -162,10 +162,10 @@ -- map that for maps C pointer types to Haskell types for pointer that have -- been registered using a pointer hook ----- * the `Bool' indicates whether for a C type "ctype", we map "ctype" itself+-- * the `Bool' indicates whether for a C type "ctype", we map "ctype" itself -- or "*ctype" ----- * the co-domain details how this pointer is represented in Haskell.+-- * the co-domain details how this pointer is represented in Haskell. -- See HsPtrRep. -- type PointerMap = Map (Bool, Ident) HsPtrRep@@ -173,7 +173,7 @@ -- Define how pointers are represented in Haskell. ----- * The first element is true if the pointer points to a function.+-- * The first element is true if the pointer points to a function. -- The second is the Haskell pointer type (plain -- Ptr, ForeignPtr or StablePtr). The third field is (Just wrap) if the -- pointer is wrapped in a newtype. Where "wrap" @@ -283,9 +283,9 @@ -- add code to the delayed fragments (the code is made to start at a new line) ----- * currently only code belonging to call hooks can be delayed+-- * currently only code belonging to call hooks can be delayed ----- * if code for the same call hook (ie, same C function) is delayed+-- * if code for the same call hook (ie, same C function) is delayed -- repeatedly only the first entry is stored; it is checked that the hooks -- specify the same flags (ie, produce the same delayed code) --@@ -348,7 +348,7 @@ -- query the Haskell object map for a class ----- * raise an error if the class cannot be found+-- * raise an error if the class cannot be found -- queryClass :: Ident -> GB HsObject queryClass hsName = do@@ -361,7 +361,7 @@ -- query the Haskell object map for a pointer ----- * raise an error if the pointer cannot be found+-- * raise an error if the pointer cannot be found -- queryPointer :: Ident -> GB HsObject queryPointer hsName = do@@ -374,7 +374,7 @@ -- merge the pointer and Haskell object maps ----- * currently, the read map overrides any entires for shared keys in the map+-- * currently, the read map overrides any entires for shared keys in the map -- that is already in the monad; this is so that, if multiple import hooks -- add entries for shared keys, the textually latest prevails; any local -- entries are entered after all import hooks anyway
c2hs/gen/GenBind.hs view
@@ -248,7 +248,7 @@ -- check for integral C types ----- * For marshalling purposes C char's are integral types (see also types+-- * For marshalling purposes C char's are integral types (see also types -- classes for which the FFI guarantees instances for `CChar', `CSChar', and -- `CUChar') --@@ -286,11 +286,11 @@ -- given a C header file and a binding file, expand all hooks in the binding -- file using the C header information (EXPORTED) ----- * together with the module, returns the contents of the .chi file+-- * together with the module, returns the contents of the .chi file ----- * if any error (not warnings) is encountered, a fatal error is raised.+-- * if any error (not warnings) is encountered, a fatal error is raised. ----- * also returns all warning messages encountered (last component of result)+-- * also returns all warning messages encountered (last component of result) -- expandHooks :: AttrC -> CHSModule -> CST s (CHSModule, String, String) expandHooks ac mod = do@@ -450,7 +450,7 @@ mLock <- if isNol then return Nothing else getLock let ideLexeme = identToLexeme ide -- orignal name might have been a shadow hsLexeme = ideLexeme `maybe` identToLexeme $ oalias- fiLexeme = hsLexeme ++ "'_" -- *Urgh* - probably unique...+ fiLexeme = hsLexeme ++ "'_" -- *Urgh* - probably unique... fiIde = onlyPosIdent nopos fiLexeme cdecl' = cide `simplifyDecl` cdecl callHook = CHSCall isPure isUns isNol cide (Just fiIde) pos@@ -561,10 +561,10 @@ -- produce code for an enumeration ----- * an extra instance declaration is required when any of the enumeration+-- * an extra instance declaration is required when any of the enumeration -- constants is explicitly assigned a value in its definition ----- * the translation function strips prefixes where possible (different+-- * the translation function strips prefixes where possible (different -- enumerators maye have different prefixes) -- enumDef :: CEnum -> String -> TransFun -> [String] -> GB String@@ -617,10 +617,10 @@ -- Haskell code for an instance declaration for `Enum' ----- * the expression of all explicitly specified tag values already have to be+-- * the expression of all explicitly specified tag values already have to be -- in normal form, ie, to be an int constant ----- * enumerations start at 0 and whenever an explicit value is specified,+-- * enumerations start at 0 and whenever an explicit value is specified, -- following tags are assigned values continuing from the explicitly -- specified one --@@ -677,7 +677,7 @@ -- generate a foreign import declaration that is put into the delayed code ----- * the C declaration is a simplified declaration of the function that we+-- * the C declaration is a simplified declaration of the function that we -- want to import into Haskell land -- callImport :: CHSHook -> Bool -> Bool -> Maybe String -> String -> String@@ -790,7 +790,7 @@ -- -- construct the function type --- -- * specified types appear in the argument and result only if their "in"+ -- * specified types appear in the argument and result only if their "in" -- and "out" marshaller, respectively, is not the `void' marshaller -- funTy parms parm =@@ -873,7 +873,7 @@ -- the result marshalling may not use an "in" marshaller and can only have -- one C value --- -- * a default marshaller maybe used for "out" marshalling+ -- * a default marshaller maybe used for "out" marshalling -- checkResMarsh (CHSParm (Just _) _ _ _ pos) _ = resMarshIllegalInErr pos@@ -937,13 +937,13 @@ -- compute from an access path, the declarator finally accessed and the index -- path required for the access ----- * each element in the index path specifies dereferencing an address and the +-- * each element in the index path specifies dereferencing an address and the -- offset to be added to the address before dereferencing ----- * the returned declaration is already normalised (ie, alias have been+-- * the returned declaration is already normalised (ie, alias have been -- expanded) ----- * it may appear as if `t.m' and `t->m' should have different access paths,+-- * it may appear as if `t.m' and `t->m' should have different access paths, -- as the latter specifies one more dereferencing; this is certainly true in -- C, but it doesn't apply here, as `t.m' is merely provided for the -- convenience of the interface writer - it is strictly speaking an@@ -955,7 +955,7 @@ do decl <- findAndChaseDecl ide False True return (ide `simplifyDecl` decl, [BitSize 0 0])-accessPath (CHSDeref (CHSRoot ide) _) = -- *t+accessPath (CHSDeref (CHSRoot ide) _) = -- *t do decl <- findAndChaseDecl ide True True return (ide `simplifyDecl` decl, [BitSize 0 0])@@ -984,7 +984,7 @@ case declr of (Just (CVarDeclr _ _), _, _) -> nop _ -> structExpectedErr ide-accessPath (CHSDeref path pos) = -- *a+accessPath (CHSDeref path pos) = -- *a do (decl, offsets) <- accessPath path decl' <- derefOrErr decl@@ -1003,10 +1003,10 @@ -- replaces a decleration by its alias if any ----- * the alias inherits any field size specification that the original+-- * the alias inherits any field size specification that the original -- declaration may have ----- * declaration must have exactly one declarator+-- * declaration must have exactly one declarator -- replaceByAlias :: CDecl -> GB CDecl replaceByAlias cdecl@(CDecl _ [(_, _, size)] at) =@@ -1082,7 +1082,7 @@ where -- we have to be careful here to ensure proper sign extension; -- in particular, shifting right followed by anding a mask is- -- *not* sufficient; instead, we exploit in the following that+ -- *not* sufficient; instead, we exploit in the following that -- `shiftR' performs sign extension -- extractBitfield = "; return $ (val `shiftL` (" @@ -1155,11 +1155,11 @@ -- generate the class and instance definitions for a class hook ----- * the pointer type must not be a stable pointer+-- * the pointer type must not be a stable pointer ----- * the first super class (if present) must be the direct superclass+-- * the first super class (if present) must be the direct superclass ----- * all Haskell objects in the superclass list must be pointer objects+-- * all Haskell objects in the superclass list must be pointer objects -- classDef :: Position -- for error messages -> String -- class name@@ -1223,19 +1223,19 @@ -- types that may occur in foreign declarations, ie, Haskell land types ----- * we reprsent C functions with no arguments (ie, the ANSI C `void'+-- * we reprsent C functions with no arguments (ie, the ANSI C `void' -- argument) by `FunET UnitET res' rather than just `res' internally, -- although the latter representation is finally emitted into the binding -- file; this is because we need to know which types are functions (in -- particular, to distinguish between `Ptr a' and `FunPtr a') ----- * aliased types (`DefinedET') are represented by a string plus their C+-- * aliased types (`DefinedET') are represented by a string plus their C -- declaration; the latter is for functions interpreting the following -- structure; an aliased type is always a pointer type that is contained in -- the pointer map (and got there either from a .chi or from a pointer hook -- in the same module) ----- * the representation for pointers does not distinguish between normal,+-- * the representation for pointers does not distinguish between normal, -- function, foreign, and stable pointers; function pointers are identified -- by their argument and foreign and stable pointers are only used -- indirectly, by referring to type names introduced by a `pointer' hook@@ -1270,7 +1270,7 @@ -- pretty print an external type ----- * a previous version of this function attempted to not print unnecessary+-- * a previous version of this function attempted to not print unnecessary -- brackets; this however doesn't work consistently due to `DefinedET'; so, -- we give up on the idea (preferring simplicity) --@@ -1307,12 +1307,12 @@ -- compute the type of the C function declared by the given C object ----- * the identifier specifies in which of the declarators we are interested+-- * the identifier specifies in which of the declarators we are interested ----- * if the third argument is `True', the function result should not be+-- * if the third argument is `True', the function result should not be -- wrapped into an `IO' type ----- * the caller has to guarantee that the object does indeed refer to a+-- * the caller has to guarantee that the object does indeed refer to a -- function -- extractFunType :: Position -> CDecl -> Bool ->@@ -1361,9 +1361,9 @@ -- compute a non-struct/union type from the given declaration ----- * the declaration may have at most one declarator+-- * the declaration may have at most one declarator ----- * C functions are represented as `Ptr (FunEt ...)' or `Addr' if in+-- * C functions are represented as `Ptr (FunEt ...)' or `Addr' if in -- compatibility mode (ie, `--old-ffi=yes') -- extractSimpleType :: Position -> CDecl -> GB ExtType@@ -1380,11 +1380,11 @@ -- compute a Haskell type for a type referenced in a C pointer type ----- * the declaration may have at most one declarator+-- * the declaration may have at most one declarator ----- * struct/union types are mapped to `()'+-- * struct/union types are mapped to `()' ----- * NB: this is by definition not a result type+-- * NB: this is by definition not a result type -- extractPtrType :: CDecl -> GB ExtType extractPtrType cdecl = do@@ -1396,16 +1396,16 @@ -- compute a Haskell type from the given C declaration, where C functions are -- represented by function pointers ----- * the declaration may have at most one declarator+-- * the declaration may have at most one declarator ----- * all C pointers (including functions) are represented as `Addr' if in+-- * all C pointers (including functions) are represented as `Addr' if in -- compatibility mode (--old-ffi) ----- * typedef'ed types are chased+-- * typedef'ed types are chased ----- * takes the pointer map into account+-- * takes the pointer map into account ----- * IMPORTANT NOTE: `sizeAlignOf' relies on `DefinedET' only being produced+-- * IMPORTANT NOTE: `sizeAlignOf' relies on `DefinedET' only being produced -- for pointer types; if this ever changes, we need to -- handle `DefinedET's differently. The problem is that -- entries in the pointer map currently prevent@@ -1542,7 +1542,7 @@ -- compute the complex (external) type determined by a list of type specifiers ----- * may not be called for a specifier that defines a typedef alias+-- * may not be called for a specifier that defines a typedef alias -- specType :: Position -> [CDeclSpec] -> Maybe CExpr -> GB CompType specType cpos specs osize = @@ -1618,9 +1618,9 @@ -- precise size representation ----- * this is a pair of a number of octets and a number of bits+-- * this is a pair of a number of octets and a number of bits ----- * if the number of bits is nonzero, the octet component is aligned by the+-- * if the number of bits is nonzero, the octet component is aligned by the -- alignment constraint for `CIntPT' (important for accessing bitfields with -- more than 8 bits) --@@ -1695,7 +1695,7 @@ -- sizeAlignOf :: CDecl -> GB (BitSize, Int) ----- * we make use of the assertion that `extractCompType' can only return a+-- * we make use of the assertion that `extractCompType' can only return a -- `DefinedET' when the declaration is a pointer declaration -- sizeAlignOf (CDecl specs [(Just declr, _, size)] ats) | isArrDeclr declr =@@ -1737,7 +1737,7 @@ -- apply the given alignment constraint at the given offset ----- * if the alignment constraint is negative or zero, it is the alignment+-- * if the alignment constraint is negative or zero, it is the alignment -- constraint for a bitfield -- alignOffset :: BitSize -> Int -> BitSize
c2hs/gen/GenHeader.hs view
@@ -41,7 +41,7 @@ -- --- TODO ---------------------------------------------------------------------- ----- * Ideally, `ghFrag[s]' should be tail recursive+-- * Ideally, `ghFrag[s]' should be tail recursive module GenHeader ( genHeader@@ -71,9 +71,9 @@ -- |Generate a custom C header from a CHS binding module. ----- * All CPP directives and inline-C fragments are moved into the custom header+-- * All CPP directives and inline-C fragments are moved into the custom header ----- * The CPP and inline-C fragments are removed from the .chs tree and+-- * The CPP and inline-C fragments are removed from the .chs tree and -- conditionals are replaced by structured conditionals -- genHeader :: CHSModule -> CST s ([String], CHSModule, String)@@ -125,7 +125,7 @@ -- Generate the C header for an entire .chs module. ----- * This works more or less like a recursive decent parser for a statement+-- * This works more or less like a recursive decent parser for a statement -- sequence that may contain conditionals, where `ghFrag' implements most of -- the state transition system of the associated automaton --@@ -140,7 +140,7 @@ -- Collect header and fragments up to eof or a CPP directive that is part of a -- conditional ----- * We collect the header (ie, CPP directives and inline-C) using a+-- * We collect the header (ie, CPP directives and inline-C) using a -- difference list to avoid worst case O(n^2) complexity due to -- concatenation of lines that go into the header. --@@ -198,7 +198,7 @@ where -- enter a new conditional (may be an #if[[n]def] or #elif) --- -- * Arguments are the lexeme of the directive `s', the position of that+ -- * Arguments are the lexeme of the directive `s', the position of that -- directive `pos', and the fragments following the directive `frags' -- openIf s pos frags = @@ -241,7 +241,7 @@ -- -- turn a completed conditional into a `CHSCond' fragment --- -- * `(s, fragsTh)' is the CPP directive `s' containing the condition under+ -- * `(s, fragsTh)' is the CPP directive `s' containing the condition under -- which `fragTh' should be executed; `alts' are alternative branches -- (with conditions); and `oelse' is an optional else-branch --
c2hs/state/Switches.hs view
@@ -118,7 +118,7 @@ -- trace setting on startup ----- * all traces are initially off+-- * all traces are initially off -- initialTraces :: Traces initialTraces = Traces {
c2hs/toplevel/C2HSConfig.hs view
@@ -61,11 +61,11 @@ -- C preprocessor options (EXPORTED) ----- * `-x c' forces CPP to regard the input as C code; this option seems to be+-- * `-x c' forces CPP to regard the input as C code; this option seems to be -- understood at least on Linux, FreeBSD, and Solaris and seems to make a -- difference over the default language setting on FreeBSD ----- * `-P' would suppress `#line' directives+-- * `-P' would suppress `#line' directives -- cppopts :: [String] cppopts = case (os,cpp) of@@ -101,7 +101,7 @@ -- indicates in which direction the C compiler fills bitfields (EXPORTED) ----- * the value is 1 or -1, depending on whether the direction is growing+-- * the value is 1 or -1, depending on whether the direction is growing -- towards the MSB -- bitfieldDirection :: Int@@ -113,7 +113,7 @@ -- storage unit in its entirety introduce padding or split over two storage -- units (EXPORTED) ----- * `True' means that such a bitfield introduces padding (instead of being+-- * `True' means that such a bitfield introduces padding (instead of being -- split) -- bitfieldPadding :: Bool@@ -131,7 +131,7 @@ -- the alignment constraint for a bitfield (EXPORTED) ----- * this makes the assumption that the alignment of a bitfield is independent+-- * this makes the assumption that the alignment of a bitfield is independent -- of the bitfield's size -- bitfieldAlignment :: Int
c2hs/toplevel/Gtk2HsC2Hs.hs view
@@ -285,7 +285,7 @@ -- main process (set up base configuration, analyse command line, and execute -- compilation process) ----- * Exceptions are caught and reported+-- * Exceptions are caught and reported -- compile :: [String] -> CST s () compile cmdLine =@@ -343,9 +343,9 @@ -- execute the compilation task ----- * if `Help' is present, emit the help message and ignore the rest--- * if `Version' is present, do it first (and only once)--- * actual compilation is only invoked if we have one or two extra arguments+-- * if `Help' is present, emit the help message and ignore the rest+-- * if `Version' is present, do it first (and only once)+-- * actual compilation is only invoked if we have one or two extra arguments -- (otherwise, it is just skipped) -- execute :: [Flag] -> [FilePath] -> CST s ()@@ -393,7 +393,7 @@ -- process an option ----- * `Help' cannot occur+-- * `Help' cannot occur -- processOpt :: Flag -> CST s () processOpt (CPPOpts cppopt ) = addCPPOpts [cppopt]@@ -421,7 +421,7 @@ -- Compute the base name for all generated files (Haskell, C header, and .chi -- file) ----- * The result is available from the `outputSB' switch+-- * The result is available from the `outputSB' switch -- computeOutputName :: FilePath -> CST s () computeOutputName bndFileNoSuffix =@@ -444,7 +444,7 @@ -- set the options for the C proprocessor ----- * any header search path that is set with `-IDIR' is also added to+-- * any header search path that is set with `-IDIR' is also added to -- `hpathsSB' -- addCPPOpts :: [String] -> CST s ()@@ -482,9 +482,9 @@ -- set the search directories for .chi files ----- * Several -i flags are accumulated. Later paths have higher priority.+-- * Several -i flags are accumulated. Later paths have higher priority. ----- * The current directory is always searched last because it is the+-- * The current directory is always searched last because it is the -- standard value in the compiler state. -- setInclude :: String -> CST s ()@@ -526,10 +526,10 @@ -- read the binding module, construct a header, run it through CPP, read it, -- and finally generate the Haskell target ----- * the header file name (first argument) may be empty; otherwise, it already+-- * the header file name (first argument) may be empty; otherwise, it already -- contains the right suffix ----- * the binding file name has been stripped of the .chs suffix+-- * the binding file name has been stripped of the .chs suffix -- process :: FilePath -> Maybe FilePath -> FilePath -> CST s () process headerFile preCompFile bndFileStripped =
callbackGen/HookGenerator.hs view
@@ -238,7 +238,7 @@ -- type declaration: only consume variables when they are needed ----- * Tint is used as return value as well. Therefore Integral has to be added+-- * Tint is used as return value as well. Therefore Integral has to be added -- to the context. Grrr. -- context :: [Types] -> [Char] -> [ShowS]
gtk2hs-buildtools.cabal view
@@ -1,5 +1,5 @@ Name: gtk2hs-buildtools-Version: 0.13.2.0+Version: 0.13.2.1 License: GPL-2 License-file: COPYING Copyright: (c) 2001-2010 The Gtk2Hs Team