comp.lang.ada
 help / color / mirror / Atom feed
* Re: Pageless Text_IO
  1999-11-16  0:00     ` Robert Dewar
@ 1999-11-16  0:00       ` Arthur Evans Jr
  1999-11-17  0:00         ` Robert Dewar
  0 siblings, 1 reply; 18+ messages in thread
From: Arthur Evans Jr @ 1999-11-16  0:00 UTC (permalink / raw)


In article <80s3fj$8c6$1@nnrp1.deja.com>, Robert Dewar
<robert_dewar@my-deja.com> wrote:

> Yes, and in general trying to use Text_IO's view of what a
> line number means is probably a poor idea. For example it
> would not work at all on Ada source (since VT ends a line
> for the Ada source program, but not for Text_IO!)

What a curious statement!  VT may indeed signify end of a source
line in some particular Ada implementation (GNAT?), but it surely
does not in general.  As Robert himself has repeatedly pointed out
in this forum, the standard is silent on how to represent an Ada
source program in a computer.

Art Evans




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00   ` Robert Dewar
@ 1999-11-16  0:00     ` John Herro
  1999-11-17  0:00       ` Robert Dewar
  1999-11-17  0:00     ` Wes Groleau
  1 sibling, 1 reply; 18+ messages in thread
From: John Herro @ 1999-11-16  0:00 UTC (permalink / raw)



Robert Dewar <robert_dewar@my-deja.com> wrote:
> A form parameter  PAGE_BREAKS => NO  would be a handy
> addition to Text_IO, it would say simply that on input
> new page characters were not treated specially in any
> way, just treated as characters if encountered, and
> on output, New_Page generates such a character but has
> no other effect.
     There's a way to achieve that now.  I've done it, but it's slow and
crude, and it works only on some systems.  (E.g., it works with DOS, but not
with VAX/VMS.)  You can instantiate Sequential_IO for Character, and write
your own version of Get_Line.  This enables you to handle special
characters, like Form Feeds, the same way you handle other characters.  Of
course, it's up to you if you want to keep line and page counts.
- John Herro
You can download a shareware AdaTutor program at
http://members.aol.com/AdaTutor







^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00 Pageless Text_IO David Starner
@ 1999-11-16  0:00 ` DuckE
  1999-11-17  0:00   ` Robert Dewar
  1999-11-17  0:00   ` Wes Groleau
  1999-11-16  0:00 ` Robert Dewar
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 18+ messages in thread
From: DuckE @ 1999-11-16  0:00 UTC (permalink / raw)


Why not use Set_Page_Length to set the length of a page sufficently long
that you will never run into the length?  All text will appear on page 1.

Esthletically correct? No.  But it should work.

SteveD


David Starner <dvdeug@x8b4e53cd.> wrote in message
news:80qarp$9qe1@news.cis.okstate.edu...
> I'm having some problems with Text_IO, and Barnes' book doesn't
> cover it well.
>
> I'm writing a compiler. Programmers tend to embed form feeds in
> the text, without expecting the compiler to worry about them.
> In particular, "Page 7: Line 1: Invalid character" wouldn't
> amuse most programmers. Is there any way to tell the compiler
> to ignore page breaks?
>
> --
> David Starner - dstarner98@aasaa.ofe.org
> I see no trend at all, except toward women playing mean and ugly
> sociopaths who are good at killing and who enjoy dark powers. Maybe
> it's just my friends?
> -- Dr. Kromm, on who plays what type of character in RPGs






^ permalink raw reply	[flat|nested] 18+ messages in thread

* Pageless Text_IO
@ 1999-11-16  0:00 David Starner
  1999-11-16  0:00 ` DuckE
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: David Starner @ 1999-11-16  0:00 UTC (permalink / raw)


I'm having some problems with Text_IO, and Barnes' book doesn't
cover it well.

I'm writing a compiler. Programmers tend to embed form feeds in
the text, without expecting the compiler to worry about them.
In particular, "Page 7: Line 1: Invalid character" wouldn't
amuse most programmers. Is there any way to tell the compiler
to ignore page breaks? 

-- 
David Starner - dstarner98@aasaa.ofe.org
I see no trend at all, except toward women playing mean and ugly 
sociopaths who are good at killing and who enjoy dark powers. Maybe 
it's just my friends?
	-- Dr. Kromm, on who plays what type of character in RPGs




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00 Pageless Text_IO David Starner
  1999-11-16  0:00 ` DuckE
  1999-11-16  0:00 ` Robert Dewar
@ 1999-11-16  0:00 ` Robert Dewar
  1999-11-16  0:00   ` Robert Dewar
  1999-11-16  0:00 ` Robert Dewar
  3 siblings, 1 reply; 18+ messages in thread
From: Robert Dewar @ 1999-11-16  0:00 UTC (permalink / raw)


In article <80qarp$9qe1@news.cis.okstate.edu>,
  dstarner98@aasaa.ofe.org wrote:
> I'm writing a compiler. Programmers tend to embed form feeds
in
> the text, without expecting the compiler to worry about them.
> In particular, "Page 7: Line 1: Invalid character" wouldn't
> amuse most programmers. Is there any way to tell the compiler
> to ignore page breaks?

Which compiler? The one you are writing? If so, only you can
answer this question. The Ada compiler itself should ignore
page breaks. There is no problem in skipping page breaks using
Text_IO.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00 Pageless Text_IO David Starner
  1999-11-16  0:00 ` DuckE
@ 1999-11-16  0:00 ` Robert Dewar
  1999-11-16  0:00   ` David Starner
  1999-11-16  0:00 ` Robert Dewar
  1999-11-16  0:00 ` Robert Dewar
  3 siblings, 1 reply; 18+ messages in thread
From: Robert Dewar @ 1999-11-16  0:00 UTC (permalink / raw)


In article <80qarp$9qe1@news.cis.okstate.edu>,
  dstarner98@aasaa.ofe.org wrote:
> I'm writing a compiler. Programmers tend to embed form feeds
in
> the text, without expecting the compiler to worry about them.
> In particular, "Page 7: Line 1: Invalid character" wouldn't
> amuse most programmers. Is there any way to tell the compiler
> to ignore page breaks?

Which compiler? The one you are writing? If so, only you can
answer this question. The Ada compiler itself should ignore
page breaks. There is no problem in skipping page breaks using
Text_IO.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00 Pageless Text_IO David Starner
                   ` (2 preceding siblings ...)
  1999-11-16  0:00 ` Robert Dewar
@ 1999-11-16  0:00 ` Robert Dewar
  3 siblings, 0 replies; 18+ messages in thread
From: Robert Dewar @ 1999-11-16  0:00 UTC (permalink / raw)


In article <80qarp$9qe1@news.cis.okstate.edu>,
  dstarner98@aasaa.ofe.org wrote:
> I'm writing a compiler. Programmers tend to embed form feeds
in
> the text, without expecting the compiler to worry about them.
> In particular, "Page 7: Line 1: Invalid character" wouldn't
> amuse most programmers. Is there any way to tell the compiler
> to ignore page breaks?

Which compiler? The one you are writing? If so, only you can
answer this question. The Ada compiler itself should ignore
page breaks. There is no problem in skipping page breaks using
Text_IO.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00 ` Robert Dewar
@ 1999-11-16  0:00   ` David Starner
  1999-11-16  0:00     ` Robert Dewar
  0 siblings, 1 reply; 18+ messages in thread
From: David Starner @ 1999-11-16  0:00 UTC (permalink / raw)


On Tue, 16 Nov 1999 04:57:05 GMT, Robert Dewar <robert_dewar@my-deja.com> wrote:
>page breaks. There is no problem in skipping page breaks using
>Text_IO.
If I'm reading the ARM & GNAT's source correctly, reading a page
break will reset the line count. So if I need a count of the 
current line, that ignores page breaks, I need to keep it myself,
right?

-- 
David Starner - dstarner98@aasaa.ofe.org
I see no trend at all, except toward women playing mean and ugly 
sociopaths who are good at killing and who enjoy dark powers. Maybe 
it's just my friends?
	-- Dr. Kromm, on who plays what type of character in RPGs




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00   ` David Starner
@ 1999-11-16  0:00     ` Robert Dewar
  1999-11-16  0:00       ` Arthur Evans Jr
  0 siblings, 1 reply; 18+ messages in thread
From: Robert Dewar @ 1999-11-16  0:00 UTC (permalink / raw)


In article <80qqae$8a22@news.cis.okstate.edu>,
  dvdeug@x8b4e53cd. (David Starner) wrote:
> On Tue, 16 Nov 1999 04:57:05 GMT, Robert Dewar
<robert_dewar@my-deja.com> wrote:
> >page breaks. There is no problem in skipping page breaks
using
> >Text_IO.
> If I'm reading the ARM & GNAT's source correctly, reading a
page
> break will reset the line count. So if I need a count of the
> current line, that ignores page breaks, I need to keep it
myself,
> right?


Yes, and in general trying to use Text_IO's view of what a
line number means is probably a poor idea. For example it
would not work at all on Ada source (since VT ends a line
for the Ada source program, but not for Text_IO!)


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00 ` Robert Dewar
@ 1999-11-16  0:00   ` Robert Dewar
  1999-11-16  0:00     ` John Herro
  1999-11-17  0:00     ` Wes Groleau
  0 siblings, 2 replies; 18+ messages in thread
From: Robert Dewar @ 1999-11-16  0:00 UTC (permalink / raw)


Actually I agree page breaks are a nuisance. It was a big
mistake to have Text_IO know anything about pages this way,
apart from being able to generate a page mark.

A form parameter  PAGE_BREAKS => NO  would be a handy
addition to Text_IO, it would say simply that on input
new page characters were not treated specially in any
way, just treated as characters if encountered, and
on output, New_Page generates such a character but has
no other effect.

Needs a bit more detailed woring out, but sounds quite
practical.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00 ` DuckE
  1999-11-17  0:00   ` Robert Dewar
@ 1999-11-17  0:00   ` Wes Groleau
  1 sibling, 0 replies; 18+ messages in thread
From: Wes Groleau @ 1999-11-17  0:00 UTC (permalink / raw)


> Why not use Set_Page_Length to set the length of a page sufficently long
> that you will never run into the length?  All text will appear on page 1.
> 
> Esthletically correct? No.  But it should work.

For output.  But I think the original problem was with input.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00   ` Robert Dewar
  1999-11-16  0:00     ` John Herro
@ 1999-11-17  0:00     ` Wes Groleau
  1999-11-19  0:00       ` Robert Dewar
  1 sibling, 1 reply; 18+ messages in thread
From: Wes Groleau @ 1999-11-17  0:00 UTC (permalink / raw)


> A form parameter  PAGE_BREAKS => NO  would be a handy
> addition to Text_IO, it would say simply that on input
> new page characters were not treated specially in any
> way, just treated as characters if encountered, and
> on output, New_Page generates such a character but has
> no other effect.
> 
> Needs a bit more detailed woring out, but sounds quite
> practical.

Doesn't the language leave the meaning of form parameters
entirely up to the implementation?  Put it in GNAT and let
the users say whether they agree.  :-)




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00       ` Arthur Evans Jr
@ 1999-11-17  0:00         ` Robert Dewar
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Dewar @ 1999-11-17  0:00 UTC (permalink / raw)


In article <ev_remove_this_ans-1611991644460001@192.168.1.254>,
  ev_remove_this_ans@evans.pgh.pa.us (Arthur Evans Jr) wrote:
> In article <80s3fj$8c6$1@nnrp1.deja.com>, Robert Dewar
>
> What a curious statement!  VT may indeed signify end of a
> source line in some particular Ada implementation (GNAT?), but
> it surely does not in general.  As Robert himself has
> repeatedly pointed out in this forum, the standard is silent
> on how to represent an Ada source program in a computer.
>
> Art Evans

Well the point is (and I suspect from the above that maybe Art
doesn't know this, many people don't :-) VT is a REQUIRED
format effector in the source input. Every compiler must have
a representation for VT, and must treat it as end of line.

Now in language lawyer mode, Art is right, the standard does
not say that VT must be represented as the ASCII character VT,
but in practice all ASCII-based Ada compilers will use VT to
represent VT, what other possible choice is there (the
ACAATS/ACVC tests also use VT as the representation of VT in the
distributed tests).

Note that it is also the case that you can represent the
character A using ASCII 'B' and the character B using ASCII
'A'. That would be perverse but valid. In my view it would be
equally perverse to represent VT with other than ASCII VT.

So what I said is true in practice, if you are writing an Ada
compiler where you make the absolutely standard choice of
representing VT as Ascii.VT, then if you use Text_IO, you will
find its notion of line numbers does not match that of the RM.

By the way, the allowance of VT in text is truly a horrible
anacronism. In some early days VT did a partial form skip so
you could use it for vertical tabulation (hence the name), but
no such printers have been made for a long time (though many
modern electronic printers simulate the old carriage tapes,
including VT :-)

You can do some horrible things with VT, since usually printers
ignore it, as do terminal displays, so you can have a line
of code with what looks like an embedded comment:

   procedure (X : Integer -- always positive --; y : Float);

How does this work? By having a VT here        ^

YECH :-)


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00     ` John Herro
@ 1999-11-17  0:00       ` Robert Dewar
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Dewar @ 1999-11-17  0:00 UTC (permalink / raw)


In article <3831d7ed@excalibur.GBM>,
  "John Herro" <john@prousa.net> wrote:
> I've done it, but it's slow and
> crude, and it works only on some systems.  (E.g., it works
> with DOS, but not with VAX/VMS.)

> You can instantiate Sequential_IO for Character, and write
> your own version of Get_Line.

This is not just OS dependent, but compiler dependent, there
is no guarantee that sequential_IO on character will work
this way. For example in Ada 83, it would be quite legitimate
for it to raise an error for a character greater than 127, and
in either Ada 83 or Ada 95, it would be legitimate to have
control information at the start of the file, or even for
every record.

> This enables you to handle special
> characters, like Form Feeds, the same way you handle other
characters.  Of
> course, it's up to you if you want to keep line and page
counts.

In practice you can also do this special kind of programming
with Text_IO if you are careful.

However, the proper way to roll your own is with stream IO
in Ada 95, not sequential IO, and this has the advantage that
it intermixes with Text_IO very smoothly.



> - John Herro
> You can download a shareware AdaTutor program at
> http://members.aol.com/AdaTutor
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-16  0:00 ` DuckE
@ 1999-11-17  0:00   ` Robert Dewar
  1999-11-17  0:00   ` Wes Groleau
  1 sibling, 0 replies; 18+ messages in thread
From: Robert Dewar @ 1999-11-17  0:00 UTC (permalink / raw)


In article <383210d2.0@news.pacifier.com>,
  "DuckE" <nospam_steved@pacifier.com> wrote:
> Why not use Set_Page_Length to set the length of a page
> sufficently long that you will never run into the length?  All
> text will appear on page 1.
>
> Esthletically correct? No.  But it should work.

Yes, but why not just specify unbounded page length by setting
it to zero, much more straight forward. This is typically the
default in any case.

But this solves only the output problem, not the input problem
which was the source of the original question (remember we
were talking about inputting source to a compiler). Here the
trouble is that form feed in the input will indeed reset the
line count.

>
> SteveD
>
> David Starner <dvdeug@x8b4e53cd.> wrote in message
> news:80qarp$9qe1@news.cis.okstate.edu...
> > I'm having some problems with Text_IO, and Barnes' book
doesn't
> > cover it well.
> >
> > I'm writing a compiler. Programmers tend to embed form feeds
in
> > the text, without expecting the compiler to worry about
them.
> > In particular, "Page 7: Line 1: Invalid character" wouldn't
> > amuse most programmers. Is there any way to tell the
compiler
> > to ignore page breaks?
> >
> > --
> > David Starner - dstarner98@aasaa.ofe.org
> > I see no trend at all, except toward women playing mean and
ugly
> > sociopaths who are good at killing and who enjoy dark
powers. Maybe
> > it's just my friends?
> > -- Dr. Kromm, on who plays what type of character in RPGs
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-17  0:00     ` Wes Groleau
@ 1999-11-19  0:00       ` Robert Dewar
  1999-11-24  0:00         ` Wes Groleau
  0 siblings, 1 reply; 18+ messages in thread
From: Robert Dewar @ 1999-11-19  0:00 UTC (permalink / raw)


In article <3832C9A0.C05FAE51@ftw.rsc.raytheon.com>,
  Wes Groleau <wwgrol@ftw.rsc.raytheon.com> wrote:
> Doesn't the language leave the meaning of form parameters
> entirely up to the implementation?  Put it in GNAT and let
> the users say whether they agree.  :-)

Well why don't you put it in GNAT? That's why we have open
sources, right? :-)


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-19  0:00       ` Robert Dewar
@ 1999-11-24  0:00         ` Wes Groleau
  1999-11-25  0:00           ` Robert Dewar
  0 siblings, 1 reply; 18+ messages in thread
From: Wes Groleau @ 1999-11-24  0:00 UTC (permalink / raw)



> > Doesn't the language leave the meaning of form parameters
> > entirely up to the implementation?  Put it in GNAT and let
> > the users say whether they agree.  :-)
> 
> Well why don't you put it in GNAT? That's why we have open
> sources, right? :-)

Not very many users will want to download my version of GNAT.
But if ACT puts it in, since the form parameter is optional,
its availability won't hurt those who decide not to use it!




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Pageless Text_IO
  1999-11-24  0:00         ` Wes Groleau
@ 1999-11-25  0:00           ` Robert Dewar
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Dewar @ 1999-11-25  0:00 UTC (permalink / raw)


In article <383C604F.54773629@ftw.rsc.raytheon.com>,
  Wes Groleau <wwgrol@ftw.rsc.raytheon.com> wrote:

> Not very many users will want to download my version of GNAT.
> But if ACT puts it in, since the form parameter is optional,
> its availability won't hurt those who decide not to use it!

So, figure out the necessary patch and send it along! We are
happy to incorporate useful contributions like this!


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~1999-11-25  0:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-16  0:00 Pageless Text_IO David Starner
1999-11-16  0:00 ` DuckE
1999-11-17  0:00   ` Robert Dewar
1999-11-17  0:00   ` Wes Groleau
1999-11-16  0:00 ` Robert Dewar
1999-11-16  0:00   ` David Starner
1999-11-16  0:00     ` Robert Dewar
1999-11-16  0:00       ` Arthur Evans Jr
1999-11-17  0:00         ` Robert Dewar
1999-11-16  0:00 ` Robert Dewar
1999-11-16  0:00   ` Robert Dewar
1999-11-16  0:00     ` John Herro
1999-11-17  0:00       ` Robert Dewar
1999-11-17  0:00     ` Wes Groleau
1999-11-19  0:00       ` Robert Dewar
1999-11-24  0:00         ` Wes Groleau
1999-11-25  0:00           ` Robert Dewar
1999-11-16  0:00 ` Robert Dewar

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