//#まいまくろ つくったひと:太田雅之 19990503 #include "_idmcmd.h" //#URLエンコード文字列をデコード void URLDecode(TX* text) { BOOL bSelect = FALSE; char hexh, hexl, c; int CurPos; //カーソル位置保存 CurPos = txGetAddress(text); if (txSelectGetMode(text)) { //選択範囲されていれば txWalkStart(text); bSelect = TRUE; } //先頭にカーソル移動 txJumpPara(text,1); //メインループ %A5%EF%A1%BC%A5%E0%A5%BA%A5%A2%A5%EB%A5%DE%A5%B2%A5%C9%A5%F3 while(!txIsCurEof(text)) { if (txReadChar(text) == '%') { hexh = txReadChar(text); if ((hexh>='0'&&hexh<='9')||(hexh>='a'&&hexh<='f')||(hexh>='A'&&hexh<='F')) { if (hexh>='a') hexh -= 0x20; hexl = txReadChar(text); if ((hexl>='0'&&hexl<='9')||(hexl>='a'&&hexl<='f')||(hexl>='A'&&hexl<='F')) { if (hexl>='a') hexl -= 0x20; //3文字消してエンコード txLeft(text);txLeft(text);txLeft(text); txDeleteChar(text);txDeleteChar(text);txDeleteChar(text); c = 0; if (hexh>='A') { c += (hexh-'A'+10)*16; } else { c += (hexh-'0')*16; } if (hexl>='A') { c += (hexl-'A'+10); } else { c += (hexl-'0'); } txInsertChar(text, c); } } } } if (bSelect == TRUE) { //選択範囲ウォーク終了 txWalkEnd(text); } //カーソル位置の復元 txJumpAddress(text, CurPos); } //#行を入れ替える void LineExchange (TX* text) { txJumpLineTop(text); txSelectEx(text, CLIP_LINE); if (!txNextPara(text)) { txSelectQuit(text); return; } txPrivateClear(text); txPrivatePush(text); txSelectDelete(text); txSelectQuit(text); txPrevPara(text); txPrivatePaste(text); txNextPara(text); } //#イベントキャプチャ //##カレントディレクトリを指定するファイラー void filer (TX *text) { char currentdir[256] = ""; char *pc = currentdir; char *pcExt = NULL; if (text->szfilename[0] != '\0') { strcpy(currentdir, text->szfilename); while (*(pc+1) != '\0') pc++; while (*pc != '\\') { if (*pc == '.') pcExt = pc+1; pc--; } *(++pc) = '*'; *(++pc) = '.'; #if 0 //マスクとして拡張子を送る if (pcExt) while (*pcExt != '\0') *(++pc) = *(pcExt++); #else *(++pc) = '*'; #endif *(pc+1) = '\0'; wzexec("/fWzFiler -f\""+currentdir+"\""); } else { wzexec("/fWzFiler"); } } //##カレントディレクトリを指定するgrep void grep (TX *text) { char currentdir[256] = ""; char *pc = currentdir; char *pcExt = NULL; strcpy(currentdir, text->szfilename); while (*pc != '\0') pc++; pc--; while (*pc != '\\') { if (*pc == '.') pcExt = pc+1; pc--; } *(++pc) = '*'; if (pcExt) { *(++pc) = '.'; while (*pcExt != '\0') *(++pc) = *(pcExt++); } *(pc+1) = '\0'; if (txIsClipInPara(text)) { txstr sz; txGetWord(text,sz); wzexec("/fWzGrep -s\""+sz+"\" -f\""+currentdir+"\""); } else { wzexec("/fWzGrep -f\""+text->szfilename+"\""); } }