* using charles library @ 2003-05-26 13:27 Roman V. Isaev 2003-05-26 13:40 ` Preben Randhol 2003-05-27 20:24 ` Matthew Heaney 0 siblings, 2 replies; 33+ messages in thread From: Roman V. Isaev @ 2003-05-26 13:27 UTC (permalink / raw) I'm learning the ropes, so it might be stupid question but I tried use charles.maps.sorted.strings.unbounded (used sample code by mheaney@on2.com from this newsgroup archive): with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Charles.Maps.Sorted.Strings.Unbounded; with Charles.Strings.Unbounded; use Charles.Strings.Unbounded; package body gettext is package Translation_Tables is new Charles.Maps.Sorted.Strings.Unbounded (Element_Type => Charles.Strings.Unbounded.Container_Type); TT : Translation_Tables.Container_Type; ........ procedure load_mo_file is ........ Insert(TT, "key", Element => To_Container("value")); When I try to compile I get following error: gnatmake -gnatf gettext -I../charles 2>&1|head adagcc -c -gnatf -I../charles gettext.adb gettext.adb:133:10: no candidate interpretations match the actuals: gettext.adb:133:10: missing argument for parameter "New_Item" in call to "insert" declared at charles-strings-unbounded.ads:180 gettext.adb:133:10: missing argument for parameter "New_Item" in call to "insert" declared at charles-strings-unbounded.ads:175 gettext.adb:133:10: missing argument for parameter "New_Item" in call to "insert" declared at charles-strings-unbounded.ads:170 gettext.adb:133:10: missing argument for parameter "New_Item" in call to "insert" declared at charles-strings-unbounded.ads:164 gettext.adb:133:10: missing argument for parameter "Count" in call to "insert" declared at charles-strings-unbounded.ads:159 gettext.adb:133:10: missing argument for parameter "New_Item" in call to "insert" declared at a-strunb.ads:274 gettext.adb:133:10: missing argument for parameter "New_Item" in call to "insert" declared at a-strunb.ads:268 gnatmake: "gettext.adb" compilation error What's wrong?.. fbsd 4.8, gnat 3.15p built from ports, charles-20030320.zip. ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 13:27 using charles library Roman V. Isaev @ 2003-05-26 13:40 ` Preben Randhol 2003-05-26 16:44 ` Roman V. Isaev 2003-05-27 20:24 ` Matthew Heaney 1 sibling, 1 reply; 33+ messages in thread From: Preben Randhol @ 2003-05-26 13:40 UTC (permalink / raw) Roman V. Isaev wrote: > I'm learning the ropes, so it might be stupid question but I tried > use charles.maps.sorted.strings.unbounded (used sample code by > mheaney@on2.com from this newsgroup archive): > > with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; > with Charles.Maps.Sorted.Strings.Unbounded; > with Charles.Strings.Unbounded; use Charles.Strings.Unbounded; > > package body gettext is > > package Translation_Tables is > new Charles.Maps.Sorted.Strings.Unbounded > (Element_Type => Charles.Strings.Unbounded.Container_Type); > > TT : Translation_Tables.Container_Type; > > ........ > > procedure load_mo_file is > > ........ > > Insert(TT, "key", Element => To_Container("value")); Because it is: Insert(TT, "key", New_Item => To_Container("value")); as I can see from the .ads file although I haven't tried to compile this. -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 13:40 ` Preben Randhol @ 2003-05-26 16:44 ` Roman V. Isaev 2003-05-26 17:05 ` Preben Randhol ` (3 more replies) 0 siblings, 4 replies; 33+ messages in thread From: Roman V. Isaev @ 2003-05-26 16:44 UTC (permalink / raw) > > I'm learning the ropes, so it might be stupid question but I tried > > use charles.maps.sorted.strings.unbounded (used sample code by > > mheaney@on2.com from this newsgroup archive): > > with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; > > with Charles.Maps.Sorted.Strings.Unbounded; > > with Charles.Strings.Unbounded; use Charles.Strings.Unbounded; > > package body gettext is > > package Translation_Tables is > > new Charles.Maps.Sorted.Strings.Unbounded > > (Element_Type => Charles.Strings.Unbounded.Container_Type); > > TT : Translation_Tables.Container_Type; > > ........ > > procedure load_mo_file is > > ........ > > Insert(TT, "key", Element => To_Container("value")); > Because it is: > Insert(TT, "key", New_Item => To_Container("value")); > as I can see from the .ads file although I haven't tried to compile > this. It still complains: gnatmake -gnatf gettext -I../charles adagcc -c -gnatf -I../charles gettext.adb gettext.adb:133:10: no candidate interpretations match the actuals: gettext.adb:133:10: missing argument for parameter "Index" in call to "insert" declared at charles-strings-unbounded.ads:180 gettext.adb:133:10: missing argument for parameter "Count" in call to "insert" declared at charles-strings-unbounded.ads:159 gettext.adb:133:17: expected private type "unbounded.Container_Type" defined at charles-strings-unbounded.ads:41 gettext.adb:133:17: found private type "test.Container_Type" defined at charles-maps-sorted-strings-unbounded.ads:63, instance at line 12 gettext.adb:133:17: ==> in call to "Insert" at charles-strings-unbounded.ads:175 gettext.adb:133:17: ==> in call to "Insert" at charles-strings-unbounded.ads:170 gettext.adb:133:17: ==> in call to "Insert" at charles-strings-unbounded.ads:164 gettext.adb:133:17: ==> in call to "Insert" at a-strunb.ads:274 gnatmake: "gettext.adb" compilation error I wonder is there any package easier to use? I only want two functions, something like store(key,value) and lookup(key), that's all, without 20+ string declaration voodoo... Grrrrr. I miss perl's associative arrays. ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 16:44 ` Roman V. Isaev @ 2003-05-26 17:05 ` Preben Randhol 2003-05-26 17:10 ` Preben Randhol 2003-05-26 17:16 ` Jeffrey Carter ` (2 subsequent siblings) 3 siblings, 1 reply; 33+ messages in thread From: Preben Randhol @ 2003-05-26 17:05 UTC (permalink / raw) Roman V. Isaev wrote: >> > I'm learning the ropes, so it might be stupid question but I tried >> > use charles.maps.sorted.strings.unbounded (used sample code by >> > mheaney@on2.com from this newsgroup archive): >> > with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; >> > with Charles.Maps.Sorted.Strings.Unbounded; >> > with Charles.Strings.Unbounded; use Charles.Strings.Unbounded; >> > package body gettext is >> > package Translation_Tables is >> > new Charles.Maps.Sorted.Strings.Unbounded >> > (Element_Type => Charles.Strings.Unbounded.Container_Type); >> > TT : Translation_Tables.Container_Type; >> > ........ >> > procedure load_mo_file is >> > ........ >> > Insert(TT, "key", Element => To_Container("value")); >> Because it is: >> Insert(TT, "key", New_Item => To_Container("value")); >> as I can see from the .ads file although I haven't tried to compile >> this. > > It still complains: Ah because you have to do: Charles.Maps.Sorted.Strings.Unbounded.Insert (TT, "key", New_Item => To_Container("value")); as you are only withing the Charles.Maps.Sorted.Strings.Unbounded child package. Now it tries to find the Insert in Charles.Strings.Unbounded. I assume you are using the Insert from Charles.Maps.Sorted.Strings.Unbounded ? > I wonder is there any package easier to use? I only want two > functions, something like store(key,value) and lookup(key), that's > all, without 20+ string declaration voodoo... Grrrrr. I miss perl's > associative arrays. Relax, it is only that you are not so familiar with Ada. It doesn't have to do with the library. :-) -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 17:05 ` Preben Randhol @ 2003-05-26 17:10 ` Preben Randhol 2003-05-26 22:05 ` Roman V. Isaev 0 siblings, 1 reply; 33+ messages in thread From: Preben Randhol @ 2003-05-26 17:10 UTC (permalink / raw) Preben Randhol wrote: > Roman V. Isaev wrote: >>> > I'm learning the ropes, so it might be stupid question but I tried >>> > use charles.maps.sorted.strings.unbounded (used sample code by >>> > mheaney@on2.com from this newsgroup archive): >>> > with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; >>> > with Charles.Maps.Sorted.Strings.Unbounded; >>> > with Charles.Strings.Unbounded; use Charles.Strings.Unbounded; >>> > package body gettext is >>> > package Translation_Tables is >>> > new Charles.Maps.Sorted.Strings.Unbounded >>> > (Element_Type => Charles.Strings.Unbounded.Container_Type); >>> > TT : Translation_Tables.Container_Type; >>> > ........ >>> > procedure load_mo_file is >>> > ........ >>> > Insert(TT, "key", Element => To_Container("value")); >>> Because it is: >>> Insert(TT, "key", New_Item => To_Container("value")); >>> as I can see from the .ads file although I haven't tried to compile >>> this. >> >> It still complains: > > Ah because you have to do: > > Charles.Maps.Sorted.Strings.Unbounded.Insert > (TT, "key", New_Item => To_Container("value")); Ooops sorry forget what I said my fault: Should be: with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Charles.Maps.Sorted.Strings.Unbounded; with Charles.Strings.Unbounded; use Charles.Strings.Unbounded; package body gettext is package Translation_Tables is new Charles.Maps.Sorted.Strings.Unbounded (Element_Type => Charles.Strings.Unbounded.Container_Type); TT : Translation_Tables.Container_Type; procedure load_mo_file is Translation_Tables.Insert(TT, "key", New_Item => To_Container("value")); As you know want to call the Insert in the Translation_Tables package you made. -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 17:10 ` Preben Randhol @ 2003-05-26 22:05 ` Roman V. Isaev 0 siblings, 0 replies; 33+ messages in thread From: Roman V. Isaev @ 2003-05-26 22:05 UTC (permalink / raw) > Ooops sorry forget what I said my fault: > Should be: > with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; > with Charles.Maps.Sorted.Strings.Unbounded; > with Charles.Strings.Unbounded; use Charles.Strings.Unbounded; > package body gettext is > package Translation_Tables is > new Charles.Maps.Sorted.Strings.Unbounded > (Element_Type => > Charles.Strings.Unbounded.Container_Type); > TT : Translation_Tables.Container_Type; > procedure load_mo_file is > Translation_Tables.Insert(TT, "key", New_Item => To_Container("value")); > As you know want to call the Insert in the Translation_Tables package > you made. Thanks, this worked :) ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 16:44 ` Roman V. Isaev 2003-05-26 17:05 ` Preben Randhol @ 2003-05-26 17:16 ` Jeffrey Carter 2003-05-27 15:05 ` Matthew Heaney 2003-05-26 17:20 ` Preben Randhol 2003-05-27 18:27 ` Stephen Leake 3 siblings, 1 reply; 33+ messages in thread From: Jeffrey Carter @ 2003-05-26 17:16 UTC (permalink / raw) Roman V. Isaev wrote: > > I wonder is there any package easier to use? I only want two > functions, something like store(key,value) and lookup(key), that's > all, without 20+ string declaration voodoo... Grrrrr. I miss perl's > associative arrays. You might want to look at the PragmAda Reusable Components, specifically PragmARC.Skip_List_Unbounded. You'd have to declare a record type containing your Key and Value fields, and comparison operations ("=" and "<") for the type that only compare the Key Field, but it still seems a lot simpler than what you've described. You'd then use Insert and Search. The PragmAda Reusable Components are available from http://home.earthlink.net/~jrcarter010/pragmarc.htm -- Jeff Carter "Spam! Spam! Spam! Spam! Spam! Spam! Spam! Spam!" Monty Python's Flying Circus ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 17:16 ` Jeffrey Carter @ 2003-05-27 15:05 ` Matthew Heaney 2003-05-27 18:28 ` Stephen Leake 0 siblings, 1 reply; 33+ messages in thread From: Matthew Heaney @ 2003-05-27 15:05 UTC (permalink / raw) Jeffrey Carter <spam@spam.com> wrote in message news:<3ED24C46.6080208@spam.com>... > Roman V. Isaev wrote: > > > > I wonder is there any package easier to use? I only want two > > functions, something like store(key,value) and lookup(key), that's > > all, without 20+ string declaration voodoo... Grrrrr. I miss perl's > > associative arrays. Your problem is a consequence of the fact that the intended element type, String, is indefinite. Most container libraries in Ada --including Charles-- require container elements to be definite, with some kind of constraint. That's why the generic formal type looks like this: generic type Element_Type is private; package GP is ...; Note that this is the case even for built-in array types: type String cannot be an array component subtype directly. Had you chosen a simpler type, as Integer or Float, then you would have had fewer difficulties instantiating the component. If you need to use type String as a container element, then you need some kind of wrapper class, either Ada.Strings.Unbounded or Charles.Strings.Unbounded, that is itself definite. To store a key/element pair in the map, use Insert: Insert (Map, Key, Element); That operation is overloaded to return an iterator that designates the pair: Insert (Map, Key, Element, Iterator); It's overloaded again to return a Success parameter, which allows the insertion to be conditional (insert fails if key is already in the map): Insert (Map, Key, Element, Iterator, Success); To lookup a key/value pair, just use the Find operation: procedure Op (Map : Map_Subtype) is I : Iterator_Type := Find (Map, Key); begin if I /= Back (Map) then declare E : Element_Type := Element (I); --or E : Element_TYpe renames To_Access (I).all; begin ... end; end if; end; It wasn't clear from your original example why you were using Ada.Strings.Unbounded, if you were using Charles.Strings.Unbounded as the element type. Drop me a line if any of this isn't clear. Matt ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-27 15:05 ` Matthew Heaney @ 2003-05-27 18:28 ` Stephen Leake 0 siblings, 0 replies; 33+ messages in thread From: Stephen Leake @ 2003-05-27 18:28 UTC (permalink / raw) mheaney@on2.com (Matthew Heaney) writes: > Jeffrey Carter <spam@spam.com> wrote in message > news:<3ED24C46.6080208@spam.com>... > > Roman V. Isaev wrote: > > > > > > I wonder is there any package easier to use? I only want two > > > functions, something like store(key,value) and lookup(key), that's > > > all, without 20+ string declaration voodoo... Grrrrr. I miss perl's > > > associative arrays. > > Your problem is a consequence of the fact that the intended element > type, String, is indefinite. Most container libraries in Ada > --including Charles-- require container elements to be definite, with > some kind of constraint. SAL (http://www.toadmail.com/~ada_wizard/ada/sal.html) allows the container elements to be indefinite. -- -- Stephe ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 16:44 ` Roman V. Isaev 2003-05-26 17:05 ` Preben Randhol 2003-05-26 17:16 ` Jeffrey Carter @ 2003-05-26 17:20 ` Preben Randhol 2003-05-26 22:46 ` Roman V. Isaev 2003-05-27 18:27 ` Stephen Leake 3 siblings, 1 reply; 33+ messages in thread From: Preben Randhol @ 2003-05-26 17:20 UTC (permalink / raw) Roman V. Isaev wrote: >> > package body gettext is > I wonder is there any package easier to use? I only want two > functions, something like store(key,value) and lookup(key), that's > all, without 20+ string declaration voodoo... Grrrrr. I miss perl's > associative arrays. By the way what are you using it for? It is not for locales (gettext) on Linux? If yes, then look at the GtkAda package. -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 17:20 ` Preben Randhol @ 2003-05-26 22:46 ` Roman V. Isaev 2003-05-27 4:35 ` Gautier Write-only 2003-05-27 10:31 ` Preben Randhol 0 siblings, 2 replies; 33+ messages in thread From: Roman V. Isaev @ 2003-05-26 22:46 UTC (permalink / raw) > >> > package body gettext is > > I wonder is there any package easier to use? I only want two > > functions, something like store(key,value) and lookup(key), that's > > all, without 20+ string declaration voodoo... Grrrrr. I miss perl's > > associative arrays. > By the way what are you using it for? It is not for locales (gettext) on > Linux? If yes, then look at the GtkAda package. I would not touch Gtk stuff with a ten-foot pole. Gtk on WinXX performance is a joke and even Gtk on X11 performance is lousy (I always compile freeciv with Xaw3D because of that despite of Xaw3D interface strangeness). Seeing simple windows redraw themselves in times of common 1Ghz+ computers is Not Right. I developed some applications in C++ using wxWindows and wxWindows compared with Gtk is like sports car compared with econobox. IMHO :-) Anyway, this isn't the main reason. The main reason is to learn some Ada, I have to start somewhere and I'll need translation code anyway. Recently I dug out some old father's Pascal code that does some scientific calculations. It needs user interface and cleanup. Don't want to use Delphi. Many years ago I did an interface for it, using Clarion 2.1 for DOS, but program wasn't released :) Now I want to use AWS (I'm playing with it right now and it's amazing) so the interface would be accessible via TCP/IP and the program would be extremely portable (to run it on the openbsd server in demo mode). Scientific code produces lengthy text output, right now only cyrillic, and that output has to be translated somehow. I want to use gettext .mo files because I like poEdit and I want to give it to my father to translate most of his messages (I don't know a damn in oil field science). Didn't try to run xgettext on ada sources yet tho... but I hope string extraction is not a big problem. ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 22:46 ` Roman V. Isaev @ 2003-05-27 4:35 ` Gautier Write-only 2003-05-29 17:29 ` Roman V. Isaev 2003-05-27 10:31 ` Preben Randhol 1 sibling, 1 reply; 33+ messages in thread From: Gautier Write-only @ 2003-05-27 4:35 UTC (permalink / raw) Roman V. Isaev: > Recently I dug out some old father's Pascal code that does > some scientific calculations. > It needs user interface and cleanup. Don't want to use Delphi. Did you consider a translation of the Pascal code too (it could facilitate maintenance and performance, and lift the language interfacing issues) ? In that case the tool on the link below may help you... ______________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm#p2ada NB: For a direct answer, e-mail address on the Web site! ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-27 4:35 ` Gautier Write-only @ 2003-05-29 17:29 ` Roman V. Isaev 2003-05-29 18:56 ` Gautier Write-only ` (2 more replies) 0 siblings, 3 replies; 33+ messages in thread From: Roman V. Isaev @ 2003-05-29 17:29 UTC (permalink / raw) > > Recently I dug out some old father's Pascal code that does > > some scientific calculations. > > It needs user interface and cleanup. Don't want to use Delphi. > Did you consider a translation of the Pascal code too (it could > facilitate maintenance and performance, and lift the language > interfacing issues) ? The main question is not the translation itself which is possible. It may pose problems too as these 3000+ lines of "pascal" contain mostly this: IF KK=2 THEN GOTO 179; GOTO 178; 179: YRR:=YR21; YZR:=ABS((1.0+Y2)/Y12-2.0*XY*(XY-Z)-4.0/3.0* (Y1+Y2)/Y12*Z+(2.0*XY-Z)*(2.0*XY-Z)*(2.0*XY-Z)/3.0*Z*Y1/(1.0+Y)); IF YZR>1.E-18 THEN GOTO 190; YZR:=1.E-18; 190: YR21:=TAU0*DG*FG/ETA/Q-8.0*Z/YZR; But most probably my father won't learn new programming language, he is too old. I remember it took a lot of time to switch from Fortran used on mainframes and early PCs to Pascal and later he had enough problems simply switching from turbo6 to delphi. Actually this line noise makes sense if you know underlying math. I don't (and frankly don't want to know). So he have to maintain his code (years ago he refused to change his horrid text formatting 'cause it helped him to remember certain parts of the program when I brougt pascal source formatter). I can let him sit and pound this program as he did it many times. > In that case the tool on the link below may help you... > Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm#p2ada This tool breaks on lines like this: ZL[IZ+3]:=(DK1[IDK+1]-2.*DK1[IDK+6])*0.001; 2.* is valid, because pascal thinks its just a 2.0*. p2ada also breaks on things like this: bih:=1.e-5; there are no useful 1.e constants like 1.e-18 and 1.E6 in ada (and p2ada can't handle these either, so I gave up for awhile 'cause these are used a lot). Writeln(FFF,'text',QY1:1:5,'text') turns into something like that: Put(FFF); Put( -- [P2Ada]: !Help! Maybe (file,...) here "text text text "); Put( -- [P2Ada]: !Help! Maybe (file,...) here QY1,5,1,0); Put( -- [P2Ada]: !Help! Maybe (file,...) here " text text text"); New_Line; -- [P2Ada]: !Help! Maybe (file) Ugh. Dunno how to handle 1.e constants gracefully. ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-29 17:29 ` Roman V. Isaev @ 2003-05-29 18:56 ` Gautier Write-only 2003-05-29 23:19 ` Gautier Write-only 2003-05-30 8:48 ` Preben Randhol 2 siblings, 0 replies; 33+ messages in thread From: Gautier Write-only @ 2003-05-29 18:56 UTC (permalink / raw) > > Did you consider a translation of the Pascal code too (it could > > facilitate maintenance and performance, and lift the language > > interfacing issues) ? Roman V. Isaev: > The main question is not the translation itself which is possible. > It may pose problems too as these 3000+ lines of "pascal" contain mostly this: > > IF KK=2 THEN GOTO 179; > GOTO 178; > 179: YRR:=YR21; > YZR:=ABS((1.0+Y2)/Y12-2.0*XY*(XY-Z)-4.0/3.0* > (Y1+Y2)/Y12*Z+(2.0*XY-Z)*(2.0*XY-Z)*(2.0*XY-Z)/3.0*Z*Y1/(1.0+Y)); > IF YZR>1.E-18 THEN GOTO 190; > YZR:=1.E-18; > 190: YR21:=TAU0*DG*FG/ETA/Q-8.0*Z/YZR; Ouch! Are you sure you don't want to know the math behind ?... - Just kidding. > > In that case the tool on the link below may help you... > > Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm#p2ada > > This tool breaks on lines like this: [ things with 2.* or 1.e-5 ] I'll try something. Normally a little change to Pascal.l should do the trick. Normally... > there are no useful 1.e constants like 1.e-18 and 1.E6 in ada Sure there are: 1.0e-18, 1.0E6 :-) > Writeln(FFF,'text',QY1:1:5,'text') turns into something like that: > > Put(FFF); > Put( -- [P2Ada]: !Help! Maybe (file,...) here > "text text text "); > Put( -- [P2Ada]: !Help! Maybe (file,...) here > QY1,5,1,0); > Put( -- [P2Ada]: !Help! Maybe (file,...) here > " text text text"); New_Line; -- [P2Ada]: !Help! Maybe (file) Okay: if you make P2Ada "see" the definition of FFF (a file I suppose), e.g. by using the Import/Export features of P2Ada, you'll have Put(FFF,"text text text"); Put(FFF,QY1,5,1,0); Put(FFF,"text text text"); New_Line(FFF); ...at least I hope so - I've left some bugs for the pleasure of it. ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site! ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-29 17:29 ` Roman V. Isaev 2003-05-29 18:56 ` Gautier Write-only @ 2003-05-29 23:19 ` Gautier Write-only 2003-05-30 7:56 ` Roman V. Isaev ` (2 more replies) 2003-05-30 8:48 ` Preben Randhol 2 siblings, 3 replies; 33+ messages in thread From: Gautier Write-only @ 2003-05-29 23:19 UTC (permalink / raw) Roman V. Isaev: [reply 2] > p2ada also breaks on things like this: bih:=1.e-5; Okay, I gave a quick try in Pascal.l, replacing {DIGIT}+({PERIOD}{DIGIT}+)?("E"({PLUS}|-)?{DIGIT}+)? {return CONSTANT_t;} by {DIGIT}+({PERIOD}{DIGIT}*)?("E"({PLUS}|-)?{DIGIT}+)? {return CONSTANT_t;} It works for the numbers, but as usual the engine breaks on another thing, here it is: "1..10" 8-( ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site! ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-29 23:19 ` Gautier Write-only @ 2003-05-30 7:56 ` Roman V. Isaev 2003-05-30 13:49 ` Gautier 2003-05-30 14:36 ` Robert C. Leif 2003-05-30 19:21 ` Randy Brukardt 2 siblings, 1 reply; 33+ messages in thread From: Roman V. Isaev @ 2003-05-30 7:56 UTC (permalink / raw) > > p2ada also breaks on things like this: bih:=1.e-5; > Okay, I gave a quick try in Pascal.l, replacing > {DIGIT}+({PERIOD}{DIGIT}+)?("E"({PLUS}|-)?{DIGIT}+)? {return CONSTANT_t;} > by > {DIGIT}+({PERIOD}{DIGIT}*)?("E"({PLUS}|-)?{DIGIT}+)? {return CONSTANT_t;} > It works for the numbers, but as usual the engine breaks on > another thing, here it is: "1..10" 8-( Another p2ada glitch -- very big variable declaration like VAR A,ALF,APR,A1,A2, C,CP, DPKR,DP,DS,DV,DV0,DV00,DMA,DMA1,DMA2,DMA3,DMI,DMI1,DMI2,DMI3, DLKN,DSHP,DSHP1,DLPG,DPG,DDAD, DDAC,DDA,DDAD1,DDAC1, ENTK,ETA,ETA1, FM,FS,FI,FNMI,FNMI1,FNMA,FNMA1, GLPR,GMP,GMD, MUG,MP,MK,MT, PY,PYS,PYS1,PRU,PT,PT1,PZ,PD1,PM1,PDD,PDD1, PMA,PC1,PS1,PALF,PMAX,PMAX1,PLNA,PZ1, QSH,QSH1,QY,QZ,QZ1,QZS,QZS1,QZS2,QND,QND1, QN1,QN,QKR1,QY1, RV,RVV,RRSH,RRSH1,RSH,RPR,RPR1,RPR2,RMA,R2, RMA1,RMAR,REG1,R21,RDGM1, SSS, TAU,TNM,TNPL,TNR,TND,TNK,TDI,TDD,TDL,TKY,TPSY,TC, UR1,UR, VSH,VD,VM,VM1,VDMI,VDMI1,VDMA,VDMA1,VU1, XY1,XY2, ZZ,ZP :Real; turns into one long line in ada source and I have to split it manually after each run. Adagide reformat goes to the extreme, placing every variable per line and iccfmt_nt goes nuts on cyrillic text (lots of invalid character in string literal errors). ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-30 7:56 ` Roman V. Isaev @ 2003-05-30 13:49 ` Gautier 0 siblings, 0 replies; 33+ messages in thread From: Gautier @ 2003-05-30 13:49 UTC (permalink / raw) Roman V. Isaev: > Another p2ada glitch -- very big variable declaration like [...] > turns into one long line in ada source and I have to split it manually after > each run. Effectively the spaces and new_line's land before the variables. Until someone finds the time to zap out the grammar system behind p2ada I'm afraid you'll have these sort of bad formatted outputs. > Adagide reformat goes to the extreme, placing every variable per > line and iccfmt_nt goes nuts on cyrillic text (lots of invalid character in > string literal errors). In AdaGIDE you can switch off the "Advanced reformat", and the normal reformatter gives you: A,ALF,APR,A1,A2,C,CP,DPKR,DP,DS,DV,DV0,DV00,DMA,DMA1,DMA2,DMA3,DMI,DMI1, DMI2,DMI3,DLKN,DSHP,DSHP1,DLPG,DPG,DDAD,DDAC,DDA,DDAD1,DDAC1,ENTK,ETA, ETA1,FM,FS,FI,FNMI,FNMI1,FNMA,FNMA1,GLPR,GMP,GMD,MUG,MP,MK,MT,PY,PYS, PYS1,PRU,PT,PT1,PZ,PD1,PM1,PDD,PDD1,PMA,PC1,PS1,PALF,PMAX,PMAX1,PLNA, PZ1,QSH,QSH1,QY,QZ,QZ1,QZS,QZS1,QZS2,QND,QND1,QN1,QN,QKR1,QY1,RV,RVV, RRSH,RRSH1,RSH,RPR,RPR1,RPR2,RMA,R2,RMA1,RMAR,REG1,R21,RDGM1,SSS,TAU, TNM,TNPL,TNR,TND,TNK,TDI,TDD,TDL,TKY,TPSY,TC,UR1,UR,VSH,VD,VM,VM1, VDMI,VDMI1,VDMA,VDMA1,VU1,XY1,XY2,ZZ,ZP:Float; :-) ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site! ^ permalink raw reply [flat|nested] 33+ messages in thread
* RE: using charles library 2003-05-29 23:19 ` Gautier Write-only 2003-05-30 7:56 ` Roman V. Isaev @ 2003-05-30 14:36 ` Robert C. Leif 2003-05-30 17:32 ` Preben Randhol 2003-05-30 19:21 ` Randy Brukardt 2 siblings, 1 reply; 33+ messages in thread From: Robert C. Leif @ 2003-05-30 14:36 UTC (permalink / raw) To: 'Gautier Write-only', comp.lang.ada It would be useful to publish the URL of the Charles Library. Bob Leif -----Original Message----- From: Gautier Write-only [mailto:gautier@somewhere.nil] Sent: Thursday, May 29, 2003 4:19 PM To: comp.lang.ada@ada.eu.org Roman V. Isaev: [reply 2] > p2ada also breaks on things like this: bih:=1.e-5; Okay, I gave a quick try in Pascal.l, replacing {DIGIT}+({PERIOD}{DIGIT}+)?("E"({PLUS}|-)?{DIGIT}+)? {return CONSTANT_t;} by {DIGIT}+({PERIOD}{DIGIT}*)?("E"({PLUS}|-)?{DIGIT}+)? {return CONSTANT_t;} It works for the numbers, but as usual the engine breaks on another thing, here it is: "1..10" 8-( ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site! ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-30 14:36 ` Robert C. Leif @ 2003-05-30 17:32 ` Preben Randhol 0 siblings, 0 replies; 33+ messages in thread From: Preben Randhol @ 2003-05-30 17:32 UTC (permalink / raw) Robert C. Leif wrote: > It would be useful to publish the URL of the Charles Library. http://home.earthlink.net/~matthewjheaney/charles/ -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-29 23:19 ` Gautier Write-only 2003-05-30 7:56 ` Roman V. Isaev 2003-05-30 14:36 ` Robert C. Leif @ 2003-05-30 19:21 ` Randy Brukardt 2003-05-31 11:50 ` Gautier Write-only 2 siblings, 1 reply; 33+ messages in thread From: Randy Brukardt @ 2003-05-30 19:21 UTC (permalink / raw) Roman V. Isaev said: >p2ada also breaks on things like this: bih:=1.e-5; So does Pastran. That's not surprising, that is not legal Pascal according to the Pascal standard. Of course, a particular compiler might allow it anyway. That's one difference between Ada and nearly every other programming language: Ada compilers are tested for conformance. An Ada compiler that tried to allow 1.e-5 would fail to pass the conformity tests and would be fixed. Other languages aren't tested, and code that doesn't work on another compiler is the result. Randy. ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-30 19:21 ` Randy Brukardt @ 2003-05-31 11:50 ` Gautier Write-only 2003-05-31 14:24 ` Bill Findlay ` (2 more replies) 0 siblings, 3 replies; 33+ messages in thread From: Gautier Write-only @ 2003-05-31 11:50 UTC (permalink / raw) > Roman V. Isaev: > >p2ada also breaks on things like this: bih:=1.e-5; Randy Brukardt wrote: > So does Pastran. That's not surprising, that is not legal Pascal > according to the Pascal standard. P2Ada breaks (see test explained in the reply) only because the lexer is unable to see "1..2" as "1" (constant), ".." (double_dot), "2" but sees "1." and ".2"... If a translator from Pascal was expected to only recognize standard Pascal, it would be completely useless. No chance of going beyond a few lines of "usual" Pascal. > Of course, a particular compiler might allow it anyway. That's one > difference between Ada and nearly every other programming language: Ada > compilers are tested for conformance. An Ada compiler that tried to > allow 1.e-5 would fail to pass the conformity tests and would be fixed. > Other languages aren't tested, and code that doesn't work on another > compiler is the result. ... and Pascal is a remarkable example (if not the worst) of fragmentation into incompatible dialects - we can forgive it since the language was designed for teaching programmation. And this is exaclty why a Pascal->Ada translator is useful ;-)! And, of course, a translator must understand the most possible dialects. It should translate "bih:=1.e-5;" into "bih:=1.0e-5;" and go on, instead of stopping. ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site! ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-31 11:50 ` Gautier Write-only @ 2003-05-31 14:24 ` Bill Findlay 2003-06-01 3:42 ` Randy Brukardt 2003-06-02 11:02 ` Georg Bauhaus 2 siblings, 0 replies; 33+ messages in thread From: Bill Findlay @ 2003-05-31 14:24 UTC (permalink / raw) On 31/5/03 12:50, in article 3ED896EC.CF303D93@somewhere.nil, "Gautier Write-only" <gautier@somewhere.nil> wrote: ... > If a translator from Pascal was expected to only recognize standard > Pascal, it would be completely useless. No chance of going beyond a few > lines of "usual" Pascal. Unfortunately true. >> Of course, a particular compiler might allow it anyway. That's one >> difference between Ada and nearly every other programming language: Ada >> compilers are tested for conformance. ... > > ... and Pascal is a remarkable example (if not the worst) of > fragmentation into incompatible dialects - we can forgive it since > the language was designed for teaching programmation. Well, Pascal was actually one of the first languages to have a vendor-independent standard-conformance validation test-suite and process (implemented by the British Standards Institution, which sponsored the development of the British, later ANSI and ISO, standard). Unfortunately, some vendors (curses be upon them) chose to ignore the established Zurich and (later) institutional standards in favour of customer lock-in through proprietary extensions. The fragmentation had little to do with teaching, and in fact was detrimental to teaching, because it fragmented the text-book market as well. -- Bill-Findlay chez blue-yonder.co.uk ("-" => "") ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-31 11:50 ` Gautier Write-only 2003-05-31 14:24 ` Bill Findlay @ 2003-06-01 3:42 ` Randy Brukardt 2003-06-02 11:02 ` Georg Bauhaus 2 siblings, 0 replies; 33+ messages in thread From: Randy Brukardt @ 2003-06-01 3:42 UTC (permalink / raw) Gautier Write-only wrote in message <3ED896EC.CF303D93@somewhere.nil>... >> Of course, a particular compiler might allow it anyway. That's one >> difference between Ada and nearly every other programming language: Ada >> compilers are tested for conformance. An Ada compiler that tried to >> allow 1.e-5 would fail to pass the conformity tests and would be fixed. >> Other languages aren't tested, and code that doesn't work on another >> compiler is the result. > >... and Pascal is a remarkable example (if not the worst) of >fragmentation into incompatible dialects - we can forgive it since >the language was designed for teaching programmation. >And this is exaclty why a Pascal->Ada translator is useful ;-)! >And, of course, a translator must understand the most possible >dialects. It should translate "bih:=1.e-5;" into "bih:=1.0e-5;" >and go on, instead of stopping. A worthy goal, but practically impossible. The different dialects of Pascal aren't even lexically or syntactically compatible (as you found out trying to make this change). We decided that the only practical thing to do was to make a semi-custom version for each customer (particularly as it is the wildly varying separate compilation features of the different Pascal's that matter the most). Randy. ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-31 11:50 ` Gautier Write-only 2003-05-31 14:24 ` Bill Findlay 2003-06-01 3:42 ` Randy Brukardt @ 2003-06-02 11:02 ` Georg Bauhaus 2003-06-02 20:25 ` Gautier Write-only 2 siblings, 1 reply; 33+ messages in thread From: Georg Bauhaus @ 2003-06-02 11:02 UTC (permalink / raw) Gautier Write-only <gautier@somewhere.nil> wrote: : : ... and Pascal is a remarkable example (if not the worst) of : fragmentation into incompatible dialects - we can forgive it since : the language was designed for teaching programmation. : And this is exaclty why a Pascal->Ada translator is useful ;-)! : And, of course, a translator must understand the most possible : dialects. It should translate "bih:=1.e-5;" into "bih:=1.0e-5;" : and go on, instead of stopping. Does it warn Pascal authors when they use non-standard constructs? (Assuming there are people who carelessly write Pascal and then translate to Ada, because they have to deliver Ada.) It might bring some of Ada's "standard advantages" to their attention. -- Georg ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-06-02 11:02 ` Georg Bauhaus @ 2003-06-02 20:25 ` Gautier Write-only 0 siblings, 0 replies; 33+ messages in thread From: Gautier Write-only @ 2003-06-02 20:25 UTC (permalink / raw) [About a Pascal to Ada translator] # Does it warn Pascal authors when they use non-standard # constructs? (Assuming there are people who carelessly write Pascal and # then translate to Ada, because they have to deliver Ada.) # It might bring some of Ada's "standard advantages" to their # attention. It could be an idea - count the non-standard constructs in the Pascal source and give the total as well as the total/lines ratio after translation. Of course one should not "punish" people for being "careless", since the compilers accept non-standard constructs, partly for commerical lock-in purposes and partly because they *have* to extend the language. ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site! ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-29 17:29 ` Roman V. Isaev 2003-05-29 18:56 ` Gautier Write-only 2003-05-29 23:19 ` Gautier Write-only @ 2003-05-30 8:48 ` Preben Randhol 2 siblings, 0 replies; 33+ messages in thread From: Preben Randhol @ 2003-05-30 8:48 UTC (permalink / raw) Roman V. Isaev wrote: > > The main question is not the translation itself which is possible. > It may pose problems too as these 3000+ lines of "pascal" contain mostly this: > > IF KK=2 THEN GOTO 179; > GOTO 178; > 179: YRR:=YR21; > YZR:=ABS((1.0+Y2)/Y12-2.0*XY*(XY-Z)-4.0/3.0* > (Y1+Y2)/Y12*Z+(2.0*XY-Z)*(2.0*XY-Z)*(2.0*XY-Z)/3.0*Z*Y1/(1.0+Y)); > IF YZR>1.E-18 THEN GOTO 190; > YZR:=1.E-18; > 190: YR21:=TAU0*DG*FG/ETA/Q-8.0*Z/YZR; Oh, Fortran in Pascal :-) -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 22:46 ` Roman V. Isaev 2003-05-27 4:35 ` Gautier Write-only @ 2003-05-27 10:31 ` Preben Randhol 2003-05-29 20:30 ` Roman V. Isaev 1 sibling, 1 reply; 33+ messages in thread From: Preben Randhol @ 2003-05-27 10:31 UTC (permalink / raw) Roman V. Isaev wrote: > I would not touch Gtk stuff with a ten-foot pole. Gtk on WinXX performance > is a joke and even Gtk on X11 performance is lousy (I always compile freeciv > with Xaw3D because of that despite of Xaw3D interface strangeness). Seeing > simple windows redraw themselves in times of common 1Ghz+ computers is Not > Right. Huh? I use Gtk on my old 166Mhz and I don't these problems, not even on faster computers (1GHz). But I think you are refering to the lack of double buffering in the Gtk 1.2. As I understand this is fixed in 2.2. However I have not experienced this. Please explain a bit more which programs you see this and what happens. Freeciv works nice with Gtk on both my old machine and the faster onces as far as I can see. But Gtk is not for action games if that is what you mean. At any rate you can have a look at how they did it with the gettext :-) > Anyway, this isn't the main reason. The main reason is to learn > some Ada, I have to start somewhere and I'll need translation code > anyway. Recently I dug out some old father's Pascal code that does > some scientific calculations. It needs user interface and cleanup. > Don't want to use Delphi. Many years ago I did an interface for it, > using Clarion 2.1 for DOS, but program wasn't released :) Now I > want to use AWS (I'm playing with it right now and it's amazing) so > the interface would be accessible via TCP/IP and the program would > be extremely portable (to run it on the openbsd server in demo > mode). Scientific code produces lengthy text output, right now > only cyrillic, and that output has to be translated somehow. I want > to use gettext .mo files because I like poEdit and I want to give > it to my father to translate most of his messages (I don't know a > damn in oil field science). Didn't try to run xgettext on ada Oh, interesting. What was the program used for? > sources yet tho... but I hope string extraction is not a big > problem. You could also consider making a binding to the gettext. -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-27 10:31 ` Preben Randhol @ 2003-05-29 20:30 ` Roman V. Isaev 2003-05-30 9:01 ` Preben Randhol 0 siblings, 1 reply; 33+ messages in thread From: Roman V. Isaev @ 2003-05-29 20:30 UTC (permalink / raw) > > I would not touch Gtk stuff with a ten-foot pole. Gtk on WinXX performance > > is a joke and even Gtk on X11 performance is lousy (I always compile freeciv > > with Xaw3D because of that despite of Xaw3D interface strangeness). Seeing > > simple windows redraw themselves in times of common 1Ghz+ computers is Not > > Right. > Huh? I use Gtk on my old 166Mhz and I don't these problems, not even on > faster computers (1GHz). But I think you are refering to the lack of > double buffering in the Gtk 1.2. As I understand this is fixed in 2.2. > However I have not experienced this. Please explain a bit more which > programs you see this and what happens. Just start GVD on WinXX and go to preferences. Every tab is so jerky, they redraw themselves several times and it's quite visible. Most funny are Source and Data tabs, when you click them widgets run around like cockroaches before settling on their places. May be it's fixed in 2.2 but all I see is only 1.3 for win available for download. I'm not that brave to venture into compiling 2.0 on windoze and I see no 2.2 at all there at http://libre.act-europe.fr/GtkAda/ :) Sluggish Gtk behaviour makes applications look sloppy and low-quality. > Freeciv works nice with Gtk on both my old machine and the faster onces > as far as I can see. But Gtk is not for action games if that is what you > mean. Freeciv isn't an action game. I see it as normal program with GUI. I mean only interface speed and snappiness (damn, don't know how to say). Gtk feels very laggy, no matter c++ or ada was used. > At any rate you can have a look at how they did it with the gettext :-) They didn't. If you want to use gettext you have to haul its dll on winXX and use -lintl on unix. They simply made binding for C gettext library (and no ada parser so far). I wrote tiny library that loads .mo files and translates text using table from that file as I played with Ada: package TinyGetText is procedure LoadMoFile(filename: string); function GetText (E : String) return String; function "-" (E : String) return String; -- alias for GetText end TinyGetText; Using it: LoadMoFile("make.mo"); Put(-"write jobserver"); New_Line; If anyone interested I can publish it (although code is crappy by any standard and doesn't handle errors well, it's my first experience with ada dammit). I don't like its dependency on charles library, gettext package should come alone (unless ada gets something like perl CPAN interface and autodownload of dependent libraries) or depend only on standard library (not GNAT specific). .mo files alredy come with precomputed hash, but I don't know Ada well enough to make this package work with hash yet :) > > Anyway, this isn't the main reason. The main reason is to learn > > some Ada, I have to start somewhere and I'll need translation code > > anyway. Recently I dug out some old father's Pascal code that does > > some scientific calculations. It needs user interface and cleanup. > > Don't want to use Delphi. Many years ago I did an interface for it, > > using Clarion 2.1 for DOS, but program wasn't released :) Now I > > want to use AWS (I'm playing with it right now and it's amazing) so > > the interface would be accessible via TCP/IP and the program would > > be extremely portable (to run it on the openbsd server in demo > > mode). Scientific code produces lengthy text output, right now > > only cyrillic, and that output has to be translated somehow. I want > > to use gettext .mo files because I like poEdit and I want to give > > it to my father to translate most of his messages (I don't know a > > damn in oil field science). Didn't try to run xgettext on ada > Oh, interesting. What was the program used for? Calculating oil well characteristics given certain pump, pipes, fluid type and other 70+ parameters... but I'm afraid it might be faster to take all math and write anew than wade through fortran-like code, and I won't have enough spare time for either endeavour. ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-29 20:30 ` Roman V. Isaev @ 2003-05-30 9:01 ` Preben Randhol 2003-05-30 22:02 ` Roman V. Isaev 0 siblings, 1 reply; 33+ messages in thread From: Preben Randhol @ 2003-05-30 9:01 UTC (permalink / raw) Roman V. Isaev wrote: > Just start GVD on WinXX and go to preferences. Every tab is so > jerky, they redraw themselves several times and it's quite visible. > Most funny are Source and Data tabs, when you click them widgets > run around like cockroaches before settling on their places. May be > it's fixed in 2.2 but all I see is only 1.3 for win available for > download. I'm not that brave to venture into compiling 2.0 on windoze > and I see no 2.2 at all there at http://libre.act-europe.fr/GtkAda/ :) > Sluggish Gtk behaviour makes applications look sloppy and low-quality. OK I think then perhaps it is an issue with the windows port of Gtk, because I don't see this in any of the following programs: gvd, gimp, galeon, gtop, gedit, glimmer, civclient-gtk, gnumeric, abiword, rox, gvim, glosa etc... on Linux. All use GTK+. > They didn't. If you want to use gettext you have to haul > its dll on winXX and use -lintl on unix. They simply made binding > for C gettext library (and no ada parser so far). That's why I said you could look at making a binding. > I wrote tiny library that loads .mo files and translates text > using table from that file as I played with Ada: Nice, but your Strings are they expecting UTF-8? > If anyone interested I can publish it (although code is crappy > by any standard and doesn't handle errors well, it's my first > experience with ada dammit). I don't like its dependency on charles > library, gettext package should come alone (unless ada gets > something like perl CPAN interface and autodownload of dependent > libraries) or depend only on standard library (not GNAT > specific). .mo files alredy come with precomputed hash, but > I don't know Ada well enough to make this package work with > hash yet :) Why not depend on charles? We need sooner or later to *pick* one container library so I don't she why charles should be it. When I have time I plan to look at it in order to use it in my applications. > Calculating oil well characteristics given certain pump, pipes, > fluid type and other 70+ parameters... but I'm afraid it might > be faster to take all math and write anew than wade through > fortran-like code, and I won't have enough spare time for either > endeavour. But the calculations are still applicable? -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-30 9:01 ` Preben Randhol @ 2003-05-30 22:02 ` Roman V. Isaev 2003-05-31 13:34 ` Preben Randhol 0 siblings, 1 reply; 33+ messages in thread From: Roman V. Isaev @ 2003-05-30 22:02 UTC (permalink / raw) > > Just start GVD on WinXX and go to preferences. Every tab is so > > jerky, they redraw themselves several times and it's quite visible. > > Most funny are Source and Data tabs, when you click them widgets > > run around like cockroaches before settling on their places. May be > > it's fixed in 2.2 but all I see is only 1.3 for win available for > > download. I'm not that brave to venture into compiling 2.0 on windoze > > and I see no 2.2 at all there at http://libre.act-europe.fr/GtkAda/ :) > > Sluggish Gtk behaviour makes applications look sloppy and low-quality. > OK I think then perhaps it is an issue with the windows port of Gtk, > because I don't see this in any of the following programs: gvd, gimp, > galeon, gtop, gedit, glimmer, civclient-gtk, gnumeric, abiword, rox, > gvim, glosa etc... on Linux. All use GTK+. Windows Gtk is horrible. But unix version feels laggy too, especially compared with programs written with Athena, wxWindows and even qt. *sigh* I think we need a benchmark that measures time between action (i.e. button click or menu item select) and new window settling down, i.e. no more changes to that window. Then benchmark every toolkit creating new window from scratch with say 50 widgets and see who's faster and by what margin... > > They didn't. If you want to use gettext you have to haul > > its dll on winXX and use -lintl on unix. They simply made binding > > for C gettext library (and no ada parser so far). > That's why I said you could look at making a binding. Yep, but what's the point of using Ada linking lots of C libraries, may be it's easier to use C everywhere just to be uniform? :) > > I wrote tiny library that loads .mo files and translates text > > using table from that file as I played with Ada: > Nice, but your Strings are they expecting UTF-8? .mo format has no indication wheter it UTF-8 or no. Just a translation table for byte sequences. .po editors don't know about UTF-8 either, at least poEdit by Vaclav Slavik doesn't, another editor in X11 (on freebsd if i remember correctly) did not too. If UTF-8 strings are kept in the same String type as usual strings then it's not a problem. If UTF-8 strings are kept in special string type than I have to know how to convert that type into character sequence... > > If anyone interested I can publish it (although code is crappy > > by any standard and doesn't handle errors well, it's my first > > experience with ada dammit). I don't like its dependency on charles > > library, gettext package should come alone (unless ada gets > > something like perl CPAN interface and autodownload of dependent > > libraries) or depend only on standard library (not GNAT > > specific). .mo files alredy come with precomputed hash, but > > I don't know Ada well enough to make this package work with > > hash yet :) > Why not depend on charles? We need sooner or later to *pick* one > container library so I don't she why charles should be it. When I have > time I plan to look at it in order to use it in my applications. Because it's really annoying when you start using some library and it requires another one, you go search for it the net only to find it discontinued... and you are lucky if that old version is still available somewhere (i.e. you use want to some library and it depends on gd, but you find that gd author dropped gif support several years ago, his site says basically "get lost if you want gif support" and this library have to work with gifs). > > Calculating oil well characteristics given certain pump, pipes, > > fluid type and other 70+ parameters... but I'm afraid it might > > be faster to take all math and write anew than wade through > > fortran-like code, and I won't have enough spare time for either > > endeavour. > But the calculations are still applicable? Yes. I translated these sources with the help of p2ada and obscene language. Had to change some variable types and many procedure arguments were used in calculations (not allowed in Ada, only if argument is marked as "out"). It works (delphi recompiled version works too). Probably turbo5 binary was throwing errors around because its runtime doesn't like XP "dos"). But as I said it's a question of maintainig this code and I can't do that because I don't know math that well and my father won't learn another language (he did not really learn pascal anyway) :) Found bugs in AdaGIDE while fiddling. It garbles cyrillic (windows-1251 encoding) text inside the selection when you press "comment" button and garbles cyrillic randomly when you simply work with file -- change, compile, change, compile, everything looks fine until suddenly you find some strings garbled and file overwritten :( ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-30 22:02 ` Roman V. Isaev @ 2003-05-31 13:34 ` Preben Randhol 0 siblings, 0 replies; 33+ messages in thread From: Preben Randhol @ 2003-05-31 13:34 UTC (permalink / raw) Roman V. Isaev wrote: > Windows Gtk is horrible. But unix version feels laggy too, especially > compared with programs written with Athena, wxWindows and even qt. Huh? wxWindows and qt are sluggish compared to Gtk. By the way what distribution do you use? > .mo format has no indication wheter it UTF-8 or no. Just a translation > table for byte sequences. .po editors don't know about UTF-8 either, at > least poEdit by Vaclav Slavik doesn't, another editor in X11 (on freebsd > if i remember correctly) did not too. If UTF-8 strings are kept in the same > String type as usual strings then it's not a problem. If UTF-8 strings are > kept in special string type than I have to know how to convert that type > into character sequence... Point is that UTF-8 will be more or less standard in most applications soon. Gtk+ 2.x uses it as a default and expect UTF-8 valid strings. > Because it's really annoying when you start using some library and it > requires another one, you go search for it the net only to find > it discontinued... and you are lucky if that old version is still > available somewhere (i.e. you use want to some library and it depends > on gd, but you find that gd author dropped gif support several years ago, > his site says basically "get lost if you want gif support" and this > library have to work with gifs). So in stead on should reinvent the wheel for every project? Charles is GMGPL so if it is discontinued it is just to pick it up and continue the development. I cannot start making my own binding to Gtk+, because I might fear that it will stop being developed. > But as I said it's a question of maintainig this code and I can't do that > because I don't know math that well and my father won't learn another > language (he did not really learn pascal anyway) :) Perhaps better to get the maths written down into a paper? -- Preben Randhol http://www.pvv.org/~randhol/ ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 16:44 ` Roman V. Isaev ` (2 preceding siblings ...) 2003-05-26 17:20 ` Preben Randhol @ 2003-05-27 18:27 ` Stephen Leake 3 siblings, 0 replies; 33+ messages in thread From: Stephen Leake @ 2003-05-27 18:27 UTC (permalink / raw) rm@gunlab.com.ru (Roman V. Isaev) writes: > I wonder is there any package easier to use? Try SAL: http://www.toadmail.com/~ada_wizard/ada/sal.html (yes, I checked the link this time). See the file Source_Common/Test/test_poly_binary_trees_sorted_aux.ads for an example of a sorted binary tree with string keys. "Easy" is mostly a matter of good examples. I hope this works for you. > I only want two functions, something like store(key,value) and > lookup(key), that's all, without 20+ string declaration voodoo... > Grrrrr. I miss perl's associative arrays. Well, Ada is more powerful and more flexible, and therefore packages are harder to learn. But more productive once you do. -- -- Stephe ^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: using charles library 2003-05-26 13:27 using charles library Roman V. Isaev 2003-05-26 13:40 ` Preben Randhol @ 2003-05-27 20:24 ` Matthew Heaney 1 sibling, 0 replies; 33+ messages in thread From: Matthew Heaney @ 2003-05-27 20:24 UTC (permalink / raw) rm@gunlab.com.ru (Roman V. Isaev) wrote in message news:<d3ba4d4c.0305260527.52e7ee57@posting.google.com>... > I'm learning the ropes, so it might be stupid question but I tried > use charles.maps.sorted.strings.unbounded (used sample code by > mheaney@on2.com from this newsgroup archive): > > with Charles.Maps.Sorted.Strings.Unbounded; > with Charles.Strings.Unbounded; use Charles.Strings.Unbounded; > > package body gettext is > > package Translation_Tables is > new Charles.Maps.Sorted.Strings.Unbounded > (Element_Type => Charles.Strings.Unbounded.Container_Type); > > TT : Translation_Tables.Container_Type; > > ........ > > procedure load_mo_file is > > ........ > > Insert(TT, "key", Element => To_Container("value")); > > > When I try to compile I get following error: The parameter name is incorrect (as was already pointed out), but you also need a use clause: TT : Translation_Tables.Container_Type; use Translation_Tables; ... Insert (TT, "key", To_Container ("value")); If you're manipulating string containers (Charles.Strings.Unbounded, etc), then it may be easier to define a conversion operator: function "+" (S : String) return Charles.Strings.Unbounded.Container_Type renames To_Container; This allows you to say: Insert (TT, "key", +"value"); In C++, the string ctor allows type conversions be made silently (i.e. there is no syntactic penalty), but Ada requires type conversions to be explicit. ^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2003-06-02 20:25 UTC | newest] Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-05-26 13:27 using charles library Roman V. Isaev 2003-05-26 13:40 ` Preben Randhol 2003-05-26 16:44 ` Roman V. Isaev 2003-05-26 17:05 ` Preben Randhol 2003-05-26 17:10 ` Preben Randhol 2003-05-26 22:05 ` Roman V. Isaev 2003-05-26 17:16 ` Jeffrey Carter 2003-05-27 15:05 ` Matthew Heaney 2003-05-27 18:28 ` Stephen Leake 2003-05-26 17:20 ` Preben Randhol 2003-05-26 22:46 ` Roman V. Isaev 2003-05-27 4:35 ` Gautier Write-only 2003-05-29 17:29 ` Roman V. Isaev 2003-05-29 18:56 ` Gautier Write-only 2003-05-29 23:19 ` Gautier Write-only 2003-05-30 7:56 ` Roman V. Isaev 2003-05-30 13:49 ` Gautier 2003-05-30 14:36 ` Robert C. Leif 2003-05-30 17:32 ` Preben Randhol 2003-05-30 19:21 ` Randy Brukardt 2003-05-31 11:50 ` Gautier Write-only 2003-05-31 14:24 ` Bill Findlay 2003-06-01 3:42 ` Randy Brukardt 2003-06-02 11:02 ` Georg Bauhaus 2003-06-02 20:25 ` Gautier Write-only 2003-05-30 8:48 ` Preben Randhol 2003-05-27 10:31 ` Preben Randhol 2003-05-29 20:30 ` Roman V. Isaev 2003-05-30 9:01 ` Preben Randhol 2003-05-30 22:02 ` Roman V. Isaev 2003-05-31 13:34 ` Preben Randhol 2003-05-27 18:27 ` Stephen Leake 2003-05-27 20:24 ` Matthew Heaney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox