NCBI C Toolkit Cross Reference

C/asnlib/asn.h


  1 /* asn.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 * File Name: asn.h
 27 *
 28 * Author:  James Ostell
 29 *
 30 * Version Creation Date: 1/1/91
 31 *
 32 * $Revision: 6.13 $
 33 *
 34 * File Description:
 35 *   This header the interface to all the routines in the ASN.1 libraries
 36 *     that an application should ever use.  It also includes the necessary
 37 *     typedefs -- however the application programmer is not meant to use
 38 *     the internal structures directly outside of the specified functions,
 39 *     as the internal structures may be changed without notice.
 40 *
 41 * Modifications:
 42 * --------------------------------------------------------------------------
 43 * Date     Name        Description of modification
 44 * -------  ----------  -----------------------------------------------------
 45 *
 46 * ==========================================================================
 47 */
 48 
 49 #ifndef _ASNTOOL_
 50 #define _ASNTOOL_
 51 
 52                       /*** depends on NCBI core routines ***/
 53 #ifndef _NCBI_
 54 #include <ncbi.h>
 55 #endif
 56 
 57 #undef NLM_EXTERN
 58 #ifdef NLM_IMPORT
 59 #define NLM_EXTERN NLM_IMPORT
 60 #else
 61 #define NLM_EXTERN extern
 62 #endif
 63 
 64 #ifdef __cplusplus
 65 extern "C" {
 66 #endif
 67 
 68    /**** ValNode is used for internal representation of values from
 69         ****  CHOICE, SET OF, SEQ OF and combinations for many cases.
 70         ****  it is provided in ncbimisc for build object routines ****/
 71 
 72 /***  The following defines can be used for backward compatibility
 73 #define AsnValue DataVal
 74 #define AsnNode ValNode
 75 ***/
 76 /***  In addition, AsnValueNode was changed to AsnValxNode so it would
 77       not conflict with the AsnValue define above
 78 ****/
 79 
 80 #ifndef START_STRUCT
 81 #define START_STRUCT    411             /* { found */
 82 #define END_STRUCT              412             /* } found */
 83 #endif
 84 
 85    /******* AsnOptions allow customization of AsnIo and AsnType ****/
 86 
 87 typedef Pointer (LIBCALLBACK * AsnOptFreeFunc) PROTO ((Pointer));
 88 #define DefAsnOptionFree  Nlm_MemFree   /* default function for freeing AsnOption's */
 89 
 90 typedef struct asnopt {
 91         Int2 ao_class;               /* class of option. all negative numbers res.*/
 92         Int2 type;                /* type within ao_class */
 93         DataVal data;            /* data used for setting option */
 94         AsnOptFreeFunc freefunc;  /* function to free data.ptrvalue */
 95         struct asnopt PNTR next;
 96 } AsnOption, PNTR AsnOptionPtr;
 97 
 98    /******** AsnValXNode holds ENUM, Named Integer, Default values *****/
 99 
100 typedef struct asnvaluenode {
101         Int2 valueisa;
102         CharPtr name;                  /* use for strings and named int */
103         Int4 intvalue;                     /* use for int and boolean */
104         FloatHi realvalue;
105         struct asnvaluenode PNTR next;
106         AsnOptionPtr aop;              /* for comments */
107 }       AsnValxNode, PNTR AsnValxNodePtr;
108 
109    /******** AsnType is a node in the AsnTool parse tree *******/
110 
111 typedef struct asntype {
112         Int2 isa;
113         CharPtr name;
114         Uint1 tagclass;
115         Int2 tagnumber;
116         unsigned implicit   : 1;
117         unsigned optional   : 1;
118         unsigned hasdefault : 1;
119         unsigned exported   : 1;
120         unsigned imported   : 1;
121         unsigned resolved   : 1;
122         AsnValxNodePtr defaultvalue;   /* used for default value, range, subtypes */
123         struct asntype PNTR type;
124         Pointer branch;                            /* used for named ints, enum, set, sequence */
125         Int2 tmp;                      /* for temporary ->type link to local tree */
126         struct asntype PNTR next;
127         AsnOptionPtr hints;            /* used to customize the type by application */
128         CharPtr XMLname;               /* for reading/writing XML */
129         Boolean been_here;             /* needed for printing DTD */
130 }       AsnType, PNTR AsnTypePtr;
131 
132 typedef struct asnmodule {
133         CharPtr modulename;
134         CharPtr filename;              /* if module to be loaded from disk */
135         AsnTypePtr types;
136         AsnTypePtr values;
137         struct asnmodule PNTR next;    /* for chain of modules */
138         Int2 lasttype;                 /* for isa defined types */
139         Int2 lastvalue;                        /* for isa defined values */
140 }       AsnModule, PNTR AsnModulePtr;
141 
142 #define ASNIO_BUFSIZE         1024 /* default size of AsnIo.buf */
143 #define ASNIO_BUFSIZE_RESERVE  200 /* default size of reserved room in AsnIo.buf */
144 
145                                    /* AsnIo.type  bit[0] = text? bit[1]=binary?*/
146                                    /* bit[2]=input? bit[3]=output?           */
147 #define ASNIO_TEXT       1
148 #define ASNIO_BIN        2
149 #define ASNIO_IN         4
150 #define ASNIO_OUT        8
151 #define ASNIO_FILE      16
152 #define ASNIO_CARRIER   32         /* is a pure iterator */
153 #define ASNIO_XML       64
154 
155 #define ASNIO_TEXT_IN   21         /* AsnIo.type */
156 #define ASNIO_TEXT_OUT  25
157 #define ASNIO_BIN_IN    22
158 #define ASNIO_BIN_OUT   26
159 
160 typedef struct pstack {
161     AsnTypePtr type;               /* type at this level of stack */
162     Int4 len;                      /* length of item for binary decode */
163     Boolean resolved;              /* resolution of type for binary decode */
164         Boolean tag_indef;             /* indefinate tag length on input? */
165 } Pstack, PNTR PstackPtr;
166 
167 typedef struct asnexpoptstruct {
168         struct asnio PNTR aip;
169         AsnTypePtr atp;
170         DataValPtr dvp;
171         Int2 the_choice;
172         Pointer the_struct;
173         Pointer data;
174 } AsnExpOptStruct, PNTR AsnExpOptStructPtr;
175 
176 typedef void (LIBCALLBACK * AsnExpOptFunc) PROTO ((AsnExpOptStructPtr));
177 #define NO_CHOICE_SET INT2_MIN     /* for AsnExpOptStruct.the_choice  */
178 
179 typedef struct expopt {
180         Int2 numtypes;
181         AsnTypePtr PNTR types;         /* the type to check */
182         Pointer user_data;             /* user supplied data */
183         AsnExpOptFunc user_callback;   /* user supplied callback function */
184         struct expopt PNTR next;
185 } AsnExpOpt, PNTR AsnExpOptPtr;
186 
187 typedef void (LIBCALLBACK * AsnErrorFunc) PROTO((Int2, CharPtr));
188 #define ErrorRetType AsnErrorFunc  /* for backward compatibility */
189 typedef Int2 (LIBCALLBACK * AsnIoFunc) PROTO((Pointer, CharPtr, Uint2));
190 #define IoFuncType AsnIoFunc       /* for backward compatibility */
191 
192 
193 typedef struct asnio {
194         CharPtr linebuf;
195         Int1 type;            /* type- text-in, text-out, bin-in, bin-out */
196         Int2 linepos;         /* current offset in linebuf */
197         FILE * fp;            /* file to write or read to */
198         BytePtr buf;          /* buffer for I/O */
199     Int2 bufsize;         /* sizeof this buffer */
200         Int2 bytes,           /* bytes of data available in buf */
201                 offset;           /* current offset of processing in buf */
202         Uint1 tagclass;       /* last BER tag-id-len read */
203         Int2 tagnumber;
204         Boolean constructed;
205         Int4 length;            /* length of BER encoded data */
206         Boolean tagsaved;       /* TRUE if tag info already here - stops read */
207         Int4 used;              /* if tagsaved, bytes used recorded here */
208         Int1 tabsize,           /* spaces per tab */
209                 indent_level,       /* current indent level for print output */
210                 linelength,         /* max line length on output */
211                 max_indent,         /* current maximum indent levels for first */
212                 state;              /* parsing state */
213     BoolPtr first;          /* for first element on indented line for printing */
214         Int4 linenumber;        /* for reporting errors */
215         CharPtr word;           /* current word in linebuf */
216         Int2 wordlen,           /* length of word in linebuf */
217              token;             /* current parsing token for word */
218     PstackPtr typestack;    /* the parsing stack for input and output */
219         Int1 type_indent,       /* used like indent_level and max_indent, but for */
220                 max_type;           /* typestack */
221         ErrorRetType error_ret; /* user error return */
222     Pointer iostruct;       /* non-FILE io structure */
223     IoFuncType readfunc,    /* read/write functions for sockets */
224           writefunc;        /*  open and close MUST be done outside AsnIo */
225         Boolean read_id;        /* for checking AsnReadId AsnReadVal alternation */
226         CharPtr fname;          /* name of file in use */
227         AsnOptionPtr aop;       /* head of options chain */
228         AsnExpOptPtr aeop;      /* exploration options chain */
229         AsnExpOptStructPtr aeosp;
230         Boolean io_failure;     /* set on failed write, or read  */
231         Uint1 fix_non_print;    /* fix non-printing chars in VisibleStrings (see below)*/
232         Boolean scan_for_start; /* if TRUE, scan over garbage in print form */
233         Int2 spec_version;      /* used for filtering between asn.1 spec versions */
234         Boolean no_newline;     /* to suppress internal newlines in long XML strings */
235         Boolean XMLModuleWritten; /* to put header on first XML DTD only */
236     /* the following fields are used for easier ASN.1 comparisons, not normal operations */
237         Boolean asn_no_newline;  /* to suppress internal newlines in long ASN.1 strings */
238         Boolean asn_alt_struct;  /* structure ending braces on separate lines */
239 } AsnIo, PNTR AsnIoPtr;
240 
241 
242 /*****************************************************************************
243 *
244 *   fix_non_print
245 *       Non-printing chars (like \t, \n) are illegal in VisibleStrings. The
246 *   default case is to replace it with '#' and post an error message. Whether
247 *   the error will be fatal or not depends on ERR_SET_OPTS. Supported values
248 *   of fix_non_print are:
249 *
250 *   0 = (default) replace with '#', post an error of SEV_ERROR,
251 *             do not set aip->io_failure
252 *   1 = replace with '#' silently
253 *   2 = pass non-printing char through unchanged with no error message
254 *   3 = replace with '#', post an error of SEV_FATAL, do set aip->io_failure
255 *
256 *   NOTE: if you are using a pure iterator (AsnIoNullOpen()) instead of really
257 *     writing...
258 *
259 *   To avoid checking all strings, set aip->fix_non_print = 2
260 *   To check, get an error message, but not die, leave aip->fix_non_print=0
261 *   To check and fail with non printing chars, set aip->fix_non_print=3
262 *
263 *
264 *****************************************************************************/
265 
266 
267 typedef struct asniomem {    /* for AsnIo to and from a memory block */
268         AsnIoPtr aip;                    /* the AsnIoPtr for this */
269         BytePtr buf;                     /* a buffer for the data */
270         Int4 size,              /* size of this buffer (w) or bytes_to_read (r) */
271                         count;          /* count of bytes read from or written to buffer */
272 } AsnIoMem, PNTR AsnIoMemPtr;
273 
274 typedef struct asniobs {    /* for AsnIo to and from a memory ByteStore */
275         AsnIoPtr aip;                    /* the AsnIoPtr for this */
276         ByteStorePtr bsp;        /* byte store for this */
277 } AsnIoBS, PNTR AsnIoBSPtr;
278 
279 /***** typedefs used often in object loaders **********/
280 
281 typedef Pointer (LIBCALL *AsnReadFunc) PROTO((AsnIoPtr aip, AsnTypePtr atp));
282 typedef Boolean (LIBCALL *AsnWriteFunc) PROTO((Pointer object, AsnIoPtr aip, AsnTypePtr atp));
283 
284 typedef Boolean (LIBCALLBACK *AsnStreamStringFunc) (Pointer object, AsnIoPtr aip);
285 
286 /*****************************************************************************
287 *
288 *   prototypes
289 *
290 *****************************************************************************/
291 /*** asngen.c ****/
292 
293 NLM_EXTERN AsnTypePtr LIBCALL AsnReadId PROTO((AsnIoPtr aip, AsnModulePtr amp, AsnTypePtr atp));
294 NLM_EXTERN Int2  LIBCALL AsnReadVal PROTO((AsnIoPtr aip, AsnTypePtr atp, DataValPtr vp));
295 NLM_EXTERN Boolean LIBCALL AsnWrite PROTO((AsnIoPtr aip, AsnTypePtr atp, DataValPtr dvp));
296 NLM_EXTERN Boolean LIBCALL AsnWriteEx (AsnIoPtr aip, AsnTypePtr atp, DataValPtr dvp, AsnStreamStringFunc stream);
297 NLM_EXTERN Boolean LIBCALL AsnSkipValue PROTO((AsnIoPtr aip, AsnTypePtr atp));
298 
299 NLM_EXTERN Boolean LIBCALL AsnOpenStruct PROTO((AsnIoPtr aip, AsnTypePtr atp,
300                         Pointer the_struct));
301 NLM_EXTERN Boolean LIBCALL AsnCloseStruct PROTO((AsnIoPtr aip, AsnTypePtr atp,
302                         Pointer the_struct));
303 NLM_EXTERN Boolean LIBCALL AsnWriteChoice PROTO((AsnIoPtr aip, AsnTypePtr atp, Int2 choice,
304                         DataValPtr the_value));
305 NLM_EXTERN void LIBCALL AsnCheckExpOpt PROTO((AsnIoPtr aip, AsnTypePtr atp, DataValPtr dvp));
306 NLM_EXTERN AsnExpOptPtr LIBCALL AsnExpOptNew PROTO((AsnIoPtr aip, CharPtr path,
307                         Pointer user_data, AsnExpOptFunc user_func));
308 NLM_EXTERN AsnExpOptPtr LIBCALL AsnExpOptFree PROTO((AsnIoPtr aip, AsnExpOptPtr aeop));
309 NLM_EXTERN VoidPtr LIBCALL AsnFindNthPieceOfObject PROTO((AsnWriteFunc wfunc, Pointer datum, CharPtr string, Int4 n));
310 
311 NLM_EXTERN Int2 LIBCALL AsnGetLevel PROTO((AsnIoPtr aip));
312 NLM_EXTERN void LIBCALL AsnNullValueMsg PROTO((AsnIoPtr aip, AsnTypePtr node));
313 
314 /*** asntypes.c ***/
315 
316 NLM_EXTERN void LIBCALL AsnKillValue PROTO((AsnTypePtr atp, DataValPtr dvp));
317 NLM_EXTERN AsnTypePtr PNTR LIBCALL AsnTypePathFind PROTO((AsnModulePtr amp, CharPtr str, Int2Ptr numtypes));
318 NLM_EXTERN AsnTypePtr LIBCALL AsnTypeFind PROTO((AsnModulePtr amp, CharPtr str));
319 #define AsnFind(x) AsnTypeFind(NULL,x)    /* find type (all) */
320 NLM_EXTERN CharPtr LIBCALL AsnFindPrimName PROTO((AsnTypePtr atp));
321 NLM_EXTERN AsnTypePtr LIBCALL AsnFindBaseType PROTO((AsnTypePtr atp));
322 NLM_EXTERN AsnTypePtr LIBCALL AsnFindBaseTypeDTD PROTO((AsnTypePtr atp));
323 NLM_EXTERN CharPtr LIBCALL AsnFindBaseName PROTO((AsnTypePtr atp));
324 NLM_EXTERN Int2 LIBCALL AsnFindBaseIsa PROTO((AsnTypePtr atp));
325 NLM_EXTERN AsnTypePtr LIBCALL AsnLinkType PROTO((AsnTypePtr type, AsnTypePtr localtype));
326 NLM_EXTERN void LIBCALL AsnUnlinkType PROTO((AsnTypePtr type));
327 NLM_EXTERN CharPtr LIBCALL AsnTypeDumpStack PROTO((CharPtr str, AsnIoPtr aip));
328 NLM_EXTERN Boolean LIBCALL AsnTreeLoad PROTO((char * file, AsnValxNodePtr * avnptr, AsnTypePtr * atptr, AsnModulePtr * ampptr));
329 NLM_EXTERN void LIBCALL AsnStoreTree PROTO((CharPtr file, AsnModulePtr amp));
330 #define AsnLoad() AsnTreeLoad(asnfilename, &avn, &at, &amp)   /* simple loader */
331 NLM_EXTERN void LIBCALL AsnModuleLink PROTO((AsnModulePtr amp));
332 NLM_EXTERN CharPtr LIBCALL AsnEnumStr PROTO((CharPtr str, Int2 val));
333 NLM_EXTERN CharPtr LIBCALL AsnEnumTypeStr PROTO((AsnTypePtr atp, Int2 val));
334 NLM_EXTERN AsnModulePtr LIBCALL AsnAllModPtr PROTO((void));
335 
336 /*****************************************************************************
337 *
338 *   Int4 AsnTypeStringToHex(from, len, to, left)
339 *       converts an octet string to binary
340 *       returns number of hex digits created if all ok
341 *       *left is chars left at the end of the buffer including first letter of
342 *          a remaining digit (from does not have an even number of letters)
343 *          since this could include white space, could be more than 1
344 *       returns a negative number on an error
345 *       skips over internal or trailing white space
346 *       left can be NULL, in which case it is ignored
347 *
348 *****************************************************************************/
349 NLM_EXTERN Int4 LIBCALL AsnTypeStringToHex (Pointer from, Int4 len, Pointer to, Int4Ptr left);
350 
351 /*** asnio.c ****/
352 
353 NLM_EXTERN CharPtr LIBCALL AsnErrGetTypeName PROTO((CharPtr name));
354 NLM_EXTERN AsnIoPtr LIBCALL AsnIoOpen PROTO((CharPtr file_name, CharPtr mode));
355 NLM_EXTERN AsnIoPtr LIBCALL AsnIoClose PROTO((AsnIoPtr aip));
356 NLM_EXTERN AsnIoPtr LIBCALL AsnIoFree PROTO((AsnIoPtr aip, Boolean close_file));
357 NLM_EXTERN void LIBCALL AsnIoReset PROTO((AsnIoPtr aip));
358 NLM_EXTERN void LIBCALL AsnIoSetErrorMsg PROTO((AsnIoPtr aip, ErrorRetType error_ret));
359 NLM_EXTERN Int4 LIBCALL AsnIoSeek PROTO((AsnIoPtr aip, Int4 pos));
360 NLM_EXTERN Int4 LIBCALL AsnIoTell PROTO((AsnIoPtr aip));
361 NLM_EXTERN void LIBCALL AsnIoFlush PROTO((AsnIoPtr aip));
362 NLM_EXTERN AsnIoPtr LIBCALL AsnIoNew PROTO((Int1 type, FILE * fp, Pointer iostruct, IoFuncType readfunc, IoFuncType writefunc));
363 NLM_EXTERN Boolean LIBCALL AsnIoSetBufsize PROTO((AsnIoPtr aip, Int2 size));
364 NLM_EXTERN AsnOptionPtr LIBCALL AsnIoOptionNew PROTO((AsnIoPtr aip, Int2 ao_class, Int2 type, DataVal av, AsnOptFreeFunc freefunc));
365 NLM_EXTERN void LIBCALL AsnIoOptionFree PROTO((AsnIoPtr aip, Int2 ao_class, Int2 type));
366 NLM_EXTERN Boolean LIBCALL AsnClassTypeMatch PROTO((Int2 ao_class, Int2 type, Int2 this_class, Int2 this_type));
367 NLM_EXTERN AsnOptionPtr LIBCALL AsnIoOptionGet PROTO((AsnIoPtr aip, Int2 ao_class, Int2 type, AsnOptionPtr last));
368 NLM_EXTERN AsnOptionPtr LIBCALL AsnOptionNew PROTO((AsnOptionPtr PNTR aopp, Int2 ao_class, Int2 type, DataVal av, AsnOptFreeFunc freefunc));
369 NLM_EXTERN void LIBCALL AsnOptionFree PROTO((AsnOptionPtr PNTR aopp, Int2 ao_class, Int2 type));
370 NLM_EXTERN AsnOptionPtr LIBCALL AsnOptionGet PROTO((AsnOptionPtr head, Int2 ao_class, Int2 type, AsnOptionPtr last));
371 NLM_EXTERN Boolean LIBCALL AsnSetXMLmodulePrefix (CharPtr prefix);
372 NLM_EXTERN Boolean LIBCALL AsnSetXMLmodulePrefixToDefault (void);
373 NLM_EXTERN CharPtr LIBCALL AsnGetXMLmodulePrefix (void);
374 
375     /*** calculate hash value from ASN.1 ***/
376 NLM_EXTERN Uint4 LIBCALL  AsnIoHash (Pointer from, AsnWriteFunc writefunc);
377 
378     /*** read and write to memory buffer ***/
379 NLM_EXTERN AsnIoMemPtr LIBCALL AsnIoMemOpen PROTO((CharPtr mode, BytePtr buf, Int4 size));
380 NLM_EXTERN AsnIoMemPtr LIBCALL AsnIoMemClose PROTO((AsnIoMemPtr aimp));
381 NLM_EXTERN Boolean LIBCALL AsnIoMemReset PROTO((AsnIoMemPtr aimp, Int4 bytes_to_read));
382 NLM_EXTERN Int2 LIBCALL AsnIoMemRead PROTO((Pointer, CharPtr, Uint2));
383 NLM_EXTERN Int2 LIBCALL AsnIoMemWrite PROTO((Pointer, CharPtr, Uint2));
384 
385    /*** read and write to a ByteStore in memory ***/
386 NLM_EXTERN AsnIoBSPtr LIBCALL AsnIoBSOpen PROTO((CharPtr mode, ByteStorePtr bsp));
387 NLM_EXTERN AsnIoBSPtr LIBCALL AsnIoBSClose PROTO((AsnIoBSPtr aibp));
388 NLM_EXTERN Int2 LIBCALL AsnIoBSRead PROTO((Pointer, CharPtr, Uint2));
389 NLM_EXTERN Int2 LIBCALL AsnIoBSWrite PROTO((Pointer, CharPtr, Uint2));
390 
391   /** Copy and Compare functions ***/
392 NLM_EXTERN Pointer LIBCALL AsnIoCopy PROTO((Pointer from, AsnReadFunc readfunc, AsnWriteFunc writefunc));
393 NLM_EXTERN Pointer LIBCALL AsnIoMemCopy PROTO((Pointer from, AsnReadFunc readfunc, AsnWriteFunc writefunc));
394 NLM_EXTERN Boolean LIBCALL AsnIoMemComp PROTO((Pointer a, Pointer b, AsnWriteFunc writefunc));
395 
396 #define AsnIoNullOpen() AsnIoNew((ASNIO_OUT | ASNIO_TEXT | ASNIO_CARRIER), NULL, NULL, NULL, NULL)
397 
398 /*** asndebin.c ***/
399 
400 NLM_EXTERN AsnTypePtr LIBCALL AsnBinReadId PROTO((AsnIoPtr aip, AsnTypePtr atp));
401 NLM_EXTERN Int2 LIBCALL AsnBinReadVal PROTO((AsnIoPtr aip, AsnTypePtr atp, DataValPtr vp));
402 
403 /*** asnenbin.c ***/
404 
405 NLM_EXTERN Boolean LIBCALL AsnBinWrite PROTO((AsnIoPtr aip, AsnTypePtr atp, DataValPtr dvp));
406          /** expert use only ***/
407 NLM_EXTERN Boolean LIBCALL AsnEnBinTheBytes PROTO((Pointer ptr, Uint4 len, AsnIoPtr aip, Boolean is_string));
408 #define AsnEnBinBytes(a,b,c) AsnEnBinTheBytes(a, b, c, FALSE)
409 
410 /*** asnlex.c ***/
411 
412 NLM_EXTERN AsnTypePtr LIBCALL AsnTxtReadId PROTO((AsnIoPtr aip, AsnModulePtr amp, AsnTypePtr atp));
413 NLM_EXTERN Int2 LIBCALL AsnTxtReadVal PROTO((AsnIoPtr aip, AsnTypePtr atp, DataValPtr vp));
414 
415 /*** asnprint.c ***/
416 
417 NLM_EXTERN Boolean LIBCALL AsnTxtWrite PROTO((AsnIoPtr aip, AsnTypePtr atp, DataValPtr dvp));
418 NLM_EXTERN Boolean LIBCALL  AsnTxtWriteEx (AsnIoPtr aip, AsnTypePtr atp, DataValPtr dvp, AsnStreamStringFunc stream);
419 
420 /*** asnlext.c ***/
421 
422 NLM_EXTERN AsnModulePtr LIBCALL AsnLoadModules PROTO((AsnIoPtr aip));
423 
424 /*** asngenob.c ***/
425 NLM_EXTERN ValNodePtr LIBCALL AsnGenericBaseSeqOfAsnRead PROTO ((AsnIoPtr aip, AsnModulePtr amp, AsnTypePtr orig, int whichvalslot, BoolPtr isError));
426 NLM_EXTERN Boolean LIBCALL AsnGenericBaseSeqOfAsnWrite PROTO ((ValNodePtr ptr, int whichvalslot, AsnIoPtr aip, AsnTypePtr bag_atp, AsnTypePtr element_atp));
427 NLM_EXTERN Boolean LIBCALL AsnGenericBaseSeqOfFree PROTO ((ValNodePtr ptr, int whichvalslot));
428 NLM_EXTERN Pointer AsnGenericUserSeqOfAsnRead PROTO ((AsnIoPtr aip, AsnModulePtr amp, AsnTypePtr orig, BoolPtr isError, AsnReadFunc readfunc, AsnOptFreeFunc freefunc));
429 NLM_EXTERN Boolean LIBCALL AsnGenericUserSeqOfAsnWrite PROTO ((Pointer ptr, AsnWriteFunc writefunc, AsnIoPtr aip, AsnTypePtr bag_atp, AsnTypePtr element_atp));
430 NLM_EXTERN Boolean LIBCALL AsnGenericUserSeqOfFree PROTO ((Pointer ptr, AsnOptFreeFunc freefunc));
431 NLM_EXTERN Pointer LIBCALL AsnGenericChoiceSeqOfAsnRead PROTO ((AsnIoPtr aip, AsnModulePtr amp, AsnTypePtr orig, BoolPtr isError, AsnReadFunc readfunc, AsnOptFreeFunc freefunc));
432 NLM_EXTERN Boolean LIBCALL AsnGenericChoiceSeqOfAsnWrite PROTO ((Pointer ptr, AsnWriteFunc writefunc, AsnIoPtr aip, AsnTypePtr bag_atp, AsnTypePtr element_atp));
433 NLM_EXTERN Boolean LIBCALL AsnGenericChoiceSeqOfFree PROTO ((Pointer ptr, AsnOptFreeFunc freefunc));
434 
435 /*** asnbufo.c ***/
436 NLM_EXTERN Boolean LIBCALL AsnBufWrite PROTO ((AsnIoPtr aip, AsnTypePtr atp, CharPtr buf, size_t buflen));
437 NLM_EXTERN Boolean LIBCALL AsnBinBufWrite PROTO ((AsnIoPtr aip, AsnTypePtr atp, CharPtr buf, size_t buflen));
438 NLM_EXTERN Boolean LIBCALL AsnTxtBufWrite PROTO ((AsnIoPtr aip, AsnTypePtr atp, CharPtr buf, size_t buflen));
439 
440 
441 
442 /******** temporary defines for older code *************/
443 
444 #define AsnStartStruct(x,y) AsnOpenStruct(x, y, NULL)
445 #define AsnEndStruct(x,y) AsnCloseStruct(x, y, NULL)
446 
447 /***** AsnOption ao_class values - do not reuse ***************/
448 /***** all positive numbers > 0 are available to non-NCBI applications ***/
449 
450 #define OP_ANY          0
451 #define OP_TOGENBNK    -1
452 #define OP_BB2ASN      -2
453 #define OP_NCBIOBJSSET -3
454 #define OP_NCBIOBJSEQ  -4
455 #define OP_GET_MUID    -5
456 #define OP_NCBIASNTOOL -6
457 #define OP_NCBIHINTS   -7
458 #define OP_GESTALT     -8
459 #define OP_NCBIOBJSTR  -9
460 #define OP_TYPEORDER   -10     /* for printing out DTD or spec */
461 #define OP_COMMENTBEFORE -11   /*  ditto */
462 #define OP_COMMENT     -12      /*  ditto */
463 
464 /****** these are the possible returns from AsnFindBaseIsa() *****/
465 /****** the numbers are arbitrary, but should never be changed ***/
466 
467 #define BOOLEAN_TYPE                    301             /* BOOLEAN */
468 #define INTEGER_TYPE                    302             /* INTEGER */
469 #define BITS_TYPE                               303             /* BIT STRING */
470 #define OCTETS_TYPE                             304             /* OCTET STRING */
471 #define NULL_TYPE                               305             /* NULL */
472 #define OBID_TYPE                               306             /* OBJECT IDENTIFIER */
473 #define OBDES_TYPE                              307             /* ObjectDescriptor */
474 #define EXTERNAL_TYPE                   308             /* EXTERNAL */
475 #define REAL_TYPE                               309             /* REAL */
476 #define ENUM_TYPE                               310             /* ENUMERATED */
477 #define SEQ_TYPE                                311             /* SEQUENCE */
478 #define SEQOF_TYPE                              312             /* SEQUENCE OF */
479 #define SET_TYPE                                313             /* SET */
480 #define SETOF_TYPE                              314             /* SET OF */
481 #define CHOICE_TYPE                             315             /* CHOICE */
482 #define ANY_TYPE                                316             /* ANY */
483 #define NUMERICSTRING_TYPE              317         /* String Types */
484 #define PRINTABLESTRING_TYPE    318
485 #define TELETEXSTRING_TYPE              319
486 #define VIDEOTEXSTRING_TYPE             320
487 #define IA5STRING_TYPE                  321
488 #define GRAPHICSTRING_TYPE              322
489 #define VISIBLESTRING_TYPE              323
490 #define GENERALSTRING_TYPE              324
491 #define CHARACTERSTRING_TYPE    325
492 #define GENTIME_TYPE                    326             /* Time types */
493 #define UTCTIME_TYPE                    327
494 
495 #define STRSTORE_TYPE                   351             /* Application: StringStore */
496 #define BIGINT_TYPE                     352             /* Application: Int8 */
497 
498 /******* grouping macros on ISA defines above ********************/
499 
500 #define ISA_STRINGTYPE(x)       (((x) >= 317) && ((x) <= 325))
501 #define ISA_STRUCTTYPE(x)       (((x) >= 311) && ((x) <= 314))
502 #define ISA_INTTYPE(x)          (((x) == 302) || ((x) == 310))
503 
504 /* #defines used by automatically-generated object loaders */
505 #define ASNCODE_PTRVAL_SLOT 1
506 #define ASNCODE_REALVAL_SLOT 2
507 #define ASNCODE_INTVAL_SLOT 3
508 #define ASNCODE_BOOLVAL_SLOT 4
509 #define ASNCODE_BYTEVAL_SLOT 5
510 #define ASNCODE_BIGINTVAL_SLOT 6
511 
512 #ifdef __cplusplus
513 }
514 #endif
515 
516 #undef NLM_EXTERN
517 #ifdef NLM_EXPORT
518 #define NLM_EXTERN NLM_EXPORT
519 #else
520 #define NLM_EXTERN
521 #endif
522 
523 #endif
524 

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.