mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-01-03 19:26:30 +00:00
6b3fd2fecb
Update documentation/comments to rename addr, fun, var, stmt, blk, desc, reg, seg, ptr, dup, clus, val, and bttn, to address, function, variable, statement, block, description, register, segment, pointer, duplicate, cluster, value, and button, respectively.
359 lines
32 KiB
HTML
Executable file
359 lines
32 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.01">
|
|
<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>/*</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF2>This file is a stand-alone program</span><span class=cF0>
|
|
<a name="l3"></a></span><span class=cF2>which will regenerate processed dictionary</span><span class=cF0>
|
|
<a name="l4"></a></span><span class=cF2>files from a raw Project Gutenberg</span><span class=cF0>
|
|
<a name="l5"></a></span><span class=cF2>dictionary file.</span><span class=cF0>
|
|
<a name="l6"></a>
|
|
<a name="l7"></a></span><span class=cF2>See </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Credits.DD.html#l1"><span class=cF4>::/Doc/Credits.DD</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l8"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l9"></a>
|
|
<a name="l10"></a></span><span class=cF1>U0</span><span class=cF0> ACDPreprocess(</span><span class=cF1>U8</span><span class=cF0> *in_name, </span><span class=cF1>U8</span><span class=cF0> *out_name)
|
|
<a name="l11"></a>{</span><span class=cF2>/*</span><span class=cF0>
|
|
<a name="l12"></a></span><span class=cF2><cr><nl>--> <nl></span><span class=cF0>
|
|
<a name="l13"></a></span><span class=cF2>$</span><span class=cF0> </span><span class=cF2>--> $$</span><span class=cF0>
|
|
<a name="l14"></a></span><span class=cF2>\'89</span><span class=cF0> </span><span class=cF2>--> .</span><span class=cF0>
|
|
<a name="l15"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l16"></a> </span><span class=cF9>I64</span><span class=cF0> ch, i;
|
|
<a name="l17"></a> </span><span class=cF1>U8</span><span class=cF0> *src, *dst;
|
|
<a name="l18"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
|
|
<a name="l19"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
|
|
<a name="l20"></a>
|
|
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (doc = </span><span class=cF5>DocRead</span><span class=cF7>(</span><span class=cF0>in_name, </span><span class=cF3>DOCF_PLAIN_TEXT_TABS</span><span class=cF0> | </span><span class=cF3>DOCF_DBL_DOLLARS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l22"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l23"></a> doc_e = doc->head.next;
|
|
<a name="l24"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
|
|
<a name="l25"></a> {
|
|
<a name="l26"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0>)
|
|
<a name="l27"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l28"></a> src = dst = doc_e->tag;
|
|
<a name="l29"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *src++)
|
|
<a name="l30"></a> {
|
|
<a name="l31"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\\'</span><span class=cF0> && *src == </span><span class=cF6>'\''</span><span class=cF0>)
|
|
<a name="l32"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l33"></a> src++;
|
|
<a name="l34"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l35"></a> ch = </span><span class=cF5>ToUpper</span><span class=cF0>(*src++);
|
|
<a name="l36"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0> <= ch <= </span><span class=cF6>'9'</span><span class=cF0>)
|
|
<a name="l37"></a> i += ch - </span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l38"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0> <= ch <= </span><span class=cF6>'F'</span><span class=cF0>)
|
|
<a name="l39"></a> i += ch - </span><span class=cF6>'A'</span><span class=cF0> + </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l40"></a> i <<= </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l41"></a> ch = </span><span class=cF5>ToUpper</span><span class=cF0>(*src++);
|
|
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0> <= ch <= </span><span class=cF6>'9'</span><span class=cF0>)
|
|
<a name="l43"></a> i += ch - </span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l44"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0> <= ch <= </span><span class=cF6>'F'</span><span class=cF0>)
|
|
<a name="l45"></a> i += ch - </span><span class=cF6>'A'</span><span class=cF0> + </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l46"></a> *dst++ = i;
|
|
<a name="l47"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l49"></a> *dst++ = ch;
|
|
<a name="l50"></a> }
|
|
<a name="l51"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l52"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l53"></a> doc_e = doc_e->next;
|
|
<a name="l54"></a> }
|
|
<a name="l55"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(doc->filename.name, out_name);
|
|
<a name="l56"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc);
|
|
<a name="l57"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l58"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l59"></a>}
|
|
<a name="l60"></a>
|
|
<a name="l61"></a></span><span class=cF9>I64</span><span class=cF0> ACDNextCmd(</span><span class=cF1>U8</span><span class=cF0> **_ptr)
|
|
<a name="l62"></a>{
|
|
<a name="l63"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr = *_ptr, *ptr2;
|
|
<a name="l64"></a> </span><span class=cF9>I64</span><span class=cF0> ch, res = -</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l65"></a>
|
|
<a name="l66"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l67"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l68"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l69"></a> {
|
|
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>ch = *ptr++</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l71"></a> </span><span class=cF1>goto</span><span class=cF0> ncmd_done;
|
|
<a name="l72"></a> }
|
|
<a name="l73"></a> </span><span class=cF1>while</span><span class=cF0> (ch != </span><span class=cF6>'<'</span><span class=cF0>);
|
|
<a name="l74"></a>
|
|
<a name="l75"></a> ptr2 = ptr;
|
|
<a name="l76"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l77"></a> {
|
|
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>ch = *ptr2++</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l79"></a> </span><span class=cF1>goto</span><span class=cF0> ncmd_done;
|
|
<a name="l80"></a> }
|
|
<a name="l81"></a> </span><span class=cF1>while</span><span class=cF0> (ch != </span><span class=cF6>'>'</span><span class=cF0>);
|
|
<a name="l82"></a>
|
|
<a name="l83"></a> *--ptr2 = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l84"></a> res = </span><span class=cF5>ListMatch</span><span class=cF0>(ptr, </span><span class=cF6>"h1\0/h1\0def\0/def\0hw\0/hw\0tt\0/tt\0"</span><span class=cF0>
|
|
<a name="l85"></a> </span><span class=cF6>"ety\0@fld\0@cd\0@blockquote\0@wordforms\0@note\0@altname\0@chform\0"</span><span class=cF0>
|
|
<a name="l86"></a> </span><span class=cF6>"@cref\0@syn\0/ety\0@/fld\0@/cd\0@/blockquote\0@/wordforms\0@/note\0"</span><span class=cF0>
|
|
<a name="l87"></a> </span><span class=cF6>"@/altname\0@/chform\0@/cref\0@/syn\0"</span><span class=cF0>);
|
|
<a name="l88"></a> *ptr2++ = </span><span class=cF6>'>'</span><span class=cF0>;
|
|
<a name="l89"></a> ptr = ptr2;
|
|
<a name="l90"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l91"></a> </span><span class=cF1>while</span><span class=cF0> (res < </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l92"></a>
|
|
<a name="l93"></a> ncmd_done:
|
|
<a name="l94"></a> *_ptr = ptr;
|
|
<a name="l95"></a>
|
|
<a name="l96"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l97"></a>}
|
|
<a name="l98"></a>
|
|
<a name="l99"></a></span><span class=cF1>U8</span><span class=cF0> *ACDNextEntry(</span><span class=cF1>U8</span><span class=cF0> **_ptr)
|
|
<a name="l100"></a>{
|
|
<a name="l101"></a> </span><span class=cF1>U8</span><span class=cF0> *res, *ignore, *ptr = *_ptr, buf[</span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0>], *out_ptr = buf;
|
|
<a name="l102"></a> </span><span class=cF9>I64</span><span class=cF0> ch, l;
|
|
<a name="l103"></a>
|
|
<a name="l104"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l105"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l106"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l107"></a> {
|
|
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>ch = *ptr++</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l109"></a> </span><span class=cF1>goto</span><span class=cF0> nentry_done;
|
|
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (ch != </span><span class=cF6>'<'</span><span class=cF0>)
|
|
<a name="l111"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l112"></a> *out_ptr++ = ch;
|
|
<a name="l113"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'$'</span><span class=cF0>)
|
|
<a name="l114"></a> *out_ptr++ = ch;
|
|
<a name="l115"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l116"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l117"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l118"></a> }
|
|
<a name="l119"></a> ignore = </span><span class=cF6>"b>\0i>\0ppp>\0/b>\0/i>\0/p>\0"</span><span class=cF0>
|
|
<a name="l120"></a> </span><span class=cF6>"ets>\0col>\0spn>\0/ets>\0/col>\0/spn>\0er>\0as>\0cs>\0cd>\0ex>\0"</span><span class=cF0>
|
|
<a name="l121"></a> </span><span class=cF6>"/er>\0/as>\0/cs>\0/cd>\0/ex>\0"</span><span class=cF0>
|
|
<a name="l122"></a> </span><span class=cF6>"note>\0/note>\0blockquote>\0/blockquote>\0"</span><span class=cF0>;
|
|
<a name="l123"></a> </span><span class=cF1>while</span><span class=cF0> (*ignore)
|
|
<a name="l124"></a> {
|
|
<a name="l125"></a> l = </span><span class=cF5>StrLen</span><span class=cF0>(ignore);
|
|
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrNCompare</span><span class=cF7>(</span><span class=cF0>ptr, ignore, l</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l127"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l128"></a> ptr += l;
|
|
<a name="l129"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l131"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l132"></a> ignore += l + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l133"></a> }
|
|
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (!*ignore)
|
|
<a name="l135"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l136"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l137"></a>nentry_done:
|
|
<a name="l138"></a> *out_ptr++ = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l139"></a> res = </span><span class=cF5>StrNew</span><span class=cF0>(buf);
|
|
<a name="l140"></a> *_ptr = ptr - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l141"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l142"></a>}
|
|
<a name="l143"></a>
|
|
<a name="l144"></a></span><span class=cF9>I64</span><span class=cF0> ACDCompareWords(</span><span class=cF1>U8</span><span class=cF0> *e1, </span><span class=cF1>U8</span><span class=cF0> *e2)
|
|
<a name="l145"></a>{
|
|
<a name="l146"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrICompare</span><span class=cF0>(e1, e2);
|
|
<a name="l147"></a>}
|
|
<a name="l148"></a>
|
|
<a name="l149"></a></span><span class=cF1>U8</span><span class=cF0> *ACDSortWords(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF1>start</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> size, </span><span class=cF9>I64</span><span class=cF0> word_count)
|
|
<a name="l150"></a>{
|
|
<a name="l151"></a> </span><span class=cF1>U8</span><span class=cF0> **ptr_array = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>*word_count),
|
|
<a name="l152"></a> *out_start = </span><span class=cF5>MAlloc</span><span class=cF0>(size),
|
|
<a name="l153"></a> *ptr = </span><span class=cF1>start</span><span class=cF0>,*ptr2;
|
|
<a name="l154"></a> </span><span class=cF9>I64</span><span class=cF0> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l155"></a>
|
|
<a name="l156"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr)
|
|
<a name="l157"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l158"></a> ptr_array[i++] = ptr;
|
|
<a name="l159"></a> ptr += </span><span class=cF5>StrLen</span><span class=cF0>(ptr) + </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l160"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l161"></a>
|
|
<a name="l162"></a> </span><span class=cF6>"Sorting...\n"</span><span class=cF0>;
|
|
<a name="l163"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>100</span><span class=cF0>);
|
|
<a name="l164"></a> </span><span class=cF5>QuickSortI64</span><span class=cF0>(ptr_array, word_count, &ACDCompareWords);
|
|
<a name="l165"></a> </span><span class=cF6>"Done...\n"</span><span class=cF0>;
|
|
<a name="l166"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>100</span><span class=cF0>);
|
|
<a name="l167"></a>
|
|
<a name="l168"></a> ptr = out_start;
|
|
<a name="l169"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < word_count; i++)
|
|
<a name="l170"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l171"></a> ptr2 = ptr_array[i];
|
|
<a name="l172"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr2)
|
|
<a name="l173"></a> *ptr++ = *ptr2++;
|
|
<a name="l174"></a> *ptr++ = *ptr2++; </span><span class=cF2>//zero</span><span class=cF0>
|
|
<a name="l175"></a> *ptr++ = *ptr2++; </span><span class=cF2>//block lo</span><span class=cF0>
|
|
<a name="l176"></a> *ptr++ = *ptr2++; </span><span class=cF2>//block hi</span><span class=cF0>
|
|
<a name="l177"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l178"></a> *ptr++ = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l179"></a> </span><span class=cF1>return</span><span class=cF0> out_start;
|
|
<a name="l180"></a>}
|
|
<a name="l181"></a>
|
|
<a name="l182"></a></span><span class=cF1>U0</span><span class=cF0> ACDGen(</span><span class=cF1>U8</span><span class=cF0> *in_file)
|
|
<a name="l183"></a>{
|
|
<a name="l184"></a> </span><span class=cF9>I64</span><span class=cF0> cmd, size, word_count = </span><span class=cFE>0</span><span class=cF0>, largest_entry = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l185"></a> </span><span class=cF1>U8</span><span class=cF0> *st,
|
|
<a name="l186"></a> *in_ptr = </span><span class=cF5>FileRead</span><span class=cF0>(in_file, &size),
|
|
<a name="l187"></a> *in_start = in_ptr,
|
|
<a name="l188"></a> *out_ptr = </span><span class=cF5>MAlloc</span><span class=cF0>(size),
|
|
<a name="l189"></a> *out_start = out_ptr,
|
|
<a name="l190"></a> *word_ptr = </span><span class=cF5>MAlloc</span><span class=cF0>(size),
|
|
<a name="l191"></a> *word_start = word_ptr,
|
|
<a name="l192"></a> *last_word = </span><span class=cF6>""</span><span class=cF0>,
|
|
<a name="l193"></a> *def_word_start = out_ptr,
|
|
<a name="l194"></a> *sorted_word_start;
|
|
<a name="l195"></a> </span><span class=cF9>U16</span><span class=cF0> *d;
|
|
<a name="l196"></a>
|
|
<a name="l197"></a> </span><span class=cF1>if</span><span class=cF0> (!in_ptr)
|
|
<a name="l198"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l199"></a>
|
|
<a name="l200"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l201"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l202"></a> cmd = ACDNextCmd(&in_ptr);
|
|
<a name="l203"></a> </span><span class=cF1>if</span><span class=cF0> (cmd == </span><span class=cF3>ACD_H1</span><span class=cF0>)
|
|
<a name="l204"></a> {
|
|
<a name="l205"></a>next_word:
|
|
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (out_ptr - def_word_start > largest_entry)
|
|
<a name="l207"></a> largest_entry = out_ptr - def_word_start;
|
|
<a name="l208"></a>
|
|
<a name="l209"></a> def_word_start = out_ptr;
|
|
<a name="l210"></a> </span><span class=cF1>if</span><span class=cF0> (st = ACDNextEntry</span><span class=cF7>(</span><span class=cF0>&in_ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l211"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l212"></a> </span><span class=cF1>if</span><span class=cF0> (*st)
|
|
<a name="l213"></a> {
|
|
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrICompare</span><span class=cF7>(</span><span class=cF0>st, last_word</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l215"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l216"></a> word_count++;
|
|
<a name="l217"></a>
|
|
<a name="l218"></a> *word_ptr++ = </span><span class=cF3>ACD_WORD_CHAR</span><span class=cF0>;
|
|
<a name="l219"></a> last_word = word_ptr;
|
|
<a name="l220"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(word_ptr, st);
|
|
<a name="l221"></a> word_ptr += </span><span class=cF5>StrLen</span><span class=cF0>(st) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l222"></a>
|
|
<a name="l223"></a> d = word_ptr;
|
|
<a name="l224"></a> *d = (out_ptr - out_start) / </span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0>;
|
|
<a name="l225"></a> word_ptr += </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l226"></a>
|
|
<a name="l227"></a> *out_ptr++ = </span><span class=cF3>ACD_WORD_CHAR</span><span class=cF0>;
|
|
<a name="l228"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(out_ptr, st);
|
|
<a name="l229"></a> out_ptr += </span><span class=cF5>StrLen</span><span class=cF0>(st) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l230"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l231"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l232"></a>
|
|
<a name="l233"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l234"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l235"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l236"></a> {
|
|
<a name="l237"></a> cmd = ACDNextCmd(&in_ptr);
|
|
<a name="l238"></a> </span><span class=cF1>if</span><span class=cF0> (cmd == </span><span class=cF3>ACD_H1</span><span class=cF0>)
|
|
<a name="l239"></a> </span><span class=cF1>goto</span><span class=cF0> next_word;
|
|
<a name="l240"></a> }
|
|
<a name="l241"></a> </span><span class=cF1>while</span><span class=cF0> (cmd >= </span><span class=cFE>0</span><span class=cF0> &&
|
|
<a name="l242"></a> !</span><span class=cF7>(</span><span class=cF0>cmd == </span><span class=cF3>ACD_DEF</span><span class=cF0> || cmd == </span><span class=cF3>ACD_PRONUNCIATION</span><span class=cF0> || cmd == </span><span class=cF3>ACD_POS</span><span class=cF0> || cmd == </span><span class=cF3>ACD_EXTRA</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l243"></a>
|
|
<a name="l244"></a> </span><span class=cF1>if</span><span class=cF0> (cmd == </span><span class=cF3>ACD_DEF</span><span class=cF0>)
|
|
<a name="l245"></a> {
|
|
<a name="l246"></a> </span><span class=cF1>if</span><span class=cF0> (st = ACDNextEntry</span><span class=cF7>(</span><span class=cF0>&in_ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l247"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l248"></a> </span><span class=cF1>if</span><span class=cF0> (*st)
|
|
<a name="l249"></a> {
|
|
<a name="l250"></a> *out_ptr++ = </span><span class=cF3>ACD_DEF_CHAR</span><span class=cF0>;
|
|
<a name="l251"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(out_ptr, st);
|
|
<a name="l252"></a> out_ptr += </span><span class=cF5>StrLen</span><span class=cF0>(st) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l253"></a> }
|
|
<a name="l254"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l255"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l256"></a> }
|
|
<a name="l257"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cmd == </span><span class=cF3>ACD_PRONUNCIATION</span><span class=cF0>)
|
|
<a name="l258"></a> {
|
|
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (st = ACDNextEntry</span><span class=cF7>(</span><span class=cF0>&in_ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l260"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l261"></a> </span><span class=cF1>if</span><span class=cF0> (*st)
|
|
<a name="l262"></a> {
|
|
<a name="l263"></a> *out_ptr++ = </span><span class=cF3>ACD_PRONUNCIATION_CHAR</span><span class=cF0>;
|
|
<a name="l264"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(out_ptr, st);
|
|
<a name="l265"></a> out_ptr += </span><span class=cF5>StrLen</span><span class=cF0>(st) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l266"></a> }
|
|
<a name="l267"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l268"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l269"></a> }
|
|
<a name="l270"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cmd == </span><span class=cF3>ACD_POS</span><span class=cF0>)
|
|
<a name="l271"></a> {
|
|
<a name="l272"></a> </span><span class=cF1>if</span><span class=cF0> (st = ACDNextEntry</span><span class=cF7>(</span><span class=cF0>&in_ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l273"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l274"></a> </span><span class=cF1>if</span><span class=cF0> (*st)
|
|
<a name="l275"></a> {
|
|
<a name="l276"></a> *out_ptr++ = </span><span class=cF3>ACD_POS_CHAR</span><span class=cF0>;
|
|
<a name="l277"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(out_ptr, st);
|
|
<a name="l278"></a> out_ptr += </span><span class=cF5>StrLen</span><span class=cF0>(st) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l279"></a> }
|
|
<a name="l280"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l281"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l282"></a> }
|
|
<a name="l283"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cmd == </span><span class=cF3>ACD_EXTRA</span><span class=cF0>)
|
|
<a name="l284"></a> {
|
|
<a name="l285"></a> </span><span class=cF1>if</span><span class=cF0> (st = ACDNextEntry</span><span class=cF7>(</span><span class=cF0>&in_ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l286"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l287"></a> </span><span class=cF1>if</span><span class=cF0> (*st)
|
|
<a name="l288"></a> {
|
|
<a name="l289"></a> *out_ptr++ = </span><span class=cF3>ACD_EXTRA_CHAR</span><span class=cF0>;
|
|
<a name="l290"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(out_ptr, st);
|
|
<a name="l291"></a> out_ptr += </span><span class=cF5>StrLen</span><span class=cF0>(st) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l292"></a> }
|
|
<a name="l293"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l294"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l295"></a> }
|
|
<a name="l296"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l297"></a> </span><span class=cF1>while</span><span class=cF0> (cmd == </span><span class=cF3>ACD_DEF</span><span class=cF0> || cmd == </span><span class=cF3>ACD_PRONUNCIATION</span><span class=cF0> || cmd == </span><span class=cF3>ACD_POS</span><span class=cF0> || cmd == </span><span class=cF3>ACD_EXTRA</span><span class=cF0>);
|
|
<a name="l298"></a> }
|
|
<a name="l299"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l300"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l301"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l302"></a> }
|
|
<a name="l303"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l304"></a> </span><span class=cF1>while</span><span class=cF0> (cmd >= </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l305"></a>
|
|
<a name="l306"></a> *out_ptr++ = </span><span class=cF3>ACD_END_CHAR</span><span class=cF0>;
|
|
<a name="l307"></a> *word_ptr++ = </span><span class=cF3>ACD_END_CHAR</span><span class=cF0>;
|
|
<a name="l308"></a>
|
|
<a name="l309"></a> </span><span class=cF5>Free</span><span class=cF0>(in_start);
|
|
<a name="l310"></a>
|
|
<a name="l311"></a> </span><span class=cF6>"Block Size :%d\n"</span><span class=cF0>, </span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0>;
|
|
<a name="l312"></a> </span><span class=cF6>"Block Count :%04X\n"</span><span class=cF0>, (out_ptr - out_start + </span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>) / </span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0>;
|
|
<a name="l313"></a> </span><span class=cF6>"Largest Entry :%d\n"</span><span class=cF0>, largest_entry;
|
|
<a name="l314"></a> </span><span class=cF6>"Word Count :%d\n"</span><span class=cF0>, word_count;
|
|
<a name="l315"></a>
|
|
<a name="l316"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(</span><span class=cF3>ACD_DEF_FILENAME</span><span class=cF0>, out_start, out_ptr - out_start);
|
|
<a name="l317"></a> </span><span class=cF6>"Def File Size :%d\n"</span><span class=cF0>, out_ptr - out_start;
|
|
<a name="l318"></a>
|
|
<a name="l319"></a> sorted_word_start = ACDSortWords(word_start, word_ptr - word_start, word_count);
|
|
<a name="l320"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(</span><span class=cF3>ACD_WORD_FILENAME</span><span class=cF0>, sorted_word_start, word_ptr - word_start);
|
|
<a name="l321"></a> </span><span class=cF6>"Word File Size:%d\n"</span><span class=cF0>, word_ptr - word_start;
|
|
<a name="l322"></a>
|
|
<a name="l323"></a> </span><span class=cF5>Free</span><span class=cF0>(out_start);
|
|
<a name="l324"></a> </span><span class=cF5>Free</span><span class=cF0>(word_start);
|
|
<a name="l325"></a> </span><span class=cF5>Free</span><span class=cF0>(sorted_word_start);
|
|
<a name="l326"></a>}
|
|
<a name="l327"></a>
|
|
<a name="l328"></a></span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0>);
|
|
<a name="l329"></a>ACDPreprocess(</span><span class=cF6>"DICTIONARY.DD"</span><span class=cF0>, </span><span class=cF6>"DICTIONARY2.DD"</span><span class=cF0>);
|
|
<a name="l330"></a>ACDGen(</span><span class=cF6>"DICTIONARY2.DD"</span><span class=cF0>);
|
|
</span></pre></body>
|
|
</html>
|