[Ttssh2-commit] [4014] strjoin の追加。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 8月 19日 (木) 01:02:59 JST


Revision: 4014
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4014
Author:   yutakapon
Date:     2010-08-19 01:02:59 +0900 (Thu, 19 Aug 2010)

Log Message:
-----------
strjoin の追加。
http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=22781#comment:1412:22781:1282146205

Modified Paths:
--------------
    trunk/teraterm/common/helpid.h
    trunk/teraterm/ttpmacro/ttl.c
    trunk/teraterm/ttpmacro/ttmparse.c
    trunk/teraterm/ttpmacro/ttmparse.h


-------------- next part --------------
Modified: trunk/teraterm/common/helpid.h
===================================================================
--- trunk/teraterm/common/helpid.h	2010-08-18 15:41:55 UTC (rev 4013)
+++ trunk/teraterm/common/helpid.h	2010-08-18 16:02:59 UTC (rev 4014)
@@ -283,6 +283,7 @@
 #define HlpMacroCommandStrconcat        92093
 #define HlpMacroCommandStrcopy          92094
 #define HlpMacroCommandStrinert         92180
+#define HlpMacroCommandStrjoin          92185
 #define HlpMacroCommandStrlen           92095
 #define HlpMacroCommandStrmatch         92135
 #define HlpMacroCommandStrremove        92181

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2010-08-18 15:41:55 UTC (rev 4013)
+++ trunk/teraterm/ttpmacro/ttl.c	2010-08-18 16:02:59 UTC (rev 4014)
@@ -3711,6 +3711,66 @@
 #undef MAXVARNUM
 }
 
+WORD TTLStrJoin()
+{
+#define MAXVARNUM 9
+	TStrVal delimchars, buf;
+	WORD Err, VarId;
+	WORD VarType;
+	int maxvar, sp;
+	int srclen, len;
+	int i;
+	char *srcptr, *p;
+
+	Err = 0;
+	GetStrVar(&VarId,&Err);
+	GetStrVal(delimchars,&Err);
+	GetIntVal(&maxvar,&Err);
+	// get 3rd arg(optional) if given
+	if (CheckParameterGiven()) {
+		GetIntVal(&sp, &Err);
+	} else {
+		/* ƒfƒtƒHƒ‹ƒg‚͐§ŒäƒR[ƒhˆµ‚¢‚Æ‚·‚éB*/
+		sp = 1;
+	}
+	if ((Err==0) && (GetFirstChar()!=0))
+		Err = ErrSyntax;
+	if (Err!=0) return Err;
+
+	if (maxvar < 1 || maxvar > MAXVARNUM)
+		return ErrSyntax;
+
+	if (sp) {
+		// ‰üsƒR[ƒh‚ð•ÏŠ·‚·‚é
+		RestoreNewLine(delimchars);
+	}
+
+	// ƒfƒŠƒ~ƒ^‚Í1•¶Žš‚Ì‚Ý‚Æ‚·‚éB
+	len = strlen(delimchars);
+	if (len != 1)
+		return ErrSyntax;
+
+	srcptr = StrVarPtr(VarId);
+	srclen = strlen(srcptr);
+
+	srcptr[0] = '\0';
+	for (i = 0 ; i < maxvar ; i++) {
+		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "groupmatchstr%d", i + 1);
+		if (CheckVar(buf,&VarType,&VarId)) {
+			if (VarType!=TypString)
+				return ErrSyntax;
+			p = StrVarPtr(VarId);
+			strncat_s(srcptr, MaxStrLen, p, _TRUNCATE);
+			strncat_s(srcptr, MaxStrLen, delimchars, _TRUNCATE);
+		}
+	}
+	/* ÅŒã‚̃fƒŠƒ~ƒ^‚ðÁ‚· */
+	srcptr[strlen(srcptr) - 1] = '\0';
+
+	return Err;
+#undef MAXVARNUM
+}
+
 WORD TTLTestLink()
 {
 	if (GetFirstChar()!=0)
@@ -4551,6 +4611,8 @@
 			Err = TTLStrCopy(); break;
 		case RsvStrInsert:
 			Err = TTLStrInsert(); break;
+		case RsvStrJoin:
+			Err = TTLStrJoin(); break;
 		case RsvStrLen:
 			Err = TTLStrLen(); break;
 		case RsvStrMatch:

Modified: trunk/teraterm/ttpmacro/ttmparse.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.c	2010-08-18 15:41:55 UTC (rev 4013)
+++ trunk/teraterm/ttpmacro/ttmparse.c	2010-08-18 16:02:59 UTC (rev 4014)
@@ -289,6 +289,7 @@
 		else if (_stricmp(Str,"strconcat")==0) *WordId = RsvStrConcat;
 		else if (_stricmp(Str,"strcopy")==0) *WordId = RsvStrCopy;
 		else if (_stricmp(Str,"strinsert")==0) *WordId = RsvStrInsert;
+		else if (_stricmp(Str,"strjoin")==0) *WordId = RsvStrJoin;
 		else if (_stricmp(Str,"strlen")==0) *WordId = RsvStrLen;
 		else if (_stricmp(Str,"strmatch")==0) *WordId = RsvStrMatch;
 		else if (_stricmp(Str,"strremove")==0) *WordId = RsvStrRemove;

Modified: trunk/teraterm/ttpmacro/ttmparse.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.h	2010-08-18 15:41:55 UTC (rev 4013)
+++ trunk/teraterm/ttpmacro/ttmparse.h	2010-08-18 16:02:59 UTC (rev 4014)
@@ -200,6 +200,7 @@
 #define RsvStrReplace   182
 #define RsvStrTrim      183
 #define RsvStrSplit     184
+#define RsvStrJoin      185
 
 #define RsvOperator     1000
 #define RsvBNot         1001



Ttssh2-commit メーリングリストの案内
Back to archive index