comparison anagram/agcore/checksum.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1993-1999 Parsifal Software. All Rights Reserved.
4 * Copyright 2006 David A. Holland. All Rights Reserved.
5 * See the file COPYING for license and usage terms.
6 *
7 * checksum.h - self-checksum module
8 */
9
10 #ifndef CHECKSUM_H
11 #define CHECKSUM_H
12
13 enum summable {
14 SUM_AG1,
15 SUM_AG,
16 SUM_AGCL,
17 };
18
19 struct suminfo {
20 unsigned long length;
21 unsigned long sum;
22 };
23
24 struct sumentry {
25 summable what;
26 unsigned long offset;
27 suminfo correct;
28 suminfo observed;
29 };
30
31 void observeSum(sumentry *s);
32
33 void sum_remember_argv0(const char *argv0);
34
35 inline int operator != (const suminfo &a, const suminfo &b) {
36 return a.length != b.length || a.sum != b.sum;
37 }
38
39 // apparently required to have an AgStack<sumentry> (sigh)
40 inline int operator < (const sumentry &, const sumentry &) {
41 return 0;
42 }
43
44 #endif /* CHECKSUM_H */