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 15:47 ` M. A. Alves
  2002-01-10 13:00 ` Charles Fr. Rey
  1 sibling, 0 replies; 7+ 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] 7+ 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; 7+ 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] 7+ 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 ` Problème avec des get(fichier, integer) M. A. Alves
@ 2002-01-03 21:11 ` Steven Deller
  1 sibling, 0 replies; 7+ 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] 7+ 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; 7+ 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] 7+ 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
  0 siblings, 0 replies; 7+ 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] 7+ messages in thread

* Re: Problème avec des get(fichier, integer)
       [not found] <a0vili$oga$1@wanadoo.fr>
  2002-01-03 15:47 ` M. A. Alves
@ 2002-01-10 13:00 ` Charles Fr. Rey
  2002-01-11  1:55   ` Jeffrey Carter
  1 sibling, 1 reply; 7+ 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] 7+ messages in thread

* Re: Problème avec des get(fichier, integer)
  2002-01-10 13:00 ` Charles Fr. Rey
@ 2002-01-11  1:55   ` Jeffrey Carter
  0 siblings, 0 replies; 7+ 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] 7+ messages in thread

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

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

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