Discussion:
conflits de noms [débutant]
(trop ancien pour répondre)
Mehdi Saada
2017-12-15 20:29:23 UTC
Permalink
J'ai bien with Ada.Text_IO; use Ada.Text_io;
au début du fichier, mais le compilateur me dit tout de même "TEXT_IO" not visible. D'où cela peut-il venir ?
Voici les spécifications un paquet P_bounded_80-io que j'ai aussi "withé". Ça doit bien avoir un lien...

function Get_Line return P_Bounded.Bounded_String;
function Get_Line (
File : Ada.Text_Io.File_Type )
return P_Bounded.Bounded_String;
procedure Put_Line (
Item : in P_Bounded.Bounded_String );
procedure Put_Line (
File : Ada.Text_Io.File_Type;
Item : in P_Bounded.Bounded_String );
procedure Put (
File : Ada.Text_Io.File_Type;
Item : in P_Bounded.Bounded_String );
procedure Put (
Item : in P_Bounded.Bounded_String );

Ne vous embêter pas à un reprendre chaque erreur, je ne m'intéresse qu'à la pollution de l'espace de noms, enfin je suppose que ça s'appelle comme ça.

le bout de programme:
83 SET_COL(TEXT_IO.COUNT(INDEX(BS1, ALPHANUMERIC_SET, OUTSIDE)));
84 PUT_LINE(ELEMENT(BS1,INDEX(BS1, ALPHANUMERIC_SET,OUTSIDE)));
85 PUT_LINE("INDEX a marché si @ apparait juste en dessous de @ !");
89 PUT_LINE("Insertion de BS2 :" & BS2 & " dans BS1 à la huitième place");
90 INSERT(BS1,BS2,8);
91 PUT_LINE("Normalement le chiffre 1 s'affiche." & ELEMENT(BS1,8));
93 DELETE(BS1,1,5);
94 PUT_LINE("Test de delete: ai supprimé les 5 premiers caractères, la ligne suivante devrait commencé par 6");
95 PUT_LINE(BS1);
96 OVERWRITE(BS1, "123456789");
97 PUT_LINE("Après OVERWRITE, la ligne suivante devrait à nouveau commencer par 123456789 : " & BS1);
100 OVERWRITE(BS1, 5 * ' ', 1);

=> gnatmake ts_bounded
gcc -c ts_bounded.adb
ts_bounded.adb:83:17: "TEXT_IO" is not visible
ts_bounded.adb:83:17: non-visible declaration at a-textio.ads:49
ts_bounded.adb:84:09: no candidate interpretations match the actuals:
ts_bounded.adb:84:09: missing argument for parameter "Item" in call to "Put_Line" declared at p_bounded_io.ads:25, instance at p_bounded_80_io.ads:12
ts_bounded.adb:84:09: missing argument for parameter "Item" in call to "Put_Line" declared at a-textio.ads:259
ts_bounded.adb:84:18: expected private type "Ada.Strings.Bounded.Bounded_String" from instance at p_bounded_80.ads:12
ts_bounded.adb:84:18: found type "Standard.Character"
ts_bounded.adb:84:18: ==> in call to "Put_Line" at p_bounded_io.ads:22, instance at p_bounded_80_io.ads:12
ts_bounded.adb:84:18: ==> in call to "Put_Line" at a-textio.ads:263
ts_bounded.adb:90:09: no candidate interpretations match the actuals:
ts_bounded.adb:90:20: expected type "Standard.Integer"
ts_bounded.adb:90:20: found private type "Ada.Strings.Bounded.Bounded_String" from instance at p_bounded_80.ads:12
ts_bounded.adb:90:20: ==> in call to "Insert" at a-strbou.ads:352, instance at p_bounded_80.ads:12
ts_bounded.adb:96:09: no candidate interpretations match the actuals:
ts_bounded.adb:96:09: missing argument for parameter "New_Item" in call to "Overwrite" declared at a-strbou.ads:364, instance at p_bounded_80.ads:12
ts_bounded.adb:96:09: missing argument for parameter "New_Item" in call to "Overwrite" declared at a-strbou.ads:358, instance at p_bounded_80.ads:12
ts_bounded.adb:100:09: no candidate interpretations match the actuals:
ts_bounded.adb:100:26: expected type "Standard.Integer"
ts_bounded.adb:100:26: found private type "Ada.Strings.Bounded.Bounded_String" from instance at p_bounded_80.ads:12
ts_bounded.adb:100:26: ==> in call to "Overwrite" at a-strbou.ads:364, instance at p_bounded_80.ads:12
Mehdi Saada
2017-12-15 21:57:32 UTC
Permalink
J'ai bien regardé: procedure Overwrite (Source: in out Bounded_String; Position: in Positive;New_Item: in String;Drop: in Truncation := Error);
OVERWRITE(BS1, 1, 5 * ' ') est juste...

Continuer la lecture sur narkive:
Loading...