templeos-info/public/Wb/Adam/DolDoc/DocGet.HC.HTML

275 lines
27 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;DolDoc&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdUndoFilter</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l4"></a>{
<a name="l5"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l6"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce=doc-&gt;head.next;
<a name="l7"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce!=doc) </span><span class=cF7>{</span><span class=cF0>
<a name="l8"></a> doc_ce-&gt;de_flags&amp;=~</span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF0>;
<a name="l9"></a> doc_ce=doc_ce-&gt;next;
<a name="l10"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l11"></a> doc-&gt;find_replace-&gt;filter_lines=0;
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l13"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l14"></a>}
<a name="l15"></a>
<a name="l16"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocGetKey</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> *_sc=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l17"></a>{</span><span class=cF2>//Called by </span><a href="/Wb/Adam/DolDoc/DocEd.HC.HTML#l3"><span class=cF4>View</span></a><span class=cF2>. You probably don't need this.</span><span class=cF0>
<a name="l18"></a> </span><span class=cF9>I64</span><span class=cF0> ch,sc;
<a name="l19"></a> </span><span class=cF1>Bool</span><span class=cF0> cont,old_key_desc;
<a name="l20"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l21"></a> old_key_desc=</span><span class=cF5>LBtr</span><span class=cF0>(&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit,</span><span class=cF3>WIf_SELF_KEY_DESC</span><span class=cF0>);
<a name="l22"></a> </span><span class=cF1>do</span><span class=cF0> ch=</span><span class=cF5>GetKey</span><span class=cF0>(&amp;sc,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l23"></a> </span><span class=cF1>while</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_KEY_DESC</span><span class=cF0>);
<a name="l24"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit,</span><span class=cF3>WIf_SELF_KEY_DESC</span><span class=cF0>,old_key_desc);
<a name="l25"></a>
<a name="l26"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>);
<a name="l27"></a> cont=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ch==</span><span class=cF3>CH_ESC</span><span class=cF0> || ch==</span><span class=cF3>CH_SHIFT_ESC</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF2>//Check for exit filter mode</span><span class=cF0>
<a name="l29"></a> </span><span class=cF5>DocPut</span><span class=cF0> &amp;&amp; </span><span class=cF5>DocPut</span><span class=cF0>-&gt;find_replace-&gt;filter_lines) {
<a name="l30"></a> </span><span class=cF5>EdUndoFilter</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>);
<a name="l31"></a> cont=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l32"></a> }
<a name="l33"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (cont);
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (_sc) *_sc=sc;
<a name="l35"></a> </span><span class=cF1>return</span><span class=cF0> ch;
<a name="l36"></a>}
<a name="l37"></a>
<a name="l38"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;DolDoc/Input;StdIn/DolDoc&quot;</span><span class=cF0>
<a name="l39"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>DocScanLine</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc,</span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e,
<a name="l40"></a> </span><span class=cF9>I64</span><span class=cF0> *cur_col=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>CDocEntry</span><span class=cF0> **_do_e_end=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l41"></a>{</span><span class=cF2>//Start at entry in doc,make and return one line as str.</span><span class=cF0>
<a name="l42"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e2=doc_e;
<a name="l43"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock=</span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l44"></a> </span><span class=cF1>U8</span><span class=cF0> *dst,*src,*</span><span class=cF1>start</span><span class=cF0>,*res;
<a name="l45"></a> </span><span class=cF9>I64</span><span class=cF0> i=0;
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (cur_col)
<a name="l47"></a> *cur_col=-1;
<a name="l48"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e2!=doc &amp;&amp; doc_e2-&gt;type_u8!=</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;de_flags&amp;</span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_e2-&gt;tag) {
<a name="l50"></a> src=doc_e2-&gt;tag;
<a name="l51"></a> i+=</span><span class=cF5>StrLen</span><span class=cF0>(src);
<a name="l52"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;type_u8==</span><span class=cF3>DOCT_TAB</span><span class=cF0>)
<a name="l53"></a> i++;
<a name="l54"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;type_u8==</span><span class=cF3>DOCT_SHIFTED_X</span><span class=cF0> ||
<a name="l55"></a> doc_e2-&gt;type_u8==</span><span class=cF3>DOCT_SHIFTED_Y</span><span class=cF0>) {
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;attr&lt;0)
<a name="l57"></a> i++;
<a name="l58"></a> i+=6; </span><span class=cF2>//$SY,3$</span><span class=cF0>
<a name="l59"></a> }
<a name="l60"></a> doc_e2=doc_e2-&gt;next;
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l62"></a> res=</span><span class=cF5>MAlloc</span><span class=cF0>(i+1);
<a name="l63"></a> dst=res;
<a name="l64"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc &amp;&amp; doc_e-&gt;type_u8!=</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l65"></a> </span><span class=cF1>start</span><span class=cF0>=dst;
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags&amp;</span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_e-&gt;tag) {
<a name="l67"></a> src=doc_e-&gt;tag;
<a name="l68"></a> </span><span class=cF1>while</span><span class=cF0> (*src)
<a name="l69"></a> *dst++=*src++;
<a name="l70"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8==</span><span class=cF3>DOCT_TAB</span><span class=cF0>)
<a name="l71"></a> *dst++=</span><span class=cF6>'\t'</span><span class=cF0>;
<a name="l72"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8==</span><span class=cF3>DOCT_SHIFTED_Y</span><span class=cF0>) {
<a name="l73"></a> *dst(</span><span class=cF9>U32</span><span class=cF0> *)++=</span><span class=cF6>'$SY,'</span><span class=cF0>;
<a name="l74"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr&lt;0)
<a name="l75"></a> *dst++=</span><span class=cF6>'-'</span><span class=cF0>;
<a name="l76"></a> *dst++=</span><span class=cF6>'0'</span><span class=cF0>+</span><span class=cF5>AbsI64</span><span class=cF0>(doc_e-&gt;attr); </span><span class=cF2>//Supposedly -7 to 7 (single digit)</span><span class=cF0>
<a name="l77"></a> *dst++=</span><span class=cF6>'$'</span><span class=cF0>;
<a name="l78"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8==</span><span class=cF3>DOCT_SHIFTED_X</span><span class=cF0>) {
<a name="l79"></a> *dst(</span><span class=cF9>U32</span><span class=cF0> *)++=</span><span class=cF6>'$SX,'</span><span class=cF0>;
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr&lt;0)
<a name="l81"></a> *dst++=</span><span class=cF6>'-'</span><span class=cF0>;
<a name="l82"></a> *dst++=</span><span class=cF6>'0'</span><span class=cF0>+</span><span class=cF5>AbsI64</span><span class=cF0>(doc_e-&gt;attr); </span><span class=cF2>//Supposedly -7 to 7 (single digit)</span><span class=cF0>
<a name="l83"></a> *dst++=</span><span class=cF6>'$'</span><span class=cF0>;
<a name="l84"></a> }
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc-&gt;cur_entry &amp;&amp; cur_col)
<a name="l86"></a> *cur_col=</span><span class=cF1>start</span><span class=cF0>-res+doc-&gt;cur_col;
<a name="l87"></a> doc_e=doc_e-&gt;next;
<a name="l88"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (_do_e_end) *_do_e_end=doc_e;
<a name="l90"></a> *dst=0;
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e==doc-&gt;cur_entry &amp;&amp; cur_col &amp;&amp; !doc-&gt;cur_col)
<a name="l92"></a> *cur_col=dst-res;
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l94"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l95"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l96"></a>}
<a name="l97"></a>
<a name="l98"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>DocGetStr2</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> flags=0)
<a name="l99"></a>{</span><span class=cF2>//</span><a href="/Wb/Kernel/KernelA.HH.HTML#l3725"><span class=cF4>Flags</span></a><span class=cF0>
<a name="l100"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
<a name="l101"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e,*doc_e_end;
<a name="l102"></a> </span><span class=cF1>U8</span><span class=cF0> *st,*st2,*res;
<a name="l103"></a> </span><span class=cF9>I64</span><span class=cF0> ch,sc;
<a name="l104"></a> </span><span class=cF6>&quot;$PT$&quot;</span><span class=cF0>;
<a name="l105"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l106"></a> ch=</span><span class=cF5>DocGetKey</span><span class=cF0>(&amp;sc);
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF3>CH_ESC</span><span class=cF0>) {
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (doc=</span><span class=cF5>DocPut</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l109"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;doc_signature==</span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0> &amp;&amp; doc-&gt;cur_entry!=doc) {
<a name="l111"></a> doc_e=</span><span class=cF5>DocEntryCopy</span><span class=cF0>(doc,doc-&gt;cur_entry);
<a name="l112"></a> </span><span class=cF5>DocBottom</span><span class=cF0>(doc);
<a name="l113"></a> </span><span class=cF5>DocEntryRun</span><span class=cF0>(doc,doc_e,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l114"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc,doc_e);
<a name="l115"></a> }
<a name="l116"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l117"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (flags&amp;</span><span class=cF3>GSF_WITH_NEW_LINE</span><span class=cF0>)
<a name="l119"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l120"></a> } </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>) {
<a name="l121"></a> </span><span class=cF1>if</span><span class=cF0> (flags&amp;</span><span class=cF3>GSF_SHIFT_ESC_EXIT</span><span class=cF0>)
<a name="l122"></a> </span><span class=cF5>Exit</span><span class=cF0>;
<a name="l123"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l124"></a> res=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>&quot;&quot;</span><span class=cF0>);
<a name="l125"></a> </span><span class=cF1>goto</span><span class=cF0> gs_done;
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l127"></a> }
<a name="l128"></a></span><span class=cF2>//&lt;CTRL-SHIFT-ENTER&gt; is a blank line without entry</span><span class=cF0>
<a name="l129"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (flags&amp;</span><span class=cF3>GSF_WITH_NEW_LINE</span><span class=cF0> || ch!=</span><span class=cF6>'\n'</span><span class=cF0> ||
<a name="l130"></a> sc&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0> &amp;&amp; sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l131"></a>
<a name="l132"></a> doc=</span><span class=cF5>DocPut</span><span class=cF0>;
<a name="l133"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (flags&amp;</span><span class=cF3>GSF_WITH_NEW_LINE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l135"></a> doc_e=doc-&gt;cur_entry;
<a name="l136"></a> </span><span class=cF1>do</span><span class=cF0> doc_e=doc_e-&gt;last;
<a name="l137"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc &amp;&amp; doc_e-&gt;type_u8!=</span><span class=cF3>DOCT_PMT</span><span class=cF0>);
<a name="l138"></a> doc_e=doc_e-&gt;next;
<a name="l139"></a> </span><span class=cF1>if</span><span class=cF0> (res=</span><span class=cF5>DocScanLine</span><span class=cF7>(</span><span class=cF0>doc,doc_e,</span><span class=cF3>NULL</span><span class=cF0>,&amp;doc_e_end</span><span class=cF7>)</span><span class=cF0>) {
<a name="l140"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e_end!=doc &amp;&amp; doc_e_end-&gt;type_u8==</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l141"></a> st2=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>,res);
<a name="l142"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
<a name="l143"></a> res=st2;
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (st=</span><span class=cF5>DocScanLine</span><span class=cF7>(</span><span class=cF0>doc,doc_e_end-&gt;next,</span><span class=cF3>NULL</span><span class=cF0>,&amp;doc_e_end</span><span class=cF7>)</span><span class=cF0>) {
<a name="l145"></a> st2=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s%s&quot;</span><span class=cF0>,res,st);
<a name="l146"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l147"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
<a name="l148"></a> res=st2;
<a name="l149"></a> }
<a name="l150"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l151"></a> }
<a name="l152"></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="l153"></a> doc_e=doc-&gt;cur_entry;
<a name="l154"></a> </span><span class=cF1>do</span><span class=cF0> doc_e=doc_e-&gt;last;
<a name="l155"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc &amp;&amp; doc_e-&gt;type_u8!=</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> &amp;&amp;
<a name="l156"></a> doc_e-&gt;type_u8!=</span><span class=cF3>DOCT_PMT</span><span class=cF0>);
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e!=doc &amp;&amp; doc_e-&gt;type_u8!=</span><span class=cF3>DOCT_PMT</span><span class=cF0>) {
<a name="l158"></a> </span><span class=cF1>do</span><span class=cF0> doc_e=doc_e-&gt;last;
<a name="l159"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc &amp;&amp; doc_e-&gt;type_u8!=</span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> &amp;&amp;
<a name="l160"></a> doc_e-&gt;type_u8!=</span><span class=cF3>DOCT_PMT</span><span class=cF0>);
<a name="l161"></a> }
<a name="l162"></a> doc_e=doc_e-&gt;next;
<a name="l163"></a> res=</span><span class=cF5>DocScanLine</span><span class=cF0>(doc,doc_e,</span><span class=cF3>NULL</span><span class=cF0>);
<a name="l164"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l165"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l166"></a>gs_done:
<a name="l167"></a> </span><span class=cF6>&quot;$PT$$FG$$BG$&quot;</span><span class=cF0>;
<a name="l168"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l169"></a>}
<a name="l170"></a>
<a name="l171"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Keyboard Devices;Char/Input;StdIn&quot;</span><span class=cF0>
<a name="l172"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GetI64</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *msg=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> dft=0,</span><span class=cF9>I64</span><span class=cF0> lo=</span><span class=cF3>I64_MIN</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> hi=</span><span class=cF3>I64_MAX</span><span class=cF0>)
<a name="l173"></a>{</span><span class=cF2>//Prompt user for I64 expression.</span><span class=cF0>
<a name="l174"></a> </span><span class=cF1>Bool</span><span class=cF0> okay;
<a name="l175"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l176"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l177"></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="l178"></a> </span><span class=cF1>if</span><span class=cF0> (msg)
<a name="l179"></a> </span><span class=cF6>&quot;&quot;</span><span class=cF0> msg,dft;
<a name="l180"></a> st=</span><span class=cF5>GetStr</span><span class=cF0>;
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (!*st) {
<a name="l182"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l183"></a> </span><span class=cF1>return</span><span class=cF0> dft;
<a name="l184"></a> }
<a name="l185"></a> </span><span class=cF1>try</span><span class=cF0> {
<a name="l186"></a> res=</span><span class=cF5>ExePrint2</span><span class=cF0>(</span><span class=cF6>&quot;ToI64(%s);&quot;</span><span class=cF0>,st);
<a name="l187"></a> okay=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l188"></a> } </span><span class=cF1>catch</span><span class=cF0> {
<a name="l189"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l190"></a> okay=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l191"></a> }
<a name="l192"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (okay &amp;&amp; lo&lt;=res&lt;=hi)
<a name="l194"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l195"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l196"></a>}
<a name="l197"></a>
<a name="l198"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>GetF64</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *msg=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>F64</span><span class=cF0> dft=0,</span><span class=cF1>F64</span><span class=cF0> lo=</span><span class=cF3>F64_MIN</span><span class=cF0>,</span><span class=cF1>F64</span><span class=cF0> hi=</span><span class=cF3>F64_MAX</span><span class=cF0>)
<a name="l199"></a>{</span><span class=cF2>//Prompt user for F64 expression.</span><span class=cF0>
<a name="l200"></a> </span><span class=cF1>Bool</span><span class=cF0> okay;
<a name="l201"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l202"></a> </span><span class=cF1>F64</span><span class=cF0> res;
<a name="l203"></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="l204"></a> </span><span class=cF1>if</span><span class=cF0> (msg)
<a name="l205"></a> </span><span class=cF6>&quot;&quot;</span><span class=cF0> msg,dft;
<a name="l206"></a> st=</span><span class=cF5>GetStr</span><span class=cF0>;
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (!*st) {
<a name="l208"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l209"></a> </span><span class=cF1>return</span><span class=cF0> dft;
<a name="l210"></a> }
<a name="l211"></a> </span><span class=cF1>try</span><span class=cF0> {
<a name="l212"></a> res=</span><span class=cF5>ExePrint2</span><span class=cF0>(</span><span class=cF6>&quot;ToF64(%s);&quot;</span><span class=cF0>,st)(</span><span class=cF1>F64</span><span class=cF0>);
<a name="l213"></a> okay=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l214"></a> } </span><span class=cF1>catch</span><span class=cF0> {
<a name="l215"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l216"></a> okay=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l217"></a> }
<a name="l218"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l219"></a> </span><span class=cF1>if</span><span class=cF0> (okay &amp;&amp; lo&lt;=res&lt;=hi)
<a name="l220"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l221"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l222"></a>}
<a name="l223"></a>
<a name="l224"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CDate</span><span class=cF0> </span><span class=cF5>GetDate</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *msg=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>CDate</span><span class=cF0> dft=</span><span class=cF3>I64_MIN</span><span class=cF0>,
<a name="l225"></a> </span><span class=cF9>CDate</span><span class=cF0> lo=</span><span class=cF3>I64_MIN</span><span class=cF0>,</span><span class=cF9>CDate</span><span class=cF0> hi=</span><span class=cF3>I64_MAX</span><span class=cF0>)
<a name="l226"></a>{</span><span class=cF2>//Prompt user for date expression. (Use </span><a href="/Wb/Kernel/KDate.HC.HTML#l191"><span class=cF4>Now</span></a><span class=cF2>() if you want current time.)</span><span class=cF0>
<a name="l227"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l228"></a> </span><span class=cF9>CDate</span><span class=cF0> res;
<a name="l229"></a> </span><span class=cF1>if</span><span class=cF0> (dft==</span><span class=cF3>I64_MIN</span><span class=cF0>) dft=</span><span class=cF5>Now</span><span class=cF0>;
<a name="l230"></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="l231"></a> </span><span class=cF1>if</span><span class=cF0> (msg)
<a name="l232"></a> </span><span class=cF6>&quot;&quot;</span><span class=cF0> msg,dft,dft;
<a name="l233"></a> st=</span><span class=cF5>GetStr</span><span class=cF0>;
<a name="l234"></a> </span><span class=cF1>if</span><span class=cF0> (!*st) {
<a name="l235"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l236"></a> </span><span class=cF1>return</span><span class=cF0> dft;
<a name="l237"></a> }
<a name="l238"></a> res=</span><span class=cF5>Str2Date</span><span class=cF0>(st);
<a name="l239"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l240"></a> </span><span class=cF1>if</span><span class=cF0> (res&gt;=lo &amp;&amp; res&lt;=hi)
<a name="l241"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l242"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l243"></a>}
</span></pre></body>
</html>