mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 00:06:35 +00:00
923b700822
Add CAtapiWriteCmd for AHCIAtapiBlksWrite. Remove AHCIAtapiSeek and AHCIAtapiFormat.
198 lines
16 KiB
HTML
Executable file
198 lines
16 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.16">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF2>//Simple and fancy way of searching</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a></span><span class=cF2>//See ::/Apps/Vocabulary/VocabQuiz.CC</span><span class=cF0>
|
|
<a name="l4"></a></span><span class=cF2>//for another example of dictionary usage.</span><span class=cF0>
|
|
<a name="l5"></a>
|
|
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> ROWS_NUM </span><span class=cFE>20</span><span class=cF0>
|
|
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> COLS_NUM </span><span class=cFE>20</span><span class=cF0>
|
|
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> DIM_MAX </span><span class=cF5>MaxI64</span><span class=cF0>(ROWS_NUM, COLS_NUM)
|
|
<a name="l9"></a>
|
|
<a name="l10"></a></span><span class=cF1>U8</span><span class=cF0> m[ROWS_NUM][COLS_NUM];
|
|
<a name="l11"></a>
|
|
<a name="l12"></a></span><span class=cF1>U0</span><span class=cF0> Init()
|
|
<a name="l13"></a>{
|
|
<a name="l14"></a> </span><span class=cF9>I64</span><span class=cF0> x, y;
|
|
<a name="l15"></a>
|
|
<a name="l16"></a> </span><span class=cF1>for</span><span class=cF0> (y = </span><span class=cFE>0</span><span class=cF0>; y < ROWS_NUM; y++)
|
|
<a name="l17"></a> </span><span class=cF1>for</span><span class=cF0> (x = </span><span class=cFE>0</span><span class=cF0>; x < COLS_NUM; x++)
|
|
<a name="l18"></a> m[y][x] = </span><span class=cF6>'A'</span><span class=cF0> + </span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cFE>26</span><span class=cF0>;
|
|
<a name="l19"></a>}
|
|
<a name="l20"></a>
|
|
<a name="l21"></a></span><span class=cF1>U0</span><span class=cF0> Display()
|
|
<a name="l22"></a>{
|
|
<a name="l23"></a> </span><span class=cF9>I64</span><span class=cF0> x, y;
|
|
<a name="l24"></a>
|
|
<a name="l25"></a> </span><span class=cF1>for</span><span class=cF0> (y = </span><span class=cFE>0</span><span class=cF0>; y < ROWS_NUM; y++)
|
|
<a name="l26"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l27"></a> </span><span class=cF1>for</span><span class=cF0> (x = </span><span class=cFE>0</span><span class=cF0>; x < COLS_NUM; x++)
|
|
<a name="l28"></a> </span><span class=cF6>''</span><span class=cF0> m[y][x];
|
|
<a name="l29"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l30"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l31"></a>}
|
|
<a name="l32"></a>
|
|
<a name="l33"></a></span><span class=cF1>U0</span><span class=cF0> GetWord(</span><span class=cF1>U8</span><span class=cF0> *dst, </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> dx, </span><span class=cF9>I64</span><span class=cF0> dy)
|
|
<a name="l34"></a>{
|
|
<a name="l35"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> <= x < COLS_NUM && </span><span class=cFE>0</span><span class=cF0> <= y < ROWS_NUM)
|
|
<a name="l36"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l37"></a> *dst++ = m[y][x];
|
|
<a name="l38"></a> y += dy;
|
|
<a name="l39"></a> x += dx;
|
|
<a name="l40"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l41"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l42"></a>}
|
|
<a name="l43"></a>
|
|
<a name="l44"></a></span><span class=cF2>//************************************</span><span class=cF0>
|
|
<a name="l45"></a></span><span class=cF1>U0</span><span class=cF0> Search(</span><span class=cF9>I64</span><span class=cF0> dx, </span><span class=cF9>I64</span><span class=cF0> dy)
|
|
<a name="l46"></a>{
|
|
<a name="l47"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, i, n;
|
|
<a name="l48"></a> </span><span class=cF1>U8</span><span class=cF0> buf[DIM_MAX + </span><span class=cFE>1</span><span class=cF0>], *ptr;
|
|
<a name="l49"></a>
|
|
<a name="l50"></a> </span><span class=cF1>for</span><span class=cF0> (y = </span><span class=cFE>0</span><span class=cF0>; y < ROWS_NUM; y++)
|
|
<a name="l51"></a> </span><span class=cF1>for</span><span class=cF0> (x = </span><span class=cFE>0</span><span class=cF0>; x < COLS_NUM; x++)
|
|
<a name="l52"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l53"></a> GetWord(buf, x, y, dx, dy);
|
|
<a name="l54"></a> n = </span><span class=cF5>StrLen</span><span class=cF0>(buf);
|
|
<a name="l55"></a> </span><span class=cF1>for</span><span class=cF0> (i = n; i > </span><span class=cFE>2</span><span class=cF0>; i--)
|
|
<a name="l56"></a> {
|
|
<a name="l57"></a> buf[i] = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ptr = </span><span class=cF5>ACDWordPtAt</span><span class=cF0>(buf)</span><span class=cF7>)</span><span class=cF0> && *ptr++ == </span><span class=cF3>ACD_WORD_CHAR</span><span class=cF0> && !</span><span class=cF5>StrICompare</span><span class=cF7>(</span><span class=cF0>ptr, buf</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l59"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l60"></a> </span><span class=cF6>"%s "</span><span class=cF0>, buf;
|
|
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l62"></a> }
|
|
<a name="l63"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l64"></a>}
|
|
<a name="l65"></a>
|
|
<a name="l66"></a></span><span class=cF1>U0</span><span class=cF0> SimpleWordSearch()
|
|
<a name="l67"></a>{
|
|
<a name="l68"></a> Search( </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l69"></a> Search( </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l70"></a> Search(-</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l71"></a> Search( </span><span class=cFE>0</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l72"></a> Search( </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l73"></a> Search(-</span><span class=cFE>1</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l74"></a> Search( </span><span class=cFE>1</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l75"></a> Search(-</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l76"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l77"></a>}
|
|
<a name="l78"></a>
|
|
<a name="l79"></a></span><span class=cF2>//************************************</span><span class=cF0>
|
|
<a name="l80"></a></span><span class=cF1>U8</span><span class=cF0> words[ROWS_NUM * COLS_NUM * </span><span class=cFE>8</span><span class=cF0>][DIM_MAX + </span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l81"></a></span><span class=cF1>U8</span><span class=cF0> *word_ptrs[ROWS_NUM * COLS_NUM * </span><span class=cFE>8</span><span class=cF0>];
|
|
<a name="l82"></a>
|
|
<a name="l83"></a></span><span class=cF1>U0</span><span class=cF0> CollectWords(</span><span class=cF9>I64</span><span class=cF0> dx, </span><span class=cF9>I64</span><span class=cF0> dy, </span><span class=cF9>I64</span><span class=cF0> *_n)
|
|
<a name="l84"></a>{
|
|
<a name="l85"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, n = *_n;
|
|
<a name="l86"></a>
|
|
<a name="l87"></a> </span><span class=cF1>for</span><span class=cF0> (y = </span><span class=cFE>0</span><span class=cF0>; y < ROWS_NUM; y++)
|
|
<a name="l88"></a> </span><span class=cF1>for</span><span class=cF0> (x = </span><span class=cFE>0</span><span class=cF0>; x < COLS_NUM; x++)
|
|
<a name="l89"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l90"></a> GetWord(&words[n], x, y, dx, dy);
|
|
<a name="l91"></a> word_ptrs[n] = &words[n];
|
|
<a name="l92"></a> n++;
|
|
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l94"></a> *_n = n;
|
|
<a name="l95"></a>}
|
|
<a name="l96"></a>
|
|
<a name="l97"></a></span><span class=cF9>I64</span><span class=cF0> WordsCompare(</span><span class=cF1>U8</span><span class=cF0> *e1, </span><span class=cF1>U8</span><span class=cF0> *e2)
|
|
<a name="l98"></a>{
|
|
<a name="l99"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrCompare</span><span class=cF0>(e1, e2);
|
|
<a name="l100"></a>}
|
|
<a name="l101"></a>
|
|
<a name="l102"></a></span><span class=cF2>/*Format of word list entry:</span><span class=cF0>
|
|
<a name="l103"></a> </span><span class=cF2>U8 ACD_WORD_CHAR</span><span class=cF0>
|
|
<a name="l104"></a> </span><span class=cF2>U8 word[] with terminating zero</span><span class=cF0>
|
|
<a name="l105"></a> </span><span class=cF2>I16 block; //definition offset in ::/System/AutoComplete/ACDefs.DATA</span><span class=cF0>
|
|
<a name="l106"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l107"></a>
|
|
<a name="l108"></a></span><span class=cF1>U0</span><span class=cF0> DisplayWords(</span><span class=cF9>I64</span><span class=cF0> n)
|
|
<a name="l109"></a>{
|
|
<a name="l110"></a> </span><span class=cF9>I64</span><span class=cF0> i = </span><span class=cFE>0</span><span class=cF0>, k;
|
|
<a name="l111"></a> </span><span class=cF1>U8</span><span class=cF0> *w1, *w2, *dict = </span><span class=cFB>acd</span><span class=cF0>.word_list;
|
|
<a name="l112"></a>
|
|
<a name="l113"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < n; i++)
|
|
<a name="l114"></a> </span><span class=cF1>while</span><span class=cF0> (*dict)
|
|
<a name="l115"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l116"></a> w1 = word_ptrs[i];
|
|
<a name="l117"></a> w2 = dict + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l118"></a> </span><span class=cF1>while</span><span class=cF0> (*w2 && *w1 == </span><span class=cF5>ToUpper</span><span class=cF7>(</span><span class=cF0>*w2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l119"></a> {
|
|
<a name="l120"></a> w1++;
|
|
<a name="l121"></a> w2++;
|
|
<a name="l122"></a> }
|
|
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ToUpper</span><span class=cF7>(</span><span class=cF0>*w2</span><span class=cF7>)</span><span class=cF0> > *w1)
|
|
<a name="l124"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (!*w2)
|
|
<a name="l126"></a> {
|
|
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>dict + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> > </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l128"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l129"></a> k = i;
|
|
<a name="l130"></a> </span><span class=cF1>while</span><span class=cF0> (k < n && !</span><span class=cF5>StrNICompare</span><span class=cF7>(</span><span class=cF0>word_ptrs[k++], dict + </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF5>StrLen</span><span class=cF0>(dict + </span><span class=cFE>1</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l131"></a> </span><span class=cF6>"%s "</span><span class=cF0>, dict + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l132"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l133"></a> w2 = dict + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l134"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>StrICompare</span><span class=cF7>(</span><span class=cF0>w2, dict + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l135"></a> dict += </span><span class=cF5>StrLen</span><span class=cF0>(dict + </span><span class=cFE>1</span><span class=cF0>) + </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l136"></a> }
|
|
<a name="l137"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l138"></a> dict += </span><span class=cF5>StrLen</span><span class=cF0>(dict + </span><span class=cFE>1</span><span class=cF0>) + </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l139"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l140"></a>}
|
|
<a name="l141"></a>
|
|
<a name="l142"></a></span><span class=cF1>U0</span><span class=cF0> FancyWordSearch()
|
|
<a name="l143"></a>{
|
|
<a name="l144"></a> </span><span class=cF9>I64</span><span class=cF0> n = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l145"></a>
|
|
<a name="l146"></a> CollectWords( </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, &n);
|
|
<a name="l147"></a> CollectWords( </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, &n);
|
|
<a name="l148"></a> CollectWords(-</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, &n);
|
|
<a name="l149"></a> CollectWords( </span><span class=cFE>0</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>, &n);
|
|
<a name="l150"></a> CollectWords( </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, &n);
|
|
<a name="l151"></a> CollectWords(-</span><span class=cFE>1</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>, &n);
|
|
<a name="l152"></a> CollectWords( </span><span class=cFE>1</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>, &n);
|
|
<a name="l153"></a> CollectWords(-</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, &n);
|
|
<a name="l154"></a> </span><span class=cF5>QuickSortI64</span><span class=cF0>(word_ptrs, n, &WordsCompare);
|
|
<a name="l155"></a> DisplayWords(n);
|
|
<a name="l156"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l157"></a>}
|
|
<a name="l158"></a>
|
|
<a name="l159"></a></span><span class=cF2>//************************************</span><span class=cF0>
|
|
<a name="l160"></a></span><span class=cF1>U0</span><span class=cF0> WordSearch()
|
|
<a name="l161"></a>{
|
|
<a name="l162"></a> Init;
|
|
<a name="l163"></a> Display;
|
|
<a name="l164"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l165"></a> SimpleWordSearch;
|
|
<a name="l166"></a> FancyWordSearch;
|
|
<a name="l167"></a>}
|
|
<a name="l168"></a>
|
|
<a name="l169"></a>WordSearch;
|
|
</span></pre></body>
|
|
</html>
|