ZealOS/docs/Home/HtmlGen.CC.html

179 lines
15 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
2021-09-22 04:45:45 +01:00
<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>/* This converts the entire OS into HTML.</span><span class=cF0>
<a name="l2"></a></span><span class=cF2>See </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/ToHtmlToTXTDemo/ToHtml.CC.html#l1"><span class=cF4>::/Demo/ToHtmlToTXTDemo/ToHtml.CC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a></span><span class=cF2>Notice that an entry like $TX,&quot;GOOGLE&quot;,HTML=&quot;http://www.google.com&quot;$</span><span class=cF0>
<a name="l5"></a></span><span class=cF2>will be converted to text in the html with an html link.</span><span class=cF0>
<a name="l6"></a>
<a name="l7"></a></span><span class=cF2>Terry cheated by hardcoding </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/ToHtmlToTXTDemo/ToHtml.CC.html#l88"><span class=cF4>www.templeos.org</span></a><span class=cF2> as the website</span><span class=cF0>
<a name="l8"></a></span><span class=cF2>for </span><a href="https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocLink.CC.html#l29"><span class=cF4>ZealOS Links</span></a><span class=cF2>. Why don't you copy</span><span class=cF4>
<a name="l9"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/ToHtmlToTXTDemo/ToHtml.CC.html#l1"><span class=cF4>::/Demo/ToHtmlToTXTDemo/ToHtml.CC</span></a><span class=cF2> to your /Home directory</span><span class=cF0>
<a name="l10"></a></span><span class=cF2>and modify it?</span><span class=cF0> </span><span class=cF2>You are welcome to link to</span><span class=cF0>
<a name="l11"></a></span><span class=cF2>http://www.templeos.org if you want file that come on the</span><span class=cF0>
<a name="l12"></a></span><span class=cF2>ZealOS distribution.</span><span class=cF0>
<a name="l13"></a>
<a name="l14"></a></span><span class=cF2>You can pass html meta data as args to </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/ToHtmlToTXTDemo/ToHtml.CC.html#l399"><span class=cF4>ToHtml</span></a><span class=cF2>().</span><span class=cF0>
<a name="l15"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l16"></a>
<a name="l17"></a></span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0>);;
<a name="l18"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;::/Demo/ToHtmlToTXTDemo/ToHtml&quot;</span><span class=cF0>
<a name="l19"></a>
<a name="l20"></a></span><span class=cF2>//ToHtml(&quot;DemoInPage.DD&quot;, &quot;~/DemoOutPage&quot;);</span><span class=cF0>
<a name="l21"></a>
<a name="l22"></a></span><span class=cF9>CTask</span><span class=cF0> *index_task = </span><span class=cF5>User</span><span class=cF0>(</span><span class=cF6>&quot;#include \&quot;::/Demo/ToHtmlToTXTDemo/HtmlDirList\&quot;;;DocMax;DocMax;\n&quot;</span><span class=cF0>);
<a name="l23"></a></span><span class=cF5>DocClear</span><span class=cF0>(index_task-&gt;border_doc, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l24"></a></span><span class=cF5>WinVert</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>, index_task);
<a name="l25"></a></span><span class=cF5>WinToTop</span><span class=cF0>;
<a name="l26"></a>
<a name="l27"></a></span><span class=cF1>U0</span><span class=cF0> DirIndex(</span><span class=cF1>U8</span><span class=cF0> *dest_path, </span><span class=cF1>U8</span><span class=cF0> *full_name, </span><span class=cF1>U8</span><span class=cF0> *opt_func=</span><span class=cF6>&quot;&quot;</span><span class=cF0>)
<a name="l28"></a>{
<a name="l29"></a> </span><span class=cF1>U8</span><span class=cF0> *index_path,
<a name="l30"></a> *index_path_out,
<a name="l31"></a> *index_exe;
<a name="l32"></a> </span><span class=cF9>CDoc</span><span class=cF0> *index_doc;
<a name="l33"></a>
<a name="l34"></a> index_path = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s/index.DD&quot;</span><span class=cF0>, dest_path);
<a name="l35"></a> index_path_out = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s/index.html&quot;</span><span class=cF0>, dest_path);
<a name="l36"></a> </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>, index_path;
<a name="l37"></a>
<a name="l38"></a> index_exe = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;Cls;DirIndexList(\&quot;%s\&quot;);%s;View;\n&quot;</span><span class=cF0>, full_name, opt_func);
<a name="l39"></a> </span><span class=cF5>XTalk</span><span class=cF0>(index_task, index_exe);
<a name="l40"></a>
<a name="l41"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(index_task);
<a name="l42"></a>
<a name="l43"></a> index_doc = </span><span class=cF5>DocNew</span><span class=cF0>(index_path);
<a name="l44"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(index_doc, index_task-&gt;put_doc);
<a name="l45"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(index_doc);
<a name="l46"></a> </span><span class=cF5>DocDel</span><span class=cF0>(index_doc);
<a name="l47"></a>
<a name="l48"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(index_task);
<a name="l49"></a> </span><span class=cF5>MessagePostWait</span><span class=cF0>(index_task, </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>, </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l50"></a>
<a name="l51"></a> ToHtml(index_path, index_path_out);
<a name="l52"></a> </span><span class=cF5>Del</span><span class=cF0>(index_path);
<a name="l53"></a>
<a name="l54"></a> </span><span class=cF5>Free</span><span class=cF0>(index_path);
<a name="l55"></a> </span><span class=cF5>Free</span><span class=cF0>(index_path_out);
<a name="l56"></a> </span><span class=cF5>Free</span><span class=cF0>(index_exe);
<a name="l57"></a>
<a name="l58"></a>}
<a name="l59"></a>
<a name="l60"></a></span><span class=cF9>I64</span><span class=cF0> Dir2Html(</span><span class=cF1>U8</span><span class=cF0> *src_files_find_mask, </span><span class=cF1>U8</span><span class=cF0> *dst_files_find_mask)
<a name="l61"></a>{
<a name="l62"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1 = </span><span class=cF3>NULL</span><span class=cF0>, *tmpde2;
<a name="l63"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l64"></a> </span><span class=cF1>U8</span><span class=cF0> *dest_path,
<a name="l65"></a> *dest_file,
<a name="l66"></a> *dest_abs,
<a name="l67"></a> *src_abs,
<a name="l68"></a> dest_ext[</span><span class=cF3>STR_LEN</span><span class=cF0>];
<a name="l69"></a>
<a name="l70"></a> tmpde1 = </span><span class=cF5>FilesFind</span><span class=cF0>(src_files_find_mask, </span><span class=cF3>FUF_RECURSE</span><span class=cF0>);
<a name="l71"></a> dest_abs = </span><span class=cF5>DirNameAbs</span><span class=cF0>(dst_files_find_mask);
<a name="l72"></a> src_abs = </span><span class=cF5>DirNameAbs</span><span class=cF0>(src_files_find_mask);
<a name="l73"></a>
<a name="l74"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1)
<a name="l75"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde1)
<a name="l77"></a> {
<a name="l78"></a> tmpde2 = tmpde1-&gt;next;
<a name="l79"></a> res++;
<a name="l80"></a>
<a name="l81"></a> dest_file = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1-&gt;name);
<a name="l82"></a> </span><span class=cF5>FileExtRemove</span><span class=cF0>(dest_file, dest_ext);
<a name="l83"></a>
<a name="l84"></a> </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>, tmpde1-&gt;full_name;
<a name="l85"></a>
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpde1-&gt;attr &amp; </span><span class=cF3>RS_ATTR_DIR</span><span class=cF7>)</span><span class=cF0>)
<a name="l87"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>dest_ext, </span><span class=cF6>&quot;BIN.C&quot;</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l89"></a> </span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>dest_ext, </span><span class=cF6>&quot;BIN&quot;</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l90"></a> </span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>dest_ext, </span><span class=cF6>&quot;ISO.C&quot;</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l91"></a> </span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>dest_ext, </span><span class=cF6>&quot;html&quot;</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l92"></a> </span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>dest_ext, </span><span class=cF6>&quot;DATA&quot;</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l93"></a> </span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>dest_ext, </span><span class=cF6>&quot;MAP&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l94"></a> {
<a name="l95"></a> dest_path = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s/%s.%s.html&quot;</span><span class=cF0>, dest_abs, dest_file, dest_ext);
<a name="l96"></a>
<a name="l97"></a> </span><span class=cF6>&quot;%s\n\n&quot;</span><span class=cF0>, dest_path;
<a name="l98"></a> ToHtml(tmpde1-&gt;full_name, dest_path);
<a name="l99"></a> </span><span class=cFB>progress1</span><span class=cF0>++;
<a name="l100"></a>
<a name="l101"></a> </span><span class=cF5>Free</span><span class=cF0>(dest_path);
<a name="l102"></a> }
<a name="l103"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l104"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l105"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l106"></a> dest_path = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s/%s&quot;</span><span class=cF0>, dest_abs, dest_file);
<a name="l107"></a>
<a name="l108"></a> DirIndex(dest_path, tmpde1-&gt;full_name);
<a name="l109"></a>
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>tmpde1-&gt;full_name, dest_abs</span><span class=cF7>)</span><span class=cF0>)
<a name="l111"></a> Dir2Html(tmpde1-&gt;full_name, dest_path);
<a name="l112"></a>
<a name="l113"></a> </span><span class=cF5>Free</span><span class=cF0>(dest_path);
<a name="l114"></a>
<a name="l115"></a>
<a name="l116"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l117"></a>
<a name="l118"></a> </span><span class=cF5>DirEntryDel</span><span class=cF0>(tmpde1);
<a name="l119"></a> tmpde1 = tmpde2;
<a name="l120"></a>
<a name="l121"></a> </span><span class=cF5>Free</span><span class=cF0>(dest_file);
<a name="l122"></a> }
<a name="l123"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l124"></a>
<a name="l125"></a> </span><span class=cF5>Free</span><span class=cF0>(dest_abs);
<a name="l126"></a>
<a name="l127"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l128"></a>
<a name="l129"></a>}
<a name="l130"></a>
<a name="l131"></a></span><span class=cF9>I64</span><span class=cF0> HtmlGen()
<a name="l132"></a>{
<a name="l133"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l134"></a>
<a name="l135"></a> </span><span class=cF5>DocMax</span><span class=cF0>;
<a name="l136"></a> </span><span class=cF5>DocMax</span><span class=cF0>;
<a name="l137"></a> </span><span class=cF5>DelTree</span><span class=cF0>(</span><span class=cF6>&quot;::/HTML/&quot;</span><span class=cF0>);
<a name="l138"></a>
<a name="l139"></a> </span><span class=cFB>progress1</span><span class=cF0> = </span><span class=cFE>0</span><span class=cF0>;
<a name="l140"></a> </span><span class=cFB>progress1_max</span><span class=cF0> = </span><span class=cF5>FileCount</span><span class=cF0>(</span><span class=cF5>FilesFind</span><span class=cF7>(</span><span class=cF6>&quot;::/&quot;</span><span class=cF0>, </span><span class=cF3>FUF_RECURSE</span><span class=cF7>)</span><span class=cF0>);
<a name="l141"></a>
<a name="l142"></a> DirIndex(</span><span class=cF6>&quot;::/HTML/&quot;</span><span class=cF0>, </span><span class=cF6>&quot;::/&quot;</span><span class=cF0>, </span><span class=cF6>&quot;Who;&quot;</span><span class=cF0>);
<a name="l143"></a>
<a name="l144"></a> res = Dir2Html(</span><span class=cF6>&quot;::/&quot;</span><span class=cF0>, </span><span class=cF6>&quot;::/HTML/&quot;</span><span class=cF0>);
<a name="l145"></a>
<a name="l146"></a> </span><span class=cF5>Kill</span><span class=cF0>(index_task);
<a name="l147"></a>
<a name="l148"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l149"></a>}
</span></pre></body>
</html>