* Two "Simple" I/O Questions
@ 1993-02-05 8:30 gast
0 siblings, 0 replies; 3+ messages in thread
From: gast @ 1993-02-05 8:30 UTC (permalink / raw)
Essentially, I just want a program like "cp" or "cat". All it has
to do is copy the input to the output. I have found two problems.
1) Text_IO does not handle 8-bit characters. Is there another
package which does?
2) If there are multiple <eol>s at the end of a file, only one
get reads. A skipline at this point skips over all the trailing
<eol>s. There is a sample program in a book which says it copies
input to output exactly, but it fails on this case. Perhaps it
is a compiler error. Any solutions?
Thanks
David
gast@cs.ucla.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Two "Simple" I/O Questions
@ 1993-02-05 17:04 Johnny Lin
0 siblings, 0 replies; 3+ messages in thread
From: Johnny Lin @ 1993-02-05 17:04 UTC (permalink / raw)
In article <1993Feb5.083009.26460@cs.ucla.edu>, gast@CS.UCLA.EDU (David Gast) w
rites...
>Essentially, I just want a program like "cp" or "cat". All it has
>to do is copy the input to the output. I have found two problems.
>
>1) Text_IO does not handle 8-bit characters. Is there another
> package which does?
really? I didn't know that. It sounds interesting to investigave about it.
>2) If there are multiple <eol>s at the end of a file, only one
> get reads. A skipline at this point skips over all the trailing
> <eol>s. There is a sample program in a book which says it copies
> input to output exactly, but it fails on this case. Perhaps it
> is a compiler error. Any solutions?
I disagree that skip_line would skip over all the trailing <eol>s. I just
did project which has a multiple <eol>s and it didn't skip all when I tested
it.
The following is a part of lexical analyzer of compiler which I am writing.
This code reads a file throught the standard input and loads the info into
the assigned buffer.
for i in 0 .. BLOCK_SIZE - 1 loop
if END_OF_FILE then
BUFFER (LEX_END + i) := ASCII.EOT;
exit;
elsif END_OF_LINE then
BUFFER (LEX_END + i) := ASCII.CR;
SKIP_LINE;
else
GET (BUFFER (LEX_END + i));
end if;
end loop;
>Thanks
>
>David
>
>gast@cs.ucla.edu
I hope this helps.
Johnny
internet : LIN@CSUPomona.edu
packet : KC6DMH @ N6CUS.#SOCA.CA.USA.NA
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Two "Simple" I/O Questions
@ 1993-02-07 2:09 Erik Magnuson
0 siblings, 0 replies; 3+ messages in thread
From: Erik Magnuson @ 1993-02-07 2:09 UTC (permalink / raw)
In article <1993Feb5.083009.26460@cs.ucla.edu> gast@CS.UCLA.EDU (David Gast) wr
ites:
>Essentially, I just want a program like "cp" or "cat". All it has
>to do is copy the input to the output. I have found two problems.
>
>1) Text_IO does not handle 8-bit characters. Is there another
> package which does?
>
Two suggestions:
1) Use Sequential_IO instantiated for an 8 bit type. However, this may
rather inefficient if your implementation does a poor job of IO
buffering.
2) If none of the other IO packages doe what you want, write your own
using OS primitives. It's not that hard, honest.
--
Erik
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-02-07 2:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-02-07 2:09 Two "Simple" I/O Questions Erik Magnuson
-- strict thread matches above, loose matches on Subject: below --
1993-02-05 17:04 Johnny Lin
1993-02-05 8:30 gast
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox