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

Generated on Sat Oct 13 16:08:35 2001 for XMILL by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001