Menu

#4 Error when alias file is empty

newp2ada
open-fixed
nobody
5
2010-03-28
2010-01-17
Blady
No

Hello, when the alias file is empty then no declaration are recorded so the first declaration index is zero, leading to error:
$ ./p2ada type_1.pas > /dev/null
Aliases loaded from file 'alias.txt'.
P2Ada from 'type_1.pas' to Standard_Output
[DI]: Enter Ident Nr 1, 'Type_1' of kind FUNKT
[DI]: -> level 1
[DI]: Enter Ident Nr 2, 'T1' of kind TIPE
[DI]: Clear_selection
[DI]: Clear_selection
[DI]: Enter Ident Nr 3, 'a' of kind VARBL
[DI]: Enter Ident Nr 4, 'b' of kind VARBL
[DI]: Enter Ident Nr 5, 'c' of kind VARBL
[DI]: Type Ident T1 is given Type # 0
[DI]: Enter Ident Nr 6, 'T2' of kind TIPE
[DI]: Clear_selection
[DI]: Enter Type # 1 of kind ARRAYS
[DI]: Selected 'T1', of Type # 0
[DI]: Clear_selection
[DI]: Selected 'T1', of Type # 0
[DI]: Clear_selection
[DI]: Type # 1 is ARRAY of Type # 0
[DI]: Type Ident T2 is given Type # 1 of kind ARRAYS (anonymous)
raised CONSTRAINT_ERROR : p2ada_definition_info.adb:261 index check failed
if typ_stack(pt).kind = pointer then -- a pointer type
-> pt is zero !!
and if I make the following (maybe bad workaround) : if pt /= 0 and then typ_stack(pt).kind = pointer then -- a pointer type
then I get others errors when reading .def file
raised CONSTRAINT_ERROR : p2ada_definition_info.adb:989 index check failed
dd: Idt renames idt_stack(d).all;
raised CONSTRAINT_ERROR : p2ada_definition_info.adb:968 index check failed
tt: Typ renames typ_stack(t).all;
-- Definition exports, file nptest2.def
0 -- first item in IDENTS
11 -- last item in IDENTS
0 -- first item in TYPES
5 -- last item in TYPES
-- Types:
0
As first indexes are also zero !!

Is the index zero relevant?
Or else should be begin by 1?

Thanks for help, Blady.

Discussion

  • Blady

    Blady - 2010-03-28

    Hello, this bugs has been fixed in SVN release 15:
    p2ada_definition_info.adb revision 15.
    Adding a test for pt not null.
    Adding initialization of exports (odd oversight in previous version).
    Best Blady.

     
  • Blady

    Blady - 2010-03-28
    • status: open --> open-fixed