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

527 lines
50 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> PsmNoteDel(PsmNote *tmpn)
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpn-&gt;word);
<a name="l4"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpn);
<a name="l5"></a>}
<a name="l6"></a>
<a name="l7"></a>PsmNote *PsmNoteCopy(PsmNote *tmpn)
<a name="l8"></a>{
<a name="l9"></a> PsmNote *tmpn1 = </span><span class=cF5>MAllocIdent</span><span class=cF0>(tmpn);
<a name="l10"></a>
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;word)
<a name="l12"></a> tmpn1-&gt;word = </span><span class=cF5>StrNew</span><span class=cF0>(tmpn-&gt;word);
<a name="l13"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l14"></a> tmpn1-&gt;word = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l15"></a>
<a name="l16"></a> </span><span class=cF1>return</span><span class=cF0> tmpn1;
<a name="l17"></a>}
<a name="l18"></a>
<a name="l19"></a></span><span class=cF1>U0</span><span class=cF0> PsmSongDel(PsmNote *head)
<a name="l20"></a>{
<a name="l21"></a> PsmNote *tmpn, *tmpn1;
<a name="l22"></a>
<a name="l23"></a> tmpn = head-&gt;next;
<a name="l24"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != head)
<a name="l25"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l26"></a> tmpn1 = tmpn-&gt;next;
<a name="l27"></a> PsmNoteDel(tmpn);
<a name="l28"></a> tmpn = tmpn1;
<a name="l29"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l30"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(head);
<a name="l31"></a>}
<a name="l32"></a>
<a name="l33"></a></span><span class=cF1>U0</span><span class=cF0> PsmCutToClip()
<a name="l34"></a>{
<a name="l35"></a> PsmNote *tmpn, *tmpn1;
<a name="l36"></a>
<a name="l37"></a> PsmSongDel(&amp;psm.clip);
<a name="l38"></a> tmpn = psm.head.next;
<a name="l39"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != &amp;psm.head)
<a name="l40"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l41"></a> tmpn1 = tmpn-&gt;next;
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;flags &amp; PSMF_SEL)
<a name="l43"></a> {
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (psm.cur_note == tmpn)
<a name="l45"></a> psm.cur_note = tmpn-&gt;next;
<a name="l46"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpn);
<a name="l47"></a> tmpn-&gt;flags &amp;= ~PSMF_SEL;
<a name="l48"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpn, psm.clip.last);
<a name="l49"></a> }
<a name="l50"></a> tmpn = tmpn1;
<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=cF1>U0</span><span class=cF0> PsmPasteClip()
<a name="l55"></a>{
<a name="l56"></a> PsmNote *tmpn, *tmpn1;
<a name="l57"></a>
<a name="l58"></a> tmpn = psm.clip.next;
<a name="l59"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != &amp;psm.clip)
<a name="l60"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l61"></a> tmpn1 = PsmNoteCopy(tmpn);
<a name="l62"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpn1, psm.cur_note-&gt;last);
<a name="l63"></a> tmpn = tmpn-&gt;next;
<a name="l64"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l65"></a>}
<a name="l66"></a>
<a name="l67"></a></span><span class=cF1>U0</span><span class=cF0> PsmCopyToClip()
<a name="l68"></a>{
<a name="l69"></a> PsmNote *tmpn, *tmpn1;
<a name="l70"></a>
<a name="l71"></a> PsmSongDel(&amp;psm.clip);
<a name="l72"></a> tmpn = psm.head.next;
<a name="l73"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != &amp;psm.head)
<a name="l74"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;flags &amp; PSMF_SEL)
<a name="l76"></a> {
<a name="l77"></a> tmpn-&gt;flags &amp;= ~PSMF_SEL;
<a name="l78"></a> tmpn1 = PsmNoteCopy(tmpn);
<a name="l79"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpn1, psm.clip.last);
<a name="l80"></a> }
<a name="l81"></a> tmpn = tmpn-&gt;next;
<a name="l82"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l83"></a>}
<a name="l84"></a>
<a name="l85"></a>PsmNote *PsmFindNote(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0>)
<a name="l86"></a>{
<a name="l87"></a> PsmNote *tmpn=psm.head.next;
<a name="l88"></a>
<a name="l89"></a> PsmRecalcNoteXY;
<a name="l90"></a> x += PSM_NOTE_SPACING / </span><span class=cFE>2</span><span class=cF0>;
<a name="l91"></a> </span><span class=cF1>while</span><span class=cF0> (x &gt; tmpn-&gt;next-&gt;x &amp;&amp; tmpn != &amp;psm.head)
<a name="l92"></a> tmpn = tmpn-&gt;next;
<a name="l93"></a>
<a name="l94"></a> </span><span class=cF1>return</span><span class=cF0> tmpn;
<a name="l95"></a>}
<a name="l96"></a>
<a name="l97"></a></span><span class=cF1>U8</span><span class=cF0> *PsmMusicSetOctave(</span><span class=cF1>U8</span><span class=cF0> *st, </span><span class=cF9>I64</span><span class=cF0> *psm_octave)
<a name="l98"></a>{
<a name="l99"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0> &lt;= *st &lt;= </span><span class=cF6>'9'</span><span class=cF0>)
<a name="l100"></a> *psm_octave = *st++ - </span><span class=cF6>'0'</span><span class=cF0>;
<a name="l101"></a>
<a name="l102"></a> </span><span class=cF1>return</span><span class=cF0> st;
<a name="l103"></a>}
<a name="l104"></a>
<a name="l105"></a></span><span class=cF1>U8</span><span class=cF0> *PsmMusicSetNoteLen(</span><span class=cF1>U8</span><span class=cF0> *st, </span><span class=cF1>F64</span><span class=cF0> *psm_duration)
<a name="l106"></a>{
<a name="l107"></a> </span><span class=cF1>Bool</span><span class=cF0> cont = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l108"></a>
<a name="l109"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l110"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l111"></a> </span><span class=cF1>switch</span><span class=cF0> (*st++)
<a name="l112"></a> {
<a name="l113"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'w'</span><span class=cF0>: *psm_duration = </span><span class=cFE>4</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l114"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'h'</span><span class=cF0>: *psm_duration = </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l115"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'q'</span><span class=cF0>: *psm_duration = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l116"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'e'</span><span class=cF0>: *psm_duration = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l117"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>: *psm_duration = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l118"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>: *psm_duration = </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * *psm_duration / </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l119"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'.'</span><span class=cF0>: *psm_duration = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * *psm_duration; </span><span class=cF1>break</span><span class=cF0>;
<a name="l120"></a>
<a name="l121"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l122"></a> st--;
<a name="l123"></a> cont = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l124"></a> }
<a name="l125"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l126"></a> </span><span class=cF1>while</span><span class=cF0> (cont);
<a name="l127"></a>
<a name="l128"></a> </span><span class=cF1>return</span><span class=cF0> st;
<a name="l129"></a>}
<a name="l130"></a>
<a name="l131"></a></span><span class=cF1>U0</span><span class=cF0> PsmLoadSongStr(</span><span class=cF1>U8</span><span class=cF0> *st, </span><span class=cF9>I64</span><span class=cF0> *psm_octave, </span><span class=cF1>F64</span><span class=cF0> *psm_duration)
<a name="l132"></a>{
<a name="l133"></a> PsmNote *tmpn, *tmpn1;
<a name="l134"></a> </span><span class=cF9>I64</span><span class=cF0> note, i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l135"></a>
<a name="l136"></a> </span><span class=cF1>while</span><span class=cF0> (*st)
<a name="l137"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l138"></a> tmpn = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PsmNote</span><span class=cF7>)</span><span class=cF0>);
<a name="l139"></a> </span><span class=cF1>while</span><span class=cF0> (*st &amp;&amp; !</span><span class=cF7>(</span><span class=cF6>'A'</span><span class=cF0> &lt;= *st &lt;= </span><span class=cF6>'G'</span><span class=cF7>)</span><span class=cF0> &amp;&amp; *st != </span><span class=cF6>'R'</span><span class=cF0>)
<a name="l140"></a> {
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (*st == </span><span class=cF6>'M'</span><span class=cF0>)
<a name="l142"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l143"></a> tmpn1 = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PsmNote</span><span class=cF7>)</span><span class=cF0>);
<a name="l144"></a> tmpn1-&gt;type = PSMT_METER;
<a name="l145"></a> st++;
<a name="l146"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'1'</span><span class=cF0> &lt;= *st &lt;= </span><span class=cF6>'9'</span><span class=cF0>)
<a name="l147"></a> tmpn1-&gt;meter_top = *st++ - </span><span class=cF6>'0'</span><span class=cF0>;
<a name="l148"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l149"></a> tmpn1-&gt;meter_top = </span><span class=cFE>4</span><span class=cF0>;
<a name="l150"></a> </span><span class=cF1>if</span><span class=cF0> (*st == </span><span class=cF6>'/'</span><span class=cF0>)
<a name="l151"></a> st++;
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'1'</span><span class=cF0> &lt;= *st &lt;= </span><span class=cF6>'9'</span><span class=cF0>)
<a name="l153"></a> tmpn1-&gt;meter_bottom = *st++ - </span><span class=cF6>'0'</span><span class=cF0>;
<a name="l154"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l155"></a> tmpn1-&gt;meter_bottom = </span><span class=cFE>4</span><span class=cF0>;
<a name="l156"></a> PsmSetWidth(tmpn1);
<a name="l157"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpn1, psm.head.last);
<a name="l158"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l159"></a> </span><span class=cF1>while</span><span class=cF0> (*st == </span><span class=cF6>'('</span><span class=cF0>)
<a name="l160"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l161"></a> </span><span class=cF5>Bts</span><span class=cF0>(&amp;tmpn-&gt;flags, PSMf_TIE);
<a name="l162"></a> st++;
<a name="l163"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l164"></a> st = PsmMusicSetOctave(st, psm_octave);
<a name="l165"></a> st = PsmMusicSetNoteLen(st, psm_duration);
<a name="l166"></a> }
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (!*st)
<a name="l168"></a> {
<a name="l169"></a> PsmNoteDel(tmpn);
<a name="l170"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l171"></a> }
<a name="l172"></a> note = *st++ - </span><span class=cF6>'A'</span><span class=cF0>;
<a name="l173"></a> </span><span class=cF1>if</span><span class=cF0> (note &lt; </span><span class=cFE>7</span><span class=cF0>)
<a name="l174"></a> {
<a name="l175"></a> note = </span><span class=cFB>music</span><span class=cF0>.note_map[note];
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (*st == </span><span class=cF6>'b'</span><span class=cF0>)
<a name="l177"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l178"></a> </span><span class=cF5>Bts</span><span class=cF0>(&amp;tmpn-&gt;flags, PSMf_FLAT);
<a name="l179"></a> note--;
<a name="l180"></a> st++;
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (note &lt; </span><span class=cFE>0</span><span class=cF0>) </span><span class=cF2>//Ab</span><span class=cF0>
<a name="l182"></a> note = </span><span class=cFE>11</span><span class=cF0>;
<a name="l183"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (note == </span><span class=cFE>2</span><span class=cF0>) </span><span class=cF2>//Cb</span><span class=cF0>
<a name="l184"></a> *psm_octave -= </span><span class=cFE>1</span><span class=cF0>;
<a name="l185"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l186"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*st == </span><span class=cF6>'#'</span><span class=cF0>)
<a name="l187"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l188"></a> </span><span class=cF5>Bts</span><span class=cF0>(&amp;tmpn-&gt;flags, PSMf_SHARP);
<a name="l189"></a> note++;
<a name="l190"></a> st++;
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (note &gt; </span><span class=cFE>11</span><span class=cF0>) </span><span class=cF2>//G#</span><span class=cF0>
<a name="l192"></a> note = </span><span class=cFE>0</span><span class=cF0>;
<a name="l193"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (note == </span><span class=cFE>3</span><span class=cF0>) </span><span class=cF2>//B#</span><span class=cF0>
<a name="l194"></a> *psm_octave += </span><span class=cFE>1</span><span class=cF0>;
<a name="l195"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l196"></a> tmpn-&gt;ona = </span><span class=cF5>Note2Ona</span><span class=cF0>(note, *psm_octave);
<a name="l197"></a> }
<a name="l198"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l199"></a> tmpn-&gt;ona = </span><span class=cFE>0</span><span class=cF0>;
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= </span><span class=cFE>2</span><span class=cF0>*.</span><span class=cFE>25</span><span class=cF0> / </span><span class=cFE>3</span><span class=cF0>)
<a name="l201"></a> i = </span><span class=cFE>0</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> (*psm_duration &lt;= .</span><span class=cFE>25</span><span class=cF0>)
<a name="l203"></a> i = </span><span class=cFE>1</span><span class=cF0>;
<a name="l204"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= </span><span class=cFE>2</span><span class=cF0> * .</span><span class=cFE>5</span><span class=cF0> / </span><span class=cFE>3</span><span class=cF0>)
<a name="l205"></a> i = </span><span class=cFE>2</span><span class=cF0>;
<a name="l206"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= .</span><span class=cFE>5</span><span class=cF0>)
<a name="l207"></a> i = </span><span class=cFE>3</span><span class=cF0>;
<a name="l208"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / </span><span class=cFE>3</span><span class=cF0>)
<a name="l209"></a> i = </span><span class=cFE>4</span><span class=cF0>;
<a name="l210"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= .</span><span class=cFE>5</span><span class=cF0> * </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>)
<a name="l211"></a> i = </span><span class=cFE>5</span><span class=cF0>;
<a name="l212"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
<a name="l213"></a> i = </span><span class=cFE>6</span><span class=cF0>;
<a name="l214"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>)
<a name="l215"></a> i = </span><span class=cFE>7</span><span class=cF0>;
<a name="l216"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
<a name="l217"></a> i = </span><span class=cFE>8</span><span class=cF0>;
<a name="l218"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*psm_duration &lt;= </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
<a name="l219"></a> i = </span><span class=cFE>9</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> (*psm_duration &lt;= </span><span class=cFE>4</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
<a name="l221"></a> i = </span><span class=cFE>10</span><span class=cF0>;
<a name="l222"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l223"></a> i = </span><span class=cFE>11</span><span class=cF0>;
<a name="l224"></a> tmpn-&gt;duration = i;
<a name="l225"></a> tmpn-&gt;type = PSMT_NOTE;
<a name="l226"></a> PsmSetWidth(tmpn);
<a name="l227"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpn, psm.cur_note-&gt;last);
<a name="l228"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l229"></a>}
<a name="l230"></a>
<a name="l231"></a></span><span class=cF1>U0</span><span class=cF0> PsmLoadSong(</span><span class=cF1>U8</span><span class=cF0> *filename, </span><span class=cF9>I64</span><span class=cF0> *psm_octave, </span><span class=cF1>F64</span><span class=cF0> *psm_duration)
<a name="l232"></a>{
<a name="l233"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l234"></a> PsmNote *tmpn;
<a name="l235"></a> </span><span class=cF9>CCompCtrl</span><span class=cF0> *cc = </span><span class=cF5>CompCtrlNew</span><span class=cF0>(</span><span class=cF5>MStrPrint</span><span class=cF7>(</span><span class=cF6>&quot;#include \&quot;%s\&quot;&quot;</span><span class=cF0>, filename</span><span class=cF7>)</span><span class=cF0>);
<a name="l236"></a>
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileOcc</span><span class=cF7>(</span><span class=cF6>&quot;incomplete&quot;</span><span class=cF0>, filename, </span><span class=cF6>&quot;&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l238"></a> psm.incomplete_entry-&gt;checked = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l239"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l240"></a> psm.incomplete_entry-&gt;checked = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l241"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>)
<a name="l242"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l243"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l244"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>cc-&gt;cur_str, </span><span class=cF6>&quot;Play&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l245"></a> {
<a name="l246"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'('</span><span class=cF0>)
<a name="l247"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_STR</span><span class=cF0>)
<a name="l248"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l249"></a> tmpn = psm.head.last;
<a name="l250"></a> st = </span><span class=cF5>LexExtStr</span><span class=cF0>(cc);
<a name="l251"></a> PsmLoadSongStr(st, psm_octave, psm_duration);
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF6>','</span><span class=cF0>)
<a name="l253"></a> {
<a name="l254"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_STR</span><span class=cF0>)
<a name="l255"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l256"></a> st = </span><span class=cF5>LexExtStr</span><span class=cF0>(cc);
<a name="l257"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l258"></a> {
<a name="l259"></a> </span><span class=cF1>do</span><span class=cF0> tmpn = tmpn-&gt;next;
<a name="l260"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != &amp;psm.head &amp;&amp; tmpn-&gt;type == PSMT_METER);
<a name="l261"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn != &amp;psm.head)
<a name="l262"></a> tmpn-&gt;word = </span><span class=cF5>StrNew</span><span class=cF0>(st);
<a name="l263"></a> st += </span><span class=cF5>StrLen</span><span class=cF0>(st) + </span><span class=cFE>1</span><span class=cF0>;
<a name="l264"></a> }
<a name="l265"></a> </span><span class=cF1>while</span><span class=cF0> (*st);
<a name="l266"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l267"></a> }
<a name="l268"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l269"></a> }
<a name="l270"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>cc-&gt;cur_str, </span><span class=cF6>&quot;music&quot;</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'.'</span><span class=cF0> &amp;&amp; </span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l271"></a> {
<a name="l272"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>cc-&gt;cur_str, </span><span class=cF6>&quot;tempo&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l273"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l274"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'='</span><span class=cF0> &amp;&amp; </span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_F64</span><span class=cF0>)
<a name="l275"></a> {
<a name="l276"></a> </span><span class=cFB>music</span><span class=cF0>.tempo = cc-&gt;cur_f64 - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0005</span><span class=cF0>;
<a name="l277"></a> tempo_state.tempo = </span><span class=cF5>Round</span><span class=cF0>(TEMPO_RANGE * </span><span class=cF7>(</span><span class=cFB>music</span><span class=cF0>.tempo - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>.</span><span class=cFE>4</span><span class=cF0>);
<a name="l278"></a> }
<a name="l279"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l280"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>cc-&gt;cur_str, </span><span class=cF6>&quot;stacatto_factor&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l281"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l282"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'='</span><span class=cF0> &amp;&amp; </span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_F64</span><span class=cF0>)
<a name="l283"></a> {
<a name="l284"></a> </span><span class=cFB>music</span><span class=cF0>.stacatto_factor = cc-&gt;cur_f64 - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0005</span><span class=cF0>;
<a name="l285"></a> tempo_state.stacatto = </span><span class=cF5>Round</span><span class=cF0>(TEMPO_RANGE * </span><span class=cF7>(</span><span class=cFB>music</span><span class=cF0>.stacatto_factor - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>12</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>88</span><span class=cF0>);
<a name="l286"></a> }
<a name="l287"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l288"></a> }
<a name="l289"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l290"></a> </span><span class=cF5>CompCtrlDel</span><span class=cF0>(cc);
<a name="l291"></a>}
<a name="l292"></a>
<a name="l293"></a></span><span class=cF1>U8</span><span class=cF0> *PsmConvertSong()
<a name="l294"></a>{
<a name="l295"></a> PsmNote *tmpn;
<a name="l296"></a> </span><span class=cF1>U8</span><span class=cF0> *st, *src, *dst;
<a name="l297"></a> </span><span class=cF9>I64</span><span class=cF0> i, ona, note, octave, last_octave, last_duration;
<a name="l298"></a>
<a name="l299"></a> i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l300"></a> tmpn = psm.head.next;
<a name="l301"></a> last_octave = </span><span class=cF3>I64_MIN</span><span class=cF0>;
<a name="l302"></a> last_duration = -</span><span class=cFE>1</span><span class=cF0>;
<a name="l303"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != &amp;psm.head)
<a name="l304"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l305"></a> dst = &amp;tmpn-&gt;ascii;
<a name="l306"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type == PSMT_METER)
<a name="l307"></a> {
<a name="l308"></a> *dst++ = </span><span class=cF6>'M'</span><span class=cF0>;
<a name="l309"></a> *dst++ = tmpn-&gt;meter_top + </span><span class=cF6>'0'</span><span class=cF0>;
<a name="l310"></a> *dst++ = </span><span class=cF6>'/'</span><span class=cF0>;
<a name="l311"></a> *dst++ = tmpn-&gt;meter_bottom + </span><span class=cF6>'0'</span><span class=cF0>;
<a name="l312"></a> }
<a name="l313"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l314"></a> {
<a name="l315"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;ona)
<a name="l316"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l317"></a> ona = tmpn-&gt;ona;
<a name="l318"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags, PSMf_SHARP</span><span class=cF7>)</span><span class=cF0>)
<a name="l319"></a> ona--;
<a name="l320"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags, PSMf_FLAT</span><span class=cF7>)</span><span class=cF0>)
<a name="l321"></a> ona++;
<a name="l322"></a> octave = </span><span class=cF5>Ona2Octave</span><span class=cF0>(ona);
<a name="l323"></a> note = </span><span class=cF5>Ona2Note</span><span class=cF0> (ona);
<a name="l324"></a> note = </span><span class=cFB>music</span><span class=cF0>.note_map[*</span><span class=cF5>ListSub</span><span class=cF0>(note, psm_note_list) - </span><span class=cF6>'A'</span><span class=cF0>];
<a name="l325"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l326"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags, PSMf_TIE</span><span class=cF7>)</span><span class=cF0>)
<a name="l327"></a> *dst++ = </span><span class=cF6>'('</span><span class=cF0>;
<a name="l328"></a> </span><span class=cF1>if</span><span class=cF0> (octave != last_octave &amp;&amp; tmpn-&gt;ona)
<a name="l329"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l330"></a> *dst++ = octave + </span><span class=cF6>'0'</span><span class=cF0>;
<a name="l331"></a> last_octave = octave;
<a name="l332"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l333"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;duration != last_duration)
<a name="l334"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l335"></a> src = </span><span class=cF5>ListSub</span><span class=cF0>(tmpn-&gt;duration, psm_duration_list);
<a name="l336"></a> *dst++ = src[</span><span class=cFE>0</span><span class=cF0>];
<a name="l337"></a> </span><span class=cF1>if</span><span class=cF0> (src[</span><span class=cFE>1</span><span class=cF0>])
<a name="l338"></a> *dst++ = src[</span><span class=cFE>1</span><span class=cF0>];
<a name="l339"></a> last_duration = tmpn-&gt;duration;
<a name="l340"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l341"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;ona)
<a name="l342"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l343"></a> src = </span><span class=cF5>ListSub</span><span class=cF0>(note, psm_note_list);
<a name="l344"></a> *dst++ = src[</span><span class=cFE>0</span><span class=cF0>];
<a name="l345"></a> </span><span class=cF1>if</span><span class=cF0> (src[</span><span class=cFE>1</span><span class=cF0>])
<a name="l346"></a> *dst++ = src[</span><span class=cFE>1</span><span class=cF0>];
<a name="l347"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags, PSMf_FLAT</span><span class=cF7>)</span><span class=cF0>)
<a name="l348"></a> *dst++ = </span><span class=cF6>'b'</span><span class=cF0>;
<a name="l349"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpn-&gt;flags, PSMf_SHARP</span><span class=cF7>)</span><span class=cF0>)
<a name="l350"></a> *dst++ = </span><span class=cF6>'#'</span><span class=cF0>;
<a name="l351"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l352"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l353"></a> *dst++ = </span><span class=cF6>'R'</span><span class=cF0>;
<a name="l354"></a> }
<a name="l355"></a> *dst++ = </span><span class=cFE>0</span><span class=cF0>;
<a name="l356"></a> i += </span><span class=cF5>StrLen</span><span class=cF0>(tmpn-&gt;ascii);
<a name="l357"></a> tmpn = tmpn-&gt;next;
<a name="l358"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l359"></a>
<a name="l360"></a> st = </span><span class=cF5>MAlloc</span><span class=cF0>(i + </span><span class=cFE>1</span><span class=cF0>);
<a name="l361"></a> dst = st;
<a name="l362"></a> tmpn = psm.head.next;
<a name="l363"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != &amp;psm.head)
<a name="l364"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l365"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(dst, tmpn-&gt;ascii);
<a name="l366"></a> dst += </span><span class=cF5>StrLen</span><span class=cF0>(tmpn-&gt;ascii);
<a name="l367"></a> tmpn = tmpn-&gt;next;
<a name="l368"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l369"></a> *dst++ = </span><span class=cFE>0</span><span class=cF0>;
<a name="l370"></a>
<a name="l371"></a> </span><span class=cF1>return</span><span class=cF0> st;
<a name="l372"></a>}
<a name="l373"></a>
<a name="l374"></a></span><span class=cF1>U8</span><span class=cF0> *PsmSaveSong(</span><span class=cF1>U8</span><span class=cF0> *dirname, </span><span class=cF1>U8</span><span class=cF0> *full_filename)
<a name="l375"></a>{
<a name="l376"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>(full_filename);
<a name="l377"></a> </span><span class=cF1>Bool</span><span class=cF0> has_words;
<a name="l378"></a> PsmNote *tmpn, *tmpn1;
<a name="l379"></a> </span><span class=cF1>F64</span><span class=cF0> measure_len = </span><span class=cFE>4</span><span class=cF0>, two_measure_left = </span><span class=cFE>2</span><span class=cF0> * measure_len;
<a name="l380"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
<a name="l381"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l382"></a>
<a name="l383"></a> </span><span class=cF5>Free</span><span class=cF0>(PsmConvertSong); </span><span class=cF2>//set tmpn-&gt;ascii;</span><span class=cF0>
<a name="l384"></a>
<a name="l385"></a> </span><span class=cFB>music</span><span class=cF0>.tempo = </span><span class=cFE>4</span><span class=cF0>.</span><span class=cFE>4</span><span class=cF0> * tempo_state.tempo / TEMPO_RANGE + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>;
<a name="l386"></a> </span><span class=cFB>music</span><span class=cF0>.stacatto_factor = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>88</span><span class=cF0> * tempo_state.stacatto / TEMPO_RANGE + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>12</span><span class=cF0>;
<a name="l387"></a>
<a name="l388"></a> has_words = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l389"></a> tmpn = psm.head.next;
<a name="l390"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != &amp;psm.head)
<a name="l391"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l392"></a> </span><span class=cF1>if</span><span class=cF0> (PsmHasWords</span><span class=cF7>(</span><span class=cF0>tmpn-&gt;word</span><span class=cF7>)</span><span class=cF0>)
<a name="l393"></a> has_words = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l394"></a> tmpn = tmpn-&gt;next;
<a name="l395"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l396"></a> </span><span class=cF1>if</span><span class=cF0> (psm.incomplete_entry-&gt;checked)
<a name="l397"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;//0 incomplete\n&quot;</span><span class=cF0>);
<a name="l398"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (has_words)
<a name="l399"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;//0 has words\n&quot;</span><span class=cF0>);
<a name="l400"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l401"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;//0 no nothing\n&quot;</span><span class=cF0>);
<a name="l402"></a>
<a name="l403"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,
<a name="l404"></a> </span><span class=cF6>&quot;U0 Song()\n&quot;</span><span class=cF0>
<a name="l405"></a> </span><span class=cF6>&quot;{\n&quot;</span><span class=cF0>
<a name="l406"></a> </span><span class=cF6>&quot;\tFs-&gt;task_end_cb=&amp;SoundTaskEndCB;\n&quot;</span><span class=cF0>
<a name="l407"></a> </span><span class=cF6>&quot;\tMusicSettingsReset;\n&quot;</span><span class=cF0>
<a name="l408"></a> </span><span class=cF6>&quot;\tmusic.tempo=%6.3f;\n&quot;</span><span class=cF0>
<a name="l409"></a> </span><span class=cF6>&quot;\tmusic.stacatto_factor=%6.3f;\n&quot;</span><span class=cF0>
<a name="l410"></a> </span><span class=cF6>&quot;\ttry {\n&quot;</span><span class=cF0>
<a name="l411"></a> </span><span class=cF6>&quot;\t\twhile (!KeyScan) {\n&quot;</span><span class=cF0>
<a name="l412"></a> </span><span class=cF6>&quot;\t\t\tPlay(\&quot;&quot;</span><span class=cF0>, </span><span class=cFB>music</span><span class=cF0>.tempo + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0005</span><span class=cF0>, </span><span class=cFB>music</span><span class=cF0>.stacatto_factor + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0005</span><span class=cF0>);
<a name="l413"></a>
<a name="l414"></a> tmpn = psm.head.next;
<a name="l415"></a> tmpn1 = tmpn;
<a name="l416"></a> has_words = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l417"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn != &amp;psm.head)
<a name="l418"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l419"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, tmpn-&gt;ascii);
<a name="l420"></a> </span><span class=cF1>if</span><span class=cF0> (PsmHasWords</span><span class=cF7>(</span><span class=cF0>tmpn-&gt;word</span><span class=cF7>)</span><span class=cF0>)
<a name="l421"></a> has_words = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l422"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn-&gt;type == PSMT_METER)
<a name="l423"></a> {
<a name="l424"></a> measure_len = tmpn-&gt;meter_top * </span><span class=cFE>4</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / tmpn-&gt;meter_bottom;
<a name="l425"></a> two_measure_left = </span><span class=cFE>0</span><span class=cF0>;
<a name="l426"></a> }
<a name="l427"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l428"></a> two_measure_left -= psm_durations[tmpn-&gt;duration];
<a name="l429"></a> tmpn = tmpn-&gt;next;
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (two_measure_left &lt; </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>001</span><span class=cF0> &amp;&amp; tmpn != &amp;psm.head)
<a name="l431"></a> {
<a name="l432"></a> </span><span class=cF1>if</span><span class=cF0> (has_words)
<a name="l433"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l434"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;\&quot;,\n\t\t\&quot;&quot;</span><span class=cF0>);
<a name="l435"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn1 != tmpn)
<a name="l436"></a> {
<a name="l437"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn1-&gt;type != PSMT_METER)
<a name="l438"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l439"></a> </span><span class=cF1>if</span><span class=cF0> (ptr=tmpn1-&gt;word)
<a name="l440"></a> {
<a name="l441"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *ptr)
<a name="l442"></a> ptr++;
<a name="l443"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%Q\\0&quot;</span><span class=cF0>, tmpn1-&gt;word);
<a name="l444"></a> }
<a name="l445"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l446"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot; \\0&quot;</span><span class=cF0>);
<a name="l447"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l448"></a> tmpn1 = tmpn1-&gt;next;
<a name="l449"></a> }
<a name="l450"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l451"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,
<a name="l452"></a> </span><span class=cF6>&quot;\&quot;);\n&quot;</span><span class=cF0>
<a name="l453"></a> </span><span class=cF6>&quot;\tPlay(\&quot;&quot;</span><span class=cF0>);
<a name="l454"></a> two_measure_left = </span><span class=cFE>2</span><span class=cF0> * measure_len;
<a name="l455"></a> tmpn1 = tmpn;
<a name="l456"></a> has_words = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l457"></a> }
<a name="l458"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l459"></a> </span><span class=cF1>if</span><span class=cF0> (has_words)
<a name="l460"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l461"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;\&quot;,\n\t\t\&quot;&quot;</span><span class=cF0>);
<a name="l462"></a> </span><span class=cF1>while</span><span class=cF0> (tmpn1 != tmpn)
<a name="l463"></a> {
<a name="l464"></a> </span><span class=cF1>if</span><span class=cF0> (tmpn1-&gt;type != PSMT_METER)
<a name="l465"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l466"></a> </span><span class=cF1>if</span><span class=cF0> (ptr = tmpn1-&gt;word)
<a name="l467"></a> {
<a name="l468"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *ptr)
<a name="l469"></a> ptr++;
<a name="l470"></a>
<a name="l471"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%Q\\0&quot;</span><span class=cF0>, tmpn1-&gt;word);
<a name="l472"></a> }
<a name="l473"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l474"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot; \\0&quot;</span><span class=cF0>);
<a name="l475"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l476"></a> tmpn1 = tmpn1-&gt;next;
<a name="l477"></a> }
<a name="l478"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l479"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,
<a name="l480"></a> </span><span class=cF6>&quot;\&quot;);\n&quot;</span><span class=cF0>
<a name="l481"></a> </span><span class=cF6>&quot;\t\t}\n&quot;</span><span class=cF0>
<a name="l482"></a> </span><span class=cF6>&quot;\t} catch\n&quot;</span><span class=cF0>
<a name="l483"></a> </span><span class=cF6>&quot;\t\tPutExcept;\n&quot;</span><span class=cF0>
<a name="l484"></a> </span><span class=cF6>&quot;\tSound;\n&quot;</span><span class=cF0>
<a name="l485"></a> </span><span class=cF6>&quot;}\n&quot;</span><span class=cF0>
<a name="l486"></a> </span><span class=cF6>&quot;\n&quot;</span><span class=cF0>
<a name="l487"></a> </span><span class=cF6>&quot;Song;\n&quot;</span><span class=cF0>);
<a name="l488"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc);
<a name="l489"></a> </span><span class=cF1>if</span><span class=cF0> (full_filename)
<a name="l490"></a> </span><span class=cF5>Free</span><span class=cF0>(full_filename);
<a name="l491"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l492"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(doc-&gt;filename.name, </span><span class=cF6>&quot;%s/Tmp.ZC&quot;</span><span class=cF0>, dirname);
<a name="l493"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l494"></a> full_filename = </span><span class=cF5>StrNew</span><span class=cF0>(doc-&gt;filename.name);
<a name="l495"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l496"></a>
<a name="l497"></a> </span><span class=cF1>return</span><span class=cF0> full_filename;
<a name="l498"></a>}
</span></pre></body>
</html>