comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: Charles container library usage examples
Date: Sun, 04 Sep 2005 19:19:53 +0200
Date: 2005-09-04T19:19:53+02:00	[thread overview]
Message-ID: <87mzmssqbq.fsf@ludovic-brenta.org> (raw)
In-Reply-To: m3d5np1xwa.fsf@rr.trudgett

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.



  parent reply	other threads:[~2005-09-04 17:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-03  2:38 Charles container library usage examples David Trudgett
2005-09-03  5:15 ` Matthew Heaney
2005-09-03  9:45   ` Simon Wright
2005-09-04  6:25     ` David Trudgett
2005-09-05 11:28       ` Georg Bauhaus
2005-09-04  0:26   ` David Trudgett
2005-09-04  9:49     ` Matthew Heaney
2005-09-06  3:01       ` David Trudgett
2005-09-06 16:22         ` Jeffrey Carter
2005-09-07  0:15         ` Matthew Heaney
2005-09-04 17:19     ` Ludovic Brenta [this message]
2005-09-06  3:01       ` David Trudgett
2005-09-06  5:08         ` Ludovic Brenta
2005-09-06  6:46           ` David Trudgett
2005-09-06  7:26             ` Ludovic Brenta
2005-09-24  0:05               ` Randy Brukardt
2005-09-09 14:57         ` James Alan Farrell
2005-09-10  7:38           ` David Trudgett
2005-09-10 14:55             ` Matthew Heaney
2005-09-10 15:26               ` Ludovic Brenta
2005-09-10 17:58                 ` Matthew Heaney
2005-09-12  0:24               ` Robert A Duff
2005-09-11 10:52             ` Georg Bauhaus
2005-09-11 21:14               ` David Trudgett
2005-09-13 23:41                 ` Björn Persson
2005-09-14  6:39                   ` David Trudgett
2005-09-12  0:21             ` Robert A Duff
2005-09-12  0:57               ` David Trudgett
2005-09-12  1:01                 ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox