TempleOSTS_131005.ISO
This commit is contained in:
1 parent
1343005a29
commit
2d2a65d572
547 files changed
+33608
-12549
No files matched your search
+71
-78
@@ -24,17 +24,16 @@ U0 SrvCtrlInit(CSrvCtrl *ctrl)
|
||||
|
||||
U0 TaskRstAwaitingMsg(CTask *task=NULL)
|
||||
{ //Pop-ups get parent messages so wake-up our pop-ups if we got a msg.
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
if (!task) task=Fs;
|
||||
if (TaskValidate(task)) {
|
||||
LBtr(&task->task_flags,TASKf_AWAITING_MSG);
|
||||
while (task=task->popup_task)
|
||||
if (TaskValidate(task))
|
||||
LBtr(&task->task_flags,TASKf_AWAITING_MSG);
|
||||
else
|
||||
break;
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
PushFD;
|
||||
Cli;
|
||||
do {
|
||||
if (TaskValidate(task))
|
||||
LBtr(&task->task_flags,TASKf_AWAITING_MSG);
|
||||
else
|
||||
break;
|
||||
} while (task=task->popup_task);
|
||||
PopFD;
|
||||
}
|
||||
|
||||
CSrvCmd *TaskExeStrQue(CTask *srv,CTask *master,
|
||||
@@ -93,18 +92,21 @@ CSrvCmd *TaskTextInputQue(CTask *srv,CTask *master,
|
||||
result->aux_str=AStrNew(data);
|
||||
|
||||
PushFD;
|
||||
if (Bt(&flags,SVCf_HIGHEST_PRIORITY) ||
|
||||
srv->next_input_filter_task==srv) {
|
||||
task=srv->last_input_filter_task;
|
||||
if (Bt(&flags,SVCf_HIGHEST_PRIORITY) || task==srv) {
|
||||
if (task!=srv)
|
||||
TaskWait(srv);
|
||||
task=Spawn(&InputFilterTask,NULL,"Input Filter",,srv);
|
||||
Cli;
|
||||
task->next_input_filter_task=srv->next_input_filter_task;
|
||||
task->last_input_filter_task=srv;
|
||||
srv->next_input_filter_task=task;
|
||||
task->next_input_filter_task->last_input_filter_task=task;
|
||||
} else
|
||||
} else {
|
||||
Cli;
|
||||
task=srv->next_input_filter_task;
|
||||
}
|
||||
result->ctrl=&task->srv_ctrl;
|
||||
Cli;
|
||||
while (LBts(&task->srv_ctrl.flags,SVCRf_LOCKED))
|
||||
Pause;
|
||||
if (!TaskValidate(task)) {
|
||||
@@ -235,8 +237,8 @@ U0 TaskWait(CTask *task=NULL)
|
||||
while (TRUE) {
|
||||
task1=task->last_input_filter_task;
|
||||
tempc1=&task1->srv_ctrl.next_waiting;
|
||||
if (TaskValidate(task1) && tempc1==tempc1->next &&
|
||||
(task1==Fs || Bt(&task1->task_flags,TASKf_IDLE)))
|
||||
if (task1==Fs || !TaskValidate(task1) ||
|
||||
tempc1==tempc1->next && Bt(&task1->task_flags,TASKf_IDLE))
|
||||
break;
|
||||
Yield;
|
||||
}
|
||||
@@ -296,26 +298,26 @@ I64 SrvCmdRun(CSrvCmd *tempc,I64 old_flags)
|
||||
LBts(&tempc->flags,SVCf_DISPATCHED);
|
||||
tempc->servant_cpu_num=Gs->num;
|
||||
LBtr(&ctrl->flags,SVCRf_LOCKED);
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
LBtr(&Fs->task_flags,TASKf_IDLE);
|
||||
try
|
||||
tempc->result=(*tempc->add)(tempc->fun_arg);
|
||||
catch
|
||||
Fs->catch_except=TRUE;
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
break;
|
||||
case SVCT_EXE_STR:
|
||||
QueRem(tempc);
|
||||
LBts(&tempc->flags,SVCf_DISPATCHED);
|
||||
tempc->servant_cpu_num=Gs->num;
|
||||
LBtr(&ctrl->flags,SVCRf_LOCKED);
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
LBtr(&Fs->task_flags,TASKf_IDLE);
|
||||
try
|
||||
tempc->result=ExePutS(tempc->aux_str);
|
||||
tempc->result=ExePrint("%s",tempc->aux_str);
|
||||
catch
|
||||
Fs->catch_except=TRUE;
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
break;
|
||||
default:
|
||||
result=SCR_DONE;
|
||||
@@ -329,7 +331,7 @@ I64 SrvCmdRun(CSrvCmd *tempc,I64 old_flags)
|
||||
QueIns(tempc,master->srv_ctrl.last_done);
|
||||
LBts(&tempc->flags,SVCf_DONE);
|
||||
LBtr(&master->srv_ctrl.flags,SVCRf_LOCKED);
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
}
|
||||
if (Bt(&flags,SVCf_FOCUS_MASTER) &&
|
||||
Bt(&master->task_flags,TASKf_USER))
|
||||
@@ -346,7 +348,7 @@ I64 SrvCmdRun(CSrvCmd *tempc,I64 old_flags)
|
||||
QueIns(tempc,ctrl->last_done);
|
||||
LBts(&tempc->flags,SVCf_DONE);
|
||||
LBtr(&ctrl->flags,SVCRf_LOCKED);
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
}
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
@@ -355,7 +357,7 @@ I64 SrvCmdRun(CSrvCmd *tempc,I64 old_flags)
|
||||
|
||||
I64 SrvCmdsHandler(CTask *task=NULL)
|
||||
{
|
||||
I64 cnt=0,old_flags=GetFlags;
|
||||
I64 cnt=0,old_flags=GetRFlags;
|
||||
CSrvCmd *tempc,*tempc1;
|
||||
if (!task) task=Fs;
|
||||
while (TRUE) {
|
||||
@@ -379,7 +381,7 @@ I64 SrvCmdsHandler(CTask *task=NULL)
|
||||
}
|
||||
sch_done:
|
||||
LBtr(&task->srv_ctrl.flags,SVCRf_LOCKED);
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
@@ -388,19 +390,19 @@ I64 Adam(U8 *fmt,...)
|
||||
//compiled and run.
|
||||
{
|
||||
I64 result;
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
CSrvCmd *tempc;
|
||||
if (Fs==adam_task) {
|
||||
tempc=TaskExeStrQue(adam_task,Fs,st,0);
|
||||
tempc=TaskExeStrQue(adam_task,Fs,buf,0);
|
||||
SrvCmdsHandler;
|
||||
} else {
|
||||
TaskWait(adam_task);
|
||||
tempc=TaskExeStrQue(adam_task,Fs,st,1<<SVCf_WAKE_MASTER);
|
||||
tempc=TaskExeStrQue(adam_task,Fs,buf,1<<SVCf_WAKE_MASTER);
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
ScanResult(tempc,&result);
|
||||
Free(st);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -408,76 +410,63 @@ U0 AdamLog(U8 *fmt,...)
|
||||
//Sends text to the adam task which gets
|
||||
//displayed.
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
if (Fs==adam_task)
|
||||
"" st;
|
||||
"%s",buf;
|
||||
else if (!IsSingleUser)
|
||||
Adam("\"%Q\";",st);
|
||||
Free(st);
|
||||
Adam("\"%Q\";",buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
U0 AdamErr(U8 *fmt,...)
|
||||
//Sends text to the adam task which gets
|
||||
//displayed as red and blinking.
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv),
|
||||
*st2=MSPrintF("%S%s","ST_ERR",st);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv),
|
||||
*st=MPrint("%S%s","ST_ERR",buf);
|
||||
if (Fs==adam_task)
|
||||
"" st2;
|
||||
"%s",st;
|
||||
else if (!IsSingleUser)
|
||||
Adam("\"%Q\";",st2);
|
||||
Free(st2);
|
||||
Adam("\"%Q\";",st);
|
||||
Free(st);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
U0 XTalk(CTask *task,U8 *fmt,...)
|
||||
//Sends text to another task's input
|
||||
//buffer.
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv),
|
||||
*st2=MSPrintF("\"%Q\";",st);
|
||||
TaskTextInputQue(task,0,st2,0);
|
||||
Free(st2);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv),
|
||||
*st=MPrint("\"%Q\";",buf);
|
||||
TaskTextInputQue(task,0,st,0);
|
||||
Free(st);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
U0 XTalkWait(CTask *task,U8 *fmt,...)
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv),
|
||||
*st2=MSPrintF("\"%Q\";",st);
|
||||
TaskTextInputQue(task,0,st2,0);
|
||||
Free(st2);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv),
|
||||
*st=MPrint("\"%Q\";",buf);
|
||||
TaskTextInputQue(task,0,st,0);
|
||||
Free(st);
|
||||
Free(buf);
|
||||
TaskWait(task);
|
||||
}
|
||||
|
||||
U0 Auto(U8 *fmt,...)
|
||||
//Sends text to one's own input buffer
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv),
|
||||
*st2=MSPrintF("\"%Q\";",st);
|
||||
if (Bt(&Fs->task_flags,TASKf_INPUT_FILTER_TASK))
|
||||
ExePutS(st2);
|
||||
else
|
||||
TaskTextInputQue(Fs,0,st2,1<<SVCf_HIGHEST_PRIORITY);
|
||||
Free(st2);
|
||||
Free(st);
|
||||
}
|
||||
|
||||
I64 SrvUser(U8 *fmt,...)
|
||||
//Spawns a visible task and sends text
|
||||
//which gets compiled and run.
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result=0;
|
||||
CSrvCmd *tempc;
|
||||
CTask *task=Spawn(&SrvUserCmdLine,NULL,"Servant",,Fs);
|
||||
Fs->popup_task=task;
|
||||
tempc=TaskExeStrQue(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
tempc=TaskExeStrQue(task,Fs,buf,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
ScanResult(tempc,&result);
|
||||
Fs->popup_task=NULL;
|
||||
Kill(task,FALSE);
|
||||
Free(st);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -485,38 +474,42 @@ U0 AutoStr(U8 *fmt,...)
|
||||
//Sends text in the nature of an AutoFile to one's
|
||||
//own input buffer.
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
if (Bt(&Fs->task_flags,TASKf_INPUT_FILTER_TASK))
|
||||
ExePutS(st);
|
||||
ExePrint("%s",buf);
|
||||
else
|
||||
TaskTextInputQue(Fs,0,st,1<<SVCf_HIGHEST_PRIORITY);
|
||||
Free(st);
|
||||
TaskTextInputQue(Fs,0,buf,1<<SVCf_HIGHEST_PRIORITY);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
U0 AutoFile(U8 *filename)
|
||||
{
|
||||
U8 *name2=DftExt(filename,"AUT.Z");
|
||||
if (Bt(&Fs->task_flags,TASKf_INPUT_FILTER_TASK))
|
||||
ExeFile(name2);
|
||||
else
|
||||
AutoStr("%F",name2);
|
||||
Free(name2);
|
||||
U8 *name=DftExt(filename,"AUT.Z");
|
||||
AutoStr("%F",name);
|
||||
Free(name);
|
||||
}
|
||||
|
||||
U0 Auto(U8 *fmt,...)
|
||||
//Sends text to one's own input buffer
|
||||
{
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
AutoStr("\"%Q\";",buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
//This sends text of an AutoFile nature to a
|
||||
//task's input buffer.
|
||||
U0 XTalkStr(CTask *task,U8 *fmt,...)
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
TaskTextInputQue(task,0,st,0);
|
||||
Free(st);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
TaskTextInputQue(task,0,buf,0);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
U0 XTalkStrWait(CTask *task,U8 *fmt,...)
|
||||
{
|
||||
U8 *st=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
TaskTextInputQue(task,0,st,0);
|
||||
Free(st);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
TaskTextInputQue(task,0,buf,0);
|
||||
Free(buf);
|
||||
TaskWait(task);
|
||||
}
|
||||
Reference in new issue
Block a user