[include support for declaring temporaries locally
John Meacham <john@repetae.net>**20070517120058] hunk ./C/FromGrin2.hs 334
-    tmp <- newVar (ptrType sptr_t)
+    (d,tmp) <- (ptrType sptr_t) `newTmpVar`  jhc_malloc (sizeof sptr_t)
hunk ./C/FromGrin2.hs 336
-    return ((tmp =* jhc_malloc (sizeof sptr_t)) & (dereference tmp =* v) & r)
+    return (d & (dereference tmp =* v) & r)
hunk ./C/FromGrin2.hs 543
-        tmp <- newVar (if sf then sptr_t else wptr_t)
-        let tmp' = concrete t tmp
-            wmalloc = if not sf && all (nonPtr . getType) as then jhc_malloc_atomic else jhc_malloc
-            malloc =  tmp =* wmalloc (sizeof st)
-            ass = [ if isValUnknown aa then mempty else project' i tmp' =* a | a <- as' | aa <- as | i <- map arg [(1 :: Int) ..] ]
+        --tmp <- newVar (if sf then sptr_t else wptr_t)
+        let wmalloc = if not sf && all (nonPtr . getType) as then jhc_malloc_atomic else jhc_malloc
+            malloc =  wmalloc (sizeof st)
hunk ./C/FromGrin2.hs 550
+        (dtmp,tmp) <- (if sf then sptr_t else wptr_t) `newTmpVar` malloc
+        let tmp' = concrete t tmp
+            ass = [ if isValUnknown aa then mempty else project' i tmp' =* a | a <- as' | aa <- as | i <- map arg [(1 :: Int) ..] ]
hunk ./C/FromGrin2.hs 555
-        return (mconcat $ malloc:tagassign:ass,res)
+        return (mconcat $ dtmp:tagassign:ass,res)
hunk ./C/Generate.hs 34
+    newTmpVar,
hunk ./C/Generate.hs 248
+
hunk ./C/Generate.hs 349
+newTmpVar t e = do
+    u <- newUniq
+    let n = name $ 'x':show u
+        d = sd $ do
+            va <- draw (variable n `assign` e)
+            t <- draw t
+            return $ t <+> va
+    return (d,variable n)
+