Statistics
| Branch: | Tag: | Revision:

root / src / hs2py.hs @ c6d48e16

History | View | Annotate | Download (1.5 kB)

1 81959e7b Petr Pudlak
{-# LANGUAGE TemplateHaskell #-}
2 81959e7b Petr Pudlak
3 4157b044 Jose A. Lopes
{-| Haskell to Python opcode generation program.
4 4157b044 Jose A. Lopes
5 4157b044 Jose A. Lopes
-}
6 4157b044 Jose A. Lopes
7 4157b044 Jose A. Lopes
{-
8 4157b044 Jose A. Lopes
9 4157b044 Jose A. Lopes
Copyright (C) 2011, 2012, 2013 Google Inc.
10 4157b044 Jose A. Lopes
11 4157b044 Jose A. Lopes
This program is free software; you can redistribute it and/or modify
12 4157b044 Jose A. Lopes
it under the terms of the GNU General Public License as published by
13 4157b044 Jose A. Lopes
the Free Software Foundation; either version 2 of the License, or
14 4157b044 Jose A. Lopes
(at your option) any later version.
15 4157b044 Jose A. Lopes
16 4157b044 Jose A. Lopes
This program is distributed in the hope that it will be useful, but
17 4157b044 Jose A. Lopes
WITHOUT ANY WARRANTY; without even the implied warranty of
18 4157b044 Jose A. Lopes
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 4157b044 Jose A. Lopes
General Public License for more details.
20 4157b044 Jose A. Lopes
21 4157b044 Jose A. Lopes
You should have received a copy of the GNU General Public License
22 4157b044 Jose A. Lopes
along with this program; if not, write to the Free Software
23 4157b044 Jose A. Lopes
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 4157b044 Jose A. Lopes
02110-1301, USA.
25 4157b044 Jose A. Lopes
26 4157b044 Jose A. Lopes
-}
27 4157b044 Jose A. Lopes
28 4157b044 Jose A. Lopes
import Ganeti.Hs2Py.GenOpCodes
29 88a0e24b Jose A. Lopes
import Ganeti.Hs2Py.ListConstants
30 81959e7b Petr Pudlak
import Ganeti.THH.PyRPC
31 81959e7b Petr Pudlak
import qualified Ganeti.WConfd.Core as WConfd
32 4157b044 Jose A. Lopes
33 0c599ca0 Jose A. Lopes
import System.Environment (getArgs)
34 0c599ca0 Jose A. Lopes
import System.Exit (exitFailure)
35 0c599ca0 Jose A. Lopes
import System.IO (hPutStrLn, stderr)
36 0c599ca0 Jose A. Lopes
37 4157b044 Jose A. Lopes
main :: IO ()
38 0c599ca0 Jose A. Lopes
main = do
39 0c599ca0 Jose A. Lopes
  args <- getArgs
40 0c599ca0 Jose A. Lopes
  case args of
41 0c599ca0 Jose A. Lopes
    ["--opcodes"] -> putStrLn showPyClasses
42 88a0e24b Jose A. Lopes
    ["--constants"] -> putConstants
43 81959e7b Petr Pudlak
    ["--wconfd-rpc"] -> putStrLn $
44 81959e7b Petr Pudlak
      $( genPyUDSRpcStubStr "ClientRpcStub" "WCONFD_SOCKET"
45 81959e7b Petr Pudlak
                            WConfd.exportedFunctions )
46 0c599ca0 Jose A. Lopes
    _ -> do
47 81959e7b Petr Pudlak
      hPutStrLn stderr "Usage: hs2py --opcodes\
48 81959e7b Petr Pudlak
                                  \| --constants\
49 81959e7b Petr Pudlak
                                  \| --wconfd-rpc"
50 0c599ca0 Jose A. Lopes
      exitFailure