12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

§237 ANNOYANCE-FILTER HEADER INCLUDE FILES 187<br />

237. Some capabilities of the program depend in non-trivial ways on the presence of certain system<br />

features detected by the ./configure script. Here we test for the prerequisites and define an internal<br />

tag to enable the feature if all are met.<br />

〈 Configuration of conditional capabilities 237 〉 ≡<br />

#if defined (HAVE_GNUPLOT) ∧ defined (HAVE_NETPBM) ∧ defined (HAVE_SYSTEM)<br />

#define HAVE_PLOT_UTILITIES<br />

#endif<br />

#if defined (HAVE_DIRENT_H) ∧ defined (HAVE_STAT)<br />

#define HAVE_DIRECTORY_TRAVERSAL<br />

#endif<br />

#if defined (HAVE_PDFTOTEXT) ∧ defined (HAVE_POPEN) ∧ (defined (HAVE_MKSTEMP) ∨ defined<br />

(HAVE_TMPNAM))<br />

#define HAVE_PDF_DECODER<br />

#endif<br />

This code is used in section 232.<br />

238. It’s a pain in the posterior to have to edit the config.h file to disable features not supported<br />

on Win32 platforms. Since we can’t run ./configure there, the process can’t be automated. So, we<br />

take the lazy way out and manually undefine features absent on Win32, even if they were auto-detected<br />

on the platform which generated config.h. Tacky.<br />

〈 Tweak configuration when building for Win32 238 〉 ≡<br />

#ifdef WIN32<br />

#undef HAVE_MMAP<br />

#endif<br />

This code is used in section 232.<br />

239. <strong>The</strong> following global variables are used to keep track of command line options.<br />

#define Annotate (c) (annotations .test (c)) /∗ Test if annotation is requested ∗/<br />

〈 Command line arguments 239 〉 ≡<br />

static double mailBias = 2.0; /∗ Bias for words in legitimate mail ∗/<br />

static unsigned int minOccurrences = 5; /∗ Minimum occurrences to trust probability ∗/<br />

static double junkThreshold = 0.9; /∗ Threshold above which we classify mail as junk ∗/<br />

static double mailThreshold = 0.9; /∗ Threshold below which we classify as mail ∗/<br />

static int significantWords = 15; /∗ Number of words to use in classifying message ∗/<br />

static double novelWordProbability = 0.2;<br />

/∗ Probability assigned to words not in dictionary ∗/<br />

static bitset〈1 ≪ (sizeof (char) ∗ 8)〉 annotations ; /∗ Annotations requested in transcript ∗/<br />

#ifdef POP3_PROXY_SERVER<br />

static int popProxyPort = 9110; /∗ POP3 proxy server listen port ∗/<br />

static string popProxyServer = "";<br />

/∗ POP3 server (IP address or fully-qualified domain name) ∗/<br />

static int popProxyServerPort = 110; /∗ POP3 server port ∗/<br />

#endif<br />

static bool bsdFolder = false ; /∗ Does mail folder use pure BSD “From␣” semantics ? ∗/<br />

See also section 240.<br />

This code is used in section 254.<br />

240. <strong>The</strong>se globals are used to check for inconsistent option specifications.<br />

〈 Command line arguments 239 〉 +≡<br />

static unsigned int nTested = 0; /∗ Number of messages tested ∗/

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!