comp.lang.ada
 help / color / mirror / Atom feed
* Problems with records--IMPORTANT
@ 1998-02-01  0:00 Dami�n Company
  1998-02-02  0:00 ` bklungle
  0 siblings, 1 reply; 6+ messages in thread
From: Dami�n Company @ 1998-02-01  0:00 UTC (permalink / raw)



Well I'm new at programmin and I have very little experience. But this
question is important for me as I have to present a practice at school!!!!
What does GNAT mean when "says" that there's a
            >>> invalid prefix in selected component "r"
I adjunt my listings

GNAT 3.10p (970814) Copyright 1992-1997 Free Software Foundation, Inc.
Compiling: llegir_racionals.adb (source file time stamp: 1998-02-01
00:50:20)
     1. package body llegir_racionals is
     2.    procedure get(op:out operacio)is
     3.       c:character;
     4.       i:integer:=1;
     5.    begin
     6.       get(c);
     7.       while c/='=' loop
     8.          op(i):=c;i:=i+1;
     9.       end loop;
    10.    end get;
    11.
    12.    procedure transformar(o:in operacio;r,s:out racional;op:out
character)is
    13.       n,d:integer:=0;i:integer:=1;
    14.       type num_text is array (1..10) of character;
    15.       num:num_text:=(1..10=>' ');
    16.       ord,l:integer:=1;nums:integer range 0..4:=0;
    17.       type taula_conv is array (0..9) of character;
    18.       t:constant taula_conv:="0123456789";j:integer:=0;p,k:integer;
    19.    begin
    20.       while o(i)/='=' loop
    21.          while o(i)/='+' or o(i)/='/' or o(i)/='-' or o(i)/='*' loop
    22.             num(l):=o(i);
    23.             l:=l+1;
    24.          end loop;
    25.          nums:=nums+1;
    26.          ord:=0;p:=1;
    27.          while l>0 loop
    28.             case nums is
    29.                when 1 =>
    30.                   j:=0;
    31.                   while num(l)/=t(j) loop
    32.                      j:=j+1;
    33.                   end loop;
    34.                   k:=0;
    35.                   while k<ord loop
    36.                      p:=p*10;
    37.                   end loop;
    38.                   n:=n+j*1;
    39.                when 3=>
    40.                   j:=0;
    41.                   while num(l)/=t(j) loop
    42.                      j:=j+1;
    43.                   end loop;
    44.                   k:=0;
    45.                   while k<ord loop
    46.                      p:=p*10;
    47.                   end loop;
    48.                   n:=n+j*1;
    49.                when 2=>
    50.                   j:=0;
    51.                   while num(l)/=t(j) loop
    52.                      j:=j+1;
    53.                   end loop;
    54.                   k:=0;
    55.                   while k<ord loop
    56.                      p:=p*10;
    57.                   end loop;
    58.                   d:=d+j*1;
    59.                when 4=>
    60.                   j:=0;
    61.                   while num(l)/=t(j) loop
    62.                      j:=j+1;
    63.                   end loop;
    64.                   k:=0;
    65.                   while k<ord loop
    66.                      p:=p*10;
    67.                   end loop;
    68.                   d:=d+j*1;
    69.                when others=> null;
    70.                end case;
    71.             l:=l-1;
    72.          end loop;
    73.          case nums is
    74.             when 1=>null;
    75.             when 2=>r.n:=n;r.d:=d;op:=o(i);
                            1      2
        >>> invalid prefix in selected component "r"
        >>> invalid prefix in selected component "r"
    76.             when 3=>null;
    77.             when 4=>s.n:=n;s.d:=d;
                            1      2
        >>> invalid prefix in selected component "s"
        >>> invalid prefix in selected component "s"
    78.             when others =>null;
    79.          end case;
    80.          i:=i+1;
    81.       end loop;
    82.    end transformar;
    83. end llegir_racionals;
 83 lines: 4 errors

I defined racional as
 type racional is
      record
         n:integer;
         d:integer;
      end record;


If someone bothers to answer
THANKS






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

end of thread, other threads:[~1998-02-05  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-01  0:00 Problems with records--IMPORTANT Dami�n Company
1998-02-02  0:00 ` bklungle
1998-02-04  0:00   ` Nick Roberts
1998-02-05  0:00     ` bklungle
1998-02-05  0:00     ` Simon Wright
1998-02-05  0:00   ` Casper

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