]> hydra-www.ietfng.org Git - dyna2/commitdiff
merge
authortimv <tim.f.vieira@gmail.com>
Wed, 12 Jun 2013 01:51:26 +0000 (21:51 -0400)
committertimv <tim.f.vieira@gmail.com>
Wed, 12 Jun 2013 01:51:26 +0000 (21:51 -0400)
1  2 
src/Dyna/Backend/Python/Backend.hs

index 8499e36c34b4bcfd2ed4d6c9173154a60b5e1396,a6e457c4a88e2c65057c505e08f976ec3410920e..7bbd6e1c9a7c70faba8fd7071d2f8369a2d8cbad
@@@ -290,20 -271,20 +290,23 @@@ printPlanHeader r c mn = d
         , "'''"]
  
  printInitializer :: Handle -> Rule -> Cost -> Actions PyDopeBS -> IO ()
 -printInitializer fh rule@(Rule _ h _ r _ _ ucruxes _) cost dope = do
 +printInitializer fh rule cost dope = do
    displayIO fh $ renderPretty 1.0 100
-                  $ "@_initializers.append" -- <> (uncurry pfa $ MA.fromJust $ findHeadFA h ucruxes)
-                    `above` "def" <+> char '_' <> tupled ["emit"] <> colon
+                  $ "def" <+> char '_' <> tupled ["emit"] <> colon
                     `above` (indent 4 $ printPlanHeader rule cost Nothing)
                     `above` pdope dope
                     <> line
+                    <> "_initializers.append((" <> (pretty $ r_index rule) <> ", _" <> "))"
+                    <> line
+                    <> line
+                    <> line
  
 +printUpdate :: Handle -> Rule -> Cost -> Int -> Maybe DFunctAr -> (DVar, DVar)
 +            -> Actions PyDopeBS -> IO ()
  -- XXX INDIR EVAL
 -printUpdate :: Handle -> Rule -> Cost -> Int -> Maybe DFunctAr -> (DVar, DVar) -> Actions PyDopeBS -> IO ()
 -printUpdate fh rule@(Rule _ h _ r _ _ _ _) cost evalix (Just (f,a)) (hv,v) dope = do
 +printUpdate _  _    _    _      Nothing      _      _    =
 +  dynacPanic "Python backend does not know how to do indirect evaluations"
 +printUpdate fh rule cost evalix (Just (f,a)) (hv,v) dope = do
    displayIO fh $ renderPretty 1.0 100
                   $ "#" <+> (pfa f a)
                     `above` "def" <+> char '_' <> tupled (map pretty [hv,v,"emit"]) <> colon