ZealOS/docs/Apps/Psalmody/JukePuppet.ZC.html
2021-12-11 06:10:58 -05:00

134 lines
13 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.07">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> SongPuppet(</span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>I64</span><span class=cF0> passes)
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF9>CDebugInfo</span><span class=cF0> *debug_info;
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> i, </span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>end</span><span class=cF0>, rip, last_rip;
<a name="l5"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmpf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l6"></a>
<a name="l7"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>250</span><span class=cF0> &amp;&amp; </span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>; i++)
<a name="l8"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l9"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf = </span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF6>&quot;Song&quot;</span><span class=cF0>, task-&gt;hash_table, </span><span class=cF3>HTT_FUN</span><span class=cF7>)</span><span class=cF0>)
<a name="l10"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l11"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
<a name="l12"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf &amp;&amp; </span><span class=cF7>(</span><span class=cF0>debug_info = tmpf-&gt;debug_info</span><span class=cF7>)</span><span class=cF0>)
<a name="l14"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>start</span><span class=cF0> = debug_info-&gt;body[</span><span class=cFE>0</span><span class=cF0>];
<a name="l16"></a> </span><span class=cF1>end</span><span class=cF0> = debug_info-&gt;body[debug_info-&gt;max_line + </span><span class=cFE>1</span><span class=cF0> - debug_info-&gt;min_line];
<a name="l17"></a> last_rip = </span><span class=cFE>0</span><span class=cF0>;
<a name="l18"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l19"></a> {
<a name="l20"></a> i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l21"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>rip = </span><span class=cF5>TaskCaller</span><span class=cF0>(task, i++)</span><span class=cF7>)</span><span class=cF0>)
<a name="l22"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0> &lt;= rip &lt; </span><span class=cF1>end</span><span class=cF0>) {
<a name="l24"></a> </span><span class=cF1>if</span><span class=cF0> (rip &lt; last_rip &amp;&amp; --passes &lt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l25"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l26"></a> last_rip = rip;
<a name="l27"></a> }
<a name="l28"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l29"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
<a name="l30"></a> }
<a name="l31"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l32"></a>}
<a name="l33"></a>
<a name="l34"></a></span><span class=cF1>U0</span><span class=cF0> JukeSongPuppet(</span><span class=cF9>CTask</span><span class=cF0> *juke_task, </span><span class=cF9>I64</span><span class=cF0> passes, </span><span class=cF9>I64</span><span class=cF0> song_num, </span><span class=cF1>U8</span><span class=cF0> *name)
<a name="l35"></a>{
<a name="l36"></a> </span><span class=cF1>Bool</span><span class=cF0> found;
<a name="l37"></a> </span><span class=cF9>CTask</span><span class=cF0> *task;
<a name="l38"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l39"></a>
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileExtDot</span><span class=cF7>(</span><span class=cF0>name</span><span class=cF7>)</span><span class=cF0>)
<a name="l41"></a> </span><span class=cF5>FileExtRemove</span><span class=cF0>(name);
<a name="l42"></a> </span><span class=cF5>BirthWait</span><span class=cF0>(&amp;juke_task-&gt;popup_task);
<a name="l43"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l44"></a> </span><span class=cF5>MessagePost</span><span class=cF0>(juke_task-&gt;popup_task, </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0> + </span><span class=cF3>SCF_CTRL</span><span class=cF0>);
<a name="l45"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l46"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; song_num; i++)
<a name="l47"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l48"></a> </span><span class=cF5>MessagePost</span><span class=cF0>(juke_task-&gt;popup_task, </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>);
<a name="l49"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l50"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l51"></a>
<a name="l52"></a> </span><span class=cF5>MessagePost</span><span class=cF0>(juke_task-&gt;popup_task, </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>, </span><span class=cF3>CH_SPACE</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l53"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l54"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>500</span><span class=cF0>);
<a name="l55"></a>
<a name="l56"></a> found = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l57"></a> task = </span><span class=cF5>Fs</span><span class=cF0>-&gt;next_task;
<a name="l58"></a> </span><span class=cF1>while</span><span class=cF0> (task != </span><span class=cF5>Fs</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>task-&gt;task_title, name</span><span class=cF7>)</span><span class=cF0>)
<a name="l60"></a> {
<a name="l61"></a> found = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l62"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l63"></a> }
<a name="l64"></a> task = task-&gt;next_task;
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l66"></a>
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (found)
<a name="l68"></a> </span><span class=cF7>{</span><span class=cF2>//Position cursor on song title during song</span><span class=cF0>
<a name="l69"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l70"></a> </span><span class=cF5>MessagePost</span><span class=cF0>(juke_task-&gt;popup_task, </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0> + </span><span class=cF3>SCF_CTRL</span><span class=cF0>);
<a name="l71"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l72"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; song_num; i++)
<a name="l73"></a> {
<a name="l74"></a> </span><span class=cF5>MessagePost</span><span class=cF0>(juke_task-&gt;popup_task, </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>);
<a name="l75"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l76"></a> }
<a name="l77"></a> SongPuppet(task, passes);
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l79"></a> </span><span class=cF5>Kill</span><span class=cF0>(task);
<a name="l80"></a>}
<a name="l81"></a>
<a name="l82"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> JukeSongsPuppet(</span><span class=cF1>U8</span><span class=cF0> *dirname=</span><span class=cF6>&quot;~/Psalmody&quot;</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> passes=</span><span class=cFE>2</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> start_song=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> end_song=</span><span class=cF3>I64_MAX</span><span class=cF0>)
<a name="l83"></a>{</span><span class=cF2>//Help make music video by puppeting JukeBox task.</span><span class=cF0>
<a name="l84"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l85"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde, *tmpde1;
<a name="l86"></a> </span><span class=cF9>CTask</span><span class=cF0> *juke_task = </span><span class=cF5>User</span><span class=cF0>(</span><span class=cF6>&quot;JukeBox(0x%X);\n&quot;</span><span class=cF0>, dirname);
<a name="l87"></a> </span><span class=cF1>F64</span><span class=cF0> t0;
<a name="l88"></a>
<a name="l89"></a> </span><span class=cF5>Cd</span><span class=cF0>(dirname);
<a name="l90"></a> tmpde1 = </span><span class=cF5>FilesFind</span><span class=cF0>(</span><span class=cF6>&quot;*&quot;</span><span class=cF0>, </span><span class=cF3>FUF_RECURSE</span><span class=cF0> | </span><span class=cF3>FUF_JUST_TXT</span><span class=cF0> | </span><span class=cF3>FUF_JUST_FILES</span><span class=cF0>);
<a name="l91"></a> </span><span class=cF1>for</span><span class=cF0> (tmpde = tmpde1, i = </span><span class=cFE>0</span><span class=cF0>; tmpde &amp;&amp; i &lt; start_song; i++)
<a name="l92"></a> tmpde = tmpde-&gt;next;
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>screencast</span><span class=cF0>.record)
<a name="l94"></a> t0 = </span><span class=cFB>screencast</span><span class=cF0>.t0_tS;
<a name="l95"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l96"></a> t0 = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l97"></a> </span><span class=cF1>for</span><span class=cF0> (i = start_song; tmpde &amp;&amp; i &lt; end_song; i++)
<a name="l98"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l99"></a> </span><span class=cF6>&quot;%12.6fs %s\n&quot;</span><span class=cF0>, </span><span class=cF5>tS</span><span class=cF0> - t0, tmpde-&gt;full_name;
<a name="l100"></a> JukeSongPuppet(juke_task, passes, i, tmpde-&gt;name);
<a name="l101"></a> tmpde = tmpde-&gt;next;
<a name="l102"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l103"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
<a name="l104"></a> </span><span class=cF5>Kill</span><span class=cF0>(juke_task);
<a name="l105"></a>}
</span></pre></body>
</html>