Fix compilation errors caused by changes in PGF2

These prevented GF from being built with C run-time support (-fc-runtime).
This commit is contained in:
hallgren
2017-02-21 13:21:59 +00:00
parent 5905964c3e
commit cc6755be33
3 changed files with 9 additions and 7 deletions

View File

@@ -136,11 +136,11 @@ Library
if flag(c-runtime) if flag(c-runtime)
exposed-modules: PGF2 exposed-modules: PGF2
other-modules: PGF2.FFI PGF2.Expr other-modules: PGF2.FFI PGF2.Expr PGF2.Type
GF.Interactive2 GF.Command.Commands2 GF.Interactive2 GF.Command.Commands2
hs-source-dirs: src/runtime/haskell-bind hs-source-dirs: src/runtime/haskell-bind
build-tools: hsc2hs build-tools: hsc2hs
extra-libraries: gu pgf extra-libraries: pgf gu
c-sources: src/runtime/haskell-bind/utils.c c-sources: src/runtime/haskell-bind/utils.c
cc-options: -std=c99 cc-options: -std=c99

View File

@@ -812,7 +812,8 @@ pgfCommands = Map.fromList [
unlines [showFun' f ty|f<-funs, unlines [showFun' f ty|f<-funs,
let ty=C.functionType pgf f, let ty=C.functionType pgf f,
target ty == c] target ty == c]
target (C.DTyp _ c _) = c --target (C.DTyp _ c _) = c
target t = case C.unType t of (_,c,_) -> c
{- {-
[e] -> case H.inferExpr pgf e of [e] -> case H.inferExpr pgf e of
Left tcErr -> error $ render (H.ppTcError tcErr) Left tcErr -> error $ render (H.ppTcError tcErr)
@@ -977,7 +978,8 @@ pgfCommands = Map.fromList [
-} -}
optCat pgf opts = optCat pgf opts =
case listFlags "cat" opts of case listFlags "cat" opts of
v:_ -> C.DTyp [] (valueString v) [] --v:_ -> C.DTyp [] (valueString v) []
v:_ -> C.mkType [] (valueString v) []
_ -> C.startCat pgf _ -> C.startCat pgf
{- {-
@@ -1029,7 +1031,7 @@ pgfCommands = Map.fromList [
| otherwise = return void -- TODO implement more options | otherwise = return void -- TODO implement more options
showFun pgf f = showFun' f (C.functionType pgf f) showFun pgf f = showFun' f (C.functionType pgf f)
showFun' f ty = "fun "++f++" : "++C.showType ty showFun' f ty = "fun "++f++" : "++C.showType [] ty
{- {-
prGrammar env@(pgf,mos) opts prGrammar env@(pgf,mos) opts

View File

@@ -167,7 +167,7 @@ cpgfMain qsem command (t,(pgf,pc)) =
grammar = showJSON $ makeObj grammar = showJSON $ makeObj
["name".=C.abstractName pgf, ["name".=C.abstractName pgf,
"lastmodified".=show t, "lastmodified".=show t,
"startcat".=C.startCat pgf, "startcat".=C.showType [] (C.startCat pgf),
"languages".=languages] "languages".=languages]
where where
languages = [makeObj ["name".= l] | (l,_)<-Map.toList langs] languages = [makeObj ["name".= l] | (l,_)<-Map.toList langs]
@@ -313,7 +313,7 @@ instance JSON C.CId where
-} -}
instance JSON C.Expr where instance JSON C.Expr where
readJSON x = readJSON x >>= maybe (fail "Bad expression.") return . C.readExpr readJSON x = readJSON x >>= maybe (fail "Bad expression.") return . C.readExpr
showJSON = showJSON . C.showExpr showJSON = showJSON . C.showExpr []
-- | Convert a 'Tree' to an 'ATree' -- | Convert a 'Tree' to an 'ATree'