Re: Re[2]: Yay for me, found an interpreter bug!

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sun,  2 Nov 2003 13:44:55 +0000, Al Getz <Xaxo at aol.com> wrote:

>I havent found this to work right.

Something else you can try. Have a standard include file as follows:

copyinc.e:
--
-- multiple file include
--
include file.e
global procedure copyinc(sequence infile, sequence outfile)
sequence cmdline, dirinfo
integer tin,tout
	cmdline=command_line()
	-- do nothing if bound:
	if equal(cmdline[1],cmdline[2]) then return end if
	dirinfo=dir(infile)
	tin=open(infile,"r")
	tout=open(outfile,"w")
	if not sequence(dirinfo) or length(dirinfo)!=1
	or tin=-1 or tout=-1 then
		printf(1,"error opening %s\n",{infile})
		if getc(0) then end if
		abort(0)
	end if
	-- I believe this is the fastest way to do this:
	for i=1 to dirinfo[1][3] do
		puts(tout,getc(tin))
	end for
	close(tin)
	close(tout)
end procedure

Then you can just code:

include t.e as test1
include copyinc.e
copyinc("t.e","t2.e")
include t2.e as test2

test2:x=3
test1:x=2

?test2:x -- this now prints a "3"


Of course I expect you'll poo-poo this idea the same way you failed to
answer the question in my last post.

I am in no way suggesting this is a sensible programming technique,
quite the opposite...

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu