comp.lang.ada
 help / color / mirror / Atom feed
From: cis.ohio-state.edu!news.sei.cmu.edu!ae@ucbvax.Berkeley.EDU  (Arthur Evans
Subject: Re: converting (limited) private types?
Date: 27 Sep 92 20:07:05 GMT	[thread overview]
Message-ID: <1992Sep27.200705.12535@sei.cmu.edu> (raw)

andrewd@cs.adelaide.edu.au (Andrew Dunstan) asks about a stack of items
of type Text_IO.File_Type, which is limited private.

It would be hard to do if you are using a stack package.  However, if
you implement the stack as an array and an index (probably reasonable in
your case), just open the file right into the stack.  Leaving out a lot,
like this:

	File_Stack: array(0..File_Stack_Max) of Text_IO.File_Type;
	Current_File: integer := 0;	-- Current item in File_Stack

	...
	-- Opening intial file
	Text_IO.Open(File_Stack(Current_File), Text_IO.In_File, ...

	-- Reading the file (can be simplified with Set_Input)
	Text_IO.Get_Line(File_Stack(Current_File), ...

	-- Processing %include (or whatever)
	Current_File := Current_File + 1;
	Text_IO.Open(File_Stack(Current_File), Text_IO.In_File, ...
	...
	-- process the file
	...
	Text_IO.Close(File_Stack(Current_File));
	Current_File := Current_File - 1;

You can easily fill in the details.

Art Evans
----------------------------------------------
Arthur Evans, Jr, PhD           Ada Consultant
461 Fairview Road
Pittsburgh PA  15238-1933
412-963-0839
ae@sei.cmu.edu

             reply	other threads:[~1992-09-27 20:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-09-27 20:07 cis.ohio-state.edu!news.sei.cmu.edu!ae [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-09-29 20:00 converting (limited) private types? Robert I. Eachus
1992-09-26 21:08 Dave Marshall
1992-09-26  2:40 munnari.oz.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!cs.adelaide.edu.au!
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox