templeos-info/public/Wb/Adam/InFile.HC.HTML

172 lines
17 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;InFile;Help System/Training&quot;</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>help_file</span><span class=cF0> </span><span class=cF6>&quot;::/Doc/InFile&quot;</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>InGetStr</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
<a name="l5"></a>{</span><span class=cF2>//Wait for user to type certain str.</span><span class=cF0>
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> ch,sc;
<a name="l7"></a> </span><span class=cF1>U8</span><span class=cF0> buf[256],*st2;
<a name="l8"></a> </span><span class=cF1>while</span><span class=cF0> (*st) </span><span class=cF7>{</span><span class=cF0>
<a name="l9"></a> ch=</span><span class=cF5>GetKey</span><span class=cF0>(&amp;sc,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (sc.u8[0]!=</span><span class=cF3>SC_SHIFT</span><span class=cF0> &amp;&amp;
<a name="l11"></a> sc.u8[0]!=</span><span class=cF3>SC_ALT</span><span class=cF0> &amp;&amp;
<a name="l12"></a> sc.u8[0]!=</span><span class=cF3>SC_CTRL</span><span class=cF0>) {
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (ch==*st) </span><span class=cF7>{</span><span class=cF0>
<a name="l14"></a> </span><span class=cF6>''</span><span class=cF0> ch;
<a name="l15"></a> st++;
<a name="l16"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l17"></a> st2=</span><span class=cF5>Char2KeyName</span><span class=cF0>(*st);
<a name="l18"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;Press the $GREEN$&lt;%s&gt;$FG$ key.&quot;</span><span class=cF0>,st2);
<a name="l19"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l20"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(buf);
<a name="l21"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l22"></a> }
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l24"></a>}
<a name="l25"></a>
<a name="l26"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>InPrint</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> mS=100,</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
<a name="l27"></a>{</span><span class=cF2>//Print message with delay after each char.</span><span class=cF0>
<a name="l28"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv),*st=buf;
<a name="l29"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
<a name="l30"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*st++) </span><span class=cF7>{</span><span class=cF0>
<a name="l31"></a> </span><span class=cF6>''</span><span class=cF0> ch;
<a name="l32"></a> </span><span class=cF5>Sleep</span><span class=cF0>(mS);
<a name="l33"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l34"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l35"></a>}
<a name="l36"></a>
<a name="l37"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>InGetKey</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> scan_code,</span><span class=cF9>I64</span><span class=cF0> sc_mask=0xFF|</span><span class=cF3>SCF_SHIFT</span><span class=cF0>|</span><span class=cF3>SCF_CTRL</span><span class=cF0>|</span><span class=cF3>SCF_ALT</span><span class=cF0>)
<a name="l38"></a>{</span><span class=cF2>//Wait for user to press certain key.</span><span class=cF0>
<a name="l39"></a> </span><span class=cF9>I64</span><span class=cF0> sc,ch;
<a name="l40"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>],*st;
<a name="l41"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l42"></a> ch=</span><span class=cF5>GetKey</span><span class=cF0>(&amp;sc);
<a name="l43"></a> </span><span class=cF1>if</span><span class=cF0> (sc.u8[0]!=</span><span class=cF3>SC_PRTSCRN1</span><span class=cF0> &amp;&amp;
<a name="l44"></a> !</span><span class=cF7>(</span><span class=cF0>sc.u8[0]==</span><span class=cF3>SC_SHIFT</span><span class=cF0> &amp;&amp; scan_code&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l45"></a> !</span><span class=cF7>(</span><span class=cF0>sc.u8[0]==</span><span class=cF3>SC_CTRL</span><span class=cF0> &amp;&amp; scan_code&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l46"></a> !</span><span class=cF7>(</span><span class=cF0>sc.u8[0]==</span><span class=cF3>SC_ALT</span><span class=cF0> &amp;&amp; scan_code&amp;</span><span class=cF3>SCF_ALT</span><span class=cF7>)</span><span class=cF0> ) {
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;sc_mask!=scan_code&amp;sc_mask) </span><span class=cF7>{</span><span class=cF0>
<a name="l48"></a> st=</span><span class=cF5>ScanCode2KeyName</span><span class=cF0>(scan_code);
<a name="l49"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;Press the $GREEN$&lt;%s&gt;$FG$ key&quot;</span><span class=cF0>,st);
<a name="l50"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l51"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(buf);
<a name="l52"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l53"></a> }
<a name="l54"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (sc&amp;sc_mask!=scan_code&amp;sc_mask);
<a name="l55"></a> </span><span class=cF5>Msg</span><span class=cF0>(</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>,ch,sc);
<a name="l56"></a>}
<a name="l57"></a>
<a name="l58"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>InGetChar</span><span class=cF0>(...)
<a name="l59"></a>{</span><span class=cF2>//Wait for user to press one of set of chars.</span><span class=cF0>
<a name="l60"></a> </span><span class=cF9>I64</span><span class=cF0> i,sc,ch;
<a name="l61"></a> </span><span class=cF1>U8</span><span class=cF0> buf[512],*st;
<a name="l62"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l63"></a> ch=</span><span class=cF5>GetKey</span><span class=cF0>(&amp;sc);
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (sc.u8[0]!=</span><span class=cF3>SC_SHIFT</span><span class=cF0> &amp;&amp; sc.u8[0]!=</span><span class=cF3>SC_ALT</span><span class=cF0> &amp;&amp; sc.u8[0]!=</span><span class=cF3>SC_CTRL</span><span class=cF0>) {
<a name="l65"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;argc;i++)
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (ch==argv[i]) </span><span class=cF7>{</span><span class=cF0>
<a name="l67"></a> </span><span class=cF5>Msg</span><span class=cF0>(</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>,ch,sc);
<a name="l68"></a> </span><span class=cF1>return</span><span class=cF0> ch;
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l70"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;Press &quot;</span><span class=cF0>);
<a name="l71"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;argc;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l72"></a> st=</span><span class=cF5>Char2KeyName</span><span class=cF0>(argv[i]);
<a name="l73"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;$GREEN$&lt;%s&gt;$FG$&quot;</span><span class=cF0>,st);
<a name="l74"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (argc==i+1)
<a name="l76"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;.&quot;</span><span class=cF0>);
<a name="l77"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (argc==i+2)
<a name="l78"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot; or &quot;</span><span class=cF0>);
<a name="l79"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l80"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;, &quot;</span><span class=cF0>);
<a name="l81"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l82"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(buf);
<a name="l83"></a> }
<a name="l84"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l85"></a>}
<a name="l86"></a>
<a name="l87"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>InUntilKey</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> scan_code,</span><span class=cF9>I64</span><span class=cF0> sc_mask=0xFF|</span><span class=cF3>SCF_SHIFT</span><span class=cF0>|</span><span class=cF3>SCF_CTRL</span><span class=cF0>|</span><span class=cF3>SCF_ALT</span><span class=cF0>)
<a name="l88"></a>{</span><span class=cF2>//Let user type until he presses certain key.</span><span class=cF0>
<a name="l89"></a> </span><span class=cF9>I64</span><span class=cF0> sc,ch;
<a name="l90"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l91"></a> ch=</span><span class=cF5>GetKey</span><span class=cF0>(&amp;sc);
<a name="l92"></a> </span><span class=cF5>Msg</span><span class=cF0>(</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>,ch,sc);
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (sc&amp;sc_mask!=scan_code&amp;sc_mask);
<a name="l94"></a>}
<a name="l95"></a>
<a name="l96"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>InUntilChar</span><span class=cF0>(...)
<a name="l97"></a>{</span><span class=cF2>//Let user type until he presses one of set of chars.</span><span class=cF0>
<a name="l98"></a> </span><span class=cF9>I64</span><span class=cF0> i,sc,ch;
<a name="l99"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l100"></a> ch=</span><span class=cF5>GetKey</span><span class=cF0>(&amp;sc);
<a name="l101"></a> </span><span class=cF5>Msg</span><span class=cF0>(</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>,ch,sc);
<a name="l102"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;argc;i++)
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (ch==argv[i])
<a name="l104"></a> </span><span class=cF1>return</span><span class=cF0> ch;
<a name="l105"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l106"></a>}
<a name="l107"></a>
<a name="l108"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>InView</span><span class=cF0>()
<a name="l109"></a>{</span><span class=cF2>//Let user type until &lt;ESC&gt; or &lt;SHIFT-ESC&gt;.</span><span class=cF0>
<a name="l110"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF5>View</span><span class=cF0>;
<a name="l111"></a> </span><span class=cF5>DocBottom</span><span class=cF0>;
<a name="l112"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l113"></a>}
<a name="l114"></a>
<a name="l115"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;InFile;Help System/Training;Mouse&quot;</span><span class=cF0>
<a name="l116"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFB>in_plot_l</span><span class=cF0>,</span><span class=cFB>in_plot_r</span><span class=cF0>;
<a name="l117"></a>
<a name="l118"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>InSetMsPlot</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> mS,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z)
<a name="l119"></a>{
<a name="l120"></a> </span><span class=cF5>MsSet</span><span class=cF0>(x,y,z,</span><span class=cFB>in_plot_l</span><span class=cF0>,</span><span class=cFB>in_plot_r</span><span class=cF0>);
<a name="l121"></a> </span><span class=cF5>Sleep</span><span class=cF0>(mS);
<a name="l122"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l123"></a>}
<a name="l124"></a>
<a name="l125"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>InSetMs</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> mS=7,</span><span class=cF9>I64</span><span class=cF0> x=</span><span class=cF3>I64_MAX</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> y=</span><span class=cF3>I64_MAX</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> z=</span><span class=cF3>I64_MAX</span><span class=cF0>,
<a name="l126"></a> </span><span class=cF9>I64</span><span class=cF0> l=</span><span class=cF3>I64_MAX</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> r=</span><span class=cF3>I64_MAX</span><span class=cF0>)
<a name="l127"></a>{</span><span class=cF2>//Move mouse to spot at certain speed.</span><span class=cF0>
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>0&lt;=x&lt;</span><span class=cF3>GR_WIDTH</span><span class=cF7>)</span><span class=cF0>)
<a name="l129"></a> x=</span><span class=cFB>ms</span><span class=cF0>.pos.x;
<a name="l130"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>0&lt;=y&lt;</span><span class=cF3>GR_HEIGHT</span><span class=cF7>)</span><span class=cF0>)
<a name="l131"></a> y=</span><span class=cFB>ms</span><span class=cF0>.pos.y;
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (z==</span><span class=cF3>I64_MAX</span><span class=cF0>)
<a name="l133"></a> z=</span><span class=cFB>ms</span><span class=cF0>.pos.z;
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>FALSE</span><span class=cF0>&lt;=l&lt;=</span><span class=cF3>TRUE</span><span class=cF7>)</span><span class=cF0>)
<a name="l135"></a> l=</span><span class=cFB>ms</span><span class=cF0>.lb;
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>FALSE</span><span class=cF0>&lt;=r&lt;=</span><span class=cF3>TRUE</span><span class=cF7>)</span><span class=cF0>)
<a name="l137"></a> r=</span><span class=cFB>ms</span><span class=cF0>.rb;
<a name="l138"></a> </span><span class=cFB>in_plot_l</span><span class=cF0>=l; </span><span class=cFB>in_plot_r</span><span class=cF0>=r;
<a name="l139"></a> </span><span class=cF5>Line</span><span class=cF0>(mS,</span><span class=cFB>ms</span><span class=cF0>.pos.x,</span><span class=cFB>ms</span><span class=cF0>.pos.y,</span><span class=cFB>ms</span><span class=cF0>.pos.z,x,y,z,&amp;</span><span class=cF5>InSetMsPlot</span><span class=cF0>);
<a name="l140"></a>}
</span></pre></body>
</html>