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