annotate clustalomega/clustal-omega-0.2.0/src/squid/gsi64.h @ 0:ff1768533a07

Migrated tool version 0.2 from old tool shed archive to new tool shed repository
author clustalomega
date Tue, 07 Jun 2011 17:04:25 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
1 /*****************************************************************
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
2 * @LICENSE@
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
3 *****************************************************************/
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
4
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
5 #ifndef GSI64H_INCLUDED
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
6 #define GSI64H_INCLUDED
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
7 #ifdef USE_GSI64
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
8
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
9 /* gsi64.h
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
10 * Database indexing (GSI64 format support)
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
11 * CVS $Id: gsi64.h,v 1.2 2000/12/21 23:42:59 eddy Exp)
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
12 *
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
13 * A GSI64 (generic sequence index, 64 bit hack) file is composed of
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
14 * recnum + nfiles + 1 records. Each record contains
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
15 * three fields; key, file number, and disk offset.
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
16 * Record 0 contains:
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
17 * [ "GSI64" ] [ nfiles ] [ recnum ]
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
18 * Records 1..nfiles map file names to file numbers, and contain:
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
19 * [ filename ] [ file number, 1..nfiles ] [ 0 (unused) ]
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
20 * Records nfiles+1 to recnum+nfiles+1 provide disk offset
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
21 * and file number indices for every key:
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
22 * [ key ] [ file number ] [ offset]
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
23 *
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
24 * Because the file is binary, we take some (but not
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
25 * complete) care to improve portability amongst platforms.
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
26 * This means using network order integers (see ntohl())
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
27 * and defining types for 16 and 64 bit integers.
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
28 *
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
29 * A short test program that verifies the sizes of these
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
30 * data types would be a good idea...
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
31 *
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
32 * Because we use 64-bit offsets, ftell64(), and fseek64(),
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
33 * we rely on the OS actually providing these. This is
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
34 * a temporary hack for human genome analysis.
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
35 */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
36 typedef unsigned long long sqd_uint64; /* 64 bit integer. */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
37
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
38 #define GSI64_KEYSIZE 32 /* keys are 32 bytes long */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
39 #define GSI64_RECSIZE 42 /* 32 + 2 + 8 bytes */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
40 #define SQD_UINT16_MAX 65535 /* 2^16-1 */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
41 #define SQD_UINT64_MAX 18446744073709551615LU /* 2^64-1 */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
42
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
43 struct gsi64_s {
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
44 FILE *gsifp; /* open GSI index file */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
45 sqd_uint16 nfiles; /* number of files = 16 bit int */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
46 sqd_uint64 recnum; /* number of records = 64 bit int */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
47 };
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
48 typedef struct gsi64_s GSI64FILE;
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
49
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
50 struct gsi64key_s {
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
51 char key[GSI64_KEYSIZE];
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
52 sqd_uint16 filenum;
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
53 sqd_uint64 offset;
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
54 };
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
55 struct gsi64index_s {
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
56 char **filenames;
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
57 int *fmt;
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
58 sqd_uint16 nfiles;
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
59
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
60 struct gsi64key_s *elems;
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
61 sqd_uint64 nkeys;
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
62 };
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
63
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
64
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
65
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
66 /* if ntohl() and friends are not available, you
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
67 * can slip replacements in by providing sre_ntohl()
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
68 * functions. (i.e., there is a possible portability problem here.)
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
69 */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
70 #if 0
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
71 #define sre_ntohl(x) ntohl(x);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
72 #define sre_ntohs(x) ntohs(x);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
73 #define sre_htonl(x) htonl(x);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
74 #define sre_htons(x) htons(x);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
75 #endif
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
76
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
77 /* from gsi64.c
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
78 */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
79 extern GSI64FILE *GSI64Open(char *gsifile);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
80 extern int GSI64GetRecord(GSI64FILE *gsi, char *f1, sqd_uint16 *f2, sqd_uint64 *f3);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
81 extern int GSI64GetOffset(GSI64FILE *gsi, char *key, char *sqfile,
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
82 int *fmt, long long *ret_offset);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
83 extern void GSI64Close(GSI64FILE *gsi);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
84 extern struct gsi64index_s *GSI64AllocIndex(void);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
85 extern void GSI64FreeIndex(struct gsi64index_s *g);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
86 extern void GSI64AddFileToIndex(struct gsi64index_s *g, char *filename, int fmt);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
87 extern void GSI64AddKeyToIndex(struct gsi64index_s *g, char *key, int filenum, long long offset);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
88 extern void GSI64SortIndex(struct gsi64index_s *g);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
89 extern void GSI64WriteIndex(FILE *fp, struct gsi64index_s *g);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
90 extern void GSI64WriteHeader(FILE *fp, int nfiles, long long nkeys);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
91 extern int GSI64WriteFileRecord(FILE *fp, char *fname, int idx, int fmt);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
92 extern int GSI64WriteKeyRecord(FILE *fp, char *key, int fileidx, long long offset);
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
93
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
94 #endif /* USE_GSI64 */
ff1768533a07 Migrated tool version 0.2 from old tool shed archive to new tool shed repository
clustalomega
parents:
diff changeset
95 #endif /*GSIH_INCLUDED*/