From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.36.253.66 with SMTP id m63mr1631673ith.22.1519908285689; Thu, 01 Mar 2018 04:44:45 -0800 (PST) X-Received: by 10.157.3.237 with SMTP id f100mr85943otf.6.1519908285514; Thu, 01 Mar 2018 04:44:45 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!border2.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no1082361ita.0!news-out.google.com!a2ni3144ite.0!nntp.google.com!e10no507559itf.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 1 Mar 2018 04:44:44 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.245.163.78; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.245.163.78 References: <39fc7bbf-77e8-4342-9af7-68cb5e9acb8a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <41524447-5faf-4adf-876c-03b9befde23a@googlegroups.com> Subject: Re: CONSTRAINT ERROR? access check failed From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Thu, 01 Mar 2018 12:44:45 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3378 X-Received-Body-CRC: 1767231862 Xref: reader02.eternal-september.org comp.lang.ada:50744 Date: 2018-03-01T04:44:44-08:00 List-Id: Those are the two last things I would like you people to review. First, I c= an't get out of that loop, even with the exit INNER; after "Rentrez vos com= mandes". It starts it again. INNER : loop declare NOM_FICHIER : String :=3D Get_Line; INDICE : NATURAL :=3D 0; begin if Index_Non_Blank (NOM_FICHIER) /=3D 0 then if not Exists (NOM_FICHIER) then Put_Line ("N'existe pas. Recommencez.= "); end if; OPEN (FILE_ENTREE, In_File, NOM_FICHIER); Set_Input (FILE_ENTREE); while not End_Of_File loop INDICE :=3D INDICE + 10; INSERT_OR_REPLACE (INDICE, LET_ONLY_GRAPHIC_CHARACTERS(GET_LINE)); end loop; end if; Put_Line ("Rentrer maintenant vos commandes"); exit INNER; exception when others =3D> Put_Line ("ERREUR"); end; end loop INNER; Then, could you tell what you think of that subprogram that is meant to pur= ge a STRING from non graphic characters (those that make the program crash)= ? function LET_ONLY_GRAPHIC_CHARACTERS (INPUT_STRING : in STRING) return STRING is use Ada.Strings.Maps.Constants, Ada.Strings.Maps, Ada.Strings.Fixed, Ada.Strings; FIRST, I, COUNT, LAST : NATURal :=3D INPUT_STRING'FIRST; OUTPUT_STRING : STRING (INPUT_STRING'Range); begin loop FIND_TOKEN (Source =3D> INPUT_STRING (I .. INPUT_STRING'LAST), Set =3D> Graphic_Set, Test =3D> Inside , First =3D> First, Last =3D> Last); if Last in INPUT_STRING'Range and LAST /=3D 0 then OUTPUT_STRING (I .. I + LAST - FIRST) :=3D INPUT_STRING (FIRST .. LAST= ); I :=3D I + LAST - FIRST + 1; else exit; end if; end loop; PRAGMA Assert (Index (OUTPUT_STRING(OUTPUT_STRING'First ..=20 (if I > OUTPUT_STRING'Length then OUTPUT_STRING'Last else I)) , GRAPHIC_SET, TEST =3D> Outside) =3D 0, "CHARACT=C3=88RES NON GRA= PHIQUE ONT ECHAPP=C3=89S !"); return OUTPUT_STRING (OUTPUT_STRING'First .. (if I > OUTPUT_STRING'Le= ngth then OUTPUT_STRING'Last else I)); end;