File: savant.h

package info (click to toggle)
remem 2.12-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,500 kB
  • ctags: 1,043
  • sloc: ansic: 6,624; sh: 3,350; lisp: 1,911; yacc: 340; makefile: 106
file content (141 lines) | stat: -rw-r--r-- 3,504 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef _SAVANT_
#define _SAVANT_

/*
All code included in versions up to and including 2.09:
   Copyright (C) 1996-2001 Massachusetts Institute of Technology.

All modifications subsequent to version 2.09 are copyright Bradley
Rhodes or their respective authors.

Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge,
Massachusetts, with support from British Telecom and Merrill Lynch.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.  For commercial licensing under other
terms, please consult the MIT Technology Licensing Office.

This program may be subject to the following US and/or foreign
patents (pending): "Method and Apparatus for Automated,
Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If
any of these patents are granted, royalty-free license to use this
and derivative programs under the GNU General Public License are
hereby granted.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/

extern void SavantError(int errcode, char *errstring);

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <ctype.h>
#include <math.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/*
#ifdef HAVE_VALUES_H
#include <values.h>
#endif
*/
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif

#ifdef HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# ifdef HAVE_SYS_NDIR_H
#  include <sys/ndir.h>
# endif
# ifdef HAVE_SYS_DIR_H
#  include <sys/dir.h>
# endif
# ifdef HAVE_NDIR_H
#  include <ndir.h>
# endif
#endif

typedef struct dirent savant_direct;

/* The following is to try to maintain a standard size 
   of the data types used in the on-disk databases. */

#if (SIZEOF_INT == 4)
typedef int DB_INT;
typedef unsigned int DB_UINT;
#elif (SIZEOF_SHORT == 4)
typedef short DB_INT;
typedef unsigned short DB_UINT;
#elif (SIZEOF_LONG == 4)
typedef long DB_INT;
typedef unsigned long DB_UINT;
#else
typedef int DB_INT;
typedef unsigned int DB_UINT;
#endif

#if (SIZEOF_SHORT == 2)
typedef short DB_SHORT;
typedef unsigned short DB_USHORT;
#elif (SIZEOF_INT == 2)
typedef short DB_INT;
typedef unsigned int DB_USHORT;
#else
typedef short DB_SHORT;
typedef unsigned short DB_USHORT;
#endif

#if (SIZEOF_FLOAT == 4)
typedef float DB_FLOAT;
#elif (SIZEOF_DOUBLE == 4)
typedef double DB_FLOAT;
#else
typedef float DB_FLOAT;
#endif

#ifdef RA_MIN
#undef RA_MIN
#endif
#ifdef RA_MAX
#undef RA_MAX
#endif

#if !defined(PATH_MAX)
#define PATH_MAX 1024
#endif

#define RA_MIN(a,b) (((a)<(b))?(a):(b))
#define RA_MAX(a,b) (((a)>(b))?(a):(b))

#define REMEM_VERSION "Savant relevance engine, ver. 2.12, 2/16/04\nCopyright 2004 MIT Media Lab and Bradley Rhodes"
#define REMEM_VERSION_NUMBER "2.12, 2/16/04"

#endif