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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,80435549e92d4e0c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail NNTP-Posting-Date: Sun, 04 Sep 2005 12:18:28 -0500 From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Charles container library usage examples References: Date: Sun, 04 Sep 2005 19:19:53 +0200 Message-ID: <87mzmssqbq.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:GH8ZJPCIL/gHtupOFlk4mMTc7uI= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 83.134.238.168 X-Trace: sv3-RvNvC6ipuY0h5J5V+BWvgLYR06Y6aTk3IyWGFRGckwWJ/1BMh2DgLcNohl3ODEW1kPvA9A6gNETzuFy!cDYWI5y7AWIe8Q3TA97BnO/1gtXZLDI1wwauCElDIMBEqZS7q9Uvx9TNcfXj1wK3jIglDg2uapc= X-Complaints-To: abuse@scarlet.be X-DMCA-Complaints-To: abuse@scarlet.biz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:4429 Date: 2005-09-04T19:19:53+02:00 List-Id: David, in the past I also played with Charles and instantiated a hashed map of Unbounded_Strings, which I used to represent the headers in an email, and then a List_Of_Regexes. You might be interested in how I did the instantiations: -- maps_of_headers.ads with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Charles.Hash_String; with Charles.Maps.Hashed.Strings.Unbounded; private package Maps_Of_Headers is new Charles.Maps.Hashed.Strings.Unbounded (Element_Type => Unbounded_String, Hash => Charles.Hash_String); -- list_of_regexes.ads with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Charles.Vectors.Unbounded; package Lists_Of_Regexes is new Charles.Vectors.Unbounded (Index_Type => Positive, Element_Type => Unbounded_String); (This toy program served me well as a "Spam Killer", which is its name; it reads a list of regular expressions in my .emacs file, uses a POP3 Ada binding to query my mailbox, and deletes all email in the mailbox that matches any of the regular expressions. I used it from a cron job and it would kill 50-100 spam mails a day, when my address was under heavy attack. Now the problem has subsided :) ) HTH -- Ludovic Brenta.