ZealOS/docs/Home/HtmlGen.CC.html

165 lines
13 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.06">
<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>
<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://tomawezome.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://tomawezome.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://tomawezome.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://tomawezome.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://tomawezome.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=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)
<a name="l23"></a>{
<a name="l24"></a> </span><span class=cF1>U8</span><span class=cF0> *index_path,
<a name="l25"></a> *index_path_out,
<a name="l26"></a> *index_exe;
<a name="l27"></a> </span><span class=cF9>CTask</span><span class=cF0> *index_task;
<a name="l28"></a> </span><span class=cF9>CDoc</span><span class=cF0> *index_doc;
<a name="l29"></a>
<a name="l30"></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="l31"></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="l32"></a> </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>, index_path;
<a name="l33"></a>
<a name="l34"></a> index_exe = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;#include \&quot;::/Demo/ToHtmlToTXTDemo/HtmlDirList\&quot;;;;&quot;</span><span class=cF0>
<a name="l35"></a> </span><span class=cF6>&quot;Cls;DirIndexList(\&quot;%s\&quot;);View;\n&quot;</span><span class=cF0>, full_name);
<a name="l36"></a> </span><span class=cF5>PopUp</span><span class=cF0>(index_exe,, &amp;index_task);
<a name="l37"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(index_task);
<a name="l38"></a>
<a name="l39"></a> index_doc = </span><span class=cF5>DocNew</span><span class=cF0>(index_path);
<a name="l40"></a> </span><span class=cF5>DocInsDoc</span><span class=cF0>(index_doc, index_task-&gt;put_doc);
<a name="l41"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(index_doc);
<a name="l42"></a> </span><span class=cF5>DocDel</span><span class=cF0>(index_doc);
<a name="l43"></a>
<a name="l44"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(index_task);
<a name="l45"></a> </span><span class=cF5>Kill</span><span class=cF0>(index_task);
<a name="l46"></a>
<a name="l47"></a> ToHtml(index_path, index_path_out);
<a name="l48"></a> </span><span class=cF5>Del</span><span class=cF0>(index_path);
<a name="l49"></a>
<a name="l50"></a> </span><span class=cF5>Free</span><span class=cF0>(index_path);
<a name="l51"></a> </span><span class=cF5>Free</span><span class=cF0>(index_path_out);
<a name="l52"></a> </span><span class=cF5>Free</span><span class=cF0>(index_exe);
<a name="l53"></a>
<a name="l54"></a>}
<a name="l55"></a>
<a name="l56"></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="l57"></a>{
<a name="l58"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1 = </span><span class=cF3>NULL</span><span class=cF0>, *tmpde2;
<a name="l59"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l60"></a> </span><span class=cF1>U8</span><span class=cF0> *dest_path,
<a name="l61"></a> *dest_file,
<a name="l62"></a> *dest_abs,
<a name="l63"></a> *src_abs,
<a name="l64"></a> dest_ext[</span><span class=cF3>STR_LEN</span><span class=cF0>];
<a name="l65"></a>
<a name="l66"></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="l67"></a> dest_abs = </span><span class=cF5>DirNameAbs</span><span class=cF0>(dst_files_find_mask);
<a name="l68"></a> src_abs = </span><span class=cF5>DirNameAbs</span><span class=cF0>(src_files_find_mask);
<a name="l69"></a>
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1)
<a name="l71"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l72"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde1)
<a name="l73"></a> {
<a name="l74"></a> tmpde2 = tmpde1-&gt;next;
<a name="l75"></a> res++;
<a name="l76"></a>
<a name="l77"></a> dest_file = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1-&gt;name);
<a name="l78"></a> </span><span class=cF5>FileExtRemove</span><span class=cF0>(dest_file, dest_ext);
<a name="l79"></a>
<a name="l80"></a> </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>, tmpde1-&gt;full_name;
<a name="l81"></a>
<a name="l82"></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="l83"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l84"></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="l85"></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="l86"></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="l87"></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="l88"></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="l89"></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="l90"></a> {
<a name="l91"></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="l92"></a>
<a name="l93"></a> </span><span class=cF6>&quot;%s\n\n&quot;</span><span class=cF0>, dest_path;
<a name="l94"></a> ToHtml(tmpde1-&gt;full_name, dest_path);
<a name="l95"></a>
<a name="l96"></a> </span><span class=cF5>Free</span><span class=cF0>(dest_path);
<a name="l97"></a> }
<a name="l98"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l99"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l100"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l101"></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="l102"></a>
<a name="l103"></a> DirIndex(dest_path, tmpde1-&gt;full_name);
<a name="l104"></a>
<a name="l105"></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="l106"></a> Dir2Html(tmpde1-&gt;full_name, dest_path);
<a name="l107"></a>
<a name="l108"></a> </span><span class=cF5>Free</span><span class=cF0>(dest_path);
<a name="l109"></a>
<a name="l110"></a>
<a name="l111"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l112"></a>
<a name="l113"></a> </span><span class=cF5>DirEntryDel</span><span class=cF0>(tmpde1);
<a name="l114"></a> tmpde1 = tmpde2;
<a name="l115"></a>
<a name="l116"></a> </span><span class=cF5>Free</span><span class=cF0>(dest_file);
<a name="l117"></a> }
<a name="l118"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l119"></a>
<a name="l120"></a> </span><span class=cF5>Free</span><span class=cF0>(dest_abs);
<a name="l121"></a>
<a name="l122"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l123"></a>
<a name="l124"></a>}
<a name="l125"></a>
<a name="l126"></a></span><span class=cF9>I64</span><span class=cF0> HtmlGen()
<a name="l127"></a>{
<a name="l128"></a> </span><span class=cF5>DocMax</span><span class=cF0>;
<a name="l129"></a> </span><span class=cF5>DocMax</span><span class=cF0>;
<a name="l130"></a> </span><span class=cF5>DelTree</span><span class=cF0>(</span><span class=cF6>&quot;::/HTML/&quot;</span><span class=cF0>);
<a name="l131"></a>
<a name="l132"></a> DirIndex(</span><span class=cF6>&quot;::/HTML/&quot;</span><span class=cF0>, </span><span class=cF6>&quot;::/&quot;</span><span class=cF0>);
<a name="l133"></a>
<a name="l134"></a> </span><span class=cF1>return</span><span class=cF0> Dir2Html(</span><span class=cF6>&quot;::/&quot;</span><span class=cF0>, </span><span class=cF6>&quot;::/HTML/&quot;</span><span class=cF0>);
<a name="l135"></a>}
</span></pre></body>
</html>