[Ttssh2-commit] [5329] マクロエラーのダイアログに詳細情報(行番号・エラー箇所位置)を追加表示するようにした。

svnno****@sourc***** svnno****@sourc*****
2013年 6月 23日 (日) 23:22:50 JST


Revision: 5329
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5329
Author:   yutakapon
Date:     2013-06-23 23:22:50 +0900 (Sun, 23 Jun 2013)
Log Message:
-----------
マクロエラーのダイアログに詳細情報(行番号・エラー箇所位置)を追加表示するようにした。
ただし、まだドラフト版。

Modified Paths:
--------------
    trunk/teraterm/ttpmacro/errdlg.cpp
    trunk/teraterm/ttpmacro/errdlg.h
    trunk/teraterm/ttpmacro/ttmbuff.c
    trunk/teraterm/ttpmacro/ttmdlg.cpp
    trunk/teraterm/ttpmacro/ttmdlg.h
    trunk/teraterm/ttpmacro/ttmparse.c
    trunk/teraterm/ttpmacro/ttmparse.h
    trunk/teraterm/ttpmacro/ttpmacro.rc

-------------- next part --------------
Modified: trunk/teraterm/ttpmacro/errdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/errdlg.cpp	2013-06-21 13:47:40 UTC (rev 5328)
+++ trunk/teraterm/ttpmacro/errdlg.cpp	2013-06-23 14:22:50 UTC (rev 5329)
@@ -15,6 +15,7 @@
 
 #include "errdlg.h"
 #include "ttmlib.h"
+#include "ttmparse.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -23,7 +24,7 @@
 #endif
 
 // CErrDlg dialog
-CErrDlg::CErrDlg(PCHAR Msg, PCHAR Line, int x, int y)
+CErrDlg::CErrDlg(PCHAR Msg, PCHAR Line, int x, int y, int lineno, int start, int end)
 	: CDialog(CErrDlg::IDD)
 {
 	//{{AFX_DATA_INIT(CErrDlg)
@@ -32,6 +33,9 @@
 	LineStr = Line;
 	PosX = x;
 	PosY = y;
+	LineNo = lineno;
+	StartPos = start;
+	EndPos = end;
 }
 
 BEGIN_MESSAGE_MAP(CErrDlg, CDialog)
@@ -49,6 +53,8 @@
 	char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG];
 	LOGFONT logfont;
 	HFONT font;
+	char buf[MaxLineLen*2], buf2[10];
+	int i, len;
 
 	CDialog::OnInitDialog();
 	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
@@ -71,8 +77,25 @@
 	SetDlgItemText(IDC_MACROERRHELP, uimsg);
 
 	SetDlgItemText(IDC_ERRMSG,MsgStr);
-	SetDlgItemText(IDC_ERRLINE,LineStr);
 
+	// \x8Ds\x94ԍ\x86\x82\xF0\x90擪\x82ɂ‚\xAF\x82\xE9\x81B
+	// TODO: \x83t\x83@\x83C\x83\x8B\x96\xBC\x82\xE0\x82‚\xAF\x82\xBD\x82\xA2\x81B
+	// \x83G\x83\x89\x81[\x89ӏ\x8A\x82Ɉ\xF3\x82\xF0\x82‚\xAF\x82\xE9\x81B
+	_snprintf_s(buf, sizeof(buf), _TRUNCATE, ":%d:", LineNo);
+	len = strlen(LineStr);
+	for (i = 0 ; i < len ; i++) {
+		if (i == StartPos)
+			strncat_s(buf, sizeof(buf), "<<<", _TRUNCATE);
+		if (i == EndPos)
+			strncat_s(buf, sizeof(buf), ">>>", _TRUNCATE);
+		buf2[0] = LineStr[i];
+		buf2[1] = 0;
+		strncat_s(buf, sizeof(buf), buf2, _TRUNCATE);
+	}
+	if (EndPos == len)
+		strncat_s(buf, sizeof(buf), ">>>", _TRUNCATE);
+	SetDlgItemText(IDC_ERRLINE, buf);
+
 	if (PosX<=GetMonitorLeftmost(PosX, PosY)-100) {
 		GetWindowRect(&R);
 		TmpDC = ::GetDC(GetSafeHwnd());

Modified: trunk/teraterm/ttpmacro/errdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/errdlg.h	2013-06-21 13:47:40 UTC (rev 5328)
+++ trunk/teraterm/ttpmacro/errdlg.h	2013-06-23 14:22:50 UTC (rev 5329)
@@ -8,7 +8,7 @@
 class CErrDlg : public CDialog
 {
 public:
-	CErrDlg(PCHAR Msg, PCHAR Line, int x, int y);
+	CErrDlg(PCHAR Msg, PCHAR Line, int x, int y, int lineno, int start, int end);
 
 	//{{AFX_DATA(CErrDlg)
 	enum { IDD = IDD_ERRDLG };
@@ -21,6 +21,8 @@
 	PCHAR MsgStr, LineStr;
 	int PosX, PosY;
 	HFONT DlgFont;
+	int LineNo;
+	int StartPos, EndPos;
 
 	//{{AFX_MSG(CErrDlg)
 	virtual BOOL OnInitDialog();

Modified: trunk/teraterm/ttpmacro/ttmbuff.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmbuff.c	2013-06-21 13:47:40 UTC (rev 5328)
+++ trunk/teraterm/ttpmacro/ttmbuff.c	2013-06-23 14:22:50 UTC (rev 5329)
@@ -188,6 +188,7 @@
 	}
 	LinePtr = 0;
 	LineLen = strlen(LineBuff);
+	LineParsePtr = 0;
 
 	// current line number (2005.7.18 yutaka)
 	LineNo = getCurrentLineNumber(Buff[INest], BuffPtr[INest]); 

Modified: trunk/teraterm/ttpmacro/ttmdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.cpp	2013-06-21 13:47:40 UTC (rev 5328)
+++ trunk/teraterm/ttpmacro/ttmdlg.cpp	2013-06-23 14:22:50 UTC (rev 5329)
@@ -261,9 +261,9 @@
 }
 
 extern "C" {
-int OpenErrDlg(PCHAR Msg, PCHAR Line)
+int OpenErrDlg(PCHAR Msg, PCHAR Line, int lineno, int start, int end)
 {
-	CErrDlg ErrDlg(Msg,Line,DlgPosX,DlgPosY);
+	CErrDlg ErrDlg(Msg,Line,DlgPosX,DlgPosY, lineno, start, end);
 	return ErrDlg.DoModal();
 }
 }

Modified: trunk/teraterm/ttpmacro/ttmdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.h	2013-06-21 13:47:40 UTC (rev 5328)
+++ trunk/teraterm/ttpmacro/ttmdlg.h	2013-06-23 14:22:50 UTC (rev 5329)
@@ -17,7 +17,7 @@
 void SetDlgPos(int x, int y);
 void OpenInpDlg(PCHAR Buff, PCHAR Text, PCHAR Caption,
                 PCHAR Default, BOOL Paswd);
-int OpenErrDlg(PCHAR Msg, PCHAR Line);
+int OpenErrDlg(PCHAR Msg, PCHAR Line, int lineno, int start, int end);
 int OpenMsgDlg(PCHAR Text, PCHAR Caption, BOOL YesNo);
 void OpenStatDlg(PCHAR Text, PCHAR Caption);
 void CloseStatDlg();

Modified: trunk/teraterm/ttpmacro/ttmparse.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.c	2013-06-21 13:47:40 UTC (rev 5328)
+++ trunk/teraterm/ttpmacro/ttmparse.c	2013-06-23 14:22:50 UTC (rev 5329)
@@ -10,6 +10,7 @@
 #include <ctype.h>
 #include "ttmdlg.h"
 #include "ttmparse.h"
+#include "ttmbuff.h"
 
 /* C\x8C\xBE\x8C\xEA\x83X\x83^\x83C\x83\x8B\x82̃R\x83\x81\x83\x93\x83g\x82\xF0\x83T\x83|\x81[\x83g\x82\xB7\x82邩\x82ǂ\xA4\x82\xA9 (2009.7.2 yutaka) */
 #define SUPPORT_C_STYLE_COMMENT
@@ -19,6 +20,7 @@
 char LineBuff[MaxLineLen]; // \x8Ds\x83o\x83b\x83t\x83@\x82̃T\x83C\x83Y\x82\xF0\x8Ag\x92\xA3\x82\xB5\x82\xBD\x81B(2007.6.9 maya)
 WORD LinePtr;
 WORD LineLen;
+WORD LineParsePtr;  // \x83g\x81[\x83N\x83\x93\x82̉\xF0\x90͂\xF0\x8AJ\x8En\x82\xB5\x82\xBD\x88ʒu (2013.6.23 yutaka)
 
 typedef struct {
     int size;
@@ -59,6 +61,14 @@
 static PCHAR StrBuff;
 static WORD IntVarCount, StrVarCount, LabVarCount, IntAryVarCount, StrAryVarCount;
 
+
+// \x83g\x81[\x83N\x83\x93\x82̉\xF0\x90͊J\x8En\x88ʒu\x82\xF0\x8DX\x90V\x82\xB7\x82\xE9\x81B
+static void UpdateLineParsePtr(void)
+{
+	LineParsePtr = LinePtr;
+}
+
+
 BOOL InitVar()
 {
 	HNameBuff = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,NameBuffLen);
@@ -112,7 +122,7 @@
 		case ErrNotSupported: strncpy_s(Msg, sizeof(Msg), "Unknown command.", _TRUNCATE); break;
 	}
 
-	i = OpenErrDlg(Msg,LineBuff);
+	i = OpenErrDlg(Msg, LineBuff, GetLineNo(), LineParsePtr, LinePtr);
 	if (i==IDOK) TTLStatus = IdTTLEnd;
 }
 

Modified: trunk/teraterm/ttpmacro/ttmparse.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.h	2013-06-21 13:47:40 UTC (rev 5328)
+++ trunk/teraterm/ttpmacro/ttmparse.h	2013-06-23 14:22:50 UTC (rev 5329)
@@ -334,6 +334,7 @@
 extern char LineBuff[MaxLineLen];
 extern WORD LinePtr;
 extern WORD LineLen;
+extern WORD LineParsePtr;
 
 #ifdef __cplusplus
 }

Modified: trunk/teraterm/ttpmacro/ttpmacro.rc
===================================================================
--- trunk/teraterm/ttpmacro/ttpmacro.rc	2013-06-21 13:47:40 UTC (rev 5328)
+++ trunk/teraterm/ttpmacro/ttpmacro.rc	2013-06-23 14:22:50 UTC (rev 5329)
@@ -67,7 +67,7 @@
 FONT 14, "System", 0, 0, 0x0
 BEGIN
     CONTROL         "",IDC_ERRMSG,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,20,4,141,8
-    CONTROL         "",IDC_ERRLINE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,20,16,130,8
+    CONTROL         "",IDC_ERRLINE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,20,16,197,8
     DEFPUSHBUTTON   "&Stop macro",IDOK,27,28,54,14
     PUSHBUTTON      "&Continue",IDCANCEL,92,28,54,14
     PUSHBUTTON      "&Help",IDC_MACROERRHELP,157,28,54,14
@@ -180,3 +180,13 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+



Ttssh2-commit メーリングリストの案内