Statistics
| Branch: | Tag: | Revision:

root / src / hs2py.hs @ 1a93514a

History | View | Annotate | Download (1.7 kB)

1
{-| Haskell to Python opcode generation program.
2

    
3
-}
4

    
5
{-
6

    
7
Copyright (C) 2011, 2012, 2013 Google Inc.
8
All rights reserved.
9

    
10
Redistribution and use in source and binary forms, with or without
11
modification, are permitted provided that the following conditions are
12
met:
13

    
14
1. Redistributions of source code must retain the above copyright notice,
15
this list of conditions and the following disclaimer.
16

    
17
2. Redistributions in binary form must reproduce the above copyright
18
notice, this list of conditions and the following disclaimer in the
19
documentation and/or other materials provided with the distribution.
20

    
21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
25
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32

    
33
-}
34

    
35
import Ganeti.Hs2Py.GenOpCodes
36
import Ganeti.Hs2Py.ListConstants
37

    
38
import System.Environment (getArgs)
39
import System.Exit (exitFailure)
40
import System.IO (hPutStrLn, stderr)
41

    
42
main :: IO ()
43
main = do
44
  args <- getArgs
45
  case args of
46
    ["--opcodes"] -> putStrLn showPyClasses
47
    ["--constants"] -> putConstants
48
    _ -> do
49
      hPutStrLn stderr "Usage: hs2py --opcodes | --constants"
50
      exitFailure