mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
dbf8647d59
Added top & right borders to RawDr. Improved spacing in some debug and compiler reporting. Fixed RawPutChar and EdLite tab width. Fixed Ui missing '0x' prefix syntax highlighter bug. Added 32BitPaint demo.
148 lines
14 KiB
HTML
Executable file
148 lines
14 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.08">
|
|
<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=cF1>U8</span><span class=cF0> *</span><span class=cF5>FileRead</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename, </span><span class=cF9>I64</span><span class=cF0> *_size=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> *_attr=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l2"></a>{</span><span class=cF2>//Read whole file from disk.</span><span class=cF0>
|
|
<a name="l3"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
|
|
<a name="l4"></a> </span><span class=cF1>U8</span><span class=cF0> *absname, *res = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l5"></a> </span><span class=cF9>I64</span><span class=cF0> size = </span><span class=cFE>0</span><span class=cF0>, attr = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l6"></a> </span><span class=cF9>CDirContext</span><span class=cF0> *dirc;
|
|
<a name="l7"></a>
|
|
<a name="l8"></a> absname = </span><span class=cF5>FileNameAbs</span><span class=cF0>(filename);
|
|
<a name="l9"></a> </span><span class=cF1>if</span><span class=cF0> (tmph = </span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>absname, </span><span class=cFB>sys_task</span><span class=cF0>->hash_table, </span><span class=cF3>HTT_FILE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l10"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l11"></a> size = tmph->user_data1;
|
|
<a name="l12"></a> res = </span><span class=cF5>MAlloc</span><span class=cF0>(size + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l13"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(res, tmph->user_data0, size);
|
|
<a name="l14"></a> res[size] = </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>//Terminate</span><span class=cF0>
|
|
<a name="l15"></a> attr = </span><span class=cF5>FileAttr</span><span class=cF0>(tmph->str, attr);
|
|
<a name="l16"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l17"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (dirc = </span><span class=cF5>DirContextNew</span><span class=cF7>(</span><span class=cF0>absname</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l20"></a> {
|
|
<a name="l21"></a> </span><span class=cF1>switch</span><span class=cF0> (dirc->drive->fs_type)
|
|
<a name="l22"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l23"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l24"></a> res = </span><span class=cFD>RedSeaFileRead</span><span class=cF0>(dirc->drive, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir, dirc->mask, &size, &attr);
|
|
<a name="l25"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l26"></a>
|
|
<a name="l27"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l28"></a> res = </span><span class=cFD>FAT32FileRead</span><span class=cF0>(dirc->drive, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir, dirc->mask, &size, &attr);
|
|
<a name="l29"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l30"></a>
|
|
<a name="l31"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l32"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File System Not Supported\n"</span><span class=cF0>);
|
|
<a name="l33"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l34"></a> </span><span class=cF5>DirContextDel</span><span class=cF0>(dirc);
|
|
<a name="l35"></a> }
|
|
<a name="l36"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l37"></a>
|
|
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (!res)
|
|
<a name="l39"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (dirc = </span><span class=cF5>DirContextNew</span><span class=cF7>(</span><span class=cF0>absname</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l41"></a> {
|
|
<a name="l42"></a> </span><span class=cF1>while</span><span class=cF0> (!res && </span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir, </span><span class=cF6>"/"</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l43"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l44"></a> </span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF6>".."</span><span class=cF0>);
|
|
<a name="l45"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>->cur_dv->fs_type)
|
|
<a name="l46"></a> {
|
|
<a name="l47"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l48"></a> res = </span><span class=cFD>RedSeaFileRead</span><span class=cF0>(dirc->drive, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir, dirc->mask, &size, &attr);
|
|
<a name="l49"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l50"></a>
|
|
<a name="l51"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l52"></a> res = </span><span class=cFD>FAT32FileRead</span><span class=cF0>(dirc->drive, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir, dirc->mask, &size, &attr);
|
|
<a name="l53"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l54"></a>
|
|
<a name="l55"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l56"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File System Not Supported\n"</span><span class=cF0>);
|
|
<a name="l57"></a> }
|
|
<a name="l58"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l59"></a> </span><span class=cF5>DirContextDel</span><span class=cF0>(dirc);
|
|
<a name="l60"></a> }
|
|
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (!res)
|
|
<a name="l63"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File not found: \"%s\".\n"</span><span class=cF0>, filename);
|
|
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (res && attr & </span><span class=cF3>RS_ATTR_RESIDENT</span><span class=cF0>)
|
|
<a name="l65"></a> </span><span class=cF5>HashGenericAdd</span><span class=cF0>(absname, </span><span class=cF3>HTT_FILE</span><span class=cF0>, </span><span class=cF5>SysMAllocIdent</span><span class=cF7>(</span><span class=cF0>res</span><span class=cF7>)</span><span class=cF0>, size, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>sys_task</span><span class=cF0>);
|
|
<a name="l66"></a>
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (_attr)
|
|
<a name="l68"></a> *_attr = attr;
|
|
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (_size)
|
|
<a name="l70"></a> *_size = size;
|
|
<a name="l71"></a> </span><span class=cF5>Free</span><span class=cF0>(absname);
|
|
<a name="l72"></a>
|
|
<a name="l73"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l74"></a>}
|
|
<a name="l75"></a>
|
|
<a name="l76"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>FileWrite</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename, </span><span class=cF1>U8</span><span class=cF0> *fbuf, </span><span class=cF9>I64</span><span class=cF0> size, </span><span class=cF9>CDate</span><span class=cF0> cdt=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> attr=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l77"></a>{</span><span class=cF2>//Write whole file to disk.</span><span class=cF0>
|
|
<a name="l78"></a> </span><span class=cF9>I64</span><span class=cF0> c = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l79"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
|
|
<a name="l80"></a> </span><span class=cF9>CDirContext</span><span class=cF0> *dirc;
|
|
<a name="l81"></a> </span><span class=cF1>U8</span><span class=cF0> *absname = </span><span class=cF5>FileNameAbs</span><span class=cF0>(filename);
|
|
<a name="l82"></a>
|
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (dirc = </span><span class=cF5>DirContextNew</span><span class=cF7>(</span><span class=cF0>filename, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l84"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l85"></a> attr = </span><span class=cF5>FileAttr</span><span class=cF0>(dirc->mask, attr);
|
|
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (!cdt)
|
|
<a name="l87"></a> cdt = </span><span class=cF5>Now</span><span class=cF0>;
|
|
<a name="l88"></a> </span><span class=cF1>switch</span><span class=cF0> (dirc->drive->fs_type)
|
|
<a name="l89"></a> {
|
|
<a name="l90"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l91"></a> c = </span><span class=cFD>RedSeaFileWrite</span><span class=cF0>(dirc->drive, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir, dirc->mask, fbuf, size, cdt, attr);
|
|
<a name="l92"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l93"></a>
|
|
<a name="l94"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l95"></a> c = </span><span class=cFD>FAT32FileWrite</span><span class=cF0>(dirc->drive, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir, dirc->mask, fbuf, size, cdt, attr);
|
|
<a name="l96"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l97"></a>
|
|
<a name="l98"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l99"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File System Not Supported\n"</span><span class=cF0>);
|
|
<a name="l100"></a> }
|
|
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (tmph = </span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>absname, </span><span class=cFB>sys_task</span><span class=cF0>->hash_table, </span><span class=cF3>HTT_FILE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l102"></a> {
|
|
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (attr & </span><span class=cF3>RS_ATTR_RESIDENT</span><span class=cF0>)
|
|
<a name="l104"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l105"></a> </span><span class=cF5>Free</span><span class=cF0>(tmph->user_data0);
|
|
<a name="l106"></a> tmph->user_data0 = </span><span class=cF5>SysMAllocIdent</span><span class=cF0>(fbuf);
|
|
<a name="l107"></a> tmph->user_data1 = size;
|
|
<a name="l108"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l109"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l110"></a> </span><span class=cF5>HashRemDel</span><span class=cF0>(tmph, </span><span class=cFB>sys_task</span><span class=cF0>->hash_table);
|
|
<a name="l111"></a> }
|
|
<a name="l112"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (attr & </span><span class=cF3>RS_ATTR_RESIDENT</span><span class=cF0>)
|
|
<a name="l113"></a> </span><span class=cF5>HashGenericAdd</span><span class=cF0>(absname, </span><span class=cF3>HTT_FILE</span><span class=cF0>, </span><span class=cF5>SysMAllocIdent</span><span class=cF7>(</span><span class=cF0>fbuf</span><span class=cF7>)</span><span class=cF0>, size, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>sys_task</span><span class=cF0>);
|
|
<a name="l114"></a> </span><span class=cF5>DirContextDel</span><span class=cF0>(dirc);
|
|
<a name="l115"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l116"></a> </span><span class=cF5>Free</span><span class=cF0>(absname);
|
|
<a name="l117"></a>
|
|
<a name="l118"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l119"></a>}
|
|
</span></pre></body>
|
|
</html>
|