From 08cb32d77e6427a2e1bac5d9c10de4f2b26f523c Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Thu, 10 May 2012 12:42:44 +0200 Subject: [PATCH] hlint: use CamelCase for printf stuff --- Mate/BasicBlocks.hs | 6 +++--- Mate/ClassPool.hs | 18 +++++++++--------- Mate/Debug.hs | 24 ++++++++++++------------ Mate/MethodPool.hs | 10 +++++----- Mate/Strings.hs | 2 +- debug.h | 14 +++++++------- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Mate/BasicBlocks.hs b/Mate/BasicBlocks.hs index 92120e0..bf34eee 100644 --- a/Mate/BasicBlocks.hs +++ b/Mate/BasicBlocks.hs @@ -90,7 +90,7 @@ parseMethod :: Class Resolved -> B.ByteString -> IO (Maybe MapBB) parseMethod cls method = do let maybe_bb = testCFG $ lookupMethod method cls let msig = methodSignature $ (classMethods cls) !! 1 - printf_bb "BB: analysing \"%s\"\n" $ toString (method `B.append` ": " `B.append` (encode msig)) + printfBb "BB: analysing \"%s\"\n" $ toString (method `B.append` ": " `B.append` (encode msig)) #ifdef DBG_BB printMapBB maybe_bb #endif @@ -99,8 +99,8 @@ parseMethod cls method = do -- TODO: remove ;-) let (Just m) = lookupMethod method cls case attrByName m "Code" of - Nothing -> printf_bb "exception: no handler for this method\n" - Just exceptionstream -> printf_bb "exception: \"%s\"\n" (show $ codeExceptions $ decodeMethod exceptionstream) + Nothing -> printfBb "exception: no handler for this method\n" + Just exceptionstream -> printfBb "exception: \"%s\"\n" (show $ codeExceptions $ decodeMethod exceptionstream) return maybe_bb diff --git a/Mate/ClassPool.hs b/Mate/ClassPool.hs index 1f7d785..986193d 100644 --- a/Mate/ClassPool.hs +++ b/Mate/ClassPool.hs @@ -133,12 +133,12 @@ loadClass path = do let w32_iftable = fromIntegral $ ptrToIntPtr iftable :: Word32 -- store interface-table at offset 0 in method-table pokeElemOff (intPtrToPtr $ fromIntegral mbase) 0 w32_iftable - printf_cp "staticmap: %s @ %s\n" (show staticmap) (toString path) - printf_cp "fieldmap: %s @ %s\n" (show fieldmap) (toString path) - printf_cp "methodmap: %s @ %s\n" (show methodmap) (toString path) - printf_cp "mbase: 0x%08x\n" mbase - printf_cp "interfacemethod: %s @ %s\n" (show immap) (toString path) - printf_cp "iftable: 0x%08x\n" w32_iftable + printfCp "staticmap: %s @ %s\n" (show staticmap) (toString path) + printfCp "fieldmap: %s @ %s\n" (show fieldmap) (toString path) + printfCp "methodmap: %s @ %s\n" (show methodmap) (toString path) + printfCp "mbase: 0x%08x\n" mbase + printfCp "interfacemethod: %s @ %s\n" (show immap) (toString path) + printfCp "iftable: 0x%08x\n" w32_iftable virtual_map <- get_virtualmap >>= ptr2virtualmap let virtual_map' = M.insert mbase path virtual_map virtualmap2ptr virtual_map' >>= set_virtualmap @@ -157,7 +157,7 @@ loadInterface path = do case M.lookup path imap of Just _ -> return () Nothing -> do - printf_cp "interface: loading \"%s\"\n" $ toString path + printfCp "interface: loading \"%s\"\n" $ toString path let ifpath = toString $ path `B.append` ".class" cfile <- parseClassFile ifpath -- load "superinterfaces" first @@ -255,9 +255,9 @@ loadAndInitClass path = do let mi = (MethodInfo "" path (methodSignature m)) entry <- compileBB hmap' mi addMethodRef entry mi [path] - printf_cp "executing static initializer from %s now\n" (toString path) + printfCp "executing static initializer from %s now\n" (toString path) executeFuncPtr entry - printf_cp "static initializer from %s done\n" (toString path) + printfCp "static initializer from %s done\n" (toString path) Nothing -> error $ "loadClass: static initializer not found (WTF?). abort" Nothing -> return () diff --git a/Mate/Debug.hs b/Mate/Debug.hs index b5ee689..c03bfcc 100644 --- a/Mate/Debug.hs +++ b/Mate/Debug.hs @@ -16,32 +16,32 @@ instance VarArgsFake (IO a) where instance (Show a, VarArgsFake r) => VarArgsFake (a -> r) where varFake _ = \_ -> varFake [] -printf_fake :: String -> (VarArgsFake t) => t -printf_fake _ = varFake [] +printfFake :: String -> (VarArgsFake t) => t +printfFake _ = varFake [] -- see counterpart at `debug.h' #ifndef DBG_JIT -printf_jit :: String -> (VarArgsFake t) => t -printf_jit = printf_fake +printfJit :: String -> (VarArgsFake t) => t +printfJit = printfFake #endif #ifndef DBG_BB -printf_bb :: String -> (VarArgsFake t) => t -printf_bb = printf_fake +printfBb :: String -> (VarArgsFake t) => t +printfBb = printfFake #endif #ifndef DBG_MP -printf_mp :: String -> (VarArgsFake t) => t -printf_mp = printf_fake +printfMp :: String -> (VarArgsFake t) => t +printfMp = printfFake #endif #ifndef DBG_CP -printf_cp :: String -> (VarArgsFake t) => t -printf_cp = printf_fake +printfCp :: String -> (VarArgsFake t) => t +printfCp = printfFake #endif #ifndef DBG_STR -printf_str :: String -> (VarArgsFake t) => t -printf_str = printf_fake +printfStr :: String -> (VarArgsFake t) => t +printfStr = printfFake #endif diff --git a/Mate/MethodPool.hs b/Mate/MethodPool.hs index 067a989..3740f1e 100644 --- a/Mate/MethodPool.hs +++ b/Mate/MethodPool.hs @@ -70,7 +70,7 @@ getMethodEntry signal_from methodtable = do case M.lookup mi' mmap of Nothing -> do cls <- getClassFile cm - printf_mp "getMethodEntry(from 0x%08x): no method \"%s\" found. compile it\n" w32_from (show mi') + printfMp "getMethodEntry(from 0x%08x): no method \"%s\" found. compile it\n" w32_from (show mi') mm <- lookupMethodRecursive method [] cls case mm of Just (mm', clsnames, cls') -> do @@ -87,7 +87,7 @@ getMethodEntry signal_from methodtable = do True -> do -- TODO(bernhard): cleaner please... *do'h* let symbol = (replace "/" "_" $ toString cm) ++ "__" ++ (toString method) ++ "__" ++ (replace ";" "_" $ replace "/" "_" $ replace "(" "_" (replace ")" "_" $ toString $ encode sig)) - printf_mp "native-call: symbol: %s\n" symbol + printfMp "native-call: symbol: %s\n" symbol nf <- loadNativeFunction symbol let w32_nf = fromIntegral nf let mmap' = M.insert mi' w32_nf mmap @@ -165,9 +165,9 @@ compileBB hmap methodinfo = do let tmap' = M.union tmap new_tmap -- prefers elements in cmap trapmap2ptr tmap' >>= set_trapmap - printf_jit "generated code of \"%s\":\n" (toString $ methName methodinfo) - mapM_ (printf_jit "%s\n" . showAtt) (snd right) - printf_jit "\n\n" + printfJit "generated code of \"%s\":\n" (toString $ methName methodinfo) + mapM_ (printfJit "%s\n" . showAtt) (snd right) + printfJit "\n\n" -- UNCOMMENT NEXT LINE FOR GDB FUN -- _ <- getLine -- (1) start it with `gdb ./mate' and then `run ' diff --git a/Mate/Strings.hs b/Mate/Strings.hs index 6e54181..36b2342 100644 --- a/Mate/Strings.hs +++ b/Mate/Strings.hs @@ -44,5 +44,5 @@ allocateJavaString str = do BI.memset newstr 0 (fromIntegral $ strlen + 1) copyBytes newstr arr strlen let w32_ptr = fromIntegral $ ptrToIntPtr newstr - printf_str "new str ptr: 0x%08x (%s)@%d\n" w32_ptr (toString str) strlen + printfStr "new str ptr: 0x%08x (%s)@%d\n" w32_ptr (toString str) strlen return w32_ptr diff --git a/debug.h b/debug.h index 58fbf3b..633b891 100644 --- a/debug.h +++ b/debug.h @@ -3,7 +3,7 @@ * DBG_MP ..... MethodPool.hs * DBG_CP ..... ClassPool.hs * DBG_STR .... Strings.hs - * // no printf_* defined + * // no printf* defined * DBG_TRAP ... show information @ trap.c * DBG_CLASS .. dump classfile */ @@ -46,27 +46,27 @@ #endif /* it would be awesome if we could just write - * > printf_fake = printf + * > printfFake = printf * here, but the type can't be infered, since `PrintfType' * isn't visible (at least this is my explanation :/). * if I'm wrong, move this to `Mate/Debug.hs' */ #ifdef DBG_JIT -#define printf_jit printf +#define printfJit printf #endif #ifdef DBG_BB -#define printf_bb printf +#define printfBb printf #endif #ifdef DBG_MP -#define printf_mp printf +#define printfMp printf #endif #ifdef DBG_CP -#define printf_cp printf +#define printfCp printf #endif #ifdef DBG_STR -#define printf_str printf +#define printfStr printf #endif -- 2.25.1