Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Some questions about GPS

163 views
Skip to first unread message

Ian Douglas

unread,
Jul 23, 2018, 2:26:07 PM7/23/18
to
Hi

Please advise if off topic.

Finally trying to learn Ada, after years of PHP. Did Pascal at varsity back in the 80s.

Using GPS on Linux but some things driving me nuts, so need to determine if "that's the way it is" or is my configuration is flaky.

1. Line numbers: selected option for "all" but only first few are shown, then they stop.

2. When selecting text to copy/cut, it reverts to black on white when selected. I'm used to Kate where selected text gets a different background so you can clearly see what you've selected. Is this me or the way the editor works (and IMHO this is sub-optimal for usability).

3. Am trying to read in a file, play with it, and write it out. So started with "Expanded with proper error handling and reporting it reads:" example (2nd one) on https://www.rosettacode.org/wiki/File_input/output#Line_by_line , but the compiler insists that the two "close input" statements are "unreachable code".
Is this normal? If I comment them out, it compiles okay. And runs okay.

Thanks, Ian

Jacob Sparre Andersen

unread,
Jul 23, 2018, 3:01:32 PM7/23/18
to
Ian Douglas <i...@vionia.com> writes:

> Using GPS on Linux but some things driving me nuts, so need to
> determine if "that's the way it is" or is my configuration is flaky.

Which version of GPS? The one currently packaged for Debian is indeed a
bit flaky, while the one packaged with GNAT Community Edition, which you
can download from AdaCore works quite well.

> 1. Line numbers: selected option for "all" but only first few are
> shown, then they stop.

Wierd.

> 2. When selecting text to copy/cut, it reverts to black on white when
> selected. I'm used to Kate where selected text gets a different
> background so you can clearly see what you've selected. Is this me or
> the way the editor works (and IMHO this is sub-optimal for usability).

I'm pretty sure that is a user setting (but I can't remember where/how
you set it).

> 3. Am trying to read in a file, play with it, and write it out. So
> started with "Expanded with proper error handling and reporting it
> reads:" example (2nd one) on
> https://www.rosettacode.org/wiki/File_input/output#Line_by_line , but
> the compiler insists that the two "close input" statements are
> "unreachable code".

The two calls to "Close" just after "end loop" are indeed unreachable,
and shouldn't be there.

Greetings,

Jacob
--
"Very small. Go to sleep" -- monster (not drooling)

Dmitry A. Kazakov

unread,
Jul 23, 2018, 3:02:23 PM7/23/18
to
On 2018-07-23 20:26, Ian Douglas wrote:

> Using GPS on Linux but some things driving me nuts, so need to determine if "that's the way it is" or is my configuration is flaky.
>
> 1. Line numbers: selected option for "all" but only first few are shown, then they stop.

Some older versions had this bug, I remember. Reload the file/project
and line numbers will reappear.

> 2. When selecting text to copy/cut, it reverts to black on white when selected. I'm used to Kate where selected text gets a different background so you can clearly see what you've selected. Is this me or the way the editor works (and IMHO this is sub-optimal for usability).

It can be changed in Edit->Preferences->Editor->Fonts & Colors.

> 3. Am trying to read in a file, play with it, and write it out. So started with "Expanded with proper error handling and reporting it reads:" example (2nd one) on https://www.rosettacode.org/wiki/File_input/output#Line_by_line , but the compiler insists that the two "close input" statements are "unreachable code".

The compiler is right. The loop is left only upon an exception, e.g. on
the file end (End_Error) or on any other error.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Niklas Holsti

unread,
Jul 23, 2018, 3:09:53 PM7/23/18
to
On 18-07-23 21:26 , Ian Douglas wrote:
> Hi
>
> Please advise if off topic.
>
> Finally trying to learn Ada, after years of PHP. Did Pascal at
> varsity back in the 80s.
>
> Using GPS on Linux but some things driving me nuts, so need to
> determine if "that's the way it is" or is my configuration is flaky.

[I'll let someone more knowledgeable about GPS answer Q 1 and 2]

> 3. Am trying to read in a file, play with it, and write it out. So
> started with "Expanded with proper error handling and reporting it
> reads:" example (2nd one) on
> https://www.rosettacode.org/wiki/File_input/output#Line_by_line , but
> the compiler insists that the two "close input" statements are
> "unreachable code". Is this normal?

(The quoted text above seems a little garbled, but the URL is whole, so
I looked at that.)

The two statements that call Close (one for Input, one for Output) and
follow the loop, but precede the exception handlers, are indeed
unreachable, because the loop can terminate only by raising an exception
(normally End_Error), in which case the exception handler is entered.
These two Close calls are never executed. This Rosetta-code example
should be corrected by removing these statements.

> If I comment them out, it
> compiles okay. And runs okay.

This is as expected.

--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .

Ian Douglas

unread,
Jul 23, 2018, 4:17:47 PM7/23/18
to
hi All

Thanks for the speedy replies :)

On Monday, 23 July 2018 21:01:32 UTC+2, Jacob Sparre Andersen wrote:


> Which version of GPS? The one currently packaged for Debian is indeed a
> bit flaky, while the one packaged with GNAT Community Edition, which you
> can download from AdaCore works quite well.

Sorry, should have included that.
GPS 2017 (20170515) hosted on x86_64-pc-linux-gnu
GNAT GPL 2017 (20170515-63)

I'm on Gentoo Linux.

[I] dev-ada/gps
Available versions: (~)2017^t ~2018^t {doc PYTHON_TARGETS="python2_7"}
Installed versions: 2017^t(12:53:03 29/04/2018)(-doc PYTHON_TARGETS="python2_7")

Suppose I could try to get the 2018 version installed.

>
> > 1. Line numbers: selected option for "all" but only first few are
> > shown, then they stop.
>
> Wierd.

I'm using that example from RosettaCode. When cursor is at top of file, I see line numbers up to 4. If I scroll down so that (4) goes up at the top, suddenly 5 to 11 appear. As you say, Weird.

>
> I'm pretty sure that is a user setting (but I can't remember where/how
> you set it).

I thought as much but there isn't anything marked "selected text colour" or words to that effect... unless this is another bug in the 2017 version. So didn't know if it was just not there, or hiding under some obtuse description. I could not find any mention of it in the online docs (hence asking experts here :- )

Will try to rewrite that code reading the file to do some sort of while-not-end-of-file....

Thanks, Ian

Jeffrey R. Carter

unread,
Jul 23, 2018, 5:10:46 PM7/23/18
to
On 07/23/2018 08:26 PM, Ian Douglas wrote:
>
> 2. When selecting text to copy/cut, it reverts to black on white when selected. I'm used to Kate where selected text gets a different background so you can clearly see what you've selected. Is this me or the way the editor works (and IMHO this is sub-optimal for usability).

This is a problem with the version of GPS packaged with many Linux distros. It
shows up, for example, in GPS 6.1.2016 (20160515) that comes with Ubuntu. I have
downloaded and use GPS 2018 (20180528) from the Community Edition primarily to
get around this problem.

--
Jeff Carter
"I did not rob a bank. If I'd robbed a bank, everything
would be great. I tried to rob a bank, is what happened,
and they got me. I misspelled the note."
Take the Money and Run
140

Ian Douglas

unread,
Jul 24, 2018, 4:01:10 PM7/24/18
to
FWIW, I tried to update to 2018 version of GPS but it fails to compile. (It is marked "unstable" in Gentoo, despite being "recommended" version".)

So tried updating other bits of Ada to 2018, some worked, some still wanted 2017 stuff, so gave up and tried to undo. Not sure how well :)

End result is that somehow it dropped me back to 2015 version of GPS, which does not have the line number or "select highlight" issues that the 2017 version has. Does have slightly dated interface but I can live with that.

Have mailed the package maintainer for an ETA on when 2018 version will be working properly.

Thanks again for the help.

Cheers, Ian

Patrick Noffke

unread,
Jul 26, 2018, 9:33:10 AM7/26/18
to
On Tuesday, July 24, 2018 at 3:01:10 PM UTC-5, Ian Douglas wrote:
> FWIW, I tried to update to 2018 version of GPS but it fails to compile. (It is marked "unstable" in Gentoo, despite being "recommended" version".)
>

You can download prebuilt binaries of the 2018 Community Edition from here:
https://www.adacore.com/download

The gnat-community-2018-20180528-x86_64-linux-bin installer includes GPS.

Regards,
Patrick

Ian Douglas

unread,
Jul 27, 2018, 6:03:33 AM7/27/18
to
On Thursday, 26 July 2018 15:33:10 UTC+2, Patrick Noffke wrote:
>
> You can download prebuilt binaries of the 2018 Community Edition from here:
> https://www.adacore.com/download
>
> The gnat-community-2018-20180528-x86_64-linux-bin installer includes GPS.

Thanks, will take a look :-)

Cheers, Ian
0 new messages