comp.lang.ada
 help / color / mirror / Atom feed
* Re: Probl�me avec des get(fichier, integer)
       [not found] <a0vili$oga$1@wanadoo.fr>
@ 2002-01-03  0:25 ` Nick Roberts
  2002-01-03  1:50   ` Matthew Graybosch
  2002-01-07  9:43   ` Jean-Pierre Rosen
  2002-01-03 15:47 ` Problème " M. A. Alves
  2002-01-10 13:00 ` Problème " Charles Fr. Rey
  2 siblings, 2 replies; 13+ messages in thread
From: Nick Roberts @ 2002-01-03  0:25 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

Le caract�re ':' fait partie de la syntaxe des coquilles de nombre d'Ada
(c'est une alternative pour '#', utilis�e pour des num�ros base).

Le choix pour vous est entre:  (a) emploient un caract�re diff�rent de ':';
(b) (meilleur) transf�rent la ligne enti�re dans une corde (de String, de
Bounded_String, ou d'Unbounded_String de type peut-�tre), coupant cette
corde en ses sous-cha�nes, selon les d�limiteurs, et puis convertissant
chaque sous-cha�ne en nombre.

Alors, j'esp�re que ceci aide. (J'esp�re que vous pouvez le comprendre!)

--
Les meilleurs voeux,
Nick Roberts






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

* Re: Probl�me avec des get(fichier, integer)
  2002-01-03  0:25 ` Probl�me avec des get(fichier, integer) Nick Roberts
@ 2002-01-03  1:50   ` Matthew Graybosch
  2002-01-07  9:43   ` Jean-Pierre Rosen
  1 sibling, 0 replies; 13+ messages in thread
From: Matthew Graybosch @ 2002-01-03  1:50 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1400 bytes --]

On Thu, 3 Jan 2002 00:25:23 -0000
"Nick Roberts" <nickroberts@adaos.worldonline.co.uk> wrote:

> Le caract�re ':' fait partie de la syntaxe des coquilles de nombre d'Ada
> (c'est une alternative pour '#', utilis�e pour des num�ros base).
> 
> Le choix pour vous est entre:  (a) emploient un caract�re diff�rent de
> ':';(b) (meilleur) transf�rent la ligne enti�re dans une corde (de String,
> de Bounded_String, ou d'Unbounded_String de type peut-�tre), coupant cette
> corde en ses sous-cha�nes, selon les d�limiteurs, et puis convertissant
> chaque sous-cha�ne en nombre.
> 
> Alors, j'esp�re que ceci aide. (J'esp�re que vous pouvez le comprendre!)

I ran Nick's post through Babelfish in case I'm not the only one who is less
than fluent in French:

Character ': ' fact part of the syntax of the shells of a number of Ada (it
is an alternative for ' # ', used for numbers bases). The choice for you is
between: (A) employ a character different from ': '; (b) (better) transfers
the whole line in a cord (of String, Bounded_String, or Unbounded_String of
the type perhaps), cutting this cord in its under-chains, according to
delimitors', and then converting each under-chain into a number. Then, I
hope that this helps. (I hope that you can include/understand it!)


-- 
Matthew Graybosch
http://www.starbreaker.net
GnuPG Key ID: 0x45BC4581
"Sex, Unix, and rock 'n roll"

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

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

* Re: Problème avec des get(fichier, integer)
       [not found] <a0vili$oga$1@wanadoo.fr>
  2002-01-03  0:25 ` Probl�me avec des get(fichier, integer) Nick Roberts
@ 2002-01-03 15:47 ` M. A. Alves
  2002-01-03 17:56   ` Probl�me " Nick Roberts
  2002-01-10 13:00 ` Problème " Charles Fr. Rey
  2 siblings, 1 reply; 13+ messages in thread
From: M. A. Alves @ 2002-01-03 15:47 UTC (permalink / raw)
  To: comp.lang.ada

On Wed, 2 Jan 2002, Benoit F wrote:
> I've the line "1/12/01:12" in a file, This line is a french date
> (day/month/year) with an hour
>
> I've got the following type date :
>    subtype tjours is positive range 1..31;
>    subtype tmois is positive range 1..12;
>    subtype tans  is positive range 1..99;
>
>   type TDate is record
>       J:tjours;
>       M:tmois;
>       A:tans;
>    end record;
>
> I wrote this procedure
>
>    procedure Get (F: in File_Type; D: out TDate) is
>    -- Entree d'une date a partir du fichier
>       Slash : Character;
>    begin
>       Get (F,D.J);
>       Get (F,Slash);
>       Get (F,D.M);
>       Get (F,Slash);
>       Get (F,D.A); <= here raise DATA_ERROR
>    end;
>
> The error is because of the ':' charcater whose folow the date. If I replace
> the ':' by an other character, the procedure work !

Seems like a GNAT bug to me.

> If sombody know the solution to make work my procedure !

The obvious workaround is to clean the line e.g. read the line to a string
S and make the Get from the slice S(1 .. N) where N is the position of the
':'.

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugal    mob 351+939354002





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

* Re: Problème avec des get(fichier, integer)
       [not found] <Pine.LNX.4.33.0201031536550.26565-100000@lagoa.niaad.liacc.up.pt>
@ 2002-01-03 16:43 ` M. A. Alves
  2002-01-03 21:11 ` Steven Deller
  1 sibling, 0 replies; 13+ messages in thread
From: M. A. Alves @ 2002-01-03 16:43 UTC (permalink / raw)
  To: comp.lang.ada

I wrote:
> The obvious workaround is to clean the line e.g. read the line to a string
> S and make the Get from the slice S(1 .. N) where N is the position
> of the ':'.

Erratum: where ".. N" replace by ".. N - 1".

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugal    mob 351+939354002





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

* Re: Probl�me avec des get(fichier, integer)
  2002-01-03 15:47 ` Problème " M. A. Alves
@ 2002-01-03 17:56   ` Nick Roberts
  2002-01-04 11:46     ` Problème " M. A. Alves
  2002-01-10 15:15     ` Probl�me " Robert A Duff
  0 siblings, 2 replies; 13+ messages in thread
From: Nick Roberts @ 2002-01-03 17:56 UTC (permalink / raw)


"M. A. Alves" <maa@liacc.up.pt> wrote in message
news:mailman.1010072881.27934.comp.lang.ada@ada.eu.org...

> ...
> Seems like a GNAT bug to me.

It's not a GNAT bug! Poor GNAT seems to get wrongly accused too often.

In a dark corner of the reference manual - RM95 J.2 (3) - you will see that
the '#' hashes in a based numeric literal are permitted to be replaced by
':' colons. (This is an obsolescent feature, and so may be removed by a
future revision.)

Thus, standard Ada.Integer_Text_IO.Get interprets a ':' character as part of
the numeric literal (and if it gets to the end of the line before finding
the next one, raises Ada.IO_Exceptions.Data_Error).

So GNAT behaves absolutely pukka here.

--
Nick Roberts






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

* RE: Problème avec des get(fichier, integer)
       [not found] <Pine.LNX.4.33.0201031536550.26565-100000@lagoa.niaad.liacc.up.pt>
  2002-01-03 16:43 ` M. A. Alves
@ 2002-01-03 21:11 ` Steven Deller
  1 sibling, 0 replies; 13+ messages in thread
From: Steven Deller @ 2002-01-03 21:11 UTC (permalink / raw)
  To: comp.lang.ada

> -----Original Message-----
> From: comp.lang.ada-admin@ada.eu.org 
> [mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of M. A. Alves
> Sent: Thursday, January 03, 2002 10:48 AM
> To: comp.lang.ada@ada.eu.org
> Subject: Re: Problème avec des get(fichier, integer)
...
> Seems like a GNAT bug to me.

Nope.  It is correct Ada (83 *or* 95).

RTFM carefully :-).

Regards,
Steve Deller




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

* RE: Problème avec des get(fichier, integer)
       [not found] <006801c1949b$39e20500$0301a8c6@STEVEN>
@ 2002-01-04 11:40 ` M. A. Alves
  0 siblings, 0 replies; 13+ messages in thread
From: M. A. Alves @ 2002-01-04 11:40 UTC (permalink / raw)
  To: comp.lang.ada

> > Seems like a GNAT bug to me.
>
> Nope.  It is correct Ada (83 *or* 95).
>
> RTFM carefully :-).

I did reread A.10.8 and did not find anything _clearly_
distinguishing the effect of ':' vs. '/'.

What is it?  And where in the ARM?

Thanks in advance for your tutoring,

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugal    mob 351+939354002





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

* Re: Problème avec des get(fichier, integer)
  2002-01-03 17:56   ` Probl�me " Nick Roberts
@ 2002-01-04 11:46     ` M. A. Alves
  2002-01-10 15:15     ` Probl�me " Robert A Duff
  1 sibling, 0 replies; 13+ messages in thread
From: M. A. Alves @ 2002-01-04 11:46 UTC (permalink / raw)
  To: comp.lang.ada

On Thu, 3 Jan 2002, Nick Roberts wrote:

> "M. A. Alves" <maa@liacc.up.pt> wrote in message
> news:mailman.1010072881.27934.comp.lang.ada@ada.eu.org...
>
> > ...
> > Seems like a GNAT bug to me.
>
> It's not a GNAT bug! Poor GNAT seems to get wrongly accused too often.

I stand corrected.

> In a dark corner of the reference manual . . . [':' = '#']

Yes, "dark", as in "not clear" (cf. my previous message).

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugal    mob 351+939354002





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

* Re: Probl�me avec des get(fichier, integer)
  2002-01-03  0:25 ` Probl�me avec des get(fichier, integer) Nick Roberts
  2002-01-03  1:50   ` Matthew Graybosch
@ 2002-01-07  9:43   ` Jean-Pierre Rosen
  1 sibling, 0 replies; 13+ messages in thread
From: Jean-Pierre Rosen @ 2002-01-07  9:43 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 918 bytes --]


"Nick Roberts" <nickroberts@adaos.worldonline.co.uk> a �crit dans le message news: a108h2$nfen7$1@ID-25716.news.dfncis.de...
> Le caract�re ':' fait partie de la syntaxe des coquilles de nombre d'Ada
> (c'est une alternative pour '#', utilis�e pour des num�ros base).
>
> Le choix pour vous est entre:  (a) emploient un caract�re diff�rent de ':';
> (b) (meilleur) transf�rent la ligne enti�re dans une corde (de String, de
> Bounded_String, ou d'Unbounded_String de type peut-�tre), coupant cette
> corde en ses sous-cha�nes, selon les d�limiteurs, et puis convertissant
> chaque sous-cha�ne en nombre.
>
Ou plus simplement:
      Get (F,D.A, width =>2); <= plantage ici DATA_ERROR
Ce qui force la lecture sur 2 caract�res (exactement)

--
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





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

* Re: Problème avec des get(fichier, integer)
       [not found] <a0vili$oga$1@wanadoo.fr>
  2002-01-03  0:25 ` Probl�me avec des get(fichier, integer) Nick Roberts
  2002-01-03 15:47 ` Problème " M. A. Alves
@ 2002-01-10 13:00 ` Charles Fr. Rey
  2002-01-11  1:55   ` Jeffrey Carter
  2 siblings, 1 reply; 13+ messages in thread
From: Charles Fr. Rey @ 2002-01-10 13:00 UTC (permalink / raw)


In my opinion you'd better use the predefined date & time types ...

Y'a plein de fonctions et de types déjà prédéfinis et comme ça tu
utilises un format de date "standard". Tout dépends évidemment de
l'utilisation de ton programme, mais si le format de date n'est pas
imposé, t'as meilleur temps d'utiliser le format prédéfini.

Benoit F wrote:
> 
> I'm Fench so spry for my bad english. En français plus bas !
> I've the line "1/12/01:12" in a file, This line is a french date
> (day/month/year) with an hour
> 
> I've got the following type date :
>    subtype tjours is positive range 1..31;
>    subtype tmois is positive range 1..12;
>    subtype tans  is positive range 1..99;
> 
>   type TDate is record
>       J:tjours;
>       M:tmois;
>       A:tans;
>    end record;
> 
> I wrote this procedure
> 
>    procedure Get (F: in File_Type; D: out TDate) is
>    -- Entree d'une date a partir du fichier
>       Slash : Character;
>    begin
>       Get (F,D.J);
>       Get (F,Slash);
>       Get (F,D.M);
>       Get (F,Slash);
>       Get (F,D.A); <= here raise DATA_ERROR
>    end;
> 
> The error is because of the ':' charcater whose folow the date. If I replace
> the ':' by an other character, the procedure work !
> If sombody know the solution to make work my procedure !
> 
> ------------------------------------------------------------
> French traduction
> 
> mon fichier contient sur une ligne : "1/12/01:12"
> Elle correspond à une date suivie d'un nombre d'heure
> 
> j'ai un type date :
> 
>    subtype tjours is positive range 1..31;
>    subtype tmois is positive range 1..12;
>    subtype tans  is positive range 1..99;
> 
>   type TDate is record
>       J:tjours;
>       M:tmois;
>       A:tans;
>    end record;
> 
> j'ai crée la fonction
> 
>    procedure Get (F: in File_Type; D: out TDate) is
>    -- Entree d'une date a partir du fichier
>       Slash : Character;
>    begin
>       Get (F,D.J);
>       Get (F,Slash);
>       Get (F,D.M);
>       Get (F,Slash);
>       Get (F,D.A); <= plantage ici DATA_ERROR
>    end;
> 
> Le plantage est causé par le caractère ':' qui suit la date !
> Si je mais un autre caractère que ':' la procedure marche !
> 
> Si quelqu'un à une idée, je le remercie



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

* Re: Probl�me avec des get(fichier, integer)
  2002-01-03 17:56   ` Probl�me " Nick Roberts
  2002-01-04 11:46     ` Problème " M. A. Alves
@ 2002-01-10 15:15     ` Robert A Duff
  2002-01-10 23:46       ` Nick Roberts
  1 sibling, 1 reply; 13+ messages in thread
From: Robert A Duff @ 2002-01-10 15:15 UTC (permalink / raw)


"Nick Roberts" <nickroberts@adaos.worldonline.co.uk> writes:

> In a dark corner of the reference manual - RM95 J.2 (3) - you will see that
> the '#' hashes in a based numeric literal are permitted to be replaced by
> ':' colons. (This is an obsolescent feature, and so may be removed by a
> future revision.)

I believe obsolescent features will never be removed.

- Bob



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

* Re: Probl�me avec des get(fichier, integer)
  2002-01-10 15:15     ` Probl�me " Robert A Duff
@ 2002-01-10 23:46       ` Nick Roberts
  0 siblings, 0 replies; 13+ messages in thread
From: Nick Roberts @ 2002-01-10 23:46 UTC (permalink / raw)


"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message
news:wccd70ii6du.fsf@shell01.TheWorld.com...

> "Nick Roberts" <nickroberts@adaos.worldonline.co.uk> writes:
>
> > In a dark corner of the reference manual - RM95 J.2 (3) - you will see
that
> > the '#' hashes in a based numeric literal are permitted to be replaced
by
> > ':' colons. (This is an obsolescent feature, and so may be removed by a
> > future revision.)
>
> I believe obsolescent features will never be removed.

I suppose the pressures will tend to be in favour of retention, for most (or
all) obsolescent features, for a while yet. Perhaps come Ada 2050 ;-)

Or will computers be programming us by then? :-) *

--
Best wishes,
Nick Roberts



* suggesting the horrible notion of a "blue scream of death" [shudder]






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

* Re: Problème avec des get(fichier, integer)
  2002-01-10 13:00 ` Problème " Charles Fr. Rey
@ 2002-01-11  1:55   ` Jeffrey Carter
  0 siblings, 0 replies; 13+ messages in thread
From: Jeffrey Carter @ 2002-01-11  1:55 UTC (permalink / raw)


"Charles Fr. Rey" wrote:
> 
> Benoit F wrote:
> >
> > I'm Fench so spry for my bad english. En fran�ais plus bas !
> > I've the line "1/12/01:12" in a file, This line is a french date
> > (day/month/year) with an hour

I haven't seen the original post, so I'll reply to it through Rey's
response.

You probably should read the entire line into a string and then parse
the string. The operations in Ada.Strings.Fixed may be helpful for this.

-- 
Jeff Carter
"I unclog my nose towards you."
Monty Python & the Holy Grail



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

end of thread, other threads:[~2002-01-11  1:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <a0vili$oga$1@wanadoo.fr>
2002-01-03  0:25 ` Probl�me avec des get(fichier, integer) Nick Roberts
2002-01-03  1:50   ` Matthew Graybosch
2002-01-07  9:43   ` Jean-Pierre Rosen
2002-01-03 15:47 ` Problème " M. A. Alves
2002-01-03 17:56   ` Probl�me " Nick Roberts
2002-01-04 11:46     ` Problème " M. A. Alves
2002-01-10 15:15     ` Probl�me " Robert A Duff
2002-01-10 23:46       ` Nick Roberts
2002-01-10 13:00 ` Problème " Charles Fr. Rey
2002-01-11  1:55   ` Jeffrey Carter
     [not found] <Pine.LNX.4.33.0201031536550.26565-100000@lagoa.niaad.liacc.up.pt>
2002-01-03 16:43 ` M. A. Alves
2002-01-03 21:11 ` Steven Deller
     [not found] <006801c1949b$39e20500$0301a8c6@STEVEN>
2002-01-04 11:40 ` M. A. Alves

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