2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-07-05 20:23:13 +01:00
< meta name = "generator" content = "ZealOS V0.06" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-07-03 05:07:57 +01:00
< 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 >
2021-07-04 23:11:34 +01:00
< 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)
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< a name = "l14" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > x, y;
2021-07-03 05:07:57 +01:00
< a name = "l15" > < / a >
2021-07-04 23:11:34 +01:00
< 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 > ;
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< a name = "l23" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > x, y;
2021-07-03 05:07:57 +01:00
< a name = "l24" > < / a >
2021-07-04 23:11:34 +01:00
< 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 >
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< 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 > ;
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< 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;
2021-07-03 05:07:57 +01:00
< a name = "l49" > < / a >
2021-07-04 23:11:34 +01:00
< 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 >
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< 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 > ;
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< a name = "l85" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > x, y, n = *_n;
2021-07-03 05:07:57 +01:00
< a name = "l86" > < / a >
2021-07-04 23:11:34 +01:00
< 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;
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< a name = "l99" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF5 > StrCompare< / span > < span class = cF0 > (e1, e2);
2021-07-03 05:07:57 +01:00
< 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 >
2021-07-04 23:11:34 +01:00
< 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 >
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< 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;
2021-07-03 05:07:57 +01:00
< a name = "l112" > < / a >
2021-07-04 23:11:34 +01:00
< 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 >
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< a name = "l144" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > n = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l145" > < / a >
2021-07-04 23:11:34 +01:00
< 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 > ;
2021-07-03 05:07:57 +01:00
< 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 > {
2021-07-04 23:11:34 +01:00
< 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;
2021-07-03 05:07:57 +01:00
< a name = "l167" > < / a > }
< a name = "l168" > < / a >
< a name = "l169" > < / a > WordSearch;
< / span > < / pre > < / body >
< / html >