gdritter repos GRUtils / fb88aa3
Removed YAMLize, replaced EscapedString with smaller C version of the same utility, updated RSAPair, changed makefiles to use musl-gcc Getty Ritter 9 years ago
14 changed file(s) with 78 addition(s) and 132 deletion(s). Collapse all Expand all
+0
-22
EscapedString/EscapedString.cabal less more
1 -- Initial ToJSString.cabal generated by cabal init. For further
2 -- documentation, see http://haskell.org/cabal/users-guide/
3
4 name: EscapedString
5 version: 0.1.0.0
6 -- synopsis:
7 -- description:
8 -- license:
9 license-file: LICENSE
10 author: Getty Ritter
11 maintainer: gdritter@galois.com
12 -- copyright:
13 category: Codec
14 build-type: Simple
15 -- extra-source-files:
16 cabal-version: >=1.10
17
18 executable ToJSString
19 main-is: EscapedString.hs
20 build-depends: base >=4.6 && <4.7, aeson, text, bytestring
21 hs-source-dirs: src
22 default-language: Haskell2010
+0
-14
EscapedString/LICENSE less more
1 DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 Version 2, December 2004
3
4 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5
6 Everyone is permitted to copy and distribute verbatim or modified
7 copies of this license document, and changing it is allowed as long
8 as the name is changed.
9
10 DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
13 0. You just DO WHAT THE FUCK YOU WANT TO.
14
+0
-2
EscapedString/Setup.hs less more
1 import Distribution.Simple
2 main = defaultMain
+0
-8
EscapedString/src/EscapedString.hs less more
1 module Main where
2
3 import Data.Aeson (Value(String), encode)
4 import Data.ByteString.Lazy.Char8 (putStrLn)
5 import Data.Text.IO (getContents)
6 import Prelude hiding (getContents, putStrLn)
7
8 main = getContents >>= putStrLn . encode . String
+0
-8
EscapedString/src/ToJSString.hs~ less more
1 module Main where
2
3 import Control.Monad ((>=>))
4 import Data.Aeson (Value(String))
5 import Data.Text.IO (getContents)
6 import Prelude hiding (getContents)
7
8 main = getContents >>= putStrLn . show . String
1 -- Initial RSAPair.cabal generated by cabal init. For further
2 -- documentation, see http://haskell.org/cabal/users-guide/
3
41 name: RSAPair
5 version: 0.1.0.0
2 version: 0.1.0.1
63 license: OtherLicense
74 license-file: LICENSE
85 author: Getty Ritter
96 maintainer: gdritter@galois.com
10 -- copyright:
117 category: Codec
128 build-type: Simple
13 -- extra-source-files:
149 cabal-version: >=1.10
1510
16 executable RSAPair
11 executable rsa-pair
1712 main-is: RSAPair.hs
18 -- other-modules:
19 -- other-extensions:
20 build-depends: base >=4.6 && <4.7,
13 build-depends: base >=4.6 && <4.8,
2114 bytestring, binary, DRBG, crypto-api, RSA
2215 hs-source-dirs: src
2316 default-language: Haskell2010
+0
-14
YAMLize/LICENSE less more
1 DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 Version 2, December 2004
3
4 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5
6 Everyone is permitted to copy and distribute verbatim or modified
7 copies of this license document, and changing it is allowed as long
8 as the name is changed.
9
10 DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
13 0. You just DO WHAT THE FUCK YOU WANT TO.
14
+0
-2
YAMLize/Setup.hs less more
1 import Distribution.Simple
2 main = defaultMain
+0
-21
YAMLize/YAMLize.cabal less more
1 name: YAMLize
2 version: 0.1.0.0
3 license: OtherLicense
4 license-file: LICENSE
5 author: Getty Ritter
6 maintainer: gdritter@galois.com
7 category: Data
8 build-type: Simple
9 cabal-version: >=1.10
10
11 executable ToYAML
12 main-is: ToYAML.hs
13 build-depends: base >=4.6 && <4.7, yaml, aeson, bytestring
14 hs-source-dirs: src
15 default-language: Haskell2010
16
17 executable FromYAML
18 main-is: FromYAML.hs
19 build-depends: base >=4.6 && <4.7, yaml, aeson, bytestring
20 hs-source-dirs: src
21 default-language: Haskell2010
+0
-15
YAMLize/src/FromYAML.hs less more
1 {-# LANGUAGE ScopedTypeVariables #-}
2
3 module Main where
4
5 import Control.Monad ((>=>))
6 import qualified Data.Aeson as Json
7 import qualified Data.ByteString as BS
8 import qualified Data.ByteString.Lazy.Char8 as BSL
9 import Data.Maybe (fromJust)
10 import qualified Data.Yaml as Yaml
11
12 main = do
13 contents <- BS.getContents
14 let value :: Yaml.Value = fromJust (Yaml.decode contents)
15 BSL.putStrLn (Json.encode value)
+0
-15
YAMLize/src/ToYAML.hs less more
1 {-# LANGUAGE ScopedTypeVariables #-}
2
3 module Main where
4
5 import Control.Monad ((>=>))
6 import qualified Data.Aeson as Json
7 import qualified Data.ByteString.Char8 as BS
8 import qualified Data.ByteString.Lazy.Char8 as BSL
9 import Data.Maybe (fromJust)
10 import qualified Data.Yaml as Yaml
11
12 main = do
13 contents <- BSL.getContents
14 let value :: Yaml.Value = fromJust (Json.decode contents)
15 BS.putStrLn (Yaml.encode value)
1 CC = musl-gcc
2 LDFLAGS = -lm
3
4 all: escstring
5
6 escstring:
7 $(CC) $(LDFLAGS) escstring.c -o $@
8
9 clean:
10 rm -f escstring escstring.o
1 #include <stdio.h>
2
3 int main(int argc, char* argv[])
4 {
5 char c;
6 putchar('"');
7 while ((c = getchar()) != EOF) {
8 switch (c) {
9 case 0x08:
10 putchar('\\');
11 putchar('b');
12 break;
13 case 0x0a:
14 putchar('\\');
15 putchar('n');
16 break;
17 case 0x0c:
18 putchar('\\');
19 putchar('f');
20 break;
21 case 0x0d:
22 putchar('\\');
23 putchar('r');
24 break;
25 case 0x09:
26 putchar('\\');
27 putchar('t');
28 break;
29 case '"':
30 case '\\':
31 case 0x00:
32 case 0x01:
33 case 0x02:
34 case 0x03:
35 case 0x04:
36 case 0x05:
37 case 0x06:
38 case 0x07:
39 case 0x0b:
40 case 0x0e:
41 case 0x0f:
42 case 0x10:
43 case 0x11:
44 case 0x12:
45 case 0x13:
46 case 0x14:
47 case 0x15:
48 case 0x16:
49 case 0x17:
50 case 0x18:
51 case 0x19:
52 case 0x1a:
53 case 0x1b:
54 case 0x1c:
55 case 0x1d:
56 case 0x1e:
57 case 0x1f:
58 putchar('\\');
59 default:
60 putchar(c);
61 }
62 }
63 putchar('"');
64 }
1 CC = gcc
1 CC = musl-gcc
22 LDFLAGS = -lm
33
44 all: expseq