comp.lang.ada
 help / color / mirror / Atom feed
* Newbie questions re Unicode (1)
@ 2020-07-12  8:14 Ian Douglas
  2020-07-12  8:25 ` Simon Wright
  2020-07-13 15:28 ` Shark8
  0 siblings, 2 replies; 18+ messages in thread
From: Ian Douglas @ 2020-07-12  8:14 UTC (permalink / raw)


Hi all

Third attempt at learning Ada.

If I try to declare a variable using non-Latin, the compiler objects.

φ : Long_Float := 1.6180339887;

Why is that?

I'm using UTF-8 in GPS.

Apparently you need to pass -gnatW8 to the compiler, but I can't figure out where in GPS to do that ... the "switches" page shows me stuff for Pretty Printer.

Thanks, Ian

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

* Re: Newbie questions re Unicode (1)
  2020-07-12  8:14 Newbie questions re Unicode (1) Ian Douglas
@ 2020-07-12  8:25 ` Simon Wright
  2020-07-12  8:42   ` Ian Douglas
  2020-07-13 15:28 ` Shark8
  1 sibling, 1 reply; 18+ messages in thread
From: Simon Wright @ 2020-07-12  8:25 UTC (permalink / raw)


Ian Douglas <ian@vionia.com> writes:

> If I try to declare a variable using non-Latin, the compiler objects.
>
> φ : Long_Float := 1.6180339887;
>
> Why is that?
>
> I'm using UTF-8 in GPS.
>
> Apparently you need to pass -gnatW8 to the compiler, but I can't
> figure out where in GPS to do that ... the "switches" page shows me
> stuff for Pretty Printer.

Edit. Project Properties, Build, Switches, Ada

At the bottom of the page, there's a summary box, showing all the
switches curently selected: you can type -gnatW8 directly in this box,
even though there's no GUI for selecting it.

By the way, if you're on Windows or macOS, don't use non-Latin
characters in unit names!
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81114

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

* Re: Newbie questions re Unicode (1)
  2020-07-12  8:25 ` Simon Wright
@ 2020-07-12  8:42   ` Ian Douglas
  2020-07-12 18:43     ` Simon Wright
  0 siblings, 1 reply; 18+ messages in thread
From: Ian Douglas @ 2020-07-12  8:42 UTC (permalink / raw)


On Sunday, 12 July 2020 10:25:48 UTC+2, Simon Wright  wrote:
> 
> Edit. Project Properties, Build, Switches, Ada
> 

I only have Pretty Printer under switches.
I did try putting the switch in there (since was only place I could find, and that was only by accidental mouse-over ... they could add a label there...) but it didn't stick. And no effect.

https://imgur.com/vyxaCng

Am using Gentoo Linux, GPS is :

GPS 0.0 (unknown date) hosted on x86_64-pc-linux-gnu
GNAT Community 2019 (20190517-83)

Thanks, Ian

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

* Re: Newbie questions re Unicode (1)
  2020-07-12  8:42   ` Ian Douglas
@ 2020-07-12 18:43     ` Simon Wright
  2020-07-12 20:08       ` Ian Douglas
  2020-07-18 12:20       ` Bob Goddard
  0 siblings, 2 replies; 18+ messages in thread
From: Simon Wright @ 2020-07-12 18:43 UTC (permalink / raw)


Sorry, I can't help further (something bizarre has happened to GPS on my
Mac, complaining about being unable to verify supplier of files that
aren't there :).

But you should have much more than just Pretty Printer under
Build/Switches.

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

* Re: Newbie questions re Unicode (1)
  2020-07-12 18:43     ` Simon Wright
@ 2020-07-12 20:08       ` Ian Douglas
  2020-07-18 12:20       ` Bob Goddard
  1 sibling, 0 replies; 18+ messages in thread
From: Ian Douglas @ 2020-07-12 20:08 UTC (permalink / raw)


On Sunday, 12 July 2020 20:43:59 UTC+2, Simon Wright  wrote:
> Sorry, I can't help further (something bizarre has happened to GPS on my
> Mac, complaining about being unable to verify supplier of files that
> aren't there :).
> 
> But you should have much more than just Pretty Printer under
> Build/Switches.

Thanks, I filed a bug with Gentoo.

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

* Re: Newbie questions re Unicode (1)
  2020-07-12  8:14 Newbie questions re Unicode (1) Ian Douglas
  2020-07-12  8:25 ` Simon Wright
@ 2020-07-13 15:28 ` Shark8
  2020-07-13 16:59   ` Simon Wright
  2020-07-21 19:54   ` Ian Douglas
  1 sibling, 2 replies; 18+ messages in thread
From: Shark8 @ 2020-07-13 15:28 UTC (permalink / raw)


Typically what I do here is:
(1) Right click the text-area in GPS, select properties; in the dialog change the setting "character-set" to "Unicode UTF-8".
(2) At the top of the file, after "Pragma Ada_2012;" put " Pragma Wide_Character_Encoding(UTF8);"
(3) Edit Project Properties: under Build, Switches, Ada there's a text-box at the bottom; append "-gnatw8".

I think there's a way to edit the default character-set in new files, but I've forgotten how; you can just do #1 on each new file though.

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

* Re: Newbie questions re Unicode (1)
  2020-07-13 15:28 ` Shark8
@ 2020-07-13 16:59   ` Simon Wright
  2020-07-21 15:36     ` Shark8
  2020-07-21 19:54   ` Ian Douglas
  1 sibling, 1 reply; 18+ messages in thread
From: Simon Wright @ 2020-07-13 16:59 UTC (permalink / raw)


Shark8 <onewingedshark@gmail.com> writes:

> Typically what I do here is:
> (1) Right click the text-area in GPS, select properties; in the dialog
> change the setting "character-set" to "Unicode UTF-8".
> (2) At the top of the file, after "Pragma Ada_2012;" put " Pragma
> Wide_Character_Encoding(UTF8);"
> (3) Edit Project Properties: under Build, Switches, Ada there's a
> text-box at the bottom; append "-gnatw8".

Do you have to do all 3?

Personally I wouldn't bother with (2) because (a) it's the default;
unless (b) you're using GNAT CE, in which case it's the only
possibility!

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

* Re: Newbie questions re Unicode (1)
  2020-07-12 18:43     ` Simon Wright
  2020-07-12 20:08       ` Ian Douglas
@ 2020-07-18 12:20       ` Bob Goddard
  2020-07-21 19:57         ` Ian Douglas
  1 sibling, 1 reply; 18+ messages in thread
From: Bob Goddard @ 2020-07-18 12:20 UTC (permalink / raw)


On Sunday, 12 July 2020 19:43:59 UTC+1, Simon Wright  wrote:
> Sorry, I can't help further (something bizarre has happened to GPS on my
> Mac, complaining about being unable to verify supplier of files that
> aren't there :).
> 
> But you should have much more than just Pretty Printer under
> Build/Switches.

Well, he should be able to edit the project gpr file directly. Perhaps posting that may be better than posting a screen capture.


B

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

* Re: Newbie questions re Unicode (1)
  2020-07-13 16:59   ` Simon Wright
@ 2020-07-21 15:36     ` Shark8
  0 siblings, 0 replies; 18+ messages in thread
From: Shark8 @ 2020-07-21 15:36 UTC (permalink / raw)


On Monday, July 13, 2020 at 10:59:46 AM UTC-6, Simon Wright wrote:
> Shark8  writes:
> 
> > Typically what I do here is:
> > (1) Right click the text-area in GPS, select properties; in the dialog
> > change the setting "character-set" to "Unicode UTF-8".
> > (2) At the top of the file, after "Pragma Ada_2012;" put " Pragma
> > Wide_Character_Encoding(UTF8);"
> > (3) Edit Project Properties: under Build, Switches, Ada there's a
> > text-box at the bottom; append "-gnatw8".
> 
> Do you have to do all 3?
> 
> Personally I wouldn't bother with (2) because (a) it's the default;
> unless (b) you're using GNAT CE, in which case it's the only
> possibility!

#2 isn't strictly necessary, no.
But if you're not using Pragma Restrictions( NO_IMPLEMENTATION_DEFINED_PRAGMAS ); it's nice to have in the program-text what the character-set is.

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

* Re: Newbie questions re Unicode (1)
  2020-07-13 15:28 ` Shark8
  2020-07-13 16:59   ` Simon Wright
@ 2020-07-21 19:54   ` Ian Douglas
  2020-07-21 20:11     ` J-P. Rosen
  1 sibling, 1 reply; 18+ messages in thread
From: Ian Douglas @ 2020-07-21 19:54 UTC (permalink / raw)


On Monday, 13 July 2020 17:28:02 UTC+2, Shark8  wrote:

> (3) Edit Project Properties: under Build, Switches, Ada there's a text-box at the bottom; append "-gnatw8".
> 

Sorry wasn't  expecting further follow-ups.

Character set on computer and in Ada programs is utf-8.

I don't have the "Ada" tab under Switches, I've posted it as a bug for the Gentoo maintainer to attend to.

Thanks for feedback.

Cheers, Ian

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

* Re: Newbie questions re Unicode (1)
  2020-07-18 12:20       ` Bob Goddard
@ 2020-07-21 19:57         ` Ian Douglas
  2020-07-25 11:44           ` 196...@googlemail.com
  2020-07-27 20:26           ` Simon Wright
  0 siblings, 2 replies; 18+ messages in thread
From: Ian Douglas @ 2020-07-21 19:57 UTC (permalink / raw)


On Saturday, 18 July 2020 14:20:39 UTC+2, Bob Goddard  wrote:
> 
> Well, he should be able to edit the project gpr file directly. Perhaps posting that may be better than posting a screen capture.

.gpr file:

project Checkall is
    for Source_Dirs use ("src");
    for Object_Dir use "obj";
    for Main use ("checkall.adb");
end Checkall;

Should I add something about utf in there?

Sorry still near the bottom of the learning curve, getting to grips with the language, all the other stuff around the syntax etc still pretty much a black box.

Thanks, Ian

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

* Re: Newbie questions re Unicode (1)
  2020-07-21 19:54   ` Ian Douglas
@ 2020-07-21 20:11     ` J-P. Rosen
  0 siblings, 0 replies; 18+ messages in thread
From: J-P. Rosen @ 2020-07-21 20:11 UTC (permalink / raw)


Le 21/07/2020 à 21:54, Ian Douglas a écrit :
> Character set on computer and in Ada programs is utf-8.
Just to be pedantic: UTF-8 is not a character set, it's an encoding
method (generally applied to the ISO-10646/Unicode character set)

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

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

* Re: Newbie questions re Unicode (1)
  2020-07-21 19:57         ` Ian Douglas
@ 2020-07-25 11:44           ` 196...@googlemail.com
  2020-07-27 13:46             ` Ian Douglas
  2020-07-27 20:26           ` Simon Wright
  1 sibling, 1 reply; 18+ messages in thread
From: 196...@googlemail.com @ 2020-07-25 11:44 UTC (permalink / raw)


On Tuesday, 21 July 2020 at 20:57:12 UTC+1, i...@vionia.com wrote:
> On Saturday, 18 July 2020 14:20:39 UTC+2, Bob Goddard wrote: 
> > 
> > Well, he should be able to edit the project gpr file directly. Perhaps posting that may be better than posting a screen capture.
> .gpr file: 
> 
> project Checkall is 
> for Source_Dirs use ("src"); 
> for Object_Dir use "obj"; 
> for Main use ("checkall.adb"); 
> end Checkall; 
> 
> Should I add something about utf in there? 
> 
> Sorry still near the bottom of the learning curve, getting to grips with the language, all the other stuff around the syntax etc still pretty much a black box. 
> 
> Thanks, Ian

I would have thought that ...
for Languages use ("Ada");
is missing.

Under Project properties->Sources->Languages, there should be a tick against Ada.

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

* Re: Newbie questions re Unicode (1)
  2020-07-25 11:44           ` 196...@googlemail.com
@ 2020-07-27 13:46             ` Ian Douglas
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Douglas @ 2020-07-27 13:46 UTC (permalink / raw)


On Saturday, 25 July 2020 13:44:33 UTC+2, 196...@googlemail.com  wrote:
> I would have thought that ...
> for Languages use ("Ada");
> is missing.
> 
> Under Project properties->Sources->Languages, there should be a tick against Ada.


Ada is set as the language under project properties.

Cheers, Ian

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

* Re: Newbie questions re Unicode (1)
  2020-07-21 19:57         ` Ian Douglas
  2020-07-25 11:44           ` 196...@googlemail.com
@ 2020-07-27 20:26           ` Simon Wright
  2020-07-29  7:28             ` Ian Douglas
  1 sibling, 1 reply; 18+ messages in thread
From: Simon Wright @ 2020-07-27 20:26 UTC (permalink / raw)


Ian Douglas <ian@vionia.com> writes:

> project Checkall is
>     for Source_Dirs use ("src");
>     for Object_Dir use "obj";
>     for Main use ("checkall.adb");

   package Compiler is
      for Default_Switches ("ada") use ("-gnatW8");
   end Compiler;

> end Checkall;
>
> Should I add something about utf in there?

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

* Re: Newbie questions re Unicode (1)
  2020-07-27 20:26           ` Simon Wright
@ 2020-07-29  7:28             ` Ian Douglas
  2020-07-29  7:34               ` Ian Douglas
  0 siblings, 1 reply; 18+ messages in thread
From: Ian Douglas @ 2020-07-29  7:28 UTC (permalink / raw)


On Monday, 27 July 2020 22:26:24 UTC+2, Simon Wright  wrote:
>    package Compiler is
>       for Default_Switches ("ada") use ("-gnatW8");
>    end Compiler;
> 

Thanks Simon, that works. With some limitations.

For example, π and φ or even φπ are accepted as variable names, but not something like ₢ for example. I guess only Latin 1 characters are allowed.

I'm on Linux and have custom .XCompose key combinations to type such things easily, but they don't work in GPS. Curiously, combinations defined in the default XCompose file *do* work, like degree sign °. Don't know if this is some GTK/KDE thing again, but as you see they work fine in Firefox which is also GTK.

Thanks for sorting it out for me :-)

Cheers, Ian

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

* Re: Newbie questions re Unicode (1)
  2020-07-29  7:28             ` Ian Douglas
@ 2020-07-29  7:34               ` Ian Douglas
  2020-07-29 15:26                 ` J-P. Rosen
  0 siblings, 1 reply; 18+ messages in thread
From: Ian Douglas @ 2020-07-29  7:34 UTC (permalink / raw)


On Wednesday, 29 July 2020 09:28:15 UTC+2, Ian Douglas  wrote:
> 
> For example, π and φ or even φπ are accepted as variable names, but not something like ₢ for example. I guess only Latin 1 characters are allowed.
> 

Mmm maybe because ₢ is a currency symbol and not defined as a "letter".

Looks like things up to Unicode block Latin Extended B are okay but not beyond.

Cheers, Ian

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

* Re: Newbie questions re Unicode (1)
  2020-07-29  7:34               ` Ian Douglas
@ 2020-07-29 15:26                 ` J-P. Rosen
  0 siblings, 0 replies; 18+ messages in thread
From: J-P. Rosen @ 2020-07-29 15:26 UTC (permalink / raw)


Le 29/07/2020 à 09:34, Ian Douglas a écrit :
> On Wednesday, 29 July 2020 09:28:15 UTC+2, Ian Douglas  wrote:
>> For example, π and φ or even φπ are accepted as variable names, but not something like ₢ for example. I guess only Latin 1 characters are allowed.
>>
> Mmm maybe because ₢ is a currency symbol and not defined as a "letter".

The definition of "Letter" for identifiers is as follows (General
Category is from ISO 10646/2017), see 2.1 and 2.3:

letter_uppercase
Any character whose General Category is defined to be “Letter, Uppercase”.

letter_lowercase
Any character whose General Category is defined to be “Letter, Lowercase”.

letter_titlecase
Any character whose General Category is defined to be “Letter, Titlecase”.

letter_modifier
Any character whose General Category is defined to be “Letter, Modifier”.

letter_other
Any character whose General Category is defined to be “Letter, Other”.

number_letter
Any character whose General Category is defined to be “Number, Letter”.

For more details, refer to ISO 10646, but be careful: ISO 10646 is 2.5
times the size of the Ada standard!

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

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

end of thread, other threads:[~2020-07-29 15:26 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-12  8:14 Newbie questions re Unicode (1) Ian Douglas
2020-07-12  8:25 ` Simon Wright
2020-07-12  8:42   ` Ian Douglas
2020-07-12 18:43     ` Simon Wright
2020-07-12 20:08       ` Ian Douglas
2020-07-18 12:20       ` Bob Goddard
2020-07-21 19:57         ` Ian Douglas
2020-07-25 11:44           ` 196...@googlemail.com
2020-07-27 13:46             ` Ian Douglas
2020-07-27 20:26           ` Simon Wright
2020-07-29  7:28             ` Ian Douglas
2020-07-29  7:34               ` Ian Douglas
2020-07-29 15:26                 ` J-P. Rosen
2020-07-13 15:28 ` Shark8
2020-07-13 16:59   ` Simon Wright
2020-07-21 15:36     ` Shark8
2020-07-21 19:54   ` Ian Douglas
2020-07-21 20:11     ` J-P. Rosen

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