Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Decode.cpp

Go to the documentation of this file.
00001 #ifdef XDEMILL
00002 
00003 #include "UnCompCont.hpp"
00004 #include "ISAXClient.hpp"
00005 #include "XMLOutput.hpp"
00006 #include "BXMLOutput.hpp"
00007 #include "LabelDict.hpp"
00008 #include "CurPath.hpp"
00009 #include "xmltk.h"
00010 #include "xmltkobj.h"
00011 
00012 
00013 #undef LoadString
00014 
00015 extern UncompressContainerMan  uncomprcont;
00016 
00017 
00018 void DecodeTreeBlock(char g_bBinary, UncompressContainer *treecont,UncompressContainer *whitespacecont,UncompressContainer *specialcont,ISAXClient *output)
00019 {
00020         char              *strptr;
00021         unsigned char     isattrib;
00022         int               mystrlen;
00023         static char       tmpstr[20];
00024 
00025         unsigned char     *curptr,*endptr;
00026         long              id;
00027         char              isneg;
00028 
00029 
00030         curptr=treecont->GetDataPtr();
00031         endptr=curptr+treecont->GetSize();
00032 
00033 
00034         // Here we do parsing...
00035         while(curptr<endptr)
00036         {
00037                 id=LoadSInt32(curptr,&isneg);
00038 
00039                 if(isneg==0)   // Do we have a label ID ?
00040                 {
00041                         if(id>=32768L)
00042                         {
00043                                 Error("Error while decompressing file!");
00044                                 Exit();
00045                         }
00046 
00047                         switch(id)
00048                         {
00049                                 case TREETOKEN_ENDLABEL:  // An end-of-label token (i.e. id==0) ?
00050                                         mystrlen=globallabeldict.LookupLabel(curpath.RemoveLabel(),&strptr,&isattrib);
00051 
00052                                         if(isattrib==0)
00053                                                 output->endElement(strptr,mystrlen);
00054                                         else
00055                                                 output->endAttribute(strptr,mystrlen);
00056                                         break;
00057 
00058                                 case TREETOKEN_EMPTYENDLABEL:  // An end-of-label token for an empty element
00059                                         curpath.RemoveLabel();
00060                                         output->endEmptyElement();
00061                                         break;
00062 
00063                                 case TREETOKEN_WHITESPACE:  // A white-space token ?
00064                                         mystrlen=whitespacecont->LoadUInt32();
00065                                         output->whitespaces((char *)whitespacecont->GetDataPtr(mystrlen),mystrlen);
00066                                         break;
00067 
00068                                 case TREETOKEN_ATTRIBWHITESPACE:  // A attrib white-space token ?
00069                                         mystrlen=whitespacecont->LoadUInt32();
00070                                         output->attribWhitespaces((char *)whitespacecont->GetDataPtr(mystrlen),mystrlen);
00071                                         break;
00072 
00073                                 case TREETOKEN_SPECIAL:    // A special token
00074                                         strptr=(char *)(specialcont->LoadString((unsigned *)&mystrlen));
00075                                         output->characters(strptr,mystrlen);
00076                                         break;
00077 
00078                                 default: // Do we have a start label token?
00079                                         id-=LABELIDX_TOKENOFFS;
00080                                         mystrlen=globallabeldict.LookupLabel((TLabelID)id,&strptr,&isattrib);
00081 
00082                                         if(isattrib==0)
00083                                                 output->startElement(strptr,mystrlen);
00084                                         else
00085                                                 output->startAttribute(strptr,mystrlen);
00086 
00087                                         curpath.AddLabel((TLabelID)id);
00088                         }
00089                 }
00090                 else  // We have a block ID ==> I.e. we have some text
00091                         uncomprcont.GetContBlock(id)->UncompressText(output);
00092         }
00093 }
00094 
00095 #endif

Generated on Sat Dec 22 16:01:49 2001 for XMILLforBinaryFormat by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001