From aae24af5d5f37be20e9a1ac017ebb23beb8ae5b3 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Fri, 20 Apr 2007 01:19:59 +0000 Subject: [PATCH] Undo change that broke case input --- fco2/GenerateC.hs | 28 +++++++++++++++------------- fco2/testcases/case.occ | 3 ++- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/fco2/GenerateC.hs b/fco2/GenerateC.hs index f7f5dc9..82ee54a 100644 --- a/fco2/GenerateC.hs +++ b/fco2/GenerateC.hs @@ -949,19 +949,21 @@ genInputCase c s -- This handles specs in a slightly odd way, because we can't insert specs into -- the body of a switch. genInputCaseBody :: A.Name -> A.Variable -> CGen () -> A.Structured -> CGen () -genInputCaseBody proto c coll s = genStructured s doV - where - doV (A.OnlyV _ (A.Variant _ n iis p)) - = do tell ["case "] - genName n - tell ["_"] - genName proto - tell [": {\n"] - coll - sequence_ $ map (genInputItem c) iis - genProcess p - tell ["break;\n"] - tell ["}\n"] +genInputCaseBody proto c coll (A.Spec _ spec s) + = genInputCaseBody proto c (genSpec spec coll) s +genInputCaseBody proto c coll (A.OnlyV _ (A.Variant _ n iis p)) + = do tell ["case "] + genName n + tell ["_"] + genName proto + tell [": {\n"] + coll + sequence_ $ map (genInputItem c) iis + genProcess p + tell ["break;\n"] + tell ["}\n"] +genInputCaseBody proto c coll (A.Several _ ss) + = sequence_ $ map (genInputCaseBody proto c coll) ss genTimerRead :: A.Variable -> A.Variable -> CGen () genTimerRead c v diff --git a/fco2/testcases/case.occ b/fco2/testcases/case.occ index 228d236..3b9ce62 100644 --- a/fco2/testcases/case.occ +++ b/fco2/testcases/case.occ @@ -2,8 +2,9 @@ PROC P () INT n: SEQ CASE n -- with ELSE + INT x: 1, 2 - SKIP + x := n 3 SKIP 4, 5, 6, 7, 8