534 lines
60 KiB
Plaintext
534 lines
60 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="generator" content="TempleOS V5.03">
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
<link rel="stylesheet" href="/style/templeos.css">
|
||
|
<script src="/script/templeos.js"></script>
|
||
|
<style type="text/css">
|
||
|
.cF0{color:#000000;background-color:#ffffff;}
|
||
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
||
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
||
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
||
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
||
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
||
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
||
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
||
|
.cF8{color:#555555;background-color:#ffffff;}
|
||
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
||
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
||
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
||
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
||
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
||
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
||
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre id="content">
|
||
|
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>JobDel</span><span class=cF0>(</span><span class=cF9>CJob</span><span class=cF0> *tmpc)
|
||
|
<a name="l2"></a>{</span><span class=cF2>//Free one cmd node.</span><span class=cF0>
|
||
|
<a name="l3"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpc->aux_str);
|
||
|
<a name="l4"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpc);
|
||
|
<a name="l5"></a>}
|
||
|
<a name="l6"></a>
|
||
|
<a name="l7"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>JobQueDel</span><span class=cF0>(</span><span class=cF9>CJob</span><span class=cF0> *head)
|
||
|
<a name="l8"></a>{
|
||
|
<a name="l9"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpc=head->next,*tmpc1;
|
||
|
<a name="l10"></a> </span><span class=cF1>while</span><span class=cF0> (tmpc!=head) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l11"></a> tmpc1=tmpc->next;
|
||
|
<a name="l12"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpc);
|
||
|
<a name="l13"></a> </span><span class=cF5>JobDel</span><span class=cF0>(tmpc);
|
||
|
<a name="l14"></a> tmpc=tmpc1;
|
||
|
<a name="l15"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l16"></a>}
|
||
|
<a name="l17"></a>
|
||
|
<a name="l18"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>JobCtrlInit</span><span class=cF0>(</span><span class=cF9>CJobCtrl</span><span class=cF0> *ctrl)
|
||
|
<a name="l19"></a>{
|
||
|
<a name="l20"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&ctrl->next_waiting);
|
||
|
<a name="l21"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&ctrl->next_done);
|
||
|
<a name="l22"></a> ctrl->flags=0;
|
||
|
<a name="l23"></a>}
|
||
|
<a name="l24"></a>
|
||
|
<a name="l25"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>TaskRstAwaitingMsg</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l26"></a>{</span><span class=cF2>//Pop-ups get parent messages so wake-up our pop-ups if we got a msg.</span><span class=cF0>
|
||
|
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
||
|
<a name="l28"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l29"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l30"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l31"></a> </span><span class=cF1>if</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>)
|
||
|
<a name="l32"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_AWAITING_MSG</span><span class=cF0>);
|
||
|
<a name="l33"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l34"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l35"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (task=task->popup_task);
|
||
|
<a name="l36"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l37"></a>}
|
||
|
<a name="l38"></a>
|
||
|
<a name="l39"></a></span><span class=cF9>CJob</span><span class=cF0> *</span><span class=cF5>TaskExe</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *srv,</span><span class=cF9>CTask</span><span class=cF0> *master,</span><span class=cF1>U8</span><span class=cF0> *data,</span><span class=cF9>I64</span><span class=cF0> flags)
|
||
|
<a name="l40"></a>{</span><span class=cF2>//Queues a request to compile and execute src code text.</span><span class=cF0>
|
||
|
<a name="l41"></a> </span><span class=cF9>CJob</span><span class=cF0> *res;
|
||
|
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (!data || !</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>srv</span><span class=cF7>)</span><span class=cF0> || master && !</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>master</span><span class=cF7>)</span><span class=cF0> ||
|
||
|
<a name="l43"></a> srv->popup_task && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&srv->task_flags,</span><span class=cF3>TASKf_FILTER_INPUT</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l44"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l45"></a> res=</span><span class=cF5>ACAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CJob</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l46"></a> res->master_task=master;
|
||
|
<a name="l47"></a> res->job_code=</span><span class=cF3>JOBT_EXE_STR</span><span class=cF0>;
|
||
|
<a name="l48"></a> res->flags=flags;
|
||
|
<a name="l49"></a> res->aux_str=</span><span class=cF5>AStrNew</span><span class=cF0>(data);
|
||
|
<a name="l50"></a> res->ctrl=&srv->srv_ctrl;
|
||
|
<a name="l51"></a>
|
||
|
<a name="l52"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l53"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l54"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&srv->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l55"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>srv</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l57"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&srv->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l58"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l59"></a> </span><span class=cF5>JobDel</span><span class=cF0>(res);
|
||
|
<a name="l60"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l62"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&srv->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l63"></a> </span><span class=cF5>TaskRstAwaitingMsg</span><span class=cF0>(srv);
|
||
|
<a name="l64"></a> </span><span class=cF5>QueIns</span><span class=cF0>(res,srv->srv_ctrl.last_waiting);
|
||
|
<a name="l65"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&srv->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_WAKE_MASTER</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l67"></a> </span><span class=cF5>Suspend</span><span class=cF0>(master);
|
||
|
<a name="l68"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l69"></a> }
|
||
|
<a name="l70"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l71"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l72"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l73"></a>}
|
||
|
<a name="l74"></a>
|
||
|
<a name="l75"></a></span><span class=cF9>CJob</span><span class=cF0> *</span><span class=cF5>TaskText</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *srv,</span><span class=cF9>CTask</span><span class=cF0> *master,</span><span class=cF1>U8</span><span class=cF0> *data,</span><span class=cF9>I64</span><span class=cF0> flags)
|
||
|
<a name="l76"></a>{</span><span class=cF2>//Post StdIn text to servant task. Tell who the master task is.</span><span class=cF0>
|
||
|
<a name="l77"></a> </span><span class=cF9>CJob</span><span class=cF0> *res;
|
||
|
<a name="l78"></a> </span><span class=cF9>CTask</span><span class=cF0> *task;
|
||
|
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (!data || !</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>srv</span><span class=cF7>)</span><span class=cF0> || master && !</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>master</span><span class=cF7>)</span><span class=cF0> ||
|
||
|
<a name="l80"></a> srv->popup_task && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&srv->task_flags,</span><span class=cF3>TASKf_FILTER_INPUT</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l81"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l82"></a> res=</span><span class=cF5>ACAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CJob</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l83"></a> res->master_task=master; </span><span class=cF2>//in case somebody cares</span><span class=cF0>
|
||
|
<a name="l84"></a> res->job_code=</span><span class=cF3>JOBT_TEXT_INPUT</span><span class=cF0>;
|
||
|
<a name="l85"></a> res->flags=flags;
|
||
|
<a name="l86"></a> res->aux_str=</span><span class=cF5>AStrNew</span><span class=cF0>(data);
|
||
|
<a name="l87"></a>
|
||
|
<a name="l88"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l89"></a> task=srv->last_input_filter_task;
|
||
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_HIGHEST_PRIORITY</span><span class=cF7>)</span><span class=cF0> || task==srv) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (task!=srv)
|
||
|
<a name="l92"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(srv);
|
||
|
<a name="l93"></a> task=</span><span class=cF5>Spawn</span><span class=cF0>(&</span><span class=cF5>InputFilterTask</span><span class=cF0>,</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF6>"Input Filter"</span><span class=cF0>,,srv);
|
||
|
<a name="l94"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l95"></a> task->next_input_filter_task=srv->next_input_filter_task;
|
||
|
<a name="l96"></a> task->last_input_filter_task=srv;
|
||
|
<a name="l97"></a> srv->next_input_filter_task=task;
|
||
|
<a name="l98"></a> task->next_input_filter_task->last_input_filter_task=task;
|
||
|
<a name="l99"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l100"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l101"></a> task=srv->next_input_filter_task;
|
||
|
<a name="l102"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l103"></a> res->ctrl=&task->srv_ctrl;
|
||
|
<a name="l104"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l105"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l106"></a> </span><span class=cF1>if</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>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l107"></a> </span><span class=cF5>JobDel</span><span class=cF0>(res);
|
||
|
<a name="l108"></a> res=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l109"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l110"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l111"></a> </span><span class=cF5>TaskRstAwaitingMsg</span><span class=cF0>(task);
|
||
|
<a name="l112"></a> </span><span class=cF5>QueIns</span><span class=cF0>(res,task->srv_ctrl.last_waiting);
|
||
|
<a name="l113"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l114"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l115"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l116"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l117"></a>}
|
||
|
<a name="l118"></a>
|
||
|
<a name="l119"></a></span><span class=cF9>CJob</span><span class=cF0> *</span><span class=cF5>TaskMsg</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *_srv,</span><span class=cF9>CTask</span><span class=cF0> *master,
|
||
|
<a name="l120"></a> </span><span class=cF9>I64</span><span class=cF0> msg_code,</span><span class=cF9>I64</span><span class=cF0> arg1,</span><span class=cF9>I64</span><span class=cF0> arg2,</span><span class=cF9>I64</span><span class=cF0> flags)
|
||
|
<a name="l121"></a>{</span><span class=cF2>//Post message to servant task. Tell who the master task is.</span><span class=cF0>
|
||
|
<a name="l122"></a></span><span class=cF2>//See </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3129"><span class=cF4>flags</span></a><span class=cF2> and </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3175"><span class=cF4>msg_code</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l123"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpc1,*tmpc;
|
||
|
<a name="l124"></a> </span><span class=cF9>CTask</span><span class=cF0> *srv=_srv;
|
||
|
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>srv</span><span class=cF7>)</span><span class=cF0> || master && !</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>master</span><span class=cF7>)</span><span class=cF0>||
|
||
|
<a name="l126"></a> srv->popup_task && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&srv->task_flags,</span><span class=cF3>TASKf_FILTER_INPUT</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l127"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l128"></a> tmpc=</span><span class=cF5>ACAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CJob</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l129"></a> tmpc->master_task=master;
|
||
|
<a name="l130"></a> tmpc->job_code=</span><span class=cF3>JOBT_MSG</span><span class=cF0>;
|
||
|
<a name="l131"></a> tmpc->msg_code=</span><span class=cF5>AbsI64</span><span class=cF0>(msg_code); </span><span class=cF2>//negative means do a down and up</span><span class=cF0>
|
||
|
<a name="l132"></a> tmpc->aux1=arg1;
|
||
|
<a name="l133"></a> tmpc->aux2=arg2;
|
||
|
<a name="l134"></a> tmpc->flags=flags;
|
||
|
<a name="l135"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_RECORD_MACRO</span><span class=cF0>],0</span><span class=cF7>)</span><span class=cF0> &&
|
||
|
<a name="l137"></a> srv!=</span><span class=cFB>sys_macro_task</span><span class=cF0> && msg_code==</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l138"></a> tmpc1=</span><span class=cF5>AMAllocIdent</span><span class=cF0>(tmpc);
|
||
|
<a name="l139"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l140"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpc1,</span><span class=cFB>sys_macro_head</span><span class=cF0>.last);
|
||
|
<a name="l141"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l142"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l143"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&srv->task_flags,</span><span class=cF3>TASKf_FILTER_INPUT</span><span class=cF7>)</span><span class=cF0> &&
|
||
|
<a name="l144"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_DONT_FILTER</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l145"></a> srv=srv->next_input_filter_task;
|
||
|
<a name="l146"></a> tmpc->ctrl=&srv->srv_ctrl;
|
||
|
<a name="l147"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&srv->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l148"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>srv</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l150"></a> </span><span class=cF5>JobDel</span><span class=cF0>(tmpc);
|
||
|
<a name="l151"></a> tmpc=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l153"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&srv->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l154"></a> </span><span class=cF5>TaskRstAwaitingMsg</span><span class=cF0>(srv);
|
||
|
<a name="l155"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpc,srv->srv_ctrl.last_waiting);
|
||
|
<a name="l156"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&srv->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l157"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l158"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l159"></a> </span><span class=cF1>if</span><span class=cF0> (msg_code<0) </span><span class=cF2>//Down-Up</span><span class=cF0>
|
||
|
<a name="l160"></a> </span><span class=cF5>TaskMsg</span><span class=cF0>(_srv,master,-msg_code+1,arg1,arg2,flags);
|
||
|
<a name="l161"></a> </span><span class=cF1>return</span><span class=cF0> tmpc;
|
||
|
<a name="l162"></a>}
|
||
|
<a name="l163"></a>
|
||
|
<a name="l164"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>JobResScan</span><span class=cF0>(</span><span class=cF9>CJob</span><span class=cF0> *rqst=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> *_res=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l165"></a>{</span><span class=cF2>//Check rqst complete, return with or without.</span><span class=cF0>
|
||
|
<a name="l166"></a> </span><span class=cF9>CJobCtrl</span><span class=cF0> *ctrl;
|
||
|
<a name="l167"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpc,*tmpc1;
|
||
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (!rqst || </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&rqst->flags,</span><span class=cF3>JOBf_DONE</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (!rqst || rqst->master_task)
|
||
|
<a name="l170"></a> ctrl=&</span><span class=cF5>Fs</span><span class=cF0>->srv_ctrl;
|
||
|
<a name="l171"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l172"></a> ctrl=rqst->ctrl;
|
||
|
<a name="l173"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l174"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l175"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&ctrl->flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l176"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l177"></a> tmpc1=&ctrl->next_done;
|
||
|
<a name="l178"></a> tmpc=tmpc1->next;
|
||
|
<a name="l179"></a> </span><span class=cF1>while</span><span class=cF0> (tmpc!=tmpc1) {
|
||
|
<a name="l180"></a> </span><span class=cF1>if</span><span class=cF0> (!rqst || rqst==tmpc) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l181"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpc);
|
||
|
<a name="l182"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&ctrl->flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l183"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l184"></a> </span><span class=cF1>if</span><span class=cF0> (_res)
|
||
|
<a name="l185"></a> *_res=tmpc->res;
|
||
|
<a name="l186"></a> </span><span class=cF5>JobDel</span><span class=cF0>(tmpc);
|
||
|
<a name="l187"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l188"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l189"></a> tmpc=tmpc->next;
|
||
|
<a name="l190"></a> }
|
||
|
<a name="l191"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&ctrl->flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l192"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l193"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l194"></a> </span><span class=cF1>if</span><span class=cF0> (_res)
|
||
|
<a name="l195"></a> *_res=0;
|
||
|
<a name="l196"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l197"></a>}
|
||
|
<a name="l198"></a>
|
||
|
<a name="l199"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>JobResGet</span><span class=cF0>(</span><span class=cF9>CJob</span><span class=cF0> *rqst=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l200"></a>{</span><span class=cF2>//See </span><a href="/Wb/Demo/MultiCore/Lock.HC.HTML#l1"><span class=cF4>::/Demo/MultiCore/Lock.HC</span></a><span class=cF0>
|
||
|
<a name="l201"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
||
|
<a name="l202"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpc1;
|
||
|
<a name="l203"></a> </span><span class=cF1>if</span><span class=cF0> (!rqst) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l204"></a> tmpc1=&</span><span class=cF5>Fs</span><span class=cF0>->srv_ctrl.next_done;
|
||
|
<a name="l205"></a> </span><span class=cF1>while</span><span class=cF0> (tmpc1==tmpc1->next) {
|
||
|
<a name="l206"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l207"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l208"></a> }
|
||
|
<a name="l209"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l210"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&rqst->flags,</span><span class=cF3>JOBf_DONE</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l211"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l212"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l213"></a> }
|
||
|
<a name="l214"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l215"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l216"></a></span><span class=cF2>//Could get taken by someone else.</span><span class=cF0>
|
||
|
<a name="l217"></a> </span><span class=cF5>JobResScan</span><span class=cF0>(rqst,&res);
|
||
|
<a name="l218"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l219"></a>}
|
||
|
<a name="l220"></a>
|
||
|
<a name="l221"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>TaskWait</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> cmd_line_pmt=</span><span class=cF3>FALSE</span><span class=cF0>)
|
||
|
<a name="l222"></a>{</span><span class=cF2>//Wait for idle.</span><span class=cF0>
|
||
|
<a name="l223"></a> </span><span class=cF9>CTask</span><span class=cF0> *task1;
|
||
|
<a name="l224"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpc1;
|
||
|
<a name="l225"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
||
|
<a name="l226"></a> </span><span class=cF1>if</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>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l227"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l228"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l229"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
||
|
<a name="l230"></a> task1=task->last_input_filter_task;
|
||
|
<a name="l231"></a> tmpc1=&task1->srv_ctrl.next_waiting;
|
||
|
<a name="l232"></a> </span><span class=cF1>if</span><span class=cF0> (task1==</span><span class=cF5>Fs</span><span class=cF0> || !</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task1</span><span class=cF7>)</span><span class=cF0> ||
|
||
|
<a name="l233"></a> tmpc1==tmpc1->next && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&task1->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF7>)</span><span class=cF0> &&
|
||
|
<a name="l234"></a> </span><span class=cF7>(</span><span class=cF0>!cmd_line_pmt || </span><span class=cF5>Bt</span><span class=cF0>(&task1->task_flags,</span><span class=cF3>TASKf_CMD_LINE_PMT</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l235"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l236"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l237"></a> }
|
||
|
<a name="l238"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l239"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l240"></a>}
|
||
|
<a name="l241"></a>
|
||
|
<a name="l242"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>PostMsg</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF9>I64</span><span class=cF0> msg_code,</span><span class=cF9>I64</span><span class=cF0> arg1,</span><span class=cF9>I64</span><span class=cF0> arg2,</span><span class=cF9>I64</span><span class=cF0> flags=0)
|
||
|
<a name="l243"></a>{</span><span class=cF2>//Post message to a task and return immediately. See </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3175"><span class=cF4>msg_code</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l244"></a> </span><span class=cF1>if</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>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l245"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&task->task_flags,</span><span class=cF3>TASKf_INPUT_FILTER_TASK</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l246"></a> </span><span class=cF5>TaskMsg</span><span class=cF0>(task->last_input_filter_task,</span><span class=cF3>NULL</span><span class=cF0>,msg_code,arg1,arg2,
|
||
|
<a name="l247"></a> flags|1<<</span><span class=cF3>JOBf_DONT_FILTER</span><span class=cF0>);
|
||
|
<a name="l248"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l249"></a> </span><span class=cF5>TaskMsg</span><span class=cF0>(task,</span><span class=cF3>NULL</span><span class=cF0>,msg_code,arg1,arg2,flags);
|
||
|
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l251"></a>}
|
||
|
<a name="l252"></a>
|
||
|
<a name="l253"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>PostMsgWait</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF9>I64</span><span class=cF0> msg_code,</span><span class=cF9>I64</span><span class=cF0> arg1,</span><span class=cF9>I64</span><span class=cF0> arg2,</span><span class=cF9>I64</span><span class=cF0> flags=0)
|
||
|
<a name="l254"></a>{</span><span class=cF2>//Post message to a task and wait until task is idle.See </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3175"><span class=cF4>msg_code</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l255"></a> </span><span class=cF5>PostMsg</span><span class=cF0>(task,msg_code,arg1,arg2,flags);
|
||
|
<a name="l256"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(task);
|
||
|
<a name="l257"></a>}
|
||
|
<a name="l258"></a>
|
||
|
<a name="l259"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Msg</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> msg_code,</span><span class=cF9>I64</span><span class=cF0> arg1,</span><span class=cF9>I64</span><span class=cF0> arg2,</span><span class=cF9>I64</span><span class=cF0> flags=0)
|
||
|
<a name="l260"></a>{</span><span class=cF2>//Post message to current task and return immediately.</span><span class=cF0>
|
||
|
<a name="l261"></a></span><span class=cF2>//See </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3175"><span class=cF4>msg_code</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l262"></a> </span><span class=cF5>PostMsg</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>,msg_code,arg1,arg2,flags);
|
||
|
<a name="l263"></a>}
|
||
|
<a name="l264"></a>
|
||
|
<a name="l265"></a>#</span><span class=cF1>define</span><span class=cF0> JOB_DONE 0
|
||
|
<a name="l266"></a>#</span><span class=cF1>define</span><span class=cF0> JOB_CONT 1
|
||
|
<a name="l267"></a>#</span><span class=cF1>define</span><span class=cF0> JOB_EXIT 2
|
||
|
<a name="l268"></a>
|
||
|
<a name="l269"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>JobRunOne</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> run_flags,</span><span class=cF9>CJobCtrl</span><span class=cF0> *ctrl)
|
||
|
<a name="l270"></a>{</span><span class=cF2>//Called with ctrl->flags,JOBCf_LOCKED.</span><span class=cF0>
|
||
|
<a name="l271"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpc=ctrl->next_waiting;
|
||
|
<a name="l272"></a> </span><span class=cF9>CTask</span><span class=cF0> *master;
|
||
|
<a name="l273"></a> </span><span class=cF9>I64</span><span class=cF0> res,flags=tmpc->flags,old_flags=</span><span class=cF5>GetRFlags</span><span class=cF0>;
|
||
|
<a name="l274"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_EXIT_ON_COMPLETE</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l275"></a> res=JOB_EXIT;
|
||
|
<a name="l276"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l277"></a> res=JOB_CONT;
|
||
|
<a name="l278"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpc->job_code) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l279"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>JOBT_SPAWN_TASK</span><span class=cF0>:
|
||
|
<a name="l280"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpc);
|
||
|
<a name="l281"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpc->flags,</span><span class=cF3>JOBf_DISPATCHED</span><span class=cF0>);
|
||
|
<a name="l282"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&ctrl->flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->aux_str)
|
||
|
<a name="l284"></a> tmpc->spawned_task=</span><span class=cF5>Spawn</span><span class=cF0>(tmpc->addr,tmpc->fun_arg,
|
||
|
<a name="l285"></a> tmpc->aux_str,,tmpc->aux1,tmpc->aux2,tmpc->flags);
|
||
|
<a name="l286"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l287"></a> tmpc->spawned_task=</span><span class=cF5>Spawn</span><span class=cF0>(tmpc->addr,tmpc->fun_arg,
|
||
|
<a name="l288"></a> </span><span class=cF6>"Unnamed"</span><span class=cF0>,,tmpc->aux1,tmpc->aux2,tmpc->flags);
|
||
|
<a name="l289"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l290"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>JOBT_CALL</span><span class=cF0>:
|
||
|
<a name="l291"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpc);
|
||
|
<a name="l292"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpc->flags,</span><span class=cF3>JOBf_DISPATCHED</span><span class=cF0>);
|
||
|
<a name="l293"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&ctrl->flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l294"></a> </span><span class=cF5>SetRFlags</span><span class=cF0>(run_flags);
|
||
|
<a name="l295"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l296"></a> </span><span class=cF1>try</span><span class=cF0>
|
||
|
<a name="l297"></a> tmpc->res=(*tmpc->addr)(tmpc->fun_arg);
|
||
|
<a name="l298"></a> </span><span class=cF1>catch</span><span class=cF0>
|
||
|
<a name="l299"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l300"></a> </span><span class=cF5>SetRFlags</span><span class=cF0>(old_flags);
|
||
|
<a name="l301"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l302"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>JOBT_EXE_STR</span><span class=cF0>:
|
||
|
<a name="l303"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpc);
|
||
|
<a name="l304"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpc->flags,</span><span class=cF3>JOBf_DISPATCHED</span><span class=cF0>);
|
||
|
<a name="l305"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&ctrl->flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l306"></a> </span><span class=cF5>SetRFlags</span><span class=cF0>(run_flags);
|
||
|
<a name="l307"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l308"></a> </span><span class=cF1>try</span><span class=cF0>
|
||
|
<a name="l309"></a> tmpc->res=</span><span class=cF5>ExePrint</span><span class=cF0>(</span><span class=cF6>"%s"</span><span class=cF0>,tmpc->aux_str);
|
||
|
<a name="l310"></a> </span><span class=cF1>catch</span><span class=cF0>
|
||
|
<a name="l311"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l312"></a> </span><span class=cF5>SetRFlags</span><span class=cF0>(old_flags);
|
||
|
<a name="l313"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l314"></a> </span><span class=cF1>default</span><span class=cF0>:
|
||
|
<a name="l315"></a> res=JOB_DONE;
|
||
|
<a name="l316"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l317"></a> </span><span class=cF1>if</span><span class=cF0> (res) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l318"></a> </span><span class=cF1>if</span><span class=cF0> (master=tmpc->master_task) {
|
||
|
<a name="l319"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_FREE_ON_COMPLETE</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l320"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l321"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&master->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l322"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l323"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpc,master->srv_ctrl.last_done);
|
||
|
<a name="l324"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpc->flags,</span><span class=cF3>JOBf_DONE</span><span class=cF0>);
|
||
|
<a name="l325"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&master->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l326"></a> </span><span class=cF5>SetRFlags</span><span class=cF0>(old_flags);
|
||
|
<a name="l327"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l328"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_FOCUS_MASTER</span><span class=cF7>)</span><span class=cF0> &&
|
||
|
<a name="l329"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&master->win_inhibit,</span><span class=cF3>WIf_SELF_FOCUS</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l330"></a> </span><span class=cFB>sys_focus_task</span><span class=cF0>=master;
|
||
|
<a name="l331"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_WAKE_MASTER</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l332"></a> </span><span class=cF5>Suspend</span><span class=cF0>(master,</span><span class=cF3>FALSE</span><span class=cF0>);
|
||
|
<a name="l333"></a> }
|
||
|
<a name="l334"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_FREE_ON_COMPLETE</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l335"></a> </span><span class=cF5>JobDel</span><span class=cF0>(tmpc);
|
||
|
<a name="l336"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!master) {
|
||
|
<a name="l337"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l338"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&ctrl->flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l339"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l340"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpc,ctrl->last_done);
|
||
|
<a name="l341"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpc->flags,</span><span class=cF3>JOBf_DONE</span><span class=cF0>);
|
||
|
<a name="l342"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&ctrl->flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l343"></a> </span><span class=cF5>SetRFlags</span><span class=cF0>(old_flags);
|
||
|
<a name="l344"></a> }
|
||
|
<a name="l345"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l346"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l347"></a>}
|
||
|
<a name="l348"></a>
|
||
|
<a name="l349"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>JobsHndlr</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> run_flags,</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l350"></a>{</span><span class=cF2>//Handle all waiting cmds and return.</span><span class=cF0>
|
||
|
<a name="l351"></a> </span><span class=cF9>I64</span><span class=cF0> cnt=0,old_flags=</span><span class=cF5>GetRFlags</span><span class=cF0>;
|
||
|
<a name="l352"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
||
|
<a name="l353"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l354"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l355"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l356"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l357"></a> </span><span class=cF1>if</span><span class=cF0> (task->srv_ctrl.next_waiting!=&task->srv_ctrl)
|
||
|
<a name="l358"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cFD>JobRunOne</span><span class=cF7>(</span><span class=cF0>run_flags,&task->srv_ctrl</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l359"></a> </span><span class=cF1>case</span><span class=cF0> JOB_CONT:
|
||
|
<a name="l360"></a> cnt++;
|
||
|
<a name="l361"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l362"></a> </span><span class=cF1>case</span><span class=cF0> JOB_EXIT:
|
||
|
<a name="l363"></a> </span><span class=cF5>Exit</span><span class=cF0>;
|
||
|
<a name="l364"></a> </span><span class=cF1>case</span><span class=cF0> JOB_DONE:
|
||
|
<a name="l365"></a> </span><span class=cF1>goto</span><span class=cF0> jh_done;
|
||
|
<a name="l366"></a> }
|
||
|
<a name="l367"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l368"></a> </span><span class=cF1>goto</span><span class=cF0> jh_done;
|
||
|
<a name="l369"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l370"></a>jh_done:
|
||
|
<a name="l371"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l372"></a> </span><span class=cF5>SetRFlags</span><span class=cF0>(old_flags);
|
||
|
<a name="l373"></a> </span><span class=cF1>return</span><span class=cF0> cnt;
|
||
|
<a name="l374"></a>}
|
||
|
<a name="l375"></a>
|
||
|
<a name="l376"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PopUp</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf,</span><span class=cF9>CTask</span><span class=cF0> *parent=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF9>CTask</span><span class=cF0> **_pu_task=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l377"></a>{</span><span class=cF2>//Execute code in </span><a href="/Wb/Kernel/Job.HC.HTML#l376"><span class=cF4>PopUp</span></a><span class=cF2> task.</span><span class=cF0>
|
||
|
<a name="l378"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
||
|
<a name="l379"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpc;
|
||
|
<a name="l380"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF5>Spawn</span><span class=cF0>(&</span><span class=cF5>SrvCmdLine</span><span class=cF0>,</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF6>"Servant"</span><span class=cF0>,,parent);
|
||
|
<a name="l381"></a> </span><span class=cF1>if</span><span class=cF0> (!parent) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l382"></a> </span><span class=cF5>TaskExe</span><span class=cF0>(task,parent,buf,1<<</span><span class=cF3>JOBf_EXIT_ON_COMPLETE</span><span class=cF0>|1<<</span><span class=cF3>JOBf_FREE_ON_COMPLETE</span><span class=cF0>);
|
||
|
<a name="l383"></a> </span><span class=cF1>if</span><span class=cF0> (_pu_task) *_pu_task=task;
|
||
|
<a name="l384"></a> </span><span class=cF1>return</span><span class=cF0> 0;
|
||
|
<a name="l385"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l386"></a> </span><span class=cF5>Fs</span><span class=cF0>->popup_task=task;
|
||
|
<a name="l387"></a> tmpc=</span><span class=cF5>TaskExe</span><span class=cF0>(task,parent,buf,1<<</span><span class=cF3>JOBf_WAKE_MASTER</span><span class=cF0>|1<<</span><span class=cF3>JOBf_FOCUS_MASTER</span><span class=cF0>);
|
||
|
<a name="l388"></a> </span><span class=cF1>if</span><span class=cF0> (_pu_task) *_pu_task=task;
|
||
|
<a name="l389"></a> </span><span class=cF5>JobResScan</span><span class=cF0>(tmpc,&res);
|
||
|
<a name="l390"></a> </span><span class=cF5>Fs</span><span class=cF0>->popup_task=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l391"></a> </span><span class=cF5>Kill</span><span class=cF0>(task);
|
||
|
<a name="l392"></a> </span><span class=cF1>if</span><span class=cF0> (_pu_task) *_pu_task=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l393"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l394"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l395"></a>}
|
||
|
<a name="l396"></a>
|
||
|
<a name="l397"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PopUpPrint</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l398"></a>{</span><span class=cF2>//Execute code in </span><a href="/Wb/Kernel/Job.HC.HTML#l376"><span class=cF4>PopUp</span></a><span class=cF2> task.</span><span class=cF0>
|
||
|
<a name="l399"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l400"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
||
|
<a name="l401"></a> res=</span><span class=cF5>PopUp</span><span class=cF0>(buf,</span><span class=cF5>Fs</span><span class=cF0>);
|
||
|
<a name="l402"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l403"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l404"></a>}
|
||
|
<a name="l405"></a>
|
||
|
<a name="l406"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Adam</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l407"></a>{</span><span class=cF2>//Make adam_task execute code.</span><span class=cF0>
|
||
|
<a name="l408"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
||
|
<a name="l409"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l410"></a> </span><span class=cF9>CJob</span><span class=cF0> *tmpc;
|
||
|
<a name="l411"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>==</span><span class=cFB>adam_task</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l412"></a> tmpc=</span><span class=cF5>TaskExe</span><span class=cF0>(</span><span class=cFB>adam_task</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>,buf,0);
|
||
|
<a name="l413"></a> </span><span class=cF5>JobsHndlr</span><span class=cF0>(</span><span class=cF5>GetRFlags</span><span class=cF0>);
|
||
|
<a name="l414"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l415"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(</span><span class=cFB>adam_task</span><span class=cF0>);
|
||
|
<a name="l416"></a> tmpc=</span><span class=cF5>TaskExe</span><span class=cF0>(</span><span class=cFB>adam_task</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>,buf,1<<</span><span class=cF3>JOBf_WAKE_MASTER</span><span class=cF0>);
|
||
|
<a name="l417"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l418"></a> </span><span class=cF5>JobResScan</span><span class=cF0>(tmpc,&res);
|
||
|
<a name="l419"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l420"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l421"></a>}
|
||
|
<a name="l422"></a>
|
||
|
<a name="l423"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>AdamLog</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l424"></a>{</span><span class=cF2>//Display text in adam_task.</span><span class=cF0>
|
||
|
<a name="l425"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l426"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>==</span><span class=cFB>adam_task</span><span class=cF0>)
|
||
|
<a name="l427"></a> </span><span class=cF6>"%s"</span><span class=cF0>,buf;
|
||
|
<a name="l428"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsSingleUser</span><span class=cF0>)
|
||
|
<a name="l429"></a> </span><span class=cF5>Adam</span><span class=cF0>(</span><span class=cF6>"\"%%s\",%d;"</span><span class=cF0>,buf);
|
||
|
<a name="l430"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l431"></a>}
|
||
|
<a name="l432"></a>
|
||
|
<a name="l433"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>AdamErr</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l434"></a>{</span><span class=cF2>//Display red blinking Err text in adam_task.</span><span class=cF0>
|
||
|
<a name="l435"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv),
|
||
|
<a name="l436"></a> *st=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF3>ST_ERR_ST</span><span class=cF0> </span><span class=cF6>"%s"</span><span class=cF0>,buf);
|
||
|
<a name="l437"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>==</span><span class=cFB>adam_task</span><span class=cF0>)
|
||
|
<a name="l438"></a> </span><span class=cF6>"%s"</span><span class=cF0>,st;
|
||
|
<a name="l439"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsSingleUser</span><span class=cF0>)
|
||
|
<a name="l440"></a> </span><span class=cF5>Adam</span><span class=cF0>(</span><span class=cF6>"\"%%s\",%d;"</span><span class=cF0>,st);
|
||
|
<a name="l441"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||
|
<a name="l442"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l443"></a>}
|
||
|
<a name="l444"></a>
|
||
|
<a name="l445"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>XTalk</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l446"></a>{</span><span class=cF2>//Sends text to other task. See </span><a href="/Wb/Misc/OSTestSuite.HC.HTML#l1"><span class=cF4>::/Misc/OSTestSuite.HC</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l447"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv),*st=</span><span class=cF5>AStrNew</span><span class=cF0>(buf),
|
||
|
<a name="l448"></a> *st2=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"\"%%s\",%d;Free(%d);"</span><span class=cF0>,st,st);
|
||
|
<a name="l449"></a> </span><span class=cF5>TaskText</span><span class=cF0>(task,</span><span class=cF3>NULL</span><span class=cF0>,st2,0);
|
||
|
<a name="l450"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
|
||
|
<a name="l451"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l452"></a>}
|
||
|
<a name="l453"></a>
|
||
|
<a name="l454"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>XTalkWait</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l455"></a>{</span><span class=cF2>//Send text to other task and wait for it to idle.</span><span class=cF0>
|
||
|
<a name="l456"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv),*st=</span><span class=cF5>AStrNew</span><span class=cF0>(buf),
|
||
|
<a name="l457"></a> *st2=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"\"%%s\",%d;Free(%d);"</span><span class=cF0>,st,st);
|
||
|
<a name="l458"></a> </span><span class=cF5>TaskText</span><span class=cF0>(task,</span><span class=cF3>NULL</span><span class=cF0>,st2,0);
|
||
|
<a name="l459"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
|
||
|
<a name="l460"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l461"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(task);
|
||
|
<a name="l462"></a>}
|
||
|
<a name="l463"></a>
|
||
|
<a name="l464"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>InStr</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l465"></a>{</span><span class=cF2>//Send InFile code to self.</span><span class=cF0>
|
||
|
<a name="l466"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l467"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_INPUT_FILTER_TASK</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l468"></a> </span><span class=cF5>ExePrint</span><span class=cF0>(</span><span class=cF6>"%s"</span><span class=cF0>,buf);
|
||
|
<a name="l469"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l470"></a> </span><span class=cF5>TaskText</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>,</span><span class=cF3>NULL</span><span class=cF0>,buf,1<<</span><span class=cF3>JOBf_HIGHEST_PRIORITY</span><span class=cF0>);
|
||
|
<a name="l471"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l472"></a>}
|
||
|
<a name="l473"></a>
|
||
|
<a name="l474"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>InFile</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename)
|
||
|
<a name="l475"></a>{</span><span class=cF2>//Send InFile code file to self.</span><span class=cF0>
|
||
|
<a name="l476"></a> </span><span class=cF1>U8</span><span class=cF0> *name=</span><span class=cF5>ExtDft</span><span class=cF0>(filename,</span><span class=cF6>"IN.Z"</span><span class=cF0>);
|
||
|
<a name="l477"></a> </span><span class=cF5>InStr</span><span class=cF0>(</span><span class=cF6>"Cd(\"%C:%s\");;#include \"%s\""</span><span class=cF0>,
|
||
|
<a name="l478"></a> </span><span class=cF5>Drv2Let</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dv</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>->cur_dir,name);
|
||
|
<a name="l479"></a> </span><span class=cF5>Free</span><span class=cF0>(name);
|
||
|
<a name="l480"></a>}
|
||
|
<a name="l481"></a>
|
||
|
<a name="l482"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>In</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l483"></a>{</span><span class=cF2>//Send text to own input buffer. See </span><a href="/Wb/Demo/AcctExample/TOS/TOSDistro.HC.HTML#l1"><span class=cF4>::/Demo/AcctExample/TOS/TOSDistro.HC</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l484"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv),*st=</span><span class=cF5>AStrNew</span><span class=cF0>(buf);
|
||
|
<a name="l485"></a> </span><span class=cF5>InStr</span><span class=cF0>(</span><span class=cF6>"\"%%s\",%d;Free(%d);"</span><span class=cF0>,st,st);
|
||
|
<a name="l486"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l487"></a>}
|
||
|
<a name="l488"></a>
|
||
|
<a name="l489"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>XTalkStr</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l490"></a>{</span><span class=cF2>//Send InFile code to other task.</span><span class=cF0>
|
||
|
<a name="l491"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l492"></a> </span><span class=cF5>TaskText</span><span class=cF0>(task,</span><span class=cF3>NULL</span><span class=cF0>,buf,0);
|
||
|
<a name="l493"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l494"></a>}
|
||
|
<a name="l495"></a>
|
||
|
<a name="l496"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>XTalkStrWait</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
|
||
|
<a name="l497"></a>{</span><span class=cF2>//Send InFile code to other task and wait for it to idle.</span><span class=cF0>
|
||
|
<a name="l498"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l499"></a> </span><span class=cF5>TaskText</span><span class=cF0>(task,</span><span class=cF3>NULL</span><span class=cF0>,buf,0);
|
||
|
<a name="l500"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
||
|
<a name="l501"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(task);
|
||
|
<a name="l502"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|