Changeset 2497
- Timestamp:
- 04/29/05 23:42:50 (4 years ago)
- svk:copy_cache_prev:
- 4052
- Files:
-
- 12 modified
-
Makefile.PL (modified) (2 diffs)
-
src/IMC.hs (modified) (2 diffs)
-
src/IMC/AST.hs (modified) (3 diffs)
-
src/IMC/Compile.hs (modified) (2 diffs)
-
src/Pugs/AST.hs (modified) (9 diffs)
-
src/Pugs/Compile/Haskell.hs (modified) (3 diffs)
-
src/Pugs/Eval.hs (modified) (3 diffs)
-
src/Pugs/External/Haskell.hs (modified) (3 diffs)
-
src/Pugs/Help.hs (modified) (1 diff)
-
src/Pugs/Parser.hs (modified) (4 diffs)
-
src/Pugs/Run.hs (modified) (1 diff)
-
src/Pugs/Shell.hs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Makefile.PL
r2465 r2497 42 42 'src/Pugs/Config.hs', 'blib6', 43 43 'test.log', 44 map {("$_/*.h i", "$_/*.o*")} @srcdirs44 map {("$_/*.hpp", "$_/*.hi", "$_/*.o*")} @srcdirs 45 45 ); 46 46 … … 120 120 121 121 %.hpp : %.hs @prereqs 122 $ghc $threaded $ghc_flags -E \$< -o \$@ 123 \$(PERL) -i -pe 's/^#.*//' \$@ 124 125 %.html : %.hpp 126 haddock -vD \$< 122 $ghc $threaded $ghc_flags -DHADDOCK -E \$< -o \$@ 123 \$(PERLRUN) util/munge_haddock.pl \$@ 127 124 128 125 profiled :: src/Pugs/Config.hs @srcfiles $version_h @prereqs -
src/IMC.hs
r2236 r2497 1 {-# OPTIONS_GHC -fglasgow-exts -fth #-}1 {-# OPTIONS_GHC -fglasgow-exts -fth -cpp #-} 2 2 3 3 {- … … 19 19 -- import IMC.Lexer 20 20 21 #ifndef HADDOCK 21 22 run = $( imcX prog ) 23 #endif 22 24 23 25 {- -
src/IMC/AST.hs
r2134 r2497 1 {-# OPTIONS_GHC -fglasgow-exts -fth #-}1 {-# OPTIONS_GHC -fglasgow-exts -fth -cpp #-} 2 2 3 3 module IMC.AST where … … 13 13 instance Value String 14 14 15 #ifndef HADDOCK 15 16 data Term a where 16 17 TStr :: String -> Term String 17 18 TOp1 :: (Show a, Value a) => Op -> Term a -> Term Statement 18 19 TSub :: SubName -> [Term Statement] -> Term Sub 20 #else 21 data Term = TStr str termstr | TOp1 op term termstatement | TSub subname arrtermstatement termsub 22 #endif 19 23 20 24 compile :: ExpQ -> ExpQ 25 #ifndef HADDOCK 21 26 compile str = [| putStrLn $ "Hello, " ++ $str ++ "!" |] 27 #endif 22 28 23 29 -- Haskell Equivalent of a BEGIN block! … … 38 44 39 45 imcCompile :: Term a -> ExpQ 46 #ifndef HADDOCK 40 47 imcCompile (TStr a) = [| return a |] 41 48 imcCompile (TOp1 "print" (TStr str)) = [| putStrLn str |] 42 49 imcCompile (TSub _ stmts) = let foo = map imcCompile stmts in 43 50 [| sequence_ $(listE foo) |] 44 51 #endif -
src/IMC/Compile.hs
r2134 r2497 1 {-# OPTIONS_GHC -fglasgow-exts -fth #-}1 {-# OPTIONS_GHC -fglasgow-exts -fth -cpp #-} 2 2 3 3 module IMC.Compile where … … 89 89 -- run :: Term a -> IO (Term a) 90 90 -- run program = $( compile [| program |] ) 91 #ifndef HADDOCK 91 92 foo program = $( compile [| program |] ) 93 #endif 92 94 93 95 -
src/Pugs/AST.hs
r2490 r2497 21 21 import qualified Data.Map as Map 22 22 23 #include "Types/Array.hs" 24 #include "Types/Handle.hs" 25 #include "Types/Hash.hs" 26 #include "Types/Scalar.hs" 27 #include "Types/Code.hs" 28 #include "Types/Thunk.hs" 29 #include "Types/Rule.hs" 30 #include "Types/Pair.hs" 31 #include "Types/Object.hs" 23 {- include "Types/Array.hs" -} 24 {- include "Types/Handle.hs" -} 25 {- include "Types/Hash.hs" -} 26 {- include "Types/Scalar.hs" -} 27 {- include "Types/Code.hs" -} 28 {- include "Types/Thunk.hs" -} 29 {- include "Types/Rule.hs" -} 30 {- include "Types/Pair.hs" -} 31 {- include "Types/Object.hs" -} 32 32 33 33 type Ident = String … … 514 514 } 515 515 516 #ifndef HADDOCK 516 517 mkSub = MkCode 517 518 { isMulti = False … … 526 527 , subBody = emptyExp 527 528 } 529 #endif 528 530 529 531 instance Ord VComplex where … … 1057 1059 return $ f (av :: VArray) 1058 1060 1061 #ifndef HADDOCK 1059 1062 data (Typeable v) => IVar v where 1060 1063 IScalar :: ScalarClass a => a -> IVar VScalar … … 1086 1089 vCast v = MkOpaque v 1087 1090 castV (MkOpaque x) = castV x 1091 #endif 1088 1092 1089 1093 readIVar :: IVar v -> Eval v … … 1100 1104 refType (MkRef x) = object_iType x 1101 1105 1106 #ifndef HADDOCK 1102 1107 instance Eq VRef where 1103 1108 (==) = const $ const False … … 1115 1120 instance (Typeable a) => Show (IVar a) where 1116 1121 show v = show (MkRef v) 1122 #endif 1117 1123 1118 1124 scalarRef x = MkRef (IScalar x) … … 1149 1155 retConstError val = retError "Can't modify constant item" val 1150 1156 1157 #ifndef HADDOCK 1151 1158 type IArray = TVar [IVar VScalar] 1152 1159 type IArraySlice = [IVar VScalar] … … 1182 1189 typeOf1 (IThunk x) = typeOf x 1183 1190 typeOf1 (IPair x) = typeOf x 1184 1191 #endif 1192 -
src/Pugs/Compile/Haskell.hs
r2462 r2497 16 16 17 17 genGHC :: Eval Val 18 #ifndef HADDOCK 18 19 genGHC = do 19 20 exp <- asks envBody … … 31 32 , TH.pprint str 32 33 ] 34 #endif 33 35 36 #ifndef HADDOCK 34 37 compile (Stmts stmt rest) = [| do 35 38 $(argC) … … 58 61 compile Noop = [| return () |] 59 62 compile exp = internalError ("Unrecognized construct: " ++ show exp) 63 #endif 60 64 61 65 #endif -
src/Pugs/Eval.hs
r2487 r2497 1 {-# OPTIONS_GHC -fglasgow-exts #-}1 {-# OPTIONS_GHC -fglasgow-exts -cpp #-} 2 2 {-# OPTIONS_GHC -#include "UnicodeC.h" #-} 3 3 … … 377 377 val <- evalExp valExp 378 378 retVal $ castV (key, val) 379 #ifndef HADDOCK 379 380 "*" | [Syn syn [exp]] <- unwrap exps -- * cancels out [] and {} 380 381 , syn == "\\{}" || syn == "\\[]" 381 382 -> enterEvalContext cxtSlurpyAny exp 383 #endif 382 384 "*" -> do -- first stab at an implementation 383 385 let [exp] = exps … … 509 511 modVal <- readVar "$?MODULE" 510 512 mod <- fromVal modVal 513 #ifndef HADDOCK 511 514 let file = (`concatMap` mod) $ \v -> case v of 512 515 { '-' -> "__"; _ | isAlphaNum v -> [v] ; _ -> "_" } 516 #endif 513 517 op1 "require_haskell" (VStr $ file ++ ".o") 514 518 retEmpty -
src/Pugs/External/Haskell.hs
r2441 r2497 68 68 69 69 externalizeHaskell :: String -> String -> IO String 70 #ifndef HADDOCK 70 71 externalizeHaskell mod code = do 71 72 let names = map snd exports … … 92 93 ParseOk (HsModule _ _ _ _ decls) -> decls 93 94 ParseFailed _ err -> error err 95 #endif 94 96 95 97 wrap :: String -> IO Dec 98 #ifndef HADDOCK 96 99 wrap fun = do 97 100 [quoted] <- runQ [d| … … 101 104 |] 102 105 return $ munge quoted ("extern__" ++ fun) 106 #endif 103 107 104 108 munge (ValD _ x y) name = ValD (VarP (mkName name)) x y -
src/Pugs/Help.hs
r2135 r2497 10 10 -} 11 11 12 #define PUGS_VERSION "6" 13 #define PUGS_DATE "" 14 #include "pugs_config.h" 15 #include "pugs_version.h" 12 {- define PUGS_VERSION "6" -} 13 {- define PUGS_DATE "" -} 14 {- include "pugs_config.h" -} 15 {- include "pugs_version.h" -} 16 16 17 17 module Pugs.Help (printInteractiveHelp, printCommandLineHelp, -
src/Pugs/Parser.hs
r2476 r2497 1 {-# OPTIONS_GHC -fglasgow-exts #-}1 {-# OPTIONS_GHC -fglasgow-exts -cpp #-} 2 2 {-# OPTIONS_GHC -#include "UnicodeC.h" #-} 3 3 … … 939 939 <|> do 940 940 sigil <- oneOf "$@%&" 941 -- ^ placeholder, * global, ? magical, . member,: private member941 --^ \^ placeholder, \* global, \? magical, \. member, \: private member 942 942 caret <- option "" $ choice $ map string $ words " ^ * ? . : " 943 943 names <- many1 wordAny `sepBy1` (try $ string "::") … … 1053 1053 1054 1054 qInterpolator :: QFlags -> RuleParser Exp 1055 #ifndef HADDOCK 1055 1056 qInterpolator flags = choice [ 1056 1057 closure, … … 1099 1100 else True -- $ followed by anything else is interpolated 1100 1101 where second = head $ tail var 1102 #endif 1101 1103 1102 1104 qLiteral = do -- This should include q:anything// as well as '' "" <> -
src/Pugs/Run.hs
r2486 r2497 73 73 errSV <- newScalar (VStr "") 74 74 defSV <- newScalar undef 75 #if defined(PUGS_HAVE_HSPLUGINS) 75 {- if defined(PUGS_HAVE_HSPLUGINS) -} 76 76 hspluginsSV <- newScalar (VInt 1) 77 #else 77 {- else -} 78 78 hspluginsSV <- newScalar (VInt 0) 79 #endif 79 {- endif -} 80 80 let subExit = \x -> case x of 81 81 [x] -> op1 "exit" x -
src/Pugs/Shell.hs
r2440 r2497 80 80 #else 81 81 addHistory _ = return () 82 #endif 82 #endif 83 83
