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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: zLibAda vs ZipAda (which should I use, if any)? Date: Thu, 25 Aug 2016 14:33:56 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <5d516246-3a7c-4be5-abef-c34fb0f5c753@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Thu, 25 Aug 2016 21:33:58 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="d7c030f56102b58a2c16dea977db88bb"; logging-data="8156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IO79qK1D9vh8GwGaOP5ulCW4vokb4omw=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: <5d516246-3a7c-4be5-abef-c34fb0f5c753@googlegroups.com> Cancel-Lock: sha1:szf+oRYqBwZBRcstCTRRvLpOIvg= Xref: news.eternal-september.org comp.lang.ada:31576 Date: 2016-08-25T14:33:56-07:00 List-Id: On 08/25/2016 01:17 PM, Aurele wrote: > Hi all, I'm faced with two possible options for reading/accessing the > contents of a zip (.zip) file from within my Ada application. One option is > to use zLibAda (by Dmitriy: http://zlib-ada.sourceforge.net/), the other is > to use ZipAda (by Gautier: http://unzip-ada.sourceforge.net/). I have no idea > how either one works and/or if they are appropriate for what I want to do! > > Anyway, my objective is to read a zip (.zip) file that contains compressed > images (bmp, jpg, tga, etc...) and then build a list (table) of available > images with its attributes (name... and/or I can determine its size > separately if I have access, etc...). > > I don't want to go through both zLibAda and ZipAda only to find out I'm on > the wrong path so I was hopping someone might have used these package and > mind enlightening me on their use (assume the file I'm reading is > "Images.zip", and has say 5 images of 250x250 pixels). Looking at Zip-Ada package Zip, it seems that you can do what you want easily (untested): with Ada.Text_IO; with Zip; procedure Zip_Test is procedure Print_One (Name : in String); -- Outputs Name to Current_Output, followed by an EOL procedure Print_All is new Zip.Traverse (Action => Print_One); -- Outputs the names of all the entries in a Zip_Info to Current_Output, -- separated by EOLs procedure Print_One (Name : in String) is -- Empty begin -- Print_One Ada.Text_IO.Put_Line (Item => Name); end Print_One; Info : Zip.Zip_Info; begin -- Zip_Test Zip.Load (Info => Info, From => "Images.zip"); Ada.Text_IO.Put_Line (Integer'Image (Zip.Entries (Info) ) & " entries"); Print_All (Info); end Zip_Test; You'd want to use an instantiation of Traverse_Verbose to get more information about the entries than just their names. -- Jeff Carter "We call your door-opening request a silly thing." Monty Python & the Holy Grail 17