[Ttssh2-commit] [4904] マクロコマンドを追加した。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2012年 4月 19日 (木) 01:49:15 JST


Revision: 4904
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4904
Author:   yutakapon
Date:     2012-04-19 01:49:14 +0900 (Thu, 19 Apr 2012)
Log Message:
-----------
マクロコマンドを追加した。
- filelock
- fileunlock

cf.
http://logmett.com/forum/viewtopic.php?f=3&t=1982

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/en/html/macro/command/index.html
    trunk/doc/en/teraterm.hhc
    trunk/doc/en/teraterm.hhp
    trunk/doc/ja/html/about/history.html
    trunk/doc/ja/html/macro/command/index.html
    trunk/doc/ja/teraterm.hhc
    trunk/doc/ja/teraterm.hhp
    trunk/teraterm/common/helpid.h
    trunk/teraterm/ttpmacro/ttl.c
    trunk/teraterm/ttpmacro/ttmparse.c
    trunk/teraterm/ttpmacro/ttmparse.h

Added Paths:
-----------
    trunk/doc/en/html/macro/command/filelock.html
    trunk/doc/en/html/macro/command/fileunlock.html
    trunk/doc/ja/html/macro/command/filelock.html
    trunk/doc/ja/html/macro/command/fileunlock.html

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/doc/en/html/about/history.html	2012-04-18 16:49:14 UTC (rev 4904)
@@ -60,6 +60,8 @@
         <ul>
           <li>added the "paramcnt"(argument count) and "param1"(macro filename) in the <a href="../macro/syntax/variables.html">Variables</a>.</li>
           <li>added a sample code in the <a href="../macro/command/connect.html">connect</a> command.</li>
+          <li>added the <a href="../macro/command/filelock.html">filelock</a> command.</li>
+          <li>added the <a href="../macro/command/fileunlock.html">fileunlock</a> command.</li>
         </ul></li>
     </ul>
   </li>

Added: trunk/doc/en/html/macro/command/filelock.html
===================================================================
--- trunk/doc/en/html/macro/command/filelock.html	                        (rev 0)
+++ trunk/doc/en/html/macro/command/filelock.html	2012-04-18 16:49:14 UTC (rev 4904)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+  <title>filelock</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>filelock</h1>
+
+<p>
+Locks the specified file.
+</p>
+
+<pre class="macro-syntax">
+filelock &lt;file handle&gt; [&lt;timeout&gt;]
+</pre>
+
+<h2>Remarks</h2>
+
+<p>
+Locks the specified whole file for exclusive access by the calling process. <br>
+The filelock command will wait until the file is unlocked. However, the command will time out
+at the &lt;timeout&gt; value when the argument is specified.
+</p>
+
+<p>
+If the function succeeds, the result variable is 0.<br>
+If the function fails, the result variable is 1.
+</p>
+
+
+<h2>Examples</h2>
+
+<pre class="macro-example">
+fileopen fhandle 'test.txt' 0
+filelock fhandle
+if result!=0 then
+	messagebox 'error' 'hoge'
+endif
+filewrite fhandle 'sample'
+pause 60
+fileunlock fhandle
+if result!=0 then
+	messagebox 'error' 'hoge'
+endif
+fileclose fhandle
+</pre>
+
+<h2>See also</h2>
+
+<ul>
+ <li>"<a href="fileunlock.html">fileunlock</a>"</li>
+</ul>
+
+</body>
+</html>

Added: trunk/doc/en/html/macro/command/fileunlock.html
===================================================================
--- trunk/doc/en/html/macro/command/fileunlock.html	                        (rev 0)
+++ trunk/doc/en/html/macro/command/fileunlock.html	2012-04-18 16:49:14 UTC (rev 4904)
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+  <title>fileunlock</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>fileunlock</h1>
+
+<p>
+Unlocks the specified file.
+</p>
+
+<pre class="macro-syntax">
+fileunlock &lt;file handle&gt;
+</pre>
+
+<h2>Remarks</h2>
+
+<p>
+Unlocks the specified whole file. Unlocking a file enables other processes
+to access the file.
+</p>
+
+<p>
+If the function succeeds, the result variable is 0.<br>
+If the function fails, the result variable is 1.
+</p>
+
+
+<h2>Examples</h2>
+
+<pre class="macro-example">
+fileopen fhandle 'test.txt' 0
+filelock fhandle
+if result!=0 then
+	messagebox 'error' 'hoge'
+endif
+filewrite fhandle 'sample'
+pause 60
+fileunlock fhandle
+if result!=0 then
+	messagebox 'error' 'hoge'
+endif
+fileclose fhandle
+</pre>
+
+<h2>See also</h2>
+
+<ul>
+ <li>"<a href="filelock.html">filelock</a>"</li>
+</ul>
+
+</body>
+</html>

Modified: trunk/doc/en/html/macro/command/index.html
===================================================================
--- trunk/doc/en/html/macro/command/index.html	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/doc/en/html/macro/command/index.html	2012-04-18 16:49:14 UTC (rev 4904)
@@ -141,6 +141,7 @@
  <li><a href="filecopy.html">filecopy</a>
  <li><a href="filecreate.html">filecreate</a>
  <li><a href="filedelete.html">filedelete</a>
+ <li><a href="filelock.html">filelock</a> (version 4.74 or later)
  <li><a href="filemarkptr.html">filemarkptr</a>
  <li><a href="fileopen.html">fileopen</a>
  <li><a href="filereadln.html">filereadln</a>
@@ -153,6 +154,7 @@
  <li><a href="filestrseek.html">filestrseek</a>
  <li><a href="filestrseek2.html">filestrseek2</a>
  <li><a href="filetruncate.html">filetruncate</a> (version 4.67 or later)
+ <li><a href="fileunlock.html">fileunlock</a> (version 4.74 or later)
  <li><a href="filewrite.html">filewrite</a>
  <li><a href="filewriteln.html">filewriteln</a>
  <li><a href="findoperations.html">findfirst, findnext, findclose</a>

Modified: trunk/doc/en/teraterm.hhc
===================================================================
--- trunk/doc/en/teraterm.hhc	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/doc/en/teraterm.hhc	2012-04-18 16:49:14 UTC (rev 4904)
@@ -476,7 +476,7 @@
 				<param name="Name" value="TTXttyplay">
 				<param name="Local" value="html\commandline\ttxttyplay.html">
 				<param name="ImageNumber" value="11">
-			</OBJECT>
+				</OBJECT>
 		</UL>
 	</UL>
 	<LI> <OBJECT type="text/sitemap">
@@ -1170,6 +1170,11 @@
 					<param name="ImageNumber" value="11">
 					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="filelock">
+					<param name="Local" value="html\macro\command\filelock.html">
+					<param name="ImageNumber" value="11">
+					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="filemarkptr">
 					<param name="Local" value="html\macro\command\filemarkptr.html">
 					<param name="ImageNumber" value="11">
@@ -1230,6 +1235,11 @@
 					<param name="ImageNumber" value="11">
 					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="fileunlock">
+					<param name="Local" value="html\macro\command\fileunlock.html">
+					<param name="ImageNumber" value="11">
+					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="filewrite">
 					<param name="Local" value="html\macro\command\filewrite.html">
 					<param name="ImageNumber" value="11">
@@ -1390,7 +1400,7 @@
 					<param name="Name" value="intdim">
 					<param name="Local" value="html\macro\command\intdim.html">
 					<param name="ImageNumber" value="11">
-					</OBJECT>					
+					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="messagebox">
 					<param name="Local" value="html\macro\command\messagebox.html">

Modified: trunk/doc/en/teraterm.hhp
===================================================================
--- trunk/doc/en/teraterm.hhp	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/doc/en/teraterm.hhp	2012-04-18 16:49:14 UTC (rev 4904)
@@ -185,6 +185,7 @@
 HlpMacroCommandFilecopy=html\macro\command\filecopy.html
 HlpMacroCommandFilecreate=html\macro\command\filecreate.html
 HlpMacroCommandFiledelete=html\macro\command\filedelete.html
+HlpMacroCommandFilelock=html\macro\command\filelock.html
 HlpMacroCommandFilemarkptr=html\macro\command\filemarkptr.html
 HlpMacroCommandFilenamebox=html\macro\command\filenamebox.html
 HlpMacroCommandFileopen=html\macro\command\fileopen.html
@@ -198,6 +199,7 @@
 HlpMacroCommandFilestrseek=html\macro\command\filestrseek.html
 HlpMacroCommandFilestrseek2=html\macro\command\filestrseek2.html
 HlpMacroCommandFiletruncate=html\macro\command\filetruncate.html
+HlpMacroCommandFileunlock=html\macro\command\fileunlock.html
 HlpMacroCommandFilewrite=html\macro\command\filewrite.html
 HlpMacroCommandFilewriteln=html\macro\command\filewriteln.html
 HlpMacroCommandFindoperations=html\macro\command\findoperations.html

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/doc/ja/html/about/history.html	2012-04-18 16:49:14 UTC (rev 4904)
@@ -60,6 +60,8 @@
         <ul>
           <li><a href="../macro/syntax/variables.html">\x95ϐ\x94</a>\x82\xC9"paramcnt"\x81i\x88\xF8\x90\x94\x82̌\x94\x81j\x81A"param1"\x81i\x83}\x83N\x83\x8D\x83t\x83@\x83C\x83\x8B\x96\xBC\x81j\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
           <li><a href="../macro/command/connect.html">connect</a>\x83R\x83}\x83\x93\x83h\x82Ƀp\x83\x89\x83\x81\x81[\x83^\x82𗘗p\x82\xB5\x82\xBD\x83T\x83\x93\x83v\x83\x8B\x83R\x81[\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
+          <li><a href="../macro/command/filelock.html">filelock</a>\x83R\x83}\x83\x93\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
+          <li><a href="../macro/command/fileunlock.html">fileunlock</a>\x83R\x83}\x83\x93\x83h\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
         </ul></li>
     </ul>
   </li>

Added: trunk/doc/ja/html/macro/command/filelock.html
===================================================================
--- trunk/doc/ja/html/macro/command/filelock.html	                        (rev 0)
+++ trunk/doc/ja/html/macro/command/filelock.html	2012-04-18 16:49:14 UTC (rev 4904)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
+  <title>filelock</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>filelock</h1>
+
+<p>
+\x8AJ\x82\xA2\x82Ă\xA2\x82\xE9\x83t\x83@\x83C\x83\x8B\x82\xF0\x83\x8D\x83b\x83N\x82\xB7\x82\xE9\x81B
+</p>
+
+<pre class="macro-syntax">
+filelock &lt;file handle&gt; [&lt;timeout&gt;]
+</pre>
+
+<h2>\x89\xF0\x90\xE0</h2>
+
+<p>
+\x82\xB7\x82łɊJ\x82\xA2\x82Ă\xA2\x82\xE9\x83t\x83@\x83C\x83\x8B\x83n\x83\x93\x83h\x83\x8B &lt;file handle&gt; \x82\xF0\x8Ew\x92肷\x82\xE9\x82ƁA\x83t\x83@\x83C\x83\x8B\x91S\x91̂\xF0\x83\x8D\x83b\x83N\x82\xB7\x82\xE9\x81B
+\x83\x8D\x83b\x83N\x92\x86\x81A\x91\xBC\x82̃v\x83\x8D\x83Z\x83X\x82\xA9\x82\xE7\x82̓\x96\x8AY\x83t\x83@\x83C\x83\x8B\x82ւ̃A\x83N\x83Z\x83X\x82̓G\x83\x89\x81[\x82ƂȂ\xE9\x81B<br>
+filelock\x93\xAF\x8Em\x82ł\xA0\x82\xEA\x82΁A\x83t\x83@\x83C\x83\x8B\x82̃\x8D\x83b\x83N\x82\xAA\x89\xF0\x8F\x9C\x82\xB3\x82\xEA\x82\xE9\x82܂ő҂B\x88\xF8\x90\x94 &lt;timeout&gt; \x82̎w\x92肪\x82\xA0\x82\xEA\x82΁A
+\x8Ew\x92莞\x8Aԁi\x95b\x81j\x8Dő\xE5\x91҂B
+</p>
+
+<p>
+\x83\x8D\x83b\x83N\x82ɐ\xAC\x8C\x{1C2DC2}\xE9\x82\xC6 result \x95ϐ\x94\x82\xAA 0 \x82ɁA\x8E\xB8\x94s\x82\xB7\x82\xE9\x82\xC6 1 \x82ƂȂ\xE9\x81B
+</p>
+
+
+<h2>\x97\xE1</h2>
+
+<pre class="macro-example">
+fileopen fhandle 'test.txt' 0
+filelock fhandle
+if result!=0 then
+	messagebox 'error' 'hoge'
+endif
+filewrite fhandle 'sample'
+pause 60
+fileunlock fhandle
+if result!=0 then
+	messagebox 'error' 'hoge'
+endif
+fileclose fhandle
+</pre>
+
+<h2>\x8EQ\x8F\xC6</h2>
+
+<ul>
+ <li>"<a href="fileunlock.html">fileunlock</a>"</li>
+</ul>
+
+</body>
+</html>

Added: trunk/doc/ja/html/macro/command/fileunlock.html
===================================================================
--- trunk/doc/ja/html/macro/command/fileunlock.html	                        (rev 0)
+++ trunk/doc/ja/html/macro/command/fileunlock.html	2012-04-18 16:49:14 UTC (rev 4904)
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
+  <title>fileunlock</title>
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <link rel="stylesheet" href="../../style.css" type="text/css">
+</head>
+
+<body>
+
+
+<h1>fileunlock</h1>
+
+<p>
+\x8AJ\x82\xA2\x82Ă\xA2\x82\xE9\x83t\x83@\x83C\x83\x8B\x82̃\x8D\x83b\x83N\x82\xF0\x89\xF0\x8F\x9C\x82\xB7\x82\xE9\x81B
+</p>
+
+<pre class="macro-syntax">
+fileunlock &lt;file handle&gt;
+</pre>
+
+<h2>\x89\xF0\x90\xE0</h2>
+
+<p>
+\x82\xB7\x82łɊJ\x82\xA2\x82Ă\xA2\x82\xE9\x83t\x83@\x83C\x83\x8B\x83n\x83\x93\x83h\x83\x8B &lt;file handle&gt; \x82\xF0\x8Ew\x92肷\x82\xE9\x82ƁA\x83t\x83@\x83C\x83\x8B\x91S\x91̂̃\x8D\x83b\x83N\x82\xF0\x89\xF0\x8F\x9C\x82\xB7\x82\xE9\x81B
+</p>
+
+<p>
+\x83\x8D\x83b\x83N\x82̉\xF0\x8F\x9C\x82ɐ\xAC\x8C\x{1C2DC2}\xE9\x82\xC6 result \x95ϐ\x94\x82\xAA 0 \x82ɁA\x8E\xB8\x94s\x82\xB7\x82\xE9\x82\xC6 1 \x82ƂȂ\xE9\x81B
+</p>
+
+
+<h2>\x97\xE1</h2>
+
+<pre class="macro-example">
+fileopen fhandle 'test.txt' 0
+filelock fhandle
+if result!=0 then
+	messagebox 'error' 'hoge'
+endif
+filewrite fhandle 'sample'
+pause 60
+fileunlock fhandle
+if result!=0 then
+	messagebox 'error' 'hoge'
+endif
+fileclose fhandle
+</pre>
+
+<h2>\x8EQ\x8F\xC6</h2>
+
+<ul>
+ <li>"<a href="filelock.html">filelock</a>"</li>
+</ul>
+
+</body>
+</html>

Modified: trunk/doc/ja/html/macro/command/index.html
===================================================================
--- trunk/doc/ja/html/macro/command/index.html	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/doc/ja/html/macro/command/index.html	2012-04-18 16:49:14 UTC (rev 4904)
@@ -141,6 +141,7 @@
  <li><a href="filecopy.html">filecopy</a>
  <li><a href="filecreate.html">filecreate</a>
  <li><a href="filedelete.html">filedelete</a>
+ <li><a href="filelock.html">filelock</a> (\x83o\x81[\x83W\x83\x87\x83\x934.74\x88ȍ~)
  <li><a href="filemarkptr.html">filemarkptr</a>
  <li><a href="fileopen.html">fileopen</a>
  <li><a href="filereadln.html">filereadln</a>
@@ -153,6 +154,7 @@
  <li><a href="filestrseek.html">filestrseek</a>
  <li><a href="filestrseek2.html">filestrseek2</a>
  <li><a href="filetruncate.html">filetruncate</a> (\x83o\x81[\x83W\x83\x87\x83\x934.67\x88ȍ~)
+ <li><a href="fileunlock.html">fileunlock</a> (\x83o\x81[\x83W\x83\x87\x83\x934.74\x88ȍ~)
  <li><a href="filewrite.html">filewrite</a>
  <li><a href="filewriteln.html">filewriteln</a>
  <li><a href="findoperations.html">findfirst, findnext, findclose</a>

Modified: trunk/doc/ja/teraterm.hhc
===================================================================
--- trunk/doc/ja/teraterm.hhc	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/doc/ja/teraterm.hhc	2012-04-18 16:49:14 UTC (rev 4904)
@@ -1183,6 +1183,10 @@
 					<param name="ImageNumber" value="11">
 					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="filelock">
+					<param name="Local" value="html\macro\command\filelock.html">
+					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="filemarkptr">
 					<param name="Local" value="html\macro\command\filemarkptr.html">
 					<param name="ImageNumber" value="11">
@@ -1243,6 +1247,10 @@
 					<param name="ImageNumber" value="11">
 					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
+					<param name="Name" value="fileunlock">
+					<param name="Local" value="html\macro\command\fileunlock.html">
+					</OBJECT>
+				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="filewrite">
 					<param name="Local" value="html\macro\command\filewrite.html">
 					<param name="ImageNumber" value="11">
@@ -1403,7 +1411,7 @@
 					<param name="Name" value="intdim">
 					<param name="Local" value="html\macro\command\intdim.html">
 					<param name="ImageNumber" value="11">
-					</OBJECT>					
+					</OBJECT>
 				<LI> <OBJECT type="text/sitemap">
 					<param name="Name" value="messagebox">
 					<param name="Local" value="html\macro\command\messagebox.html">

Modified: trunk/doc/ja/teraterm.hhp
===================================================================
--- trunk/doc/ja/teraterm.hhp	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/doc/ja/teraterm.hhp	2012-04-18 16:49:14 UTC (rev 4904)
@@ -195,6 +195,7 @@
 HlpMacroCommandFilecopy=html\macro\command\filecopy.html
 HlpMacroCommandFilecreate=html\macro\command\filecreate.html
 HlpMacroCommandFiledelete=html\macro\command\filedelete.html
+HlpMacroCommandFilelock=html\macro\command\filelock.html
 HlpMacroCommandFilemarkptr=html\macro\command\filemarkptr.html
 HlpMacroCommandFilenamebox=html\macro\command\filenamebox.html
 HlpMacroCommandFileopen=html\macro\command\fileopen.html
@@ -208,6 +209,7 @@
 HlpMacroCommandFilestrseek=html\macro\command\filestrseek.html
 HlpMacroCommandFilestrseek2=html\macro\command\filestrseek2.html
 HlpMacroCommandFiletruncate=html\macro\command\filetruncate.html
+HlpMacroCommandFileunlock=html\macro\command\fileunlock.html
 HlpMacroCommandFilewrite=html\macro\command\filewrite.html
 HlpMacroCommandFilewriteln=html\macro\command\filewriteln.html
 HlpMacroCommandFindoperations=html\macro\command\findoperations.html

Modified: trunk/teraterm/common/helpid.h
===================================================================
--- trunk/teraterm/common/helpid.h	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/teraterm/common/helpid.h	2012-04-18 16:49:14 UTC (rev 4904)
@@ -194,6 +194,7 @@
 #define HlpMacroCommandFilecopy         92024
 #define HlpMacroCommandFilecreate       92025
 #define HlpMacroCommandFiledelete       92026
+#define HlpMacroCommandFileLock         92153
 #define HlpMacroCommandFilemarkptr      92027
 #define HlpMacroCommandFilenamebox      92124
 #define HlpMacroCommandFileopen         92028
@@ -207,6 +208,7 @@
 #define HlpMacroCommandFilestrseek      92034
 #define HlpMacroCommandFilestrseek2     92035
 #define HlpMacroCommandFiletruncate     92179
+#define HlpMacroCommandFileUnLock       92154
 #define HlpMacroCommandFilewrite        92036
 #define HlpMacroCommandFilewriteln      92037
 #define HlpMacroCommandFindoperations   92039

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/teraterm/ttpmacro/ttl.c	2012-04-18 16:49:14 UTC (rev 4904)
@@ -1313,6 +1313,66 @@
 	return Err;
 }
 
+// Format: filelock <file handle> [<timeout>]
+// (2012.4.19 yutaka)
+WORD TTLFileLock()
+{
+	WORD Err;
+	int FH;
+	DWORD timeout;
+	int result;
+	BOOL ret;
+	DWORD dwStart;
+
+	Err = 0;
+	GetIntVal(&FH,&Err);
+	if (Err!=0) return Err;
+
+	timeout = -1;  // \x96\xB3\x8C\xC0\x91\xE5
+	if (CheckParameterGiven()) {
+		GetIntVal(&timeout, &Err);
+		if (Err!=0) return Err;
+	}
+
+	result = 1;  // error
+	dwStart = GetTickCount();
+	do {
+		ret = LockFile((HANDLE)FH, 0, 0, (DWORD)-1, (DWORD)-1);
+		if (ret != 0) { // \x83\x8D\x83b\x83N\x90\xAC\x8C\xF7
+			result = 0;  // success
+			break;
+		}
+		Sleep(1);
+	} while (GetTickCount() - dwStart < (timeout*1000));
+
+	SetResult(result);
+	return Err;
+}
+
+// Format: fileunlock <file handle> 
+// (2012.4.19 yutaka)
+WORD TTLFileUnLock()
+{
+	WORD Err;
+	int FH;
+	BOOL ret;
+
+	Err = 0;
+	GetIntVal(&FH,&Err);
+	if ((Err==0) && (GetFirstChar()!=0))
+		Err = ErrSyntax;
+	if (Err!=0) return Err;
+
+	ret = UnlockFile((HANDLE)FH, 0, 0, (DWORD)-1, (DWORD)-1);
+	if (ret != 0) { // \x83A\x83\x93\x83\x8D\x83b\x83N\x90\xAC\x8C\xF7
+		SetResult(0);
+	} else {
+		SetResult(1);
+	}
+
+	return Err;
+}
+
 WORD TTLFileReadln()
 {
 	WORD Err;
@@ -4891,6 +4951,10 @@
 			Err = TTLFilenameBox(); break;  // add 'filenamebox' (2007.9.13 maya)
 		case RsvFileOpen:
 			Err = TTLFileOpen(); break;
+		case RsvFileLock:
+			Err = TTLFileLock(); break;
+		case RsvFileUnLock:
+			Err = TTLFileUnLock(); break;
 		case RsvFileReadln:
 			Err = TTLFileReadln(); break;
 		case RsvFileRead:

Modified: trunk/teraterm/ttpmacro/ttmparse.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.c	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/teraterm/ttpmacro/ttmparse.c	2012-04-18 16:49:14 UTC (rev 4904)
@@ -192,6 +192,7 @@
 		else if (_stricmp(Str,"filecopy")==0) *WordId = RsvFileCopy;
 		else if (_stricmp(Str,"filecreate")==0) *WordId = RsvFileCreate;
 		else if (_stricmp(Str,"filedelete")==0) *WordId = RsvFileDelete;
+		else if (_stricmp(Str,"filelock")==0) *WordId = RsvFileLock;
 		else if (_stricmp(Str,"filemarkptr")==0) *WordId = RsvFileMarkPtr;
 		else if (_stricmp(Str,"filenamebox")==0) *WordId  = RsvFilenameBox; // add 'filenamebox' (2007.9.13 maya)
 		else if (_stricmp(Str,"fileopen")==0) *WordId = RsvFileOpen;
@@ -205,6 +206,7 @@
 		else if (_stricmp(Str,"filestrseek")==0) *WordId = RsvFileStrSeek;
 		else if (_stricmp(Str,"filestrseek2")==0) *WordId = RsvFileStrSeek2;
 		else if (_stricmp(Str,"filetruncate")==0) *WordId = RsvFileTruncate;
+		else if (_stricmp(Str,"fileunlock")==0) *WordId = RsvFileUnLock;
 		else if (_stricmp(Str,"filewrite")==0) *WordId = RsvFileWrite;
 		else if (_stricmp(Str,"filewriteln")==0) *WordId = RsvFileWriteLn;
 		else if (_stricmp(Str,"findclose")==0) *WordId = RsvFindClose;

Modified: trunk/teraterm/ttpmacro/ttmparse.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.h	2012-04-16 14:55:56 UTC (rev 4903)
+++ trunk/teraterm/ttpmacro/ttmparse.h	2012-04-18 16:49:14 UTC (rev 4904)
@@ -198,6 +198,8 @@
 #define RsvIntDim       150
 #define RsvStrDim       151
 #define RsvLogInfo      152
+#define RsvFileLock     153
+#define RsvFileUnLock   154
 #define RsvSetDebug     175
 #define RsvYmodemRecv   176
 #define RsvYmodemSend   177



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