1 /* cdromlib.h
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * RCS $Id: cdromlib.h,v 6.0 1997/08/25 18:13:13 madden Exp $
27 *
28 * Author:  Greg Schuler, Jim Ostell, Jonathan Epstein
29 *
30 * Version Creation Date: 9/23/92
31 *
32 * File Description:
33 	header for cdrom specific functions
34 *
35 * Modifications:
36 * --------------------------------------------------------------------------
37 * Date     Name        Description of modification
38 * -------  ----------  -----------------------------------------------------
39 * July'94  Schuler     Multiple changes to support new CD-ROM formats
40 * 11-25-94 Schuler     Moved CdTerm structure from here to accentr.h
41 * 05-16-94 Schuler     Added RCS Log directive.  Comments will henceforth
42 *                      be inserted automatically into the source at the
43 *                      time it is checked into the system.
44 
45 $Log: cdromlib.h,v $
46 Revision 6.0  1997/08/25 18:13:13  madden
47 Revision changed to 6.0
48 
49 Revision 5.1  1997/06/26 21:55:44  vakatov
50 [PC] DLL'd "ncbicdr.lib", "ncbiacc.lib", "ncbinacc.lib" and "ncbicacc.lib"
51 
52 Revision 5.0  1996/05/28 13:55:34  ostell
53 Set to revision 5.0
54 
55  * Revision 4.0  1995/07/26  13:50:32  ostell
56  * force revision to 4.0
57  *
58  * Revision 2.11  1995/05/16  14:12:46  schuler
59  * Automatic comment insertion enabled
60  *
61 
62 
63 
64 * ==========================================================================
65 */
66 
67 #ifndef _CDROMLIB_
68 #define _CDROMLIB_
69 
70 #ifndef _NCBI_Access_
71 #include <objacces.h>
72 #endif
73 
74 #ifndef _CDENTREZ_
75 #include <cdentrez.h>
76 #endif
77 
78 #ifndef _CDCONFIG_
79 #include <cdconfig.h>
80 #endif
81 
82 
83 /* --- Constants --- */
84 
85 /* error codes */
86 #define ERR_CD_MEMORY       1     /*  Memory allocation error   */
87 #define ERR_CD_FILECREATE   2     /*  File create error         */
88 #define ERR_CD_FILEOPEN     3     /*  File open error           */
89 #define ERR_CD_FILESEEK     4     /*  File seek error           */
90 #define ERR_CD_FILEREAD     5     /*  File read error           */
91 #define ERR_CD_FILEWRITE    6     /*  File write error          */
92 #define ERR_CD_BADTYPE      7     /*  Bad doc type code         */
93 #define ERR_CD_BADFIELD     8     /*  Bad field code            */
94 #define ERR_CD_NOTERMS      9     /*  No terms for type/field   */
95 #define ERR_CD_BADUID      10     /*  Bad unique identifier     */
96 #define ERR_CD_BADDIR      11     /*  Bad directory number      */
97 #define ERR_CD_BADFORMAT   12     /*  Format incompatible       */
98 #define ERR_CD_BADINDEX    13     /*  Index out of date         */
99 #define ERR_CD_BADDECOMP   14     /*  Decompression error       */
100 #define ERR_CD_PROGRAMMER  15     /*  Programmer error          */
101 #define ERR_CD_NO_DATASRC  16     /*  No data source (cdconfig) */
102 #define ERR_CD_LEX         17     /*  Lexical evaluation error  */
103 #define ERR_CD_BOOL        18     /*  Boolean operation error   */
104 
105 /* directory codes for CdSetPath */
106 #define NDIR        8
107 #define DIR_ROOT    0
108 #define DIR_DAT     1
109 #define DIR_SEQ     2
110 #define DIR_MED     3
111 #define DIR_TRM     4
112 #define DIR_IDX     5
113 #define DIR_LNK     6
114 #define DIR_VAL     7
115 #define DIR_SUM     8
116 
117 /* sizes & limits */
118 #define VLABEL_MAX  16
119 #define TERM_MAX    80
120 #define CAPT_MAX    20
121 #define TITLE_MAX  180
122 #define LNK_MAX      4
123 
124 /* magic number used for some CD-ROM files */
125 #define CD_MAGIC_BASE 0x4e434249  /* "NCBI" */
126 
127 typedef struct cdmediainfo {
128 	CharPtr sPath[NDIR];
129 	Boolean ejectable;
130 	CharPtr device_name;
131 	CharPtr raw_device_name;
132 	CharPtr mount_point;
133 	CharPtr mount_cmd;
134 	Boolean bAppendVer;
135 	Boolean upperCaseIt;
136 	Boolean hold_idx_open;
137 } CdMediaInfo, PNTR CdMediaInfoPtr;
138 
139 typedef Boolean ( *CdTermProc) PROTO((CdTermPtr trmp));
140 
141 #ifdef _NEW_CdEntrez_
142 #include <cdnewlib.h>
143 #endif
144 
145 /* --- Function Prototypes --- */
146 
147 #undef NLM_EXTERN
148 #ifdef NLM_IMPORT
149 #define NLM_EXTERN NLM_IMPORT
150 #else
151 #define NLM_EXTERN extern
152 #endif
153 
154 #ifdef __cplusplus
155 extern "C" {
156 #endif
157 
158 AsnIoPtr  EntrezInfoOpen PROTO((CharPtr dirname));
159 
160 Boolean  CdInit	      PROTO((void));
161 Boolean  CdFini       PROTO((void));
162 
163 EntrezInfoPtr CdGetInfo PROTO((void));
164 CharPtr CdDetailedInfo PROTO((void));
165 
166 Int2  CdTrmPageCt  PROTO((DocType type, DocField field));
167 Int2  CdTrmLookup  PROTO((DocType type, DocField field, CharPtr term));
168 Int2  CdTrmPages   PROTO((DocType type, DocField field, Int2 pg));
169 Int2  CdLinkUidGet PROTO((LinkSetPtr PNTR result, DocType type,
170 DocType link_to_type, Int2 numuid, Int4Ptr uids, Boolean mark_missing,
171 Int4 maxlink));
172 
173 Int4  CdTrmUidsFil PROTO((DocType type, DocField field, Int4 offset,
174 								Int4 count, CharPtr filename, Boolean append));
175 Int4  CdTrmUidsMem PROTO((DocType type, DocField field, Int4 offset,
176 								Int4 count, DocUidPtr mem));
177 CdTermPtr  CdTrmFind PROTO((DocType type, DocField field, CharPtr term));
178 
179 AsnIoPtr  CdDocAsnOpen  PROTO((DocType type, DocUid uid));
180 AsnIoPtr  CdDocAsnClose PROTO((AsnIoPtr aip));
181 
182 Int2  CdTermScan PROTO((DocType type, DocField field, Int2 page, Int2 numpage, CdTermProc proc));
183 NLM_EXTERN CdTermPtr  CdTermFree PROTO((CdTermPtr trmp));
184 
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 #undef NLM_EXTERN
190 #ifdef NLM_EXPORT
191 #define NLM_EXTERN NLM_EXPORT
192 #else
193 #define NLM_EXTERN
194 #endif
195 
196 #endif
197