Hello Jeff,

> Le 13 mars 2022 à 12:42, J Carter via Gnoga-list 
> <gnoga-list@lists.sourceforge.net> a écrit :
> 
> I note that Gnoga 2.1a is not backward compatible with 1.6a due to the 
> introduction of UXStrings. I had hoped that this would only involve 
> overloaded operations, and that those using String would continue to be 
> available.

In January'21, the introduction in Gnoga 2.1 of support for 
internationalization of programs might have actually led to backward 
compatibility issues, the intend was clearly to reduce them as possible.

Thus, the compatibility with Gnoga 2.1 is not straightforward though UXStrings 
API were inspired from Ada.Strings.Unbounded in order to minimize adaptation 
work from existing Ada source codes.
I've adapted Gnoga demos, tutorials and tests source code with some specific 
lines added to ease the adaptation:

+   use all type Gnoga.String;
+
+   subtype String is Gnoga.String;

Then you will change all XXXX_String types to only String.

Some Image facilities are provided:
-      Game_log ("Swapping: (" & c1.x'Img & c1.y'Img & ") and (" & c2.x'Img & 
c2.y'Img & ")");
+      Game_log ("Swapping: (" & Image (c1.x) & Image (c1.y) & ") and (" & 
Image (c2.x) & Image (c2.y) & ")");
or else create you own:
+         function Image is new UXStrings.Conversions.Scalar_Image (Match_kind);

Some conversions are provided:
-            return +Item.Director;
+            return From_UTF_8 (+Item.Director);
and
-            Item.Director.Assign (From => Value);
+            Item.Director.Assign (From => To_UTF_8 (Value));

See for instance Chattanooga adaptation:
https://sourceforge.net/p/gnoga/code/ci/d56722a45bbc370635a5fb31996cb68528d9e9dd/tree/demo/chattanooga/chattanooga.ads?barediff=524b530a568a185373790ab1111cdc06d6101fd4

With other Gnoga demos changes:
https://sourceforge.net/p/gnoga/code/ci/d56722a45bbc370635a5fb31996cb68528d9e9dd/#diff-10

> In addition to littering my code with conversions to UXString, I would have 
> to change any sources I have that use the upper half of Character to UTF-8 
> encoding, as the spec of UXStrings uses non-ASCII characters in UTF-8 
> encoding, GNAT's source-based model means that specs are read every time 
> something that uses the pkg is compiled, so any compilation against Gnoga 
> must use UTF-8 encoding. This seems like excess effort for no gain, so I 
> won't be making the transition immediately.

Conversion from and to UXStrings are limited to the outer world as files or 
databases but it was the same before with conversions from and to Ada Latin-1 
strings.
There is no more conversion between UXStrings and data received or sent to your 
HTML browser.
In Gnoga 1.x conversions are actually present from Ada Latin-1 to UTF-8 
Javascript and vice versa.
The goal was to open the ability to use characters that are not included in 
Latin-1, that is not possible at no cost.
For instance, with Gnoga 1.x you are not able to process correctly a user 
browser entry: "Price 10 €".
The Euro sign is replaced by a joker character. With Gnoga 2.x it is processed 
correctly.

> However, it appears that 2.1a has resolved the recompilation problem that 
> plagued earlier versions. What was the culprit and its fix? I would like to 
> see the fix applied back to earlier versions if possible.

The fix from Gauthier has been applied on 1.7:
https://sourceforge.net/p/gnoga/code/ci/c12bff8262ad6c0e88e9923691e59bb49e5a34e3/

HTH, Pascal.
https://blady.pagesperso-orange.fr




_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to