Render chars as hex numbers webgl
authorunc0rr
Tue, 07 Jan 2014 01:58:23 +0400
branchwebgl
changeset 9964 12b0ed9910cd
parent 9962 97ed501accc5
child 9966 01e198990211
Render chars as hex numbers
tools/pas2c/Pas2C.hs
--- a/tools/pas2c/Pas2C.hs	Tue Jan 07 00:02:58 2014 +0400
+++ b/tools/pas2c/Pas2C.hs	Tue Jan 07 01:58:23 2014 +0400
@@ -651,7 +651,7 @@
 initExpr2C' (InitHexNumber s) = return $ text "0x" <> (text . map toLower $ s)
 initExpr2C' (InitString [a]) = return . quotes $ text [a]
 initExpr2C' (InitString s) = return $ strInit s
-initExpr2C' (InitChar a) = return $ quotes $ text "\\x" <> text (showHex (read a) "")
+initExpr2C' (InitChar a) = return $ text "0x" <> text (showHex (read a) "")
 initExpr2C' (InitReference i) = id2C IOLookup i
 initExpr2C' (InitRecord fields) = do
     (fs :: [Doc]) <- mapM (\(Identifier a _, b) -> liftM (text "." <> text a <+> equals <+>) $ initExpr2C b) fields
@@ -998,7 +998,7 @@
 expr2C Null = return $ text "NULL"
 expr2C (CharCode a) = do
     modify(\s -> s{lastType = BTChar})
-    return $ quotes $ text "\\x" <> text (showHex (read a) "")
+    return $ text "0x" <> text (showHex (read a) "")
 expr2C (HexCharCode a) = if length a <= 2 then return $ quotes $ text "\\x" <> text (map toLower a) else expr2C $ HexNumber a
 expr2C (SetExpression ids) = mapM (id2C IOLookup) ids >>= return . parens . hcat . punctuate (text " | ")