Cleanup
[citadel.git] / webcit / vcard_edit.c
index a34336c417d3b29fca5206f0043912174766def3..d5cbe0b3553be8e6a546dc8dee9bb4ac57be689d 100644 (file)
@@ -111,12 +111,15 @@ typedef struct _addrbookent {
        StrBuf *name;
        HashList *VC;
        long ab_msgnum;         /* message number of address book entry */
+       StrBuf *msgNoStr;
 } addrbookent;
 
 void deleteAbEnt(void *v) {
        addrbookent *vc = (addrbookent*)v;
        DeleteHash(&vc->VC);
        FreeStrBuf(&vc->name);
+       FreeStrBuf(&vc->msgNoStr);
+       free(vc);
 }
 
 HashList *DefineToToken = NULL;
@@ -124,6 +127,10 @@ HashList *VCTokenToDefine = NULL;
 HashList *vcNames = NULL; /* todo: fill with the name strings */
 vcField* vcfUnknown = NULL;
 
+/******************************************************************************
+ *                   initialize vcard structure                               *
+ ******************************************************************************/
+
 void RegisterVCardToken(vcField* vf, StrBuf *name, int inTokenCount)
 {
        if (vf->Type == UnKnown) {
@@ -189,6 +196,10 @@ void autoRegisterTokens(long *enumCounter, vcField* vf, StrBuf *BaseStr, int lay
        FreeStrBuf(&subStr);
 }
 
+/******************************************************************************
+ *               VCard template functions                                     *
+ ******************************************************************************/
+
 int preeval_vcard_item(WCTemplateToken *Token)
 {
        WCTemplputParams TPP;
@@ -272,6 +283,15 @@ void tmpl_vcard_name_str(StrBuf *Target, WCTemplputParams *TP)
        }
 }
 
+void tmpl_vcard_msgno(StrBuf *Target, WCTemplputParams *TP)
+{
+       addrbookent *ab = (addrbookent*) CTX(CTX_VCARD);
+       if (ab->msgNoStr == NULL) {
+               ab->msgNoStr = NewStrBufPlain(NULL, 64);
+       }
+       StrBufPrintf(ab->msgNoStr, "%ld", ab->ab_msgnum);
+       StrBufAppendTemplate(Target, TP, ab->msgNoStr, 0);
+}
 void tmpl_vcard_context_name_str(StrBuf *Target, WCTemplputParams *TP)
 {
        void *vItem;
@@ -312,9 +332,6 @@ int filter_VC_ByType(const char* key, long len, void *Context, StrBuf *Target, W
        return rc;
 }
 
-
-
-
 HashList *getContextVcard(StrBuf *Target, WCTemplputParams *TP)
 {
        vcField *vf = (vcField*) CTX(CTX_VCARD_TYPE);
@@ -344,7 +361,6 @@ int filter_VC_ByContextType(const char* key, long len, void *Context, StrBuf *Ta
        }
 }
 
-
 int conditional_VC_Havetype(StrBuf *Target, WCTemplputParams *TP)
 {
        addrbookent *ab = (addrbookent*) CTX(CTX_VCARD);
@@ -374,132 +390,24 @@ int conditional_VC_Havetype(StrBuf *Target, WCTemplputParams *TP)
        return rc;
 }
 
-
-
-/*
- * Helper function for do_addrbook_view()
- * Converts a name into a three-letter tab label
- */
-void nametab(char *tabbuf, long len, char *name) {
-       stresc(tabbuf, len, name, 0, 0);
-       tabbuf[0] = toupper(tabbuf[0]);
-       tabbuf[1] = tolower(tabbuf[1]);
-       tabbuf[2] = tolower(tabbuf[2]);
-       tabbuf[3] = 0;
-}
-
-wc_mime_attachment *load_vcard(message_summary *Msg) 
-{
-       HashPos  *it;
-       StrBuf *FoundCharset = NewStrBuf();
-       StrBuf *Error;
-       void *vMime;
-       const char *Key;
-       long len;
-       wc_mime_attachment *Mime;
-       wc_mime_attachment *VCMime = NULL;
-
-       Msg->MsgBody =  (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment));
-       memset(Msg->MsgBody, 0, sizeof(wc_mime_attachment));
-       Msg->MsgBody->msgnum = Msg->msgnum;
-
-       load_message(Msg, FoundCharset, &Error);
-
-       FreeStrBuf(&FoundCharset);
-       /* look up the vcard... */
-       it = GetNewHashPos(Msg->AllAttach, 0);
-       while (GetNextHashPos(Msg->AllAttach, it, &len, &Key, &vMime) && 
-              (vMime != NULL)) 
-       {
-               Mime = (wc_mime_attachment*) vMime;
-               if ((strcmp(ChrPtr(Mime->ContentType),
-                          "text/x-vcard") == 0) ||
-                   (strcmp(ChrPtr(Mime->ContentType),
-                           "text/vcard") == 0))
-               {
-                       VCMime = Mime;
-                       break;
-               }
-       }
-       DeleteHashPos(&it);
-       if (VCMime == NULL)
-               return NULL;
-
-       if (VCMime->Data == NULL)
-               MimeLoadData(VCMime);
-       return VCMime;
-}
-
-
-
-/*
- * Turn a vCard "n" (name) field into something displayable.
- */
-void vcard_n_prettyize(char *name)
-{
-       char *original_name;
-       int i, j, len;
-
-       original_name = strdup(name);
-       len = strlen(original_name);
-       for (i=0; i<5; ++i) {
-               if (len > 0) {
-                       if (original_name[len-1] == ' ') {
-                               original_name[--len] = 0;
-                       }
-                       if (original_name[len-1] == ';') {
-                               original_name[--len] = 0;
-                       }
-               }
-       }
-       strcpy(name, "");
-       j=0;
-       for (i=0; i<len; ++i) {
-               if (original_name[i] == ';') {
-                       name[j++] = ',';
-                       name[j++] = ' ';                        
-               }
-               else {
-                       name[j++] = original_name[i];
-               }
-       }
-       name[j] = '\0';
-       free(original_name);
-}
-
+/******************************************************************************
+ *              parse one VCard                                               *
+ ******************************************************************************/
 
 void PutVcardItem(HashList *thisVC, vcField *thisField, StrBuf *ThisFieldStr, int is_qp, StrBuf *Swap)
 {
        /* if we have some untagged QP, detect it here. */
        if (is_qp || (strstr(ChrPtr(ThisFieldStr), "=?")!=NULL)){
-               StrBuf *b;
+               FlushStrBuf(Swap);
                StrBuf_RFC822_to_Utf8(Swap, ThisFieldStr, NULL, NULL); /* default charset, current charset */
-               b = ThisFieldStr;
-               ThisFieldStr = Swap; 
-               Swap = b;
+               SwapBuffers(Swap, ThisFieldStr);
                FlushStrBuf(Swap);
        }
        Put(thisVC, LKEY(thisField->cval), ThisFieldStr, HFreeStrBuf);
 }
-/*
- * html print a vcard
- * display_vcard() calls this after parsing the textual vCard into
- * our 'struct vCard' data object.
- *
- * Set 'full' to nonzero to display the full card, otherwise it will only
- * show a summary line.
- *
- * This code is a bit ugly, so perhaps an explanation is due: we do this
- * in two passes through the vCard fields.  On the first pass, we process
- * fields we understand, and then render them in a pretty fashion at the
- * end.  Then we make a second pass, outputting all the fields we don't
- * understand in a simple two-column name/value format.
- * v           the vCard to parse
- * msgnum      Citadel message pointer
- */
+
 void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, wc_mime_attachment *Mime)
 {
-       StrBuf *Val = NULL;
        StrBuf *Swap = NULL;
        int i, j, k;
        char buf[SIZ];
@@ -525,34 +433,18 @@ void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, wc_mime_attachme
                /*len = */extract_token(firsttoken, ChrPtr(thisname), 0, ';', sizeof firsttoken);
                ntokens = num_tokens(ChrPtr(thisname), ';');
                for (j=0, k=0; j < ntokens && k < 10; ++j) {
-                       /*int evc[10];*/
-                       
                        len = extract_token(buf, ChrPtr(thisname), j, ';', sizeof buf);
                        if (!strcasecmp(buf, "encoding=quoted-printable")) {
                                is_qp = 1;
-/*                             remove_token(thisname, j, ';');*/
                        }
                        else if (!strcasecmp(buf, "encoding=base64")) {
                                is_b64 = 1;
-/*                             remove_token(thisname, j, ';');*/
                        }
                        else{
                                if (StrLength(thisVCToken) > 0) {
                                        StrBufAppendBufPlain(thisVCToken, HKEY(";"), 0);
                                }
                                StrBufAppendBufPlain(thisVCToken, buf, len, 0);
-                               /*
-                               if (GetHash(VCToEnum, buf, len, &V))
-                               {
-                                       evc[k] = (int) V;
-
-                                       Put(VC, IKEY(evc), Val, HFreeStrBuf);
-
-                                       syslog(LOG_DEBUG, "[%ul] -> k: %d %s - %s", evc, k, buf, VCStr[evc[k]].Key);
-                                       k++;
-                               }
-*/
-
                        }
                }
 
@@ -593,6 +485,10 @@ void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, wc_mime_attachme
 
                                break;
                        case Base64BinaryAttachment:
+                               ThisFieldStr = NewStrBufPlain(v->prop[i].value, -1);
+                               StrBufDecodeBase64(ThisFieldStr);
+                               PutVcardItem(VC, thisField, ThisFieldStr, is_qp, Swap);
+                               break;
                        case TerminateList:
                        case UnKnown:
                                break;
@@ -618,70 +514,22 @@ void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, wc_mime_attachme
                        StrBufAppendBufPlain(oldVal, v->prop[i].value, -1, 0);
                        continue;
                }
-
-               /* copy over the payload into a StrBuf */
-               Val = NewStrBufPlain(v->prop[i].value, -1);
-                       
-               /* if we have some untagged QP, detect it here. */
-               if (is_qp || (strstr(v->prop[i].value, "=?")!=NULL)){
-                       StrBuf *b;
-                       StrBuf_RFC822_to_Utf8(Swap, Val, NULL, NULL); /* default charset, current charset */
-                       b = Val;
-                       Val = Swap; 
-                       Swap = b;
-                       FlushStrBuf(Swap);
-               }
-               else if (is_b64) {
-                       StrBufDecodeBase64(Val);
-               }
-#if 0
-               syslog(LOG_DEBUG, "-> firsttoken: %s thisname: %s Value: [%s][%s]",
-                       firsttoken,
-                      ChrPtr(thisname),
-                       ChrPtr(Val),
-                       v->prop[i].value);
-#endif 
-               FreeStrBuf(&Val);
        }
        FreeStrBuf(&thisname);
        FreeStrBuf(&Swap);
        FreeStrBuf(&thisVCToken);
 }
 
-void tmplput_VCARD_ITEM(StrBuf *Target, WCTemplputParams *TP)
+HashList *CtxGetVcardList(StrBuf *Target, WCTemplputParams *TP)
 {
-       addrbookent *ab = CTX(CTX_VCARD);
-       int evc;
-       void *vStr;
-
-       evc = GetTemplateTokenNumber(Target, TP, 0, -1);
-       if (evc != -1)
-       {
-               if (GetHash(ab->VC, IKEY(evc), &vStr))
-               {
-                       StrBufAppendTemplate(Target, TP,
-                                            (StrBuf*) vStr,
-                                            1);
-               }
-       }
-       
+       HashList *pb = CTX(CTX_VCARD_LIST);
+       return pb;
 }
 
-void display_one_vcard (StrBuf *Target, addrbookent *ab, const char *tp_name, size_t tp_name_len)
-{
-       WCTemplputParams *TP = NULL;
-       WCTemplputParams SubTP;
-
-        memset(&SubTP, 0, sizeof(WCTemplputParams));    
-       StackContext(TP, &SubTP, ab, CTX_VCARD, 0, NULL);
-
-       DoTemplate(tp_name, tp_name_len, Target, &SubTP);
-       UnStackContext(&SubTP);
-}
+/******************************************************************************
+ * Extract an embedded photo from a vCard for display on the client           *
+ ******************************************************************************/
 
-/*
- * Extract an embedded photo from a vCard for display on the client
- */
 void display_vcard_photo_img(void)
 {
        long msgnum = 0L;
@@ -716,6 +564,48 @@ void display_vcard_photo_img(void)
        free(photosrc);
 }
 
+wc_mime_attachment *load_vcard(message_summary *Msg) 
+{
+       HashPos  *it;
+       StrBuf *FoundCharset = NewStrBuf();
+       StrBuf *Error;
+       void *vMime;
+       const char *Key;
+       long len;
+       wc_mime_attachment *Mime;
+       wc_mime_attachment *VCMime = NULL;
+
+       Msg->MsgBody =  (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment));
+       memset(Msg->MsgBody, 0, sizeof(wc_mime_attachment));
+       Msg->MsgBody->msgnum = Msg->msgnum;
+
+       load_message(Msg, FoundCharset, &Error);
+
+       FreeStrBuf(&FoundCharset);
+       /* look up the vcard... */
+       it = GetNewHashPos(Msg->AllAttach, 0);
+       while (GetNextHashPos(Msg->AllAttach, it, &len, &Key, &vMime) && 
+              (vMime != NULL)) 
+       {
+               Mime = (wc_mime_attachment*) vMime;
+               if ((strcmp(ChrPtr(Mime->ContentType),
+                          "text/x-vcard") == 0) ||
+                   (strcmp(ChrPtr(Mime->ContentType),
+                           "text/vcard") == 0))
+               {
+                       VCMime = Mime;
+                       break;
+               }
+       }
+       DeleteHashPos(&it);
+       if (VCMime == NULL)
+               return NULL;
+
+       if (VCMime->Data == NULL)
+               MimeLoadData(VCMime);
+       return VCMime;
+}
+
 /*
  * Edit the vCard component of a MIME message.  
  * Supply the message number
@@ -727,7 +617,7 @@ void do_edit_vcard(long msgnum, char *partnum,
                   wc_mime_attachment *VCAtt,
                   const char *return_to, 
                   const char *force_room) {
-       HashList *VC;   WCTemplputParams SubTP;
+       WCTemplputParams SubTP;
        wcsession *WCC = WC;
        message_summary *Msg = NULL;
        wc_mime_attachment *VCMime = NULL;
@@ -764,7 +654,7 @@ void do_edit_vcard(long msgnum, char *partnum,
                        v = VCardLoad(VCAtt->Data);
                }
 
-               parse_vcard(WCC->WBuf, v, VC, NULL);
+               parse_vcard(WCC->WBuf, v, ab.VC, NULL);
        
        
                vcard_free(v);
@@ -802,8 +692,6 @@ void edit_vcard(void) {
        do_edit_vcard(msgnum, partnum, NULL, NULL, "", NULL);
 }
 
-
-
 /*
  *  parse edited vcard from the browser
  */
@@ -970,7 +858,9 @@ void submit_vcard(void) {
        FreeStrBuf(&Buf);
 }
 
-
+/******************************************************************************
+ *              Render Addressbooks                                           *
+ ******************************************************************************/
 
 typedef struct _vcardview_struct {
        long is_singlecard;
@@ -1012,6 +902,9 @@ int vcard_LoadMsgFromServer(SharedMessageStatus *Stat,
                            int is_new, 
                            int i)
 {
+       wcsession *WCC = WC;
+       WCTemplputParams *TP = NULL;
+       WCTemplputParams SubTP;
        vcardview_struct *VS;
        wc_mime_attachment *VCMime = NULL;
        struct vCard *v;
@@ -1032,9 +925,13 @@ int vcard_LoadMsgFromServer(SharedMessageStatus *Stat,
        abEntry->name = NewStrBuf();
        abEntry->VC = NewHash(0, lFlathash);
        abEntry->ab_msgnum = Msg->msgnum;
-       parse_vcard(WC->WBuf, v, abEntry->VC, VCMime);
+       parse_vcard(WCC->WBuf, v, abEntry->VC, VCMime);
+
+        memset(&SubTP, 0, sizeof(WCTemplputParams));    
+       StackContext(TP, &SubTP, abEntry, CTX_VCARD, 0, NULL);
 
-       display_one_vcard(abEntry->name, abEntry, HKEY("vcard_list_name"));
+       DoTemplate(HKEY("vcard_list_name"), WCC->WBuf, &SubTP);
+       UnStackContext(&SubTP);
 
        if (StrLength(abEntry->name) == 0) {
                StrBufPlain(abEntry->name, _("(no name)"), -1);
@@ -1053,19 +950,15 @@ int vcard_LoadMsgFromServer(SharedMessageStatus *Stat,
  * addrbook    the addressbook to render
  * num_ab      the number of the addressbook
  */
+static int NAMESPERPAGE = 60;
 void do_addrbook_view(vcardview_struct* VS) {
        long i = 0;
-       int displayed = 0;
-       int bg = 0;
-       static int NAMESPERPAGE = 60;
        int num_pages = 0;
        int tabfirst = 0;
        int tablast = 0;
-       int page = 0;
-       char **tablabels;
+       StrBuf **tablabels;
        int num_ab = GetCount(VS->addrbook);
        HashList *headlines;
-       HashPos *it;
        wcsession *WCC = WC;
 
        WCTemplputParams *TP = NULL;
@@ -1079,12 +972,12 @@ void do_addrbook_view(vcardview_struct* VS) {
        }
 
        if (num_ab > 1) {
-               ///SortByHashKey(VS->addrbook, 0);
+               SortByHashKey(VS->addrbook, 1);
        }
 
        num_pages = (GetCount(VS->addrbook) / NAMESPERPAGE) + 1;
 
-       tablabels = malloc(num_pages * sizeof (char *));
+       tablabels = malloc(num_pages * sizeof (StrBuf *));
        if (tablabels == NULL) {
                return;
        }
@@ -1106,75 +999,26 @@ void do_addrbook_view(vcardview_struct* VS) {
                if (GetHashAt(VS->addrbook, tabfirst, &hklen1, &c1, &v1)) {
                        a1 = (addrbookent*) v1;
                        StrBufAppendBuf(headline, a1->name, 0);
-
+                       StrBuf_Utf8StrCut(headline, 3);
                        if (GetHashAt(VS->addrbook, tablast, &hklen2, &c2, &v2)) {
 
                                a2 = (addrbookent*) v2;
                                StrBufAppendBufPlain(headline, HKEY(" - "), 0);
                                StrBufAppendBuf(headline, a2->name, 0);
+                               StrBuf_Utf8StrCut(headline, 9);
                        }
                }
+               tablabels[i] = headline;
                Put(headlines, LKEY(i), headline, HFreeStrBuf);
        }
+       StrTabbedDialog(WC->WBuf, num_pages, tablabels);
+       StackContext(TP, &SubTP, VS->addrbook, CTX_VCARD_LIST, 0, NULL);
 
-       tabbed_dialog(num_pages, tablabels);
-       page = (-1);
-
-       it = GetNewHashPos(VS->addrbook, 0);
-       for (i=0; i<num_ab; ++i) {
-               void *v;
-               long hklen;
-               const char *key;
-               addrbookent *abEnt;
-               GetNextHashPos(VS->addrbook, it, &hklen, &key, &v);
-               if (v == NULL)
-                       continue;
-               abEnt = (addrbookent *) v;
-               if ((i / NAMESPERPAGE) != page) {       /* New tab */
-                       page = (i / NAMESPERPAGE);
-                       if (page > 0) {
-                               do_template("vcard_list_section_end");
-                               end_tab(page-1, num_pages);
-                       }
-                       begin_tab(page, num_pages);
-                       do_template("vcard_list_section_start");
-                       displayed = 0;
-               }
-
-               if ((displayed % 4) == 0) {
-                       if (displayed > 0) {
-                               do_template("vcard_list_row_end");
-                       }
-                       do_template("vcard_list_row_start");
-                       bg = 1 - bg;
-               }
-       
-
-               StackContext(TP, &SubTP, abEnt, CTX_VCARD, 0, NULL);
-
-               DoTemplate(HKEY("vcard_list_entry"), WCC->WBuf, &SubTP);
-               UnStackContext(&SubTP);
-
-               ++displayed;
-       }
-       DeleteHashPos(&it);
-
-       /* Placeholders for empty columns at end */
-       if ((num_ab % 4) != 0) {
-               for (i=0; i<(4-(num_ab % 4)); ++i) {
-                       do_template("vcard_list_cell_end");
-               }
-       }
-       
-       do_template("vcard_list_section_end");
-       end_tab((num_pages-1), num_pages);
-
-       begin_tab(num_pages, num_pages);
-       /* FIXME there ought to be something here */
-       end_tab(num_pages, num_pages);
-
+       DoTemplate(HKEY("vcard_list"), WCC->WBuf, &SubTP);
+       UnStackContext(&SubTP);
        DeleteHash(&headlines);
-       wDumpContent(1);
+       free(tablabels);
+       StrBufAppendBufPlain(WCC->WBuf, HKEY("</div>"), 0);/* closes: id=global */
 }
 
 
@@ -1234,16 +1078,23 @@ void render_MIME_VCard(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharse
                v = VCardLoad(Mime->Data);
 
                if (v != NULL) {
-                       HashList *VC;
+                       WCTemplputParams *TP = NULL;
+                       WCTemplputParams SubTP;
                        addrbookent ab;
                        memset(&ab, 0, sizeof(addrbookent));
 
                        ab.VC = NewHash(0, lFlathash);
                        ab.ab_msgnum = Mime->msgnum;
 
-                       parse_vcard(Target, v, VC, Mime);
-                       display_one_vcard (Target, &ab, HKEY("vcard_msg_display"));
-                       DeleteHash(&VC);
+                       parse_vcard(Target, v, ab.VC, Mime);
+
+                       memset(&SubTP, 0, sizeof(WCTemplputParams));    
+                       StackContext(TP, &SubTP, &ab, CTX_VCARD, 0, NULL);
+
+                       DoTemplate(HKEY("vcard_msg_display"), Target, &SubTP);
+                       UnStackContext(&SubTP);
+                       DeleteHash(&ab.VC);
+                       vcard_free(v);
 
                }
                else {
@@ -1259,8 +1110,6 @@ void
 ServerStartModule_VCARD
 (void)
 {
-       ///VCToEnum = NewHash(0, NULL);
-
 }
 
 void 
@@ -1270,7 +1119,6 @@ ServerShutdownModule_VCARD
        DeleteHash(&DefineToToken);
        DeleteHash(&vcNames);
        DeleteHash(&VCTokenToDefine);
-       /// DeleteHash(&VCToEnum);
 }
 
 void 
@@ -1284,6 +1132,9 @@ InitModule_VCARD
        autoRegisterTokens(&VCEnumCounter, VCStrE, Prefix, 0, 0);
        FreeStrBuf(&Prefix);
 
+       REGISTERTokenParamDefine(NAMESPERPAGE);
+
+
        RegisterCTX(CTX_VCARD);
        RegisterCTX(CTX_VCARD_LIST);
        RegisterCTX(CTX_VCARD_TYPE);
@@ -1297,6 +1148,10 @@ InitModule_VCARD
                vcard_LoadMsgFromServer,
                vcard_RenderView_or_Tail,
                vcard_Cleanup);
+
+       RegisterIterator("MAIL:VCARDS", 0, NULL, CtxGetVcardList, NULL, NULL, CTX_VCARD, CTX_VCARD_LIST, IT_NOFLAG);
+
+
        WebcitAddUrlHandler(HKEY("edit_vcard"), "", 0, edit_vcard, 0);
        WebcitAddUrlHandler(HKEY("submit_vcard"), "", 0, submit_vcard, 0);
        WebcitAddUrlHandler(HKEY("vcardphoto"), "", 0, display_vcard_photo_img, NEED_URL);
@@ -1304,6 +1159,7 @@ InitModule_VCARD
        RegisterNamespace("VC:ITEM", 2, 2, tmpl_vcard_item, preeval_vcard_item, CTX_VCARD);
        RegisterNamespace("VC:CTXITEM", 1, 1, tmpl_vcard_context_item, NULL, CTX_VCARD_TYPE);
        RegisterNamespace("VC:NAME", 1, 1, tmpl_vcard_name_str, preeval_vcard_name_str, CTX_VCARD);
+       RegisterNamespace("VC:MSGNO", 0, 1, tmpl_vcard_msgno, NULL, CTX_VCARD);
        RegisterNamespace("VC:CTXNAME", 1, 1, tmpl_vcard_context_name_str, NULL, CTX_VCARD_TYPE);
        REGISTERTokenParamDefine(FlatString);
        REGISTERTokenParamDefine(StringCluster);