diff options
author | Aaron M. Ucko <ucko@debian.org> | 2005-03-24 02:38:02 +0000 |
---|---|---|
committer | Aaron M. Ucko <ucko@debian.org> | 2005-03-24 02:38:02 +0000 |
commit | 9d90590695bd2617a7cffd14904e1264c531ed17 (patch) | |
tree | 9d110c3704bc00918a0f86c5e82e7592176aea21 /asnlib | |
parent | 20e9c62b7433047567eb3a8bf3647582e12671bd (diff) |
Load ncbi (6.1.20040202) into ncbi-tools6/branches/upstream/current.
Diffstat (limited to 'asnlib')
-rw-r--r-- | asnlib/asn.h | 6 | ||||
-rw-r--r-- | asnlib/asndebin.c | 13 | ||||
-rw-r--r-- | asnlib/asnenbin.c | 9 | ||||
-rw-r--r-- | asnlib/asnprint.c | 15 | ||||
-rw-r--r-- | asnlib/asntypes.c | 34 |
5 files changed, 62 insertions, 15 deletions
diff --git a/asnlib/asn.h b/asnlib/asn.h index aecb424e..1f3179a1 100644 --- a/asnlib/asn.h +++ b/asnlib/asn.h @@ -29,7 +29,7 @@ * * Version Creation Date: 1/1/91 * -* $Revision: 6.10 $ +* $Revision: 6.11 $ * * File Description: * This header the interface to all the routines in the ASN.1 libraries @@ -48,6 +48,9 @@ * 02-24-94 Schuler AsnTypeStringToHex moved here (from asntypes.h) * * $Log: asn.h,v $ +* Revision 6.11 2003/12/03 19:31:09 gouriano +* Corrected DTD generation (a different approach) +* * Revision 6.10 2003/09/15 16:16:32 kans * added AsnWriteEx, AsnTxtWriteEx, and AsnPrintStream * @@ -390,6 +393,7 @@ NLM_EXTERN AsnTypePtr LIBCALL AsnTypeFind PROTO((AsnModulePtr amp, CharPtr str)) #define AsnFind(x) AsnTypeFind(NULL,x) /* find type (all) */ NLM_EXTERN CharPtr LIBCALL AsnFindPrimName PROTO((AsnTypePtr atp)); NLM_EXTERN AsnTypePtr LIBCALL AsnFindBaseType PROTO((AsnTypePtr atp)); +NLM_EXTERN AsnTypePtr LIBCALL AsnFindBaseTypeDTD PROTO((AsnTypePtr atp)); NLM_EXTERN CharPtr LIBCALL AsnFindBaseName PROTO((AsnTypePtr atp)); NLM_EXTERN Int2 LIBCALL AsnFindBaseIsa PROTO((AsnTypePtr atp)); NLM_EXTERN AsnTypePtr LIBCALL AsnLinkType PROTO((AsnTypePtr type, AsnTypePtr localtype)); diff --git a/asnlib/asndebin.c b/asnlib/asndebin.c index 124b32e4..86e1c4f6 100644 --- a/asnlib/asndebin.c +++ b/asnlib/asndebin.c @@ -29,7 +29,7 @@ * * Version Creation Date: 3/4/91 * -* $Revision: 6.5 $ +* $Revision: 6.6 $ * * File Description: * Special binary form (BER) decoder for ASN.1 @@ -45,6 +45,9 @@ * 08-01-93 Gish AsnDeBinReadString calls MemGet instead of MemNew * * $Log: asndebin.c,v $ +* Revision 6.6 2003/12/10 15:41:19 sirotkin +* As per toolkit RT request 15030485 and Jim Ostell, afety checks after ato2=AsnFindBaseIsa(atp) were added. +* * Revision 6.5 2002/10/09 19:16:31 ivanov * Fixed buffer overrun in the AsnDeBinReadReal() * @@ -118,9 +121,15 @@ NLM_EXTERN AsnTypePtr LIBCALL AsnBinReadId (AsnIoPtr aip, AsnTypePtr atp) if (used == ASNDEBIN_EOF) /* end of file */ return NULL; + /* see RT toolbox ticket 15030485 for the below fix */ atp2 = AsnFindBaseType(atp); /* find the base type */ - if (atp2 == NULL) return NULL; + if (atp2 == NULL) + return atp2; + if (atp2->type == NULL) + return atp2->type; + isa = atp2->type->isa; + if (atp2->type->isa != CHOICE_TYPE) { diff --git a/asnlib/asnenbin.c b/asnlib/asnenbin.c index 1c34be40..afcf1432 100644 --- a/asnlib/asnenbin.c +++ b/asnlib/asnenbin.c @@ -29,7 +29,7 @@ * * Version Creation Date: 3/4/91 * -* $Revision: 6.5 $ +* $Revision: 6.6 $ * * File Description: * Special binary (BER) encoder for ASN.1 @@ -42,6 +42,9 @@ * 04-20-93 Schuler LIBCALL calling convention * * $Log: asnenbin.c,v $ +* Revision 6.6 2003/11/07 20:57:02 beloslyu +* fix the c++ style comments to a C ones +* * Revision 6.5 2003/08/01 16:55:24 gouriano * workaround MSVC++.NET optimization bug * @@ -360,7 +363,7 @@ NLM_EXTERN void AsnEnBinInteger (Int4 theInt, AsnIoPtr aip, AsnTypePtr atp) { for (i = 0; i < 3; i++) octets[i] = octets[i+1]; -// dirty workaround of an optimization bug of MSVC++.NET compiler +/* dirty workaround of an optimization bug of MSVC++.NET compiler */ #if defined(_MSC_VER) # if _MSC_VER < 1300 octets[3] = 0; @@ -424,7 +427,7 @@ NLM_EXTERN void AsnEnBinBigInt (Int8 theInt, AsnIoPtr aip, AsnTypePtr atp) { for (i = 0; i < 7; i++) octets[i] = octets[i+1]; -// dirty workaround of an optimization bug of MSVC++.NET compiler +/* dirty workaround of an optimization bug of MSVC++.NET compiler */ #if defined(_MSC_VER) # if _MSC_VER < 1300 octets[7] = 0; diff --git a/asnlib/asnprint.c b/asnlib/asnprint.c index 5328c5c4..5d142c66 100644 --- a/asnlib/asnprint.c +++ b/asnlib/asnprint.c @@ -29,7 +29,7 @@ * * Version Creation Date: 3/4/91 * -* $Revision: 6.18 $ +* $Revision: 6.20 $ * * File Description: * Routines for printing ASN.1 value notation (text) messages and @@ -42,6 +42,12 @@ * 3/4/91 Kans Stricter typecasting for GNU C and C++ * * $Log: asnprint.c,v $ +* Revision 6.20 2003/12/03 19:31:09 gouriano +* Corrected DTD generation (a different approach) +* +* Revision 6.19 2003/12/02 19:52:48 gouriano +* Corrected DTD generation +* * Revision 6.18 2003/09/15 16:16:32 kans * added AsnWriteEx, AsnTxtWriteEx, and AsnPrintStream * @@ -1901,7 +1907,7 @@ static void AsnXMLElementStart(AsnTypePtr atp, AsnIoPtr aip) AsnPrintString(GetXMLname(atp), aip); - atp2 = AsnFindBaseType(atp); + atp2 = AsnFindBaseTypeDTD(atp); if (atp2 == atp) { if ((isa == ENUM_TYPE) || (isa == BOOLEAN_TYPE) || @@ -2351,7 +2357,8 @@ static Boolean AsnPrintTypeXML (AsnTypePtr atp, AsnIoPtr aip) if ((atp->optional) || (atp->hasdefault)) repeat = "*"; else - repeat = "+"; + repeat = "*"; +// repeat = "+"; AsnXMLElementAdd(NULL, atp->branch, repeat, aip, FALSE); break; case INTEGER_TYPE: @@ -2483,7 +2490,7 @@ static Boolean AsnPrintTypeXML (AsnTypePtr atp, AsnIoPtr aip) } else /* primitive.. all text */ { - atp2 = AsnFindBaseType(atp); + atp2 = AsnFindBaseTypeDTD(atp); if (atp2 != NULL) { isa = AsnFindBaseIsa(atp); diff --git a/asnlib/asntypes.c b/asnlib/asntypes.c index 11015913..cfce072c 100644 --- a/asnlib/asntypes.c +++ b/asnlib/asntypes.c @@ -29,7 +29,7 @@ * * Version Creation Date: 3/4/91 * -* $Revision: 6.6 $ +* $Revision: 6.9 $ * * File Description: * Routines to deal with internal operations on AsnType objects. @@ -43,6 +43,15 @@ * 02-24-94 Schuler Make AsnTypeStringToHex LIBCALL too * * $Log: asntypes.c,v $ +* Revision 6.9 2003/12/03 19:31:09 gouriano +* Corrected DTD generation (a different approach) +* +* Revision 6.8 2003/12/02 21:40:17 gouriano +* Revert back to rev 6.6 +* +* Revision 6.7 2003/12/02 19:52:49 gouriano +* Corrected DTD generation +* * Revision 6.6 2000/07/25 20:30:58 ostell * added support for printing multiple ASN.1 modules as multiple XML DTD and .mod files * @@ -233,6 +242,21 @@ NLM_EXTERN AsnTypePtr LIBCALL AsnFindBaseType (AsnTypePtr atp) return atp; } +NLM_EXTERN AsnTypePtr LIBCALL AsnFindBaseTypeDTD (AsnTypePtr atp) +{ + if (atp == NULL) return NULL; + + if (atp->type == NULL) return NULL; + + if (! ISA_BASETYPE(atp->type->isa)) + { + atp = atp->type; + if (atp->type == NULL) /* not found */ + return atp; + } + return atp; +} + /***************************************************************************** * * Int2 AsnFindBaseIsa(atp) @@ -906,7 +930,7 @@ static void AddXMLname(AsnTypePtr atp, AsnTypePtr PNTR typestack, Int2 stackptr) isa = AsnFindBaseIsa(atp2); if ((doitem) && ((isa == SEQOF_TYPE) || (isa == SETOF_TYPE))) { - atp2 = AsnFindBaseType(atp); + atp2 = AsnFindBaseTypeDTD(atp); if (atp2 != NULL) { if (atp2->name == NULL) @@ -957,12 +981,12 @@ static void AddXMLname(AsnTypePtr atp, AsnTypePtr PNTR typestack, Int2 stackptr) for (i = (stackptr - 1); (i >= 0) && (! found); i--) { - atp2 = AsnFindBaseType(typestack[i]); + atp2 = AsnFindBaseTypeDTD(typestack[i]); if ((atp2 != NULL) && (atp2->name != NULL) && (IS_UPPER(*(atp2->name)))) { while (i < stackptr) { - atp2 = AsnFindBaseType(typestack[i]); + atp2 = AsnFindBaseTypeDTD(typestack[i]); if (atp2->name == NULL) tmp = StringMove(tmp, "E"); else @@ -991,7 +1015,7 @@ static void AddXMLname(AsnTypePtr atp, AsnTypePtr PNTR typestack, Int2 stackptr) } } - atp2 = AsnFindBaseType(atp); + atp2 = AsnFindBaseTypeDTD(atp); if ((! atp->imported) && (atp2 != NULL) && (atp2->type != NULL)) { isa = atp2->type->isa; |