293 lines
26 KiB
HTML
Executable File
293 lines
26 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=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="/Wb/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> </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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l21"></a> doc_e=doc->head.next;
|
|
<a name="l22"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) {
|
|
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l24"></a> src=dst=doc_e->tag;
|
|
<a name="l25"></a> </span><span class=cF1>while</span><span class=cF0> (ch=*src++) {
|
|
<a name="l26"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l27"></a> src++;
|
|
<a name="l28"></a> i=0;
|
|
<a name="l29"></a> ch=</span><span class=cF5>ToUpper</span><span class=cF0>(*src++);
|
|
<a name="l30"></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="l31"></a> i+=ch-</span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l32"></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="l33"></a> i+=ch-</span><span class=cF6>'A'</span><span class=cF0>+10;
|
|
<a name="l34"></a> i<<=4;
|
|
<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>+10;
|
|
<a name="l40"></a> *dst++=i;
|
|
<a name="l41"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l42"></a> *dst++=ch;
|
|
<a name="l43"></a> }
|
|
<a name="l44"></a> *dst=0;
|
|
<a name="l45"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l46"></a> doc_e=doc_e->next;
|
|
<a name="l47"></a> }
|
|
<a name="l48"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(doc->filename.name,out_name);
|
|
<a name="l49"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc);
|
|
<a name="l50"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l51"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l52"></a>}
|
|
<a name="l53"></a>
|
|
<a name="l54"></a></span><span class=cF9>I64</span><span class=cF0> ACDNextCmd(</span><span class=cF1>U8</span><span class=cF0> **_ptr)
|
|
<a name="l55"></a>{
|
|
<a name="l56"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr=*_ptr,*ptr2;
|
|
<a name="l57"></a> </span><span class=cF9>I64</span><span class=cF0> ch,res=-1;
|
|
<a name="l58"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l59"></a> </span><span class=cF1>do</span><span class=cF0> {
|
|
<a name="l60"></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>) </span><span class=cF1>goto</span><span class=cF0> ncmd_done;
|
|
<a name="l61"></a> } </span><span class=cF1>while</span><span class=cF0> (ch!=</span><span class=cF6>'<'</span><span class=cF0>);
|
|
<a name="l62"></a>
|
|
<a name="l63"></a> ptr2=ptr;
|
|
<a name="l64"></a> </span><span class=cF1>do</span><span class=cF0> {
|
|
<a name="l65"></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>) </span><span class=cF1>goto</span><span class=cF0> ncmd_done;
|
|
<a name="l66"></a> } </span><span class=cF1>while</span><span class=cF0> (ch!=</span><span class=cF6>'>'</span><span class=cF0>);
|
|
<a name="l67"></a> *--ptr2=0;
|
|
<a name="l68"></a> res=</span><span class=cF5>LstMatch</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="l69"></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="l70"></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="l71"></a> </span><span class=cF6>"@/altname\0@/chform\0@/cref\0@/syn\0"</span><span class=cF0>);
|
|
<a name="l72"></a> *ptr2++=</span><span class=cF6>'>'</span><span class=cF0>;
|
|
<a name="l73"></a> ptr=ptr2;
|
|
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (res<0);
|
|
<a name="l75"></a>
|
|
<a name="l76"></a> ncmd_done:
|
|
<a name="l77"></a> *_ptr=ptr;
|
|
<a name="l78"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l79"></a>}
|
|
<a name="l80"></a>
|
|
<a name="l81"></a></span><span class=cF1>U8</span><span class=cF0> *ACDNextEntry(</span><span class=cF1>U8</span><span class=cF0> **_ptr)
|
|
<a name="l82"></a>{
|
|
<a name="l83"></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="l84"></a> </span><span class=cF9>I64</span><span class=cF0> ch,l;
|
|
<a name="l85"></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="l86"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l87"></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>) </span><span class=cF1>goto</span><span class=cF0> nentry_done;
|
|
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (ch!=</span><span class=cF6>'<'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l89"></a> *out_ptr++=ch;
|
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'$'</span><span class=cF0>)
|
|
<a name="l91"></a> *out_ptr++=ch;
|
|
<a name="l92"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l93"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l94"></a> }
|
|
<a name="l95"></a> ignore=</span><span class=cF6>"b>\0i>\0ppp>\0/b>\0/i>\0/p>\0"</span><span class=cF0>
|
|
<a name="l96"></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="l97"></a> </span><span class=cF6>"/er>\0/as>\0/cs>\0/cd>\0/ex>\0"</span><span class=cF0>
|
|
<a name="l98"></a> </span><span class=cF6>"note>\0/note>\0blockquote>\0/blockquote>\0"</span><span class=cF0>;
|
|
<a name="l99"></a> </span><span class=cF1>while</span><span class=cF0> (*ignore) {
|
|
<a name="l100"></a> l=</span><span class=cF5>StrLen</span><span class=cF0>(ignore);
|
|
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrNCmp</span><span class=cF7>(</span><span class=cF0>ptr,ignore,l</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l102"></a> ptr+=l;
|
|
<a name="l103"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l104"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l105"></a> ignore+=l+1;
|
|
<a name="l106"></a> }
|
|
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (!*ignore)
|
|
<a name="l108"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l109"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l110"></a>nentry_done:
|
|
<a name="l111"></a> *out_ptr++=0;
|
|
<a name="l112"></a> res=</span><span class=cF5>StrNew</span><span class=cF0>(buf);
|
|
<a name="l113"></a> *_ptr=ptr-1;
|
|
<a name="l114"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l115"></a>}
|
|
<a name="l116"></a>
|
|
<a name="l117"></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="l118"></a>{
|
|
<a name="l119"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrICmp</span><span class=cF0>(e1,e2);
|
|
<a name="l120"></a>}
|
|
<a name="l121"></a>
|
|
<a name="l122"></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_cnt)
|
|
<a name="l123"></a>{
|
|
<a name="l124"></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_cnt),
|
|
<a name="l125"></a> *out_start=</span><span class=cF5>MAlloc</span><span class=cF0>(size),
|
|
<a name="l126"></a> *ptr=</span><span class=cF1>start</span><span class=cF0>,*ptr2;
|
|
<a name="l127"></a> </span><span class=cF9>I64</span><span class=cF0> i=0;
|
|
<a name="l128"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l129"></a> ptr_array[i++]=ptr;
|
|
<a name="l130"></a> ptr+=</span><span class=cF5>StrLen</span><span class=cF0>(ptr)+3;
|
|
<a name="l131"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l132"></a> </span><span class=cF6>"Sorting...\n"</span><span class=cF0>; </span><span class=cF5>Sleep</span><span class=cF0>(100);
|
|
<a name="l133"></a> </span><span class=cF5>QSortI64</span><span class=cF0>(ptr_array,word_cnt,&ACDCompareWords);
|
|
<a name="l134"></a> </span><span class=cF6>"Done...\n"</span><span class=cF0>; </span><span class=cF5>Sleep</span><span class=cF0>(100);
|
|
<a name="l135"></a>
|
|
<a name="l136"></a> ptr=out_start;
|
|
<a name="l137"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<word_cnt;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l138"></a> ptr2=ptr_array[i];
|
|
<a name="l139"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr2)
|
|
<a name="l140"></a> *ptr++=*ptr2++;
|
|
<a name="l141"></a> *ptr++=*ptr2++; </span><span class=cF2>//zero</span><span class=cF0>
|
|
<a name="l142"></a> *ptr++=*ptr2++; </span><span class=cF2>//blk lo</span><span class=cF0>
|
|
<a name="l143"></a> *ptr++=*ptr2++; </span><span class=cF2>//blk hi</span><span class=cF0>
|
|
<a name="l144"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l145"></a> *ptr++=0;
|
|
<a name="l146"></a> </span><span class=cF1>return</span><span class=cF0> out_start;
|
|
<a name="l147"></a>}
|
|
<a name="l148"></a>
|
|
<a name="l149"></a></span><span class=cF1>U0</span><span class=cF0> ACDGen(</span><span class=cF1>U8</span><span class=cF0> *in_file)
|
|
<a name="l150"></a>{
|
|
<a name="l151"></a> </span><span class=cF9>I64</span><span class=cF0> cmd,size,word_cnt=0,largest_entry=0;
|
|
<a name="l152"></a> </span><span class=cF1>U8</span><span class=cF0> *st,*in_ptr=</span><span class=cF5>FileRead</span><span class=cF0>(in_file,&size),*in_start=in_ptr,
|
|
<a name="l153"></a> *out_ptr=</span><span class=cF5>MAlloc</span><span class=cF0>(size),*out_start=out_ptr,
|
|
<a name="l154"></a> *word_ptr=</span><span class=cF5>MAlloc</span><span class=cF0>(size),*word_start=word_ptr,
|
|
<a name="l155"></a> *last_word=</span><span class=cF6>""</span><span class=cF0>,*def_word_start=out_ptr,
|
|
<a name="l156"></a> *sorted_word_start;
|
|
<a name="l157"></a> </span><span class=cF9>U16</span><span class=cF0> *d;
|
|
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (!in_ptr) </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l159"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l160"></a> cmd=ACDNextCmd(&in_ptr);
|
|
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (cmd==</span><span class=cF3>ACD_H1</span><span class=cF0>) {
|
|
<a name="l162"></a>next_word:
|
|
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (out_ptr-def_word_start>largest_entry)
|
|
<a name="l164"></a> largest_entry=out_ptr-def_word_start;
|
|
<a name="l165"></a> def_word_start=out_ptr;
|
|
<a name="l166"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (*st) {
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrICmp</span><span class=cF7>(</span><span class=cF0>st,last_word</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l169"></a> word_cnt++;
|
|
<a name="l170"></a>
|
|
<a name="l171"></a> *word_ptr++=</span><span class=cF3>ACD_WORD_CHAR</span><span class=cF0>;
|
|
<a name="l172"></a> last_word=word_ptr;
|
|
<a name="l173"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(word_ptr,st);
|
|
<a name="l174"></a> word_ptr+=</span><span class=cF5>StrLen</span><span class=cF0>(st)+1;
|
|
<a name="l175"></a>
|
|
<a name="l176"></a> d=word_ptr;
|
|
<a name="l177"></a> *d=(out_ptr-out_start)/</span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0>;
|
|
<a name="l178"></a> word_ptr+=2;
|
|
<a name="l179"></a>
|
|
<a name="l180"></a> *out_ptr++=</span><span class=cF3>ACD_WORD_CHAR</span><span class=cF0>;
|
|
<a name="l181"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(out_ptr,st);
|
|
<a name="l182"></a> out_ptr+=</span><span class=cF5>StrLen</span><span class=cF0>(st)+1;
|
|
<a name="l183"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l184"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l185"></a>
|
|
<a name="l186"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l187"></a> </span><span class=cF1>do</span><span class=cF0> {
|
|
<a name="l188"></a> cmd=ACDNextCmd(&in_ptr);
|
|
<a name="l189"></a> </span><span class=cF1>if</span><span class=cF0> (cmd==</span><span class=cF3>ACD_H1</span><span class=cF0>)
|
|
<a name="l190"></a> </span><span class=cF1>goto</span><span class=cF0> next_word;
|
|
<a name="l191"></a> } </span><span class=cF1>while</span><span class=cF0> (cmd>=0 && !</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>||
|
|
<a name="l192"></a> 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="l193"></a> </span><span class=cF1>if</span><span class=cF0> (cmd==</span><span class=cF3>ACD_DEF</span><span class=cF0>) {
|
|
<a name="l194"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (*st) {
|
|
<a name="l196"></a> *out_ptr++=</span><span class=cF3>ACD_DEF_CHAR</span><span class=cF0>;
|
|
<a name="l197"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(out_ptr,st);
|
|
<a name="l198"></a> out_ptr+=</span><span class=cF5>StrLen</span><span class=cF0>(st)+1;
|
|
<a name="l199"></a> }
|
|
<a name="l200"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l201"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l202"></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="l203"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (*st) {
|
|
<a name="l205"></a> *out_ptr++=</span><span class=cF3>ACD_PRONUNCIATION_CHAR</span><span class=cF0>;
|
|
<a name="l206"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(out_ptr,st);
|
|
<a name="l207"></a> out_ptr+=</span><span class=cF5>StrLen</span><span class=cF0>(st)+1;
|
|
<a name="l208"></a> }
|
|
<a name="l209"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l210"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l211"></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="l212"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (*st) {
|
|
<a name="l214"></a> *out_ptr++=</span><span class=cF3>ACD_POS_CHAR</span><span class=cF0>;
|
|
<a name="l215"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(out_ptr,st);
|
|
<a name="l216"></a> out_ptr+=</span><span class=cF5>StrLen</span><span class=cF0>(st)+1;
|
|
<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=cF7>}</span><span class=cF0>
|
|
<a name="l220"></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="l221"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l222"></a> </span><span class=cF1>if</span><span class=cF0> (*st) {
|
|
<a name="l223"></a> *out_ptr++=</span><span class=cF3>ACD_EXTRA_CHAR</span><span class=cF0>;
|
|
<a name="l224"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(out_ptr,st);
|
|
<a name="l225"></a> out_ptr+=</span><span class=cF5>StrLen</span><span class=cF0>(st)+1;
|
|
<a name="l226"></a> }
|
|
<a name="l227"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l228"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l229"></a> }
|
|
<a name="l230"></a> </span><span class=cF7>}</span><span class=cF0> </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>||
|
|
<a name="l231"></a> cmd==</span><span class=cF3>ACD_POS</span><span class=cF0>||cmd==</span><span class=cF3>ACD_EXTRA</span><span class=cF0>);
|
|
<a name="l232"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l233"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l235"></a> }
|
|
<a name="l236"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (cmd>=0);
|
|
<a name="l237"></a> *out_ptr++=</span><span class=cF3>ACD_END_CHAR</span><span class=cF0>;
|
|
<a name="l238"></a> *word_ptr++=</span><span class=cF3>ACD_END_CHAR</span><span class=cF0>;
|
|
<a name="l239"></a>
|
|
<a name="l240"></a> </span><span class=cF5>Free</span><span class=cF0>(in_start);
|
|
<a name="l241"></a>
|
|
<a name="l242"></a> </span><span class=cF6>"Blk Size :%d\n"</span><span class=cF0>,</span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0>;
|
|
<a name="l243"></a> </span><span class=cF6>"Blk Cnt :%04X\n"</span><span class=cF0>,(out_ptr-out_start+</span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0>-1)/</span><span class=cF3>ACD_BLK_SIZE</span><span class=cF0>;
|
|
<a name="l244"></a> </span><span class=cF6>"Largest Entry :%d\n"</span><span class=cF0>,largest_entry;
|
|
<a name="l245"></a> </span><span class=cF6>"Word Count :%d\n"</span><span class=cF0>,word_cnt;
|
|
<a name="l246"></a>
|
|
<a name="l247"></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="l248"></a> </span><span class=cF6>"Def File Size :%d\n"</span><span class=cF0>,out_ptr-out_start;
|
|
<a name="l249"></a>
|
|
<a name="l250"></a> sorted_word_start=ACDSortWords(word_start,word_ptr-word_start,word_cnt);
|
|
<a name="l251"></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="l252"></a> </span><span class=cF6>"Word File Size:%d\n"</span><span class=cF0>,word_ptr-word_start;
|
|
<a name="l253"></a>
|
|
<a name="l254"></a> </span><span class=cF5>Free</span><span class=cF0>(out_start);
|
|
<a name="l255"></a> </span><span class=cF5>Free</span><span class=cF0>(word_start);
|
|
<a name="l256"></a> </span><span class=cF5>Free</span><span class=cF0>(sorted_word_start);
|
|
<a name="l257"></a>}
|
|
<a name="l258"></a>
|
|
<a name="l259"></a></span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0>);
|
|
<a name="l260"></a>ACDPreprocess(</span><span class=cF6>"DICTIONARY.DD"</span><span class=cF0>,</span><span class=cF6>"DICTIONARY2.DD"</span><span class=cF0>);
|
|
<a name="l261"></a>ACDGen(</span><span class=cF6>"DICTIONARY2.DD"</span><span class=cF0>);
|
|
</span></pre></body>
|
|
</html>
|