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)
00031 {
00032 if(id>=32768L)
00033 {
00034 Error("Error while decompressing file!");
00035 Exit();
00036 }
00037
00038 switch(id)
00039 {
00040 case TREETOKEN_ENDLABEL:
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:
00050 curpath.RemoveLabel();
00051 output->endEmptyElement();
00052 break;
00053
00054 case TREETOKEN_WHITESPACE:
00055 mystrlen=whitespacecont->LoadUInt32();
00056 output->whitespaces((char *)whitespacecont->GetDataPtr(mystrlen),mystrlen);
00057 break;
00058
00059 case TREETOKEN_ATTRIBWHITESPACE:
00060 mystrlen=whitespacecont->LoadUInt32();
00061 output->attribWhitespaces((char *)whitespacecont->GetDataPtr(mystrlen),mystrlen);
00062 break;
00063
00064 case TREETOKEN_SPECIAL:
00065 strptr=(char *)(specialcont->LoadString((unsigned *)&mystrlen));
00066 output->characters(strptr,mystrlen);
00067 break;
00068
00069 default:
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
00082 uncomprcont.GetContBlock(id)->UncompressText(output);
00083 }
00084 }
00085
00086 #endif