[esnacc-dev] [PATCH] cxx-lib: PrintXML cleanups

Aaron Conole aconole at bytheb.org
Tue Nov 29 20:35:49 UTC 2016


Most of the xml output was _close_ to Basic-XER; this commit brings
it more inline.  A future commit will add c-lib basic XER support as well.
Basic-XDR will need to wait until a suitable XML library is written.

Signed-off-by: Aaron Conole <aconole at bytheb.org>
---
 compiler/back-ends/c++-gen/gen-code.c | 324 +++++--------
 cxx-examples/src/main.cpp             |   2 +-
 cxx-lib/inc/asn-incl.h                | 120 +++--
 cxx-lib/inc/asn-listset.h             |   4 +-
 cxx-lib/src/asn-any.cpp               |  16 +-
 cxx-lib/src/asn-bool.cpp              |  13 +-
 cxx-lib/src/asn-int.cpp               | 858 ++++++++--------------------------
 cxx-lib/src/asn-null.cpp              |  12 +-
 cxx-lib/src/asn-octs.cpp              |  11 +-
 cxx-lib/src/asn-real.cpp              |  11 +-
 snacc.h                               |   9 -
 11 files changed, 435 insertions(+), 945 deletions(-)

diff --git a/compiler/back-ends/c++-gen/gen-code.c b/compiler/back-ends/c++-gen/gen-code.c
index a7fb29c..37e0269 100644
--- a/compiler/back-ends/c++-gen/gen-code.c
+++ b/compiler/back-ends/c++-gen/gen-code.c
@@ -527,7 +527,6 @@ PrintCxxTagAndLenList PARAMS ((src, t, tagList, lenVarName, bufVarName),
     char *classStr;
     char *formStr;
     Tag *tg;
-    Tag *last;
     int tagLen;
     int isShort;
 
@@ -544,7 +543,6 @@ PrintCxxTagAndLenList PARAMS ((src, t, tagList, lenVarName, bufVarName),
     /*
      * since encoding backward encode tags backwards
      */
-    last = (Tag*)LAST_LIST_ELMT (tagList);
     FOR_EACH_LIST_ELMT_RVS (tg, tagList)
     {
         classStr = Class2ClassStr (tg->tclass);
@@ -1163,40 +1161,42 @@ PrintCxxChoiceDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m, CxxRul
     /* print clone routine for ANY mgmt */
     PrintCloneMethod (hdr, src, td);
 
-    fprintf (hdr, "  %s		&operator = (const %s &that);\n", td->cxxTypeDefInfo->className, td->cxxTypeDefInfo->className);
-    fprintf (src, "%s &%s::operator = (const %s &that)\n", td->cxxTypeDefInfo->className, td->cxxTypeDefInfo->className, td->cxxTypeDefInfo->className);
+    fprintf (hdr, "  %s		&operator = (const %s &that);\n",
+             td->cxxTypeDefInfo->className, td->cxxTypeDefInfo->className);
+    fprintf (src, "%s &%s::operator = (const %s &that)\n",
+             td->cxxTypeDefInfo->className,
+             td->cxxTypeDefInfo->className,
+             td->cxxTypeDefInfo->className);
     fprintf (src, "{\n");
-    fprintf (src, "  if (this != &that)\n");
-    fprintf (src, "  {\n");
-    fprintf (src, "    Clear();\n");
+    fprintf (src, "    if (this != &that) {\n");
+    fprintf (src, "        Clear();\n");
    
     e = FIRST_LIST_ELMT (choice->basicType->a.choice);
-    fprintf (src, "    // Check first type in choice to determine if choice is empty\n");
-    fprintf (src, "    if (that.%s != NULL)\n", e->type->cxxTypeRefInfo->fieldName);
-    fprintf (src, "    {\n");
-    fprintf (src, "       switch (choiceId = that.choiceId)\n");
-    fprintf (src, "       {\n");
-
-    FOR_EACH_LIST_ELMT (e, choice->basicType->a.choice)
-    {
-	   fprintf (src, "         case %s:\n", e->type->cxxTypeRefInfo->choiceIdSymbol);
-	   if (e->type->cxxTypeRefInfo->isPtr)
-	   {
-           fprintf (src, "           %s = new %s(*that.%s);\n", e->type->cxxTypeRefInfo->fieldName, e->type->cxxTypeRefInfo->className,
-                    e->type->cxxTypeRefInfo->fieldName);
-       }
-	   else
-       {
-         fprintf (src, "           %s = that.%s;\n", e->type->cxxTypeRefInfo->fieldName, e->type->cxxTypeRefInfo->fieldName);
-       }
-	   fprintf (src, "           break;\n");
+    fprintf (src, "        if (that.%s != NULL) {\n",
+             e->type->cxxTypeRefInfo->fieldName);
+        fprintf (src, "            switch (choiceId = that.choiceId) {\n");
+
+    FOR_EACH_LIST_ELMT (e, choice->basicType->a.choice) {
+        fprintf (src, "                case %s:\n",
+                 e->type->cxxTypeRefInfo->choiceIdSymbol);
+        if (e->type->cxxTypeRefInfo->isPtr) {
+            fprintf (src, "                    %s = new %s(*that.%s);\n",
+                     e->type->cxxTypeRefInfo->fieldName,
+                     e->type->cxxTypeRefInfo->className,
+                     e->type->cxxTypeRefInfo->fieldName);
+        } else {
+            fprintf (src, "                    %s = that.%s;\n",
+                     e->type->cxxTypeRefInfo->fieldName,
+                     e->type->cxxTypeRefInfo->fieldName);
+        }
+        fprintf (src, "                break;\n");
     }
 
-    fprintf (src, "       }// end of switch\n");
-    fprintf (src, "     }// end of if\n");
-    fprintf (src, "  }\n");
+    fprintf (src, "            }\n");
+    fprintf (src, "        }\n");
+    fprintf (src, "    }\n");
     fprintf (src, "\n");
-    fprintf (src, "  return *this;\n");
+    fprintf (src, "    return *this;\n");
     fprintf (src, "}\n\n");
 
     /* BerEncodeContent */
@@ -1889,65 +1889,42 @@ PrintCxxChoiceDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m, CxxRul
         fprintf (src, "\t} // end of switch\n");
 
         fprintf (src, "} // end of %s::Print()\n\n", td->cxxTypeDefInfo->className);
-        /* ################################################################## */
-         
-        /* RWC;1/12/00; ADDED XML output capability. */
-        fprintf (hdr, "  void			PrintXML (std::ostream &os, const char *lpszTitle=NULL) const;\n");
 
-        fprintf (src, "void %s::PrintXML (std::ostream &os, const char *lpszTitle) const\n", td->cxxTypeDefInfo->className);
-        fprintf (src, "{\n");
-        fprintf (src, "  if (lpszTitle)\n");
-        fprintf (src, "  {\n");
-        fprintf (src, "     os << \"<\" << lpszTitle;\n");
-        fprintf (src, "        os << \" typeName=\\\"%s\\\" type=\\\"CHOICE\\\">\";\n", td->cxxTypeDefInfo->className);
-        fprintf (src, "  }\n");
-        fprintf (src, "  else\n");
-        fprintf (src, "        os << \"<%s type=\\\"CHOICE\\\">\";\n", td->cxxTypeDefInfo->className);
-        fprintf (src, "  switch (choiceId)\n");
-        fprintf (src, "  {\n");
+        fprintf(hdr, "  void			PrintXML (std::ostream &os, const char *lpszTitle=NULL) const;\n");
+
+        fprintf(src, "void %s::PrintXML (std::ostream &os, const char *lpszTitle) const\n", td->cxxTypeDefInfo->className);
+        fprintf(src, "{\n");
+        fprintf(src, "    const char *tagName = typeName();\n");
+        fprintf(src, "    if (lpszTitle)\n");
+        fprintf(src, "        tagName = lpszTitle;");
+        fprintf(src, "    os << \"<\" << tagName << \">\";\n");
+        fprintf(src, "    switch (choiceId) {\n");
 
         FOR_EACH_LIST_ELMT (e, choice->basicType->a.choice)
         {
-            fprintf (src, "    case %s:\n", e->type->cxxTypeRefInfo->choiceIdSymbol);
+            fprintf(src, "    case %s:\n",
+                     e->type->cxxTypeRefInfo->choiceIdSymbol);
 
             /* value notation so print the choice elmts field name */
             if (e->type->cxxTypeRefInfo->isPtr)
             {
-                fprintf (src, "      if (%s)\n", e->type->cxxTypeRefInfo->fieldName);
-                fprintf (src, "        %s->PrintXML(os", e->type->cxxTypeRefInfo->fieldName);
+                fprintf(src, "       if (%s) {\n",
+                        e->type->cxxTypeRefInfo->fieldName);
+                fprintf(src, "           %s->PrintXML(os", e->type->cxxTypeRefInfo->fieldName);
                 if (e->fieldName != NULL)
-                   fprintf (src, ",\"%s\");\n", e->fieldName);
+                   fprintf(src, ",\"%s\");\n", e->fieldName);
                 else
-                   fprintf (src, ");\n");
-                fprintf (src, "      else\n");
-                fprintf (src, "      {\n");
+                   fprintf(src, ");\n");
+                fprintf(src, "      }\n");
+            } else
+                fprintf(src, "      %s.PrintXML(os, \"%s\");\n",
+                        e->type->cxxTypeRefInfo->fieldName, e->fieldName);
 
-                if (e->fieldName != NULL)
-                {
-                    fprintf (src, "        os << \"<%s -- void3 -- /%s>\" << std::endl;\n", e->fieldName, e->fieldName);
-                }
-                else
-                {
-                    fprintf (src, "        os << \"<%s -- void3 -- /%s>\" << std::endl;\n", 
-                             e->type->cxxTypeRefInfo->fieldName, e->type->cxxTypeRefInfo->fieldName);
-                }
-                
-                fprintf (src, "      }\n");
-            }
-            else
-                fprintf (src, "      %s.PrintXML(os, \"%s\");\n", e->type->cxxTypeRefInfo->fieldName, e->fieldName);
-
-            fprintf (src, "      break;\n\n");
+            fprintf(src, "      break;\n\n");
         }
-        fprintf (src, "  } // end of switch\n");
-        fprintf (src, "  if (lpszTitle)\n");
-        fprintf (src, "     os << \"</\" << lpszTitle << \">\";\n");
-        fprintf (src, "  else\n");
-        fprintf (src, "        os << \"</%s>\";\n", td->cxxTypeDefInfo->className);
+        fprintf (src, "    } // end of switch\n");
+        fprintf (src, "    os << \"</\" << tagName << \">\";\n");
         fprintf (src, "} // %s::PrintXML\n\n", td->cxxTypeDefInfo->className);
-        
-        /* END XML Print capability. */
-        /* ################################################################## */
     }
     /* end of Print Method code */
 
@@ -1961,7 +1938,8 @@ PrintCxxChoiceDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m, CxxRul
 
 static void
 PrintCxxSeqDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
-    CxxRules *r ,TypeDef *td, Type *parent, Type *seq, int novolatilefuncs)
+                    CxxRules *r ,TypeDef *td, Type *parent ESNACC_UNUSED,
+                    Type *seq, int novolatilefuncs ESNACC_UNUSED)
 {
     NamedType *e;
     char *classStr;
@@ -1979,7 +1957,6 @@ PrintCxxSeqDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
     enum BasicTypeChoiceId tmpTypeId;
     NamedType *defByNamedType;
     NamedType *tmpElmt;
-    int allOpt;
 
     // DEFINE PER encode/decode tmp vars.
     NamedType **pSeqElementNamedType=NULL;
@@ -2939,87 +2916,50 @@ PrintCxxSeqDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
     if (printPrintersG)
 	{
 		PrintCxxSeqSetPrintFunction(src, hdr, td->cxxTypeDefInfo->className,
-			seq->basicType);
+                                    seq->basicType);
 
-        /* ##################################################################
-          RWC;1/12/00; ADDED XML output capability. */
-
-        fprintf (hdr, "  void		PrintXML (std::ostream &os, const char *lpszTitle=NULL) const;\n");
-        fprintf (src,"void %s::PrintXML (std::ostream &os, \n", td->cxxTypeDefInfo->className);
-        fprintf (src,"                   const char *lpszTitle) const\n");
-        fprintf (src, "{\n");
-        allOpt = AllElmtsOptional (seq->basicType->a.sequence);
-        fprintf (src, "  if (lpszTitle)\n");
-        fprintf (src, "  {\n");
-        fprintf (src, "     os << \"<\" << lpszTitle;\n");
-        fprintf (src, "     if (typeName() && strlen(typeName()))\n");
-        fprintf (src, "     {\n");
-        fprintf (src, "        os << \" typeName=\\\"\" << typeName() << \"\\\"\";\n");
-        fprintf (src, "     }\n");
-        fprintf (src, "  }\n");
-        fprintf (src, "  else\n");
-        fprintf (src, "  {\n");
-        fprintf (src, "     os << \"<NONE\";\n");
-        fprintf (src, "  }\n");
-        fprintf (src, "  if (typeName() && strlen(typeName()))\n");
-        fprintf (src, "  {\n");
-        fprintf (src, "     if (typeName() && strlen(typeName()))\n");
-        fprintf (src, "     {\n");
-        fprintf (src, "        os << \"<\" << typeName();\n");
-        fprintf (src, "     }\n");
-        fprintf (src, "  }\n");
-        fprintf (src, " os << \" type=\\\"SEQUENCE\\\">\" << std::endl;\n");
-        FOR_EACH_LIST_ELMT (e, seq->basicType->a.sequence)
-        {
-          inTailOptElmts = IsTailOptional (seq->basicType->a.sequence);
-          if (e->type->cxxTypeRefInfo->isPtr)
-          {
-             fprintf (src, "  if (%s (%s))\n", cxxtri->optTestRoutineName, 
-                      e->type->cxxTypeRefInfo->fieldName);
-             fprintf (src, "  {\n");
-             fprintf (src, "    %s->PrintXML(os", 
-                      e->type->cxxTypeRefInfo->fieldName);
-
-             if (e->fieldName != NULL)
-                 fprintf (src, ", \"%s\"", e->fieldName);
-                   
-             fprintf (src, ");\n");
-             fprintf (src, "  }\n");
-          }
-          else
-          {
-             fprintf (src, "    %s.PrintXML(os", e->type->cxxTypeRefInfo->fieldName);
-             if (e->fieldName != NULL)
-                fprintf (src, ", \"%s\"", e->fieldName);
-             fprintf (src, ");\n");
-          }
-          fprintf (src, "\n");
+        fprintf(hdr, "  void		PrintXML (std::ostream &os, const char *lpszTitle=NULL) const;\n");
+        fprintf(src, "void %s::PrintXML (std::ostream &os, const char *lpszTitle) const\n",
+                 td->cxxTypeDefInfo->className);
+        fprintf(src, "{\n");
+        fprintf(src, "    const char *tagName = typeName();\n");
+        fprintf(src, "    if (lpszTitle)\n");
+        fprintf(src, "        tagName = lpszTitle;\n");
+        fprintf(src, "    os << \"<\" << tagName << \">\";\n");
+
+        FOR_EACH_LIST_ELMT (e, seq->basicType->a.sequence) {
+            inTailOptElmts = IsTailOptional(seq->basicType->a.sequence);
+            if (e->type->cxxTypeRefInfo->isPtr) {
+                fprintf(src, "    if (%s (%s)) {\n",
+                        cxxtri->optTestRoutineName,
+                        e->type->cxxTypeRefInfo->fieldName);
+                fprintf(src, "        %s->",
+                        e->type->cxxTypeRefInfo->fieldName);
+            } else {
+                fprintf(src, "    %s.", e->type->cxxTypeRefInfo->fieldName);
+            }
+            fprintf(src, "PrintXML(os");
+            if (e->fieldName != NULL)
+                fprintf(src, ", \"%s\"", e->fieldName);
+            fprintf(src, ");\n");
+            if (e->type->cxxTypeRefInfo->isPtr)
+                fprintf(src, "    }\n");
+            fprintf(src, "\n");
         }
-        fprintf (src, "  if (lpszTitle)\n");
-        fprintf (src, "  {\n");
-        fprintf (src, "     os << \"</\" << lpszTitle << \">\" << std::endl;\n");
-        fprintf (src, "  }\n");
-        fprintf (src, "  else\n");
-        fprintf (src, "     if (typeName() && strlen(typeName()))\n");
-        fprintf (src, "     {\n");
-        fprintf (src, "        os << \"</\" << typeName() << \">\" << std::endl;\n");
-        fprintf (src, "     }\n");
-        fprintf (src, "} // %s::PrintXML\n\n\n", td->cxxTypeDefInfo->className);
-       /* END XML Print capability.
-       ################################################################## */
+        fprintf(src, "    os << \"</\" << tagName << \">\";\n");
+        fprintf(src, "} // %s::PrintXML\n\n\n", td->cxxTypeDefInfo->className);
     }
     /* end of print method code printer */
 
     /* close class definition */
     fprintf (hdr, "};\n\n\n");
-	novolatilefuncs = novolatilefuncs;
-    parent=parent; /*AVOIDS warning.*/
 } /* PrintCxxSeqDefCode */
 
 
 static void
 PrintCxxSetDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
-    CxxRules *r, TypeDef *td, Type *parent, Type *set, int novolatilefuncs)
+                    CxxRules *r, TypeDef *td, Type *parent ESNACC_UNUSED,
+                    Type *set, int novolatilefuncs ESNACC_UNUSED)
 {
     NamedType *e;
     char *classStr;
@@ -3034,11 +2974,9 @@ PrintCxxSetDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
     int elmtLevel=0;
     int varCount, tmpVarCount;
     int stoleChoiceTags;
-    int inTailOptElmts;
     int mandatoryElmtCount;
     enum BasicTypeChoiceId tmpTypeId;
     NamedType *defByNamedType;
-    int allOpt;
 
     // DEFINE PER encode/decode tmp vars.
     int *pSetElementTag=NULL;
@@ -3057,7 +2995,7 @@ PrintCxxSetDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
     /* write out the set elmts */
     FOR_EACH_LIST_ELMT (e, set->basicType->a.set)
     {		
-        fprintf (hdr, "  ");
+        fprintf (hdr, "    ");
     
 		/* JKG 7/31/03 */
 		/*The following code enclosed in this if/else statement */
@@ -3105,11 +3043,11 @@ PrintCxxSetDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
 
     /* Default constructor
 	*/
-    fprintf (hdr, "   %s(){Init();}\n", td->cxxTypeDefInfo->className);
+    fprintf (hdr, "     %s() { Init(); }\n", td->cxxTypeDefInfo->className);
 
 	/* Init() member function
 	 */
-	fprintf (hdr, "   void Init(void);\n");
+	fprintf (hdr, "     void Init(void);\n");
     fprintf (src, "void %s::Init(void)\n", td->cxxTypeDefInfo->className);
     fprintf (src, "{\n");
     FOR_EACH_LIST_ELMT (e, set->basicType->a.set)
@@ -3810,66 +3748,42 @@ PrintCxxSetDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
 		PrintCxxSeqSetPrintFunction(src, hdr, td->cxxTypeDefInfo->className,
 			set->basicType);
 
-         /* ##################################################################
-           RWC;1/12/00; ADDED XML output capability. */
-        fprintf (hdr, "  void PrintXML (std::ostream &os, const char *lpszTitle=NULL) const;\n");
-        fprintf (src, "void %s::PrintXML (std::ostream &os, const char *lpszTitle) const\n", td->cxxTypeDefInfo->className);
-        fprintf (src, "{\n");
-
-        allOpt = AllElmtsOptional (set->basicType->a.set);
-        fprintf (src, "  if (lpszTitle)\n");
-        fprintf (src, "  {\n");
-        fprintf (src, "     os << \"<\" << lpszTitle;\n");
-        fprintf (src, "     os << \" typeName=\\\"%s\\\" type=\\\"SET\\\">\" << std::endl;\n", td->cxxTypeDefInfo->className);
-        fprintf (src, "  }\n");
-        fprintf (src, "  else\n");
-        fprintf (src, "     os << \"<%s type=\\\"SET\\\">\" << std::endl;\n", td->cxxTypeDefInfo->className);
-        FOR_EACH_LIST_ELMT (e, set->basicType->a.set)
-        {
-            inTailOptElmts = IsTailOptional (set->basicType->a.set);
-            if (e->type->cxxTypeRefInfo->isPtr)
-                fprintf (src, "  if (%s (%s))\n", cxxtri->optTestRoutineName, e->type->cxxTypeRefInfo->fieldName);
-            fprintf (src, "  {\n");
-            if (e->type->cxxTypeRefInfo->isPtr)
-            {
-                fprintf (src, "    (*%s).PrintXML(os", e->type->cxxTypeRefInfo->fieldName);
-                if (e->fieldName != NULL)
-                   fprintf (src, ", \"%s\"", e->fieldName);
-                fprintf (src, ");\n");
-            }
-            else
-            {
-                fprintf (src, "    %s.PrintXML(os", e->type->cxxTypeRefInfo->fieldName);
-                if (e->fieldName != NULL)
-                   fprintf (src, ", \"%s\"", e->fieldName);
-                fprintf (src, ");\n");
+        fprintf(hdr, "    void PrintXML (std::ostream &os, const char *lpszTitle=NULL) const;\n");
+        fprintf(src,
+                "void %s::PrintXML (std::ostream &os, const char *lpszTitle) const\n",
+                td->cxxTypeDefInfo->className);
+        fprintf(src, "{\n");
+        fprintf(src, "    const char *tagName = typeName();\n");
+        fprintf(src, "    if (lpszTitle) {\n");
+        fprintf(src, "        tagName = lpszTitle;\n");
+        fprintf(src, "    os << \"<\" << tagName << \">\";\n",
+                td->cxxTypeDefInfo->className);
+        FOR_EACH_LIST_ELMT (e, set->basicType->a.set) {
+            const char *fieldString = "%s";
+            if (e->type->cxxTypeRefInfo->isPtr) {
+                fprintf(src, "    if (%s (%s)) {\n",
+                        cxxtri->optTestRoutineName,
+                        e->type->cxxTypeRefInfo->fieldName);
+                fprintf(src, "        %s->",
+                        e->type->cxxTypeRefInfo->fieldName);
+            } else {
+                fprintf(src, "    %s.",
+                        e->type->cxxTypeRefInfo->fieldName);
             }
-            fprintf (src, "  }\n");
+            fprintf(src, "PrintXML(os");
+            if (e->fieldName != NULL)
+                fprintf(src, ", \"%s\"", e->fieldName);
+            fprintf (src, ");\n");
             if (e->type->cxxTypeRefInfo->isPtr)
-            {
-               fprintf (src, "  else\n");
-               if (e->fieldName)
-                  fprintf (src, "        os << \"<%s -- void2 -- />\" << std::endl;\n", e->fieldName);
-               else
-                  fprintf (src, "        os << \"<%s -- void2 -- />\" << std::endl;\n", e->type->cxxTypeRefInfo->fieldName);
-            }
-            fprintf (src, "\n");
-
+                fprintf(src, "    }\n");
         }      /* END For each set element */
-        fprintf (src, "  if (lpszTitle)\n");
-        fprintf (src, "     os << \"</\" << lpszTitle << \">\" << std::endl;\n");
-        fprintf (src, "  else\n");
-        fprintf (src, "     os << \"</%s>\" << std::endl;\n", td->cxxTypeDefInfo->className);
-        fprintf (src, "} // %s::PrintXML\n\n\n", td->cxxTypeDefInfo->className);
-        /* END XML Print capability.
-        ################################################################## */
+        fprintf(src, "    os << \"</\" << tagName << \">\";\n");
+        fprintf(src, "} // %s::PrintXML\n\n\n", td->cxxTypeDefInfo->className);
     }
     /* end of print method code */
 
     /* close class definition */
-    fprintf (hdr, "};\n\n\n");
-	novolatilefuncs = novolatilefuncs;
-    parent=parent; /*AVOIDS warning.*/
+    fprintf(hdr, "};\n\n\n");
 } /* PrintCxxSetDefCode */
 
 
diff --git a/cxx-examples/src/main.cpp b/cxx-examples/src/main.cpp
index d650d6e..0fcc67e 100644
--- a/cxx-examples/src/main.cpp
+++ b/cxx-examples/src/main.cpp
@@ -131,7 +131,7 @@ void fillTest(void)
 
         std::cout << std::endl;
 
-        octs.Print(std::cout);
+        octs.PrintXML(std::cout);
 
         std::cout << std::endl; 
         std::cout << len;
diff --git a/cxx-lib/inc/asn-incl.h b/cxx-lib/inc/asn-incl.h
index 7270f28..de78f45 100644
--- a/cxx-lib/inc/asn-incl.h
+++ b/cxx-lib/inc/asn-incl.h
@@ -10,6 +10,7 @@
 
 #include "asn-config.h"
 #include "asn-buf.h"
+#include "snaccexcept.h"
 
 #ifdef WIN32
 #if defined(_MSC_VER)
@@ -606,66 +607,97 @@ extern SNACCDLL_API char	numToHexCharTblG[];
 
 class SNACCDLL_API AsnInt : public AsnType, protected PERGeneral
 {
-protected:
+ protected:
 
-   unsigned char *m_bytes;
-   unsigned long  m_len;
+    unsigned char *m_bytes;
+    unsigned long  m_len;
    
-   void storeDERInteger(const unsigned char *pDataCopy, long dataLen, bool unsignedFlag);
-
-   void		Clear(){if(m_bytes) delete[] m_bytes; /*RWC*/ m_bytes = NULL; m_len = 0;}
-   long		lEncLen()const{return length();}
-   char		getByte(long offset)const{return m_bytes[offset];}
-   void		putByte(long offset, unsigned char cByte);
+    void storeDERInteger(const unsigned char *pDataCopy, long dataLen,
+                         bool unsignedFlag);
+    void Clear() { delete [] m_bytes; m_bytes = NULL; m_len = 0; }
+    long lEncLen() const { return length(); }
+    char getByte(long offset) const { return m_bytes[offset]; }
+    void putByte(long offset, unsigned char cByte);
 
-   virtual AsnLen	Interpret(AsnBufBits &b,long offset)const;
-   virtual void		Deterpret(AsnBufBits &b, AsnLen &bitsDecoded, long offset);
-   virtual void		Allocate(long size);
+    virtual AsnLen Interpret(AsnBufBits &b,long offset)const;
+    virtual void Deterpret(AsnBufBits &b, AsnLen &bitsDecoded, long offset);
+    virtual void Allocate(long size);
 
 public:
    AsnInt (AsnIntType val=0);
    AsnInt (const char *str, bool unsignedFlag = true);
    AsnInt (const AsnOcts &o, bool unsignedFlag = true);
    AsnInt (const char *str, const size_t len, bool unsignedFlag = true);
-   AsnInt (const AsnInt &that);//generate this
+   AsnInt (const AsnInt &that);
    virtual ~AsnInt ();
 
-   virtual  const ValueRange* ValueRanges(int &sizeVRList)const { sizeVRList = 0; return NULL;}
+   virtual const ValueRange* ValueRanges(int &sizeVRList) const
+   { sizeVRList = 0; return NULL; }
       
-   virtual AsnType* Clone() const				{ return new AsnInt(*this); }
-   virtual const char* typeName() const			{ return "AsnInt"; }
-    
-   operator AsnIntType() const;
-   bool        operator == (AsnIntType o) const;
-   bool        operator != (AsnIntType o) const		{ return !operator==(o);}
-   bool        operator == (const AsnInt &o) const;
-   bool        operator != (const AsnInt &o) const;
-   bool        operator < (const AsnInt &o) const;
-   AsnInt &    operator = (const AsnInt &o);//generate this
-   //unsigned char*  Append_m_bytes(const unsigned char* AppendBytes, unsigned long templen);    
-  
-   long		length()const{ return m_len; }
-   long		length(void){ return m_len; }
-   const unsigned char * c_str(void) const { return m_bytes; }
-   void		getPadded(unsigned char *&data, size_t &len, const size_t padToSize=0) const;
-
-   int		checkConstraints (ConstraintFailList* pConstraintFails)const;
-
-   void        Set(const unsigned char *str, size_t len, bool unsignedFlag=true);
-   void        Set(AsnIntType i);
+   virtual AsnType* Clone() const { return new AsnInt(*this); }
+   virtual const char* typeName() const { return "AsnInt"; }
+
+   template <typename int_t>
+   int_t toInteger() const
+   {
+       //FUNC("AsnInt::toInteger");
+
+       if (!m_bytes || m_len <= 0)
+           return 0;
+
+       int_t iResult = 0;
+
+       if (m_len > sizeof(int_t)) {
+           throw SNACCDLL_API
+               SnaccException("integer is too big for conversion to type",
+                              DECODE_ERROR);
+       }
+
+       // If big int is negative initialize result to -1
+       if ((m_bytes[0] >> 7 == 1)) {
+           iResult = -1;
+       }
+
+       for (unsigned int i = 0; i < m_len; i++)
+           iResult = (iResult << 8) | (AsnUIntType)(m_bytes[i]);
+       return iResult;
+   }
+
+   operator AsnIntType() const { return toInteger<AsnIntType>(); }
+   bool operator == (AsnIntType o) const;
+   bool operator != (AsnIntType o) const { return !operator==(o);}
+   bool operator == (const AsnInt &o) const;
+   bool operator != (const AsnInt &o) const;
+   bool operator < (const AsnInt &o) const;
+   AsnInt &operator = (const AsnInt &o);
+
+   long length() const { return m_len; }
+   long length(void) { return m_len; }
+   const unsigned char *c_str(void) const { return m_bytes; }
+   void getPadded(unsigned char *&data, size_t &len,
+                  const size_t padToSize=0) const;
+
+   int checkConstraints (ConstraintFailList* pConstraintFails) const;
+
+   void Set(const unsigned char *str, size_t len, bool unsignedFlag=true);
+   void Set(AsnIntType i);
 
    AsnLen         BEnc (AsnBuf &b) const;
    void           BDec (const AsnBuf &b, AsnLen &bytesDecoded);
    AsnLen         BEncContent (AsnBuf &b) const;
-   void           BDecContent (const AsnBuf &b, AsnTag tagId, AsnLen elmtLen, AsnLen &bytesDecoded);
-
-   virtual AsnLen PEnc (AsnBufBits &b)const;
-   AsnLen         PEncSemiConstrained (AsnBufBits &b, long lowerBound )const;
-   AsnLen		  PEncFullyConstrained (AsnBufBits &b, long lowerBound, long upperBound)const;
-   
-   void			  PDecSemiConstrained(AsnBufBits &b, long lowerBound, AsnLen &bitsDecoded);
-   void 		  PDecFullyConstrained (AsnBufBits &b, long lowerBound, long upperBound, AsnLen &bitsDecoded);
-   void			  PDec (AsnBufBits &b, AsnLen &bitsDecoded);
+   void           BDecContent (const AsnBuf &b, AsnTag tagId, AsnLen elmtLen,
+                               AsnLen &bytesDecoded);
+
+   virtual AsnLen PEnc (AsnBufBits &b) const;
+   AsnLen         PEncSemiConstrained(AsnBufBits &b, long lowerBound ) const;
+   AsnLen         PEncFullyConstrained(AsnBufBits &b, long lowerBound,
+                                       long upperBound) const;
+
+   void           PDecSemiConstrained(AsnBufBits &b, long lowerBound,
+                                      AsnLen &bitsDecoded);
+   void           PDecFullyConstrained(AsnBufBits &b, long lowerBound,
+                                       long upperBound, AsnLen &bitsDecoded);
+   void	          PDec(AsnBufBits &b, AsnLen &bitsDecoded);
 
 
    void      Print(std::ostream& os, unsigned short indent = 0) const;
diff --git a/cxx-lib/inc/asn-listset.h b/cxx-lib/inc/asn-listset.h
index 309fd98..96adc6c 100644
--- a/cxx-lib/inc/asn-listset.h
+++ b/cxx-lib/inc/asn-listset.h
@@ -8,6 +8,8 @@
 #ifndef SNACC_ASN_LISTSET_H
 #define SNACC_ASN_LISTSET_H
 
+#include "snacc.h"
+
 #ifdef _MSC_VER
 	#pragma warning(disable: 4786)		// Disable symbols truncated warning
 #endif
@@ -50,7 +52,7 @@ public:
 	virtual SNACC::SizeConstraint* SizeConstraints() const	{ return NULL; }
 //	virtual SNACC::SizeConstraint* SizeConstraints()		{ return NULL; }
 	
-	virtual void Allocate(long size)						{}
+	virtual void Allocate(long size ESNACC_UNUSED) {}
 	virtual void Clear()									{ this->clear(); }
 	virtual SNACC::AsnLen Interpret(SNACC::AsnBufBits& b, long offset) const;
 	virtual void Deterpret(SNACC::AsnBufBits& b, SNACC::AsnLen& bitsDecoded,
diff --git a/cxx-lib/src/asn-any.cpp b/cxx-lib/src/asn-any.cpp
index d0434c6..c06adf6 100644
--- a/cxx-lib/src/asn-any.cpp
+++ b/cxx-lib/src/asn-any.cpp
@@ -543,15 +543,13 @@ void AsnAny::Print(std::ostream& os, unsigned short indent) const
 
 void AsnAny::PrintXML (std::ostream &os, const char *lpszTitle) const 
 {
-   if (lpszTitle) 
-       os << "<" << lpszTitle << " type=\"ANY\">"; 
-   else
-       os << "<ANY>"; 
-   Print(os);
-   if (lpszTitle) 
-       os << "</" << lpszTitle << ">\n"; 
-   else
-       os << "</ANY>\n"; 
+    const char *tagName = typeName();
+
+    if (lpszTitle) tagName = lpszTitle;
+
+    os << "<" << tagName << ">";
+    Print(os);
+    os << "</" << tagName << ">\n";
 }
 
 AsnAny::~AsnAny()
diff --git a/cxx-lib/src/asn-bool.cpp b/cxx-lib/src/asn-bool.cpp
index f5cd4c8..9920f07 100644
--- a/cxx-lib/src/asn-bool.cpp
+++ b/cxx-lib/src/asn-bool.cpp
@@ -123,15 +123,18 @@ AsnLen AsnBool::BEncContent (AsnBuf &b) const
 // print the BOOLEAN's value in ASN.1 value notation to the given ostream
 void AsnBool::Print (std::ostream& os, unsigned short /*indent*/) const
 {
-	os << (value ? "TRUE" : "FALSE");
+	os << (value ? "true" : "false");
 }
 
 void AsnBool::PrintXML (std::ostream &os, const char *lpszTitle) const 
 {
-   os << "<BOOLEAN>"; 
-   if (lpszTitle) os << lpszTitle; 
-   os << "-"; 
-   Print(os); os << "</BOOLEAN>\n"; 
+    const char *tagName = typeName();
+    if (lpszTitle) {
+        tagName = lpszTitle;
+    }
+    os << "<" << tagName << ">";
+    Print(os);
+    os << "</" << tagName << ">";
 }
 
 char* AsnBool::checkBoolSingleVal(const bool m_SingleVal) const
diff --git a/cxx-lib/src/asn-int.cpp b/cxx-lib/src/asn-int.cpp
index 4c1a6bb..e0c210b 100644
--- a/cxx-lib/src/asn-int.cpp
+++ b/cxx-lib/src/asn-int.cpp
@@ -2,312 +2,18 @@
 //
 // MS 92/06/16
 // Copyright (C) 1992 Michael Sample and the University of British Columbia
+// Copyright (C) 2011-2015 Azimuth Systems, Inc.
+// Copyright (C) 2016 Red Hat, Inc
 //
 // This library is free software; you can redistribute it and/or
 // modify it provided that this copyright/license information is retained
 // in original form.
 //
-// If you modify this file, you must clearly indicate your changes.
-//
 // This source code 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.
-//
-
-// $Log: asn-int.cpp,v $
-// Revision 1.66  2004/03/25 19:20:16  gronej
-// fixed some linux warnings
-//
-// Revision 1.65  2004/03/22 19:38:13  leonberp
-// changed ConstraintErrorStringList to be const to avoid possible memory corruption
-//
-// Revision 1.64  2004/03/09 16:48:45  gronej
-// Updated c++ constraint checking capability and constraint error handling
-//
-// Revision 1.63  2004/03/01 15:50:45  gronej
-// Took out SetConstraints() and member variables for constraints, replaced with functions that return constraint lists
-//
-// Revision 1.62  2004/02/12 18:55:09  gronej
-// Stable SNACC
-// non optional choices, sets and sequences are now not pointers
-// merged with list code
-// all memory leaks within SNACC fixed
-//
-// Revision 1.61  2004/02/11 19:08:48  nicholar
-// Updated Print() function so no longer uses global indent
-//
-// Revision 1.60  2004/02/06 00:39:13  nicholar
-// Changed AsnList to use std::list<T> instead of List<T>
-//
-// Revision 1.59  2004/02/04 14:59:27  gronej
-// Fixed a TON of memory leaks
-//
-// Revision 1.58  2004/02/03 14:44:32  gronej
-// made all constraint lists static to avoid memory issues
-//
-// Revision 1.57  2003/12/17 19:05:03  gronej
-// SNACC baseline merged with PER v1_7 tag
-//
-
-// Revision 1.54.2.14  2003/12/15 18:43:50  gronej
-// EKMS PER Beta Release Files
-//
-// Revision 1.54.2.13  2003/12/09 21:20:50  gronej
-// Updated to pull working EKMS test space
-//
-// Revision 1.54.2.12  2003/12/04 20:47:10  gronej
-// Moved bAlign out of all PEnc calls and into AsnBufBits as a member
-// An AsnBufBits is now invoked with a bAlign parameter defaulted to false
-//
-// Revision 1.54.2.11  2003/12/03 19:48:08  gronej
-// Fixed bitsDecoded to return correct value on decode operations
-//
-// Revision 1.54.2.10  2003/12/02 18:33:43  gronej
-// Updated and debugged PER constraint logic for primitives
-//
-// Revision 1.54.2.9  2003/12/02 17:00:09  colestor
-// Fixed unsetf(...) of HEX setting when printing.
-//
-// Revision 1.54.2.8  2003/11/26 14:23:17  colestor
-// Fixed AsnInt initialization.
-//
-// Revision 1.54.2.7  2003/11/06 20:23:25  gronej
-// Updated PER compiler with working Interpret() and Deterpret() functionality for AsnInt and String Types
-//
-// Revision 1.54.2.6  2003/11/05 14:58:54  gronej
-// working PER code merged with esnacc_1_6
-//
-
-// Revision 1.54.2.5  2003/11/04 18:04:08  gronej
-// Update PER compiler with some PERGeneral functionality  11/04/03
-//
-// Revision 1.54.2.4  2003/11/04 14:21:21  gronej
-// Update PER compiler with some PERGeneral functionality  11/04/03
-//
-// Revision 1.54.2.3  2003/10/22 12:45:58  gronej
-// Updating PER compiler
-//
-// Revision 1.54.2.2  2003/10/02 17:15:24  gronej
-// Updating PER compiler
-//
-// Revision 1.54.2.1  2003/08/12 20:04:38  gronej
-// no message
-//
-
-
-// Revision 1.54  2003/03/28 14:10:16  leonberp
-// added pragmas to get rid of warnings
-//
-// Revision 1.53  2003/03/17 17:35:16  leonberp
-// fixed compile errors for HPUX
-//
-// Revision 1.52  2003/01/28 17:30:44  leonberp
-// added AsnInt copy constructor and operator=
-//
-// Revision 1.51  2003/01/28 14:23:22  leonberp
-// replaced memmove with memcpy
-//
-// Revision 1.50  2003/01/28 14:10:13  leonberp
-// Added AsnInt destructor
-//
-// Revision 1.49  2003/01/27 20:58:06  leonberp
-// enhanced to use dynamically allocated unsigned char[] and length instead of basic_string<> for performance reasons also removed obsolete code
-//
-// Revision 1.48  2003/01/06 16:20:07  leonberp
-// Changed BDec() and BDecContent() to use const AsnBufs
-//
-// Revision 1.47  2002/12/22 01:20:52  colestor
-// (RWC)Updated PrintXML(...) details to better match specification for SEQUENCE OF and SET OF logic.
-//
-// Revision 1.46  2002/12/19 18:17:54  colestor
-// (RWC)Updated to allow integer output as ASCII.
-//
-// Revision 1.45  2002/12/17 20:27:40  leonberp
-// made BEnc() and BEncContent() const
-//
-// Revision 1.44  2002/11/25 20:21:19  leonberp
-// added AsnBuf copy constructor
-//
-// Revision 1.43  2002/10/23 21:02:48  leonberp
-// fixed AsnBuf references and fixed clock skew problem
-//
-// Revision 1.42  2002/10/23 10:51:10  mcphersc
-// Changed BUF_TYPE to AsnBuf
-//
-// Revision 1.41  2002/10/21 19:49:50  leonberp
-// changes for Linux and GCC 3.2
-//
-// Revision 1.40  2002/10/01 19:43:06  vracarl
-// now using c_ustr
-//
-// Revision 1.39  2002/09/25 13:54:54  vracarl
-// made asn_buf fixes
-//
-// Revision 1.38  2002/09/16 20:06:47  vracarl
-// new asn-octs changes
-//
-// Revision 1.37  2002/08/21 16:48:07  vracarl
-// added a FUNC and throw and checks to make sure the decimal number isn't too large
-//
-// Revision 1.36  2002/08/19 18:14:43  vracarl
-// added code to construct an int from decimal format
-//
-// Revision 1.35  2002/07/17 17:30:09  leonberp
-// fixed for unix
-//
-// Revision 1.34  2002/07/17 14:29:47  vracarl
-// removed #include<string.h>
-//
-// Revision 1.33  2002/07/15 17:04:14  vracarl
-// moved an indefinite len check
-//
-// Revision 1.32  2002/07/12 19:59:21  nicholar
-// Fixed bug in AsnInt:storeDERInteger.
-// Enhanced AsnInt::operator==(AsnIntType i) function.
-//
-// Revision 1.31  2002/06/17 18:42:14  leonberp
-// yet another bug fix
-//
-// Revision 1.30  2002/06/17 18:25:50  leonberp
-// fixed bug again
-//
-// Revision 1.29  2002/06/17 17:20:46  leonberp
-// fixed AsnInt bug
-//
-// Revision 1.28  2002/06/17 16:37:58  leonberp
-// fixed AsnInt conversion operator code
-//
-// Revision 1.27  2002/06/13 15:47:03  leonberp
-// added c_str() and length() dumped get()
-//
-// Revision 1.26  2002/06/13 15:06:26  leonberp
-// added get() to AsnInt
-//
-// Revision 1.25  2002/06/12 21:29:56  leonberp
-// fixed Linux compile error
-//
-// Revision 1.24  2002/06/12 20:43:26  leonberp
-// new AsnInt class
-//
-// Revision 1.23  2002/05/21 14:07:02  nicholar
-// Removed warnings
-//
-// Revision 1.22  2002/05/10 16:39:35  leonberp
-// latest changes for release 2.2
-// includes integrating asn-useful into C & C++ runtime library, the compiler changes that go along with that, SnaccException changes for C++ runtime and compiler
-//
-// Revision 1.21  2002/03/25 19:32:16  vracarl
-// added an AsnInt constructor to handle str to hex conversions - still need to add binary
-//
-// Revision 1.20  2002/03/01 14:07:40  vracarl
-// typo
-//
-// Revision 1.19  2002/02/28 21:47:27  vracarl
-// added an INDEFINATE_LEN check on the primitive
-//
-// Revision 1.18  2002/02/12 14:42:34  rwc
-// Updates to fix the BigInteger Get Signed call to properly pre-load 0xff.  (Thank you james.bishop at jrc.it).
-// Also some Linux/Unix fixes.
-//
-// Revision 1.17  2002/02/11 15:54:04  leonberp
-// changed the conversion and comparison operators so that they'll work with const objects
-//
-// Revision 1.16  2001/11/14 22:39:21  sfl
-// Updated logic to accept BigIntegerStr with 1 in upper-most bit on decode.
-// This allows our lib to be more forgiving on older messages, not throw
-// an exception when all else would succeed..
-//
-// Revision 1.15  2001/10/29 12:04:56  nicholar
-// Replaced memcpy with memmove where needed
-//
-// Revision 1.14  2001/10/09 13:52:30  rwc
-// Memory leak testing updates.
-//
-// Revision 1.13  2001/09/21 20:16:20  rwc
-// Partial updates to start integration of Sign/Encrypt/Sign message processing.
-//
-// Revision 1.12  2001/09/21 18:01:08  rwc
-// Updated to properly return BigIntegerString processed buffer if count matches
-// precisely to expected value.  Previously, it simply returned, without copying
-// the input to the output as expected.
-//
-// Revision 1.11  2001/08/29 22:04:18  leonberp
-// enchanced Clone() to allocate a new pointe AND COPY the object
-//
-// Revision 1.10  2001/08/27 21:25:41  leonberp
-// I 'const' enchanced CSM_Buffer and update all code that references it
-//
-// Revision 1.9  2001/08/24 15:39:24  leonberp
-// Enchanced Print() and PrintXML()  #if'd out PrintXMLSupport()
-//
-// Revision 1.8  2001/07/19 16:02:51  sfl
-// Yet more string.h updates.
-//
-// Revision 1.7  2001/07/12 19:33:37  leonberp
-// Changed namespace to SNACC and added compiler options: -ns and -nons.  Also removed dead code.
-//
-// Revision 1.6  2001/06/28 21:38:28  rwc
-// Updated to remove referneces to vdacerr, which originally replaced the cerr standard error output.
-// Updated all references in macros and source that printed to vdacerr.  All code now performs an
-// ASN_THROW(...) exception.
-//
-// Revision 1.5  2001/06/28 15:29:47  rwc
-// ADDED "SNACCASN" namespace definition to all SNACC data structures.
-// This should not affect most applications since we do not have any name
-// conflicts.
-// ALSO, combined all ASN primitive data type includes into asn-incl.h.
-//
-// Revision 1.4  2001/06/18 17:47:43  rwc
-// Updated to reflect newly added C++ Exception error handling, instead of "C" longjmp and setjmp calls.
-// Changes made to both the compiler and the SNACC C++ run-time library.
-//
-// Revision 1.3  2001/06/12 14:40:57  rwc
-// Updates to add the SFL CSM_BigIntegerStr multi-byte integer logic to
-// AsnInt for SNACC primitive support.  The code has been tested for full
-// backward compatibility for integer assign/compare, etc.
-//
-// Revision 1.2  2000/10/16 18:10:37  rwc
-// removed most warnings from C++-lib, some C-lib.
-//
-// Revision 1.1.1.1  2000/08/21 20:36:08  leonberp
-// First CVS Version of SNACC.
-//
-// Revision 1.7  1997/02/28 13:39:45  wan
-// Modifications collected for new version 1.3: Bug fixes, tk4.2.
-//
-// Revision 1.6  1995/09/07 18:55:50  rj
-// (unsigned) long int replaced by newly introduced Asn(U)IntType at a lot of places.
-// they shall provide 32 bit integer types on all platforms.
-//
-// Revision 1.5  1995/07/24  20:17:32  rj
-// #if TCL ... #endif wrapped into #if META ... #endif
-//
-// call constructor with additional pdu and create arguments.
-//
-// changed `_' to `-' in file names.
-//
-// Revision 1.4  1995/02/18  16:48:05  rj
-// denote a long if we want a long
-//
-// Revision 1.3  1994/10/08  04:18:23  rj
-// code for meta structures added (provides information about the generated code itself).
-//
-// code for Tcl interface added (makes use of the above mentioned meta code).
-//
-// virtual inline functions (the destructor, the Clone() function, BEnc(), BDec() and Print()) moved from inc/*.h to src/*.C because g++ turns every one of them into a static non-inline function in every file where the .h file gets included.
-//
-// made Print() const (and some other, mainly comparison functions).
-//
-// several `unsigned long int' turned into `size_t'.
-//
-// Revision 1.2  1994/08/28  10:01:12  rj
-// comment leader fixed.
-//
-// Revision 1.1  1994/08/28  09:20:59  rj
-// first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
-
-// Revision 2.0  6/4/01 RWC; VDA 
-// Added logic to accommodate real ASN.1 multi-byte integers, not just 4 byte.
+// NOTE: Numerous amounts of history were removed from this.  The complete
+//       change is available at https://github.com/esnacc/esnacc-ng
 
 #include "asn-incl.h"
 
@@ -328,158 +34,128 @@
 
 _BEGIN_SNACC_NAMESPACE
 
-
-
 #if META
 
-const AsnIntTypeDesc AsnInt::_desc (NULL, NULL, false, AsnTypeDesc::INTEGER, NULL, NULL);
+const AsnIntTypeDesc AsnInt::_desc (NULL, NULL, false, AsnTypeDesc::INTEGER,
+                                    NULL, NULL);
 
 const AsnTypeDesc *AsnInt::_getdesc() const
 {
-  return &_desc;
+    return &_desc;
 }
 
 #if TCL
 
-#define RETURN_NAME_INSTEAD_OF_VALUE	0
-
 int AsnInt::TclGetVal (Tcl_Interp *interp) const
 {
-#if RETURN_NAME_INSTEAD_OF_VALUE
-  const AsnNameDesc *n = _getdesc()->getnames();
-  if (n)
-    for (; n->name; n++)
-      if (n->value == value)
-      {
-	Tcl_SetResult (interp, n->name, TCL_STATIC);
-	return TCL_OK;
-      }
-#endif
-
-  char buf[32];
-  sprintf (buf, "%d", value);
-  Tcl_SetResult (interp, buf, TCL_VOLATILE);
-  return TCL_OK;
+    char buf[32];
+    sprintf (buf, "%d", value);
+    Tcl_SetResult (interp, buf, TCL_VOLATILE);
+    return TCL_OK;
 }
 
 int AsnInt::TclSetVal (Tcl_Interp *interp, const char *valstr)
 {
-  const AsnNameDesc *n = _getdesc()->getnames();
-  if (n)
-    for (; n->name; n++)
-      if (!strcmp (n->name, valstr))
-      {
-	value = n->value;
-	return TCL_OK;
-      }
+    const AsnNameDesc *n = _getdesc()->getnames();
+    if (n)
+        for (; n->name; n++)
+            if (!strcmp (n->name, valstr)) {
+                value = n->value;
+                return TCL_OK;
+            }
 
-  int valval;
-  if (Tcl_GetInt (interp, (char*)valstr, &valval) != TCL_OK)
-    return TCL_ERROR;
-  value = valval;
-  return TCL_OK;
+    int valval;
+    if (Tcl_GetInt (interp, (char*)valstr, &valval) != TCL_OK)
+        return TCL_ERROR;
+    value = valval;
+    return TCL_OK;
 }
 
 #endif /* TCL */
 #endif /* META */
 
 
-//RWC;6/4/01; newly added functionality (along with changes above).
-
-//------------------------------------------------------------------------------
-// class member definitions:
-
-//
-//
 AsnLen AsnInt::BEnc (AsnBuf &b) const
 {
     FUNC("AsnInt::BEnc");
     if( checkConstraints(NULL) != 0 )
-        throw ConstraintException("Integer not within constraints", STACK_ENTRY);
+        throw ConstraintException("Integer not within constraints",
+                                  STACK_ENTRY);
 
     AsnLen l=0;
     l = BEncContent (b);
     l += BEncDefLen (b, l);
-
     l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
     return l;
 }
 
-//
-//
 void AsnInt::BDec (const AsnBuf &b, AsnLen &bytesDecoded)
 {
-   FUNC("AsnInt::BDec");
+    FUNC("AsnInt::BDec");
 
-   AsnTag tag;
-   AsnLen elmtLen1;
+    AsnTag tag;
+    AsnLen elmtLen1;
 
-   if (((tag = BDecTag (b, bytesDecoded)) != MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
-     && (tag != MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
-   {
-    throw InvalidTagException(typeName(), tag, STACK_ENTRY);
-   }
-   elmtLen1 = BDecLen (b, bytesDecoded);
-   BDecContent (b, tag, elmtLen1, bytesDecoded);
+    if (((tag = BDecTag (b, bytesDecoded)) !=
+         MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
+        && (tag != MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE))) {
+        throw InvalidTagException(typeName(), tag, STACK_ENTRY);
+    }
+    elmtLen1 = BDecLen (b, bytesDecoded);
+    BDecContent (b, tag, elmtLen1, bytesDecoded);
 }
 
-AsnLen  AsnInt::BEncContent (AsnBuf &b) const
+AsnLen AsnInt::BEncContent (AsnBuf &b) const
 {
-   b.PutSegRvs((char *)m_bytes, m_len);
-   return m_len;
+    b.PutSegRvs((char *)m_bytes, m_len);
+    return m_len;
 }
 
-void AsnInt::BDecContent (const AsnBuf &b, AsnTag, AsnLen elmtLen, AsnLen &bytesDecoded)
+void AsnInt::BDecContent (const AsnBuf &b, AsnTag, AsnLen elmtLen,
+                          AsnLen &bytesDecoded)
 {
-   FUNC("AsnInt::BDecContent()");
+    FUNC("AsnInt::BDecContent()");
 
-   if (elmtLen == INDEFINITE_LEN)
-      throw EXCEPT("indefinite length on primitive", DECODE_ERROR);
+    if (elmtLen == INDEFINITE_LEN)
+        throw EXCEPT("indefinite length on primitive", DECODE_ERROR);
 
-   delete[] m_bytes;
-   m_bytes = new unsigned char[elmtLen + 1];
-   m_len = elmtLen;
-   b.GetSeg((char *)m_bytes, elmtLen);
-   bytesDecoded += elmtLen;
+    delete[] m_bytes;
+    m_bytes = new unsigned char[elmtLen + 1];
+    m_len = elmtLen;
+    b.GetSeg((char *)m_bytes, elmtLen);
+    bytesDecoded += elmtLen;
 }
 
 AsnInt::AsnInt (const AsnInt &that)
+    : m_bytes(0), m_len(0)
 {
-   m_len = 0;
-   m_bytes = NULL;
-   operator=(that);
+    operator=(that);
 }
 
-AsnInt::AsnInt(const char *str, const size_t len, bool unsignedFlag) 
+AsnInt::AsnInt(const char *str, const size_t len, bool unsignedFlag)
+    : m_bytes(0), m_len(0)
 {
-   m_len = 0;
-   m_bytes = NULL;
-   storeDERInteger((const unsigned char *)str, len, unsignedFlag); 
+    storeDERInteger((const unsigned char *)str, len, unsignedFlag);
 }
 
-AsnInt::AsnInt(const AsnOcts &o, bool unsignedFlag) 
+AsnInt::AsnInt(const AsnOcts &o, bool unsignedFlag)
+    : m_bytes(0), m_len(0)
 {
-   m_len = 0;
-   m_bytes = NULL;
-   storeDERInteger(o.c_ustr(), o.Len(), unsignedFlag); 
+    storeDERInteger(o.c_ustr(), o.Len(), unsignedFlag);
 }
    
 // Construct an AsnInt from an integer value
 //
 AsnInt::AsnInt (AsnIntType val)
+    : m_bytes(NULL), m_len(0)
 {
-   if (val == 0)
-   {
-      m_len = 1;
-      m_bytes = new unsigned char[1];
-      *m_bytes = 0;
-   }
-   else
-   {
-      m_len = 0;
-      m_bytes = NULL;
-      Set(val);
-   }
+    if (!val) {
+        m_len = 1;
+        m_bytes = new unsigned char[1];
+        *m_bytes = 0;
+    } else {
+        Set(val);
+    }
 }
 
 // Construct an AsnInt from a null terminated character string.
@@ -491,222 +167,107 @@ AsnInt::AsnInt (AsnIntType val)
 //
 
 AsnInt::AsnInt(const char *str, bool unsignedFlag)
+    : m_bytes(NULL), m_len(0)
 {
- 
-   char radix=0;
+   FUNC("AsnInt::AsnInt(str,unsignedFlag)");
    unsigned length = strlen(str);
-   unsigned i = 0;
-
-   //std::basic_string<unsigned char> localBytes;
-   std::vector<unsigned char> localBytes;
-
-   AsnIntType l = 0;
-
-   FUNC("AsnInt::AsnInt");
-
-   m_len = 0;
-   m_bytes = NULL;
-
    if (length == 0)
-	   return;
+       return;
 
-	switch (str[length-1])
-	{
-	case 'h':
-	case 'H':
-		radix=16;
-		break;
-	}
+   const char *useStr = str;
+   char *errstr = NULL;
+   int radix = 0;
 
-   if (radix == 16)
-   {
-      if (str[0] != '\'' && str[length-2] != '\'')
-         return;
-      length -= 2;
-      i = 1;
+   if (str[length-1] == 'H' && str[0] == '\'' && str[length-2] == '\'') {
+       useStr = str+1;
+       radix = 16;
    }
-   else
-   {
-      if (strncmp("0x", str, 2) == 0)
-      {
-		 radix = 16;
-         i = 2;
-      }
-	  else  // assume it's a decimal
-	  {
-         // make sure the number isn't out of range
-		 if (((strlen(str) >= 11) && (str[0] != '-')) ||
-		    ((strlen(str) == 11) && (str[0] == '-') && (str[1] >= '2')&& (str[2] >= '1')) ||
-			((strlen(str) == 10) && (str[0] >= '2') && (str[1] >= '1')))
-		 {
-			throw EXCEPT("decimal string is too big to convert to an integer",
-				INTEGER_ERROR);
-		 }
 
-		 l = atol(str);
-		 Set(l);
-	  }
-   }
-   
-   if (radix == 16)
-   {
-		bool flag = false;
-		unsigned char prevDigit = 0;
-		for (; i<length; i++)
-		{
-			unsigned char digit;
-
-			if (str[i] >= '0' && str[i] <= '9')
-				digit = (unsigned char)(str[i] - '0');
-			else if (str[i] >= 'A' && str[i] <= 'F')
-				digit = (unsigned char)(str[i] - 'A' + 10);
-			else if (str[i] >= 'a' && str[i] <= 'f')
-				digit = (unsigned char)(str[i] - 'a' + 10);
-			else
-				return;
-
-		  if (!flag)
-		  {
-			  prevDigit = digit;
-			  flag = true;
-		  }
-		  else
-		  {
-			  prevDigit <<= 4;
-			  prevDigit |= digit;
-
-           //localBytes += prevDigit;
-			  localBytes.push_back(prevDigit);
-
-			  flag = false;
-		  }
-		}
-	   storeDERInteger(&localBytes[0], localBytes.size(), unsignedFlag);
+   AsnIntType t;
+   if (unsignedFlag) {
+       t = strtoul(useStr, &errstr, radix);
+   } else {
+       t = strtol(useStr, &errstr, radix);
    }
+
+   if ((errstr && *errstr == '\0') ||
+       !errstr ||
+       (*errstr == '\'' && radix == 16))
+       Set(t);
+
+   throw EXCEPT("UNKNOWN INPUT BYTES.", INTEGER_ERROR);
 }
 
 AsnInt::~AsnInt()
 {
-    if(m_bytes)
-        delete[] m_bytes;
+    delete [] m_bytes;
 }
 
 void AsnInt::storeDERInteger(const unsigned char *pData, long dataLen, bool unsignedFlag)
 {
-   
-   m_len = 0;
-   delete[] m_bytes;
-
-   /* IF the application generates an r,s,p,q,g or y value in which the
-    * first 9 bits are all set to 0, then the encoding software deletes the
-    * first octet from the octets to be encoded.  This rule is applied
-    * repeatedly to the remaining octets until the first 9 bits are not all
-    * set to 0.
-    */
-   if (unsignedFlag)
-   {
-	   // Check for leading nine bits all zero
-	   if (dataLen > 1)
-	   {
-		   while (dataLen > 1 &&  !( (pData[0] & 0xFF) || (pData[1] & 0x80)) )
-		   {
+    m_len = 0;
+    delete [] m_bytes;
+
+    /* IF the application generates an r,s,p,q,g or y value in which the
+     * first 9 bits are all set to 0, then the encoding software deletes the
+     * first octet from the octets to be encoded.  This rule is applied
+     * repeatedly to the remaining octets until the first 9 bits are not all
+     * set to 0.
+     */
+    if (unsignedFlag) {
+        // Check for leading nine bits all zero
+        if (dataLen > 1) {
+		   while (dataLen > 1 && !((pData[0] & 0xFF) || (pData[1] & 0x80))) {
 			   ++pData;
 			   --dataLen; 
 		   }
-	   }
-	   
-      m_bytes = new unsigned char[dataLen + 1];
-      m_len = dataLen;
-
-	   /* If the application generates a r,s,p,q,g, or y value in which the
-       * MSB is set to 1, THEN the software prepends a single octet in which
-       * all bits are set to 0.
-       */
-	   if (*pData & 0x80)
-	   {
-		   // Prepend a leading octet
-         memcpy(m_bytes + 1, pData, dataLen);
-         *m_bytes = '\0';
-         m_len++;
-	   }
-      else
-         memcpy(m_bytes, pData, dataLen);
-
-   }
-   /*
-    * ASN.1 rules state that the first 9 bits of an integer encoding can
-    * not be all ones or all zeros.
-    */
-   else if (dataLen > 1 )
-   {
-   /* check for first first 9 bits all ones
-       */
-	   while ((dataLen > 1) && (pData[0] == 0xFF) && (pData[1] & 0x80))
-	   {
+        }
+
+        m_bytes = new unsigned char[dataLen + 1];
+        m_len = dataLen;
+
+        /* If the application generates a r,s,p,q,g, or y value in which the
+         * MSB is set to 1, THEN the software prepends a single octet in which
+         * all bits are set to 0.
+         */
+        if (*pData & 0x80) {
+            // Prepend a leading octet
+            memcpy(m_bytes + 1, pData, dataLen);
+            *m_bytes = '\0';
+            m_len++;
+        } else
+            memcpy(m_bytes, pData, dataLen);
+    } else if (dataLen > 1 ) {
+
+        /* check for first first 9 bits all ones
+         */
+	   while ((dataLen > 1) && (pData[0] == 0xFF) && (pData[1] & 0x80)) {
 		   ++pData;
 		   --dataLen;
 	   }
 	   
 	   /* check for first 9 bits all zeros
-       */
-	   while ((dataLen > 1) && (pData[0] == 0) && ((pData[1] & 0x80) == 0))
-	   {
+        */
+	   while ((dataLen > 1) && (pData[0] == 0) && ((pData[1] & 0x80) == 0)) {
 		   ++pData;
 		   --dataLen;
 	   }
-      m_bytes = new unsigned char[dataLen + 1];
-      m_len = dataLen;
-      memcpy(m_bytes, pData, dataLen);
-   }
-}
-
-AsnInt & AsnInt::operator =(const AsnInt &that)
-{
-   if (this != &that)
-   {
-      m_len = that.m_len;
-      delete[] m_bytes;
-      m_bytes = new unsigned char[m_len];
-      memcpy(m_bytes, that.m_bytes, m_len);
-   }
-
-   return *this;
+       m_bytes = new unsigned char[dataLen + 1];
+       m_len = dataLen;
+       memcpy(m_bytes, pData, dataLen);
+    }
 }
 
-// Conversion operator for converting an AsnInt to an AsnIntType
-//
-AsnInt::operator AsnIntType() const
+AsnInt &AsnInt::operator =(const AsnInt &that)
 {
-   FUNC("AsnInt::operator AsnIntType");
-
-   AsnIntType iResult=0;
-
-   if (m_len > sizeof(AsnIntType))
-   {
-    throw EXCEPT("integer is too big for conversion to AsnIntType", INTEGER_ERROR);
-   }
-
-   // If big int is negative initialize result to -1
-   //
-   if ( (m_bytes[0] >> 7 == 1) )
-   {
-      iResult = -1;
-   }
-
-   if (m_len > 0)
-   {
-     /*
-      * write from buffer into AsnIntType
-      */
-     for (unsigned int i = 0; i < m_len; i++)
-         iResult = (iResult << 8) | (AsnUIntType)(m_bytes[i]);
-   }
-   else
-   {
-     iResult = 0;
-   }
+    if (this != &that) {
+        m_len = that.m_len;
+        delete [] m_bytes;
+        m_bytes = new unsigned char[m_len];
+        memcpy(m_bytes, that.m_bytes, m_len);
+    }
 
-   return iResult; 
+    return *this;
 }
 
 // Set AsnInt from a buffer.  Buffer is assumed to be a proper
@@ -714,7 +275,7 @@ AsnInt::operator AsnIntType() const
 //
 void AsnInt::Set (const unsigned char *pData, size_t len, bool unsignedFlag)
 {
-   storeDERInteger(pData, len, unsignedFlag);
+    storeDERInteger(pData, len, unsignedFlag);
 }
 
 // Set AsnInt from a AsnIntType
@@ -731,7 +292,8 @@ void AsnInt::Set(AsnIntType iIn)
    storeDERInteger(cTmp, sizeof(iIn), (iIn >= 0));
 }
 
-void AsnInt::getPadded(unsigned char *&bigIntDataOut, size_t &bigIntLen, const size_t padToSize) const
+void AsnInt::getPadded(unsigned char *&bigIntDataOut, size_t &bigIntLen,
+                       const size_t padToSize) const
 {
    FUNC("AsnInt::GetUnSignedBitExtendedData()");   
 
@@ -803,26 +365,24 @@ bool AsnInt::operator != (const AsnInt &o) const
 
 bool AsnInt::operator==(AsnIntType o) const
 {
-   if (m_len > sizeof(AsnIntType))
-		return false;
+    if (m_len > sizeof(AsnIntType))
+        return false;
 
-	// Convert this AsnInt to a normal integer
-	AsnIntType result = 0;
-	
-   if (m_len > 0)
-	{
-		// If the AsnInt is negative initialize the result to -1
-		if ((m_bytes[0] & 0x80) != 0)
-			result = -1;
+    // Convert this AsnInt to a normal integer
+    AsnIntType result = 0;
 
-      for (unsigned int i = 0; i < m_len; ++i)
-		{
-			result <<= 8;
-			result |= (unsigned char)m_bytes[i];
-		}
-   }
+    if (m_len > 0) {
+        // If the AsnInt is negative initialize the result to -1
+        if ((m_bytes[0] & 0x80) != 0)
+            result = -1;
+
+        for (unsigned int i = 0; i < m_len; ++i) {
+            result <<= 8;
+            result |= (unsigned char)m_bytes[i];
+        }
+    }
 
-  return (result == o);
+    return (result == o);
 }
 
 bool AsnInt::operator<(const AsnInt &o) const
@@ -840,34 +400,33 @@ bool AsnInt::operator<(const AsnInt &o) const
 
 void AsnInt::Print(std::ostream& os, unsigned short /*indent*/) const
 {
-   os << "'";
-   os.setf(std::ios::hex);
-   char buf[3];
-   buf[2] = '\0';
-   for (unsigned long i = 0; i < m_len; i++)
-   {
-        sprintf(buf, "%2.2x", (int)m_bytes[i]);
-        os << buf;
-   }        //END for all data.
-   os << "'H  -- \n";
-
-   os.unsetf(std::ios::hex);
-
+    try {
+        long l = toInteger<long>();
+        os << l << '\n';
+    } catch (SnaccException &e) {
+        os << "'";
+        std::ios_base::fmtflags flags = os.flags();
+        os.setf(std::ios::hex);
+        char buf[3] = {0};
+        for (unsigned long i = 0; i < m_len; i++) {
+            sprintf(buf, "%2.2x", (int)m_bytes[i]);
+            os << buf;
+        }
+        os << "'H  -- \n";
+        os.setf(flags);
+    }
 }
 
 void AsnInt::PrintXML(std::ostream &os, const char *lpszTitle) const
 {
-   if (lpszTitle)
-   {
-       os << "<" << lpszTitle; 
-       os << " type=\"INTEGER\">\n"; 
-   }
-   else
-   {
+   if (lpszTitle) {
+       os << "<" << lpszTitle << ">\n";
+   } else {
        os << "<INTEGER>\n"; 
    }
-   //RWC:os << "-"; 
+
    Print(os); 
+
    if (lpszTitle) 
        os << "</" << lpszTitle << ">\n"; 
    else
@@ -885,8 +444,7 @@ int AsnInt::checkConstraints (ConstraintFailList* pConstraintFails)const
     long ltemp= 0;
 	 const char* tmpptr = NULL;
 
-    if (m_len > sizeof(AsnIntType) && (numValueRanges > 0) )
-    {
+    if (m_len > sizeof(AsnIntType) && (numValueRanges > 0) ) {
         throw EXCEPT("Integer is out of constraint range", CONSTRAINT_ERROR);
     }
     
@@ -894,67 +452,57 @@ int AsnInt::checkConstraints (ConstraintFailList* pConstraintFails)const
 	{
         ltemp = *this;
         
-		for(count = 0; count< numValueRanges; count++)
-		{
+		for(count = 0; count< numValueRanges; count++) {
             tmpptr = NULL;
-			if(valueRanges[count].upperBoundExists == 1)
-			{
-                if( ( ltemp < valueRanges[count].lowerBound ) || ( ltemp > valueRanges[count].upperBound ) )
-                {
-                    tmpptr = ConstraintErrorStringList[ INTEGER_VALUE_RANGE ];
+			if(valueRanges[count].upperBoundExists == 1) {
+                if ((ltemp < valueRanges[count].lowerBound) ||
+                    (ltemp > valueRanges[count].upperBound)) {
+                    tmpptr = ConstraintErrorStringList[INTEGER_VALUE_RANGE];
                 }
-			}
-			else if(valueRanges[count].upperBoundExists == 2)
-			{
-                if( ltemp != valueRanges[count].lowerBound )
-                {
-                    tmpptr = ConstraintErrorStringList[ INTEGER_SINGLE_VALUE ];
+			} else if(valueRanges[count].upperBoundExists == 2) {
+                if (ltemp != valueRanges[count].lowerBound ) {
+                    tmpptr = ConstraintErrorStringList[INTEGER_SINGLE_VALUE];
                 }
-            }
-            else if(valueRanges[count].upperBoundExists == 0)
-			{
-                if( ltemp < valueRanges[count].lowerBound )
-                {
-                    tmpptr = ConstraintErrorStringList[ INTEGER_VALUE_RANGE ];
+            } else if(valueRanges[count].upperBoundExists == 0) {
+                if (ltemp < valueRanges[count].lowerBound) {
+                    tmpptr = ConstraintErrorStringList[INTEGER_VALUE_RANGE];
                 }
             }
 
-			if(tmpptr)
-			{
-				ptr += tmpptr;
-            }
-			else
-			{
+            if(tmpptr) {
+                ptr += tmpptr;
+            } else {
 				failed = 0;
 			}
 		}
+	} else {
+        failed = 0;
 	}
-	else
-	{
-		failed = 0;
+
+	if(failed && pConstraintFails != NULL) {
+        pConstraintFails->push_back(ptr);
 	}
 
-	if(failed)
-	{
-		if(pConstraintFails!=NULL)
-			pConstraintFails->push_back(ptr);
-	}	  
     return failed;
 }
 
 void AsnInt::putByte(long offset, unsigned char cByte)
 {
-		m_bytes[offset] = cByte;
-} 
+    FUNC("AsnInt::putByte");
+    if (offset < 0 ||
+        (m_len <= (unsigned long)offset)) {
+        throw EXCEPT("Invalid Offset", INTEGER_ERROR);
+    }
+    m_bytes[offset] = cByte;
+}
 
 void AsnInt::Allocate(long size)
 {
-	unsigned char* temp = new unsigned char[m_len + size];
-    if (m_len)          // RWC;
-    {                   // RWC;
-	    memcpy(temp, m_bytes, m_len);
+    unsigned char* temp = new unsigned char[m_len + size];
+    if (m_len) {
+        memcpy(temp, m_bytes, m_len);
 	    size += m_len;
-    }                   //RWC;
+    }
 
 	Clear();
 
diff --git a/cxx-lib/src/asn-null.cpp b/cxx-lib/src/asn-null.cpp
index 19389f4..0070625 100644
--- a/cxx-lib/src/asn-null.cpp
+++ b/cxx-lib/src/asn-null.cpp
@@ -151,15 +151,17 @@ void AsnNull::BDec (const AsnBuf &b, AsnLen &bytesDecoded)
 
 void AsnNull::Print(std::ostream& os, unsigned short /*indent*/) const
 {
-	os << "NULL";
+	os << "null";
 }
 
 void AsnNull::PrintXML (std::ostream &os, const char *lpszTitle) const
 {
-   os << "<NULL>"; 
-   if (lpszTitle) os << lpszTitle; 
-   os << "-"; 
-   Print(os); os << "</NULL>\n"; 
+    const char *tagName = typeName();
+    if (lpszTitle) tagName = lpszTitle;
+
+    os << "<" << tagName << ">";
+    Print(os);
+    os << "</" << tagName << ">\n";
 }
 
 #if META
diff --git a/cxx-lib/src/asn-octs.cpp b/cxx-lib/src/asn-octs.cpp
index 83856fa..22c41bc 100644
--- a/cxx-lib/src/asn-octs.cpp
+++ b/cxx-lib/src/asn-octs.cpp
@@ -86,12 +86,11 @@ void AsnOcts::Set (const char *str, size_t len)
 void AsnOcts::PrintXML (std::ostream &os, const char *lpszTitle,
                         const char *lpszType) const
 {
-   if (lpszType)
-     os << "<" << lpszType << ">";
-   else
-     os << "<OCTET_STRING>";
-   if (lpszTitle)
-      os << lpszTitle;
+    const char *tagName = "OCTET-STRING";
+    if (lpszType)
+        tagName = lpszType;
+    os << "<" << tagName << ">";
+
    os << "-";
    Print(os);
    //PrintXMLSupport(&os, ((AsnOcts *)this)->Access(), octetLen);
diff --git a/cxx-lib/src/asn-real.cpp b/cxx-lib/src/asn-real.cpp
index 5ea17ee..5d2784f 100644
--- a/cxx-lib/src/asn-real.cpp
+++ b/cxx-lib/src/asn-real.cpp
@@ -997,15 +997,16 @@ void AsnReal::BDec (const AsnBuf &b, AsnLen &bytesDecoded)
 
 void AsnReal::Print(std::ostream& os, unsigned short /*indent*/) const
 {
-	os << value;
+    os << value;
 }
 
 void AsnReal::PrintXML (std::ostream &os, const char *lpszTitle) const 
 {
-   os << "<REAL>"; 
-   if (lpszTitle) os << lpszTitle; 
-   os << "-"; 
-   Print(os); os << "</REAL>\n"; 
+    const char *tagName = typeName();
+    if (lpszTitle) tagName = lpszTitle;
+    os << "<" << tagName << ">\n";
+    Print(os);
+    os << "</" << tagName << ">\n";
 }
 
 
diff --git a/snacc.h b/snacc.h
index 8b66aca..d9732b0 100644
--- a/snacc.h
+++ b/snacc.h
@@ -82,15 +82,6 @@
 #  define RETURN_THIS_FOR_COMPILERS_WITHOUT_VOLATILE_FUNCTIONS
 #endif
 
-#if !BOOL_BUILTIN
-#ifndef true
-/* enum bool { false, true }; */
-/* the above looks elegant, but leads to anachronisms (<, ==, !=, ... return value of type int, not enum bool), therefore: */
-typedef int bool;
-enum { false, true };
-#endif
-#endif
-
 #else /* !__cplusplus */
 
 #ifndef FALSE
-- 
2.7.4




More information about the dev mailing list