--* From DOOLEY%WATSON.vnet.ibm.com@yktvmv.watson.ibm.com  Thu Jun 30 18:23:00 1994
--* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311)
--*           id AA23625; Thu, 30 Jun 1994 18:23:00 -0400
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 2587; Thu, 30 Jun 94 18:23:01 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.DOOLEY.NOTE.VAGENT2.1469.Jun.30.18:23:01.-0400>
--*           for asbugs@watson; Thu, 30 Jun 94 18:23:01 -0400
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id 1465; Thu, 30 Jun 1994 18:23:01 EDT
--* Received: from matteo.watson.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with TCP; Thu, 30 Jun 94 18:23:00 EDT
--* Received: by matteo.watson.ibm.com (AIX 3.2/UCB 5.64/920123)
--*           id AA11550; Thu, 30 Jun 1994 18:18:52 -0400
--* Date: Thu, 30 Jun 1994 18:18:52 -0400
--* From: dooley@matteo.watson.ibm.com (Sam Dooley)
--* Message-Id: <9406302218.AA11550@matteo.watson.ibm.com>
--* To: asbugs@watson.ibm.com
--* Subject: [1] inlining generators is leaving temporaries hanging [lines0.as][v0.36.0]

--@ Fixed  by:  PI   Tue Aug 2 10:47:48 EDT 1994 
--@ Tested by:  IwillAddOne 
--@ Summary:    Not inliner bug. Emerge was not handling the new `Free' instruction properly. 

#if BugHeaders
LastSeenBy: PI
LastUpdate: 02/Aug/94
BugKeywords: optim [emerge]
Priority:
Comments: PI: I'm currently working on this bug! Emerge is not removing the
Comments: new `Free' statement when a record allocation changes heap -> stack
SeenBy:
Updates:
#endif
#assert modified
#if modified


-- asharp -Q3 -Fx lines0.as

#include "aslib"

import from SingleInteger;

blocks (p: TextReader) : Generator List String == generate {
	l := nil;
	for s in lines p repeat {
		if #s > 0 then
			l := cons(s, l);
		else if l then {
			yield reverse! l;
			l := nil;
		}
	}
	if l then yield reverse! l;
}

main() : () == {
	import from StandardIO, TextReader, List String;
	for i in 1.. for lines in blocks reader stdin repeat {
		print << "block " << i << ":" << newline;
		print << lines << newline;
	}
	print << "done" << newline;
}

main()

#else  -- original begin


-- asharp -Q3 -Fx lines0.as

#include "aslib"

import from SingleInteger;

blocks (p: TextReader) : Generator List String == generate {
	l := nil;
	for s in lines p repeat {
		if #s > 0 then
			l := cons(s, l);
		else if l then {
			yield reverse! l;
			l := nil;
		}
	}
	if l then yield reverse! l;
}

main() : () == {
	import from StandardIO, TextReader, List String;
	for i in 1.. for lines in blocks reader stdin repeat {
		print << "block " << i << ":" << newline;
		print << lines << newline;
	}
	print << "done" << newline;
}

main()

#endif -- original end

 
