version 1.6, 2000/12/14 04:35:16 |
version 1.12, 2002/11/08 02:54:12 |
|
|
/* $OpenXM: OpenXM/src/k097/lib/ox/ox.k,v 1.5 2000/12/12 13:58:21 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/k097/lib/ox/ox.k,v 1.11 2001/01/26 12:24:57 takayama Exp $ */ |
|
|
/* Load_sm1(["ox.sm1",AddString([GetEnv("OpenXM_HOME"),"/lib/sm1/ox.sm1"])], |
/* Load_sm1(["ox.sm1",AddString([GetEnv("OpenXM_HOME"),"/lib/sm1/ox.sm1"])], |
"ox.sm1.loaded"); */ |
"ox.sm1.loaded"); */ |
Line 6 Load_sm1(["oxasir.sm1",AddString([GetEnv("OpenXM_HOME" |
|
Line 6 Load_sm1(["oxasir.sm1",AddString([GetEnv("OpenXM_HOME" |
|
"/lib/sm1/oxasir.sm1"])], |
"/lib/sm1/oxasir.sm1"])], |
"oxasir.sm1.loaded"); |
"oxasir.sm1.loaded"); |
|
|
|
def oxGetClientList() { |
|
local clist; |
|
sm1(" [(oxGetClientList)] extension /clist set "); |
|
return( clist ); |
|
} |
|
|
class OXchannel extends Object { |
class OXchannel extends Object { |
local channel; |
local channel; |
/* Just add a tag. */ |
/* Just add a tag. */ |
Line 47 class OXchannel extends Object { |
|
Line 53 class OXchannel extends Object { |
|
return(r); |
return(r); |
} |
} |
|
|
|
def popString() { |
|
local cc,r; |
|
cc = channel; |
|
sm1(" cc oxpopstring /r set "); |
|
return(r); |
|
} |
|
|
|
|
} |
} |
|
|
class OXcontrol extends Object { |
class OXcontrol extends Object { |
Line 54 class OXcontrol extends Object { |
|
Line 68 class OXcontrol extends Object { |
|
def getControl() { |
def getControl() { |
return(control); |
return(control); |
} |
} |
def generate(c) { |
def generate(c,useX) { |
|
if (Length(Arglist) <= 1) { |
|
useX = true; |
|
} |
if (Tag(c) != 0) { |
if (Tag(c) != 0) { |
control = c; |
control = c; |
return(this); |
return(this); |
}else{ |
}else{ |
return(start()); |
return(start(useX)); |
} |
} |
} |
} |
def start() { |
def start(useX) { |
local c,e, pass, peer, data, s, stmp; |
local c,e, pass, peer, data, s, stmp, xopt; |
this = new(super.new0()); |
if (Length(Arglist) == 0) { |
|
useX = true; |
|
} |
|
if (useX) { |
|
xopt = " -x "; |
|
}else{ |
|
xopt = " "; |
|
} |
|
this = new(Object.new0()); |
sm1(" [(oxGenPass)] extension /pass set "); |
sm1(" [(oxGenPass)] extension /pass set "); |
sm1(" [(oxGetPort1) (localhost)] extension /peer set "); |
sm1(" [(oxGetPort1) (localhost)] extension /peer set "); |
sm1(" /data peer 1 get toString def "); |
sm1(" /data peer 1 get toString def "); |
s = AddString( |
s = AddString( |
[GetEnv("OpenXM_HOME"), |
[GetEnv("OpenXM_HOME"), |
"/src/oxc/oxc", |
"/bin/oxc", |
" -c ", pass, " -h "," localhost ", " -p ", data, " -x ", |
" -c ", pass, " -h "," localhost ", " -p ", data, xopt, |
" & "]); |
" & "]); |
sm1(" [ (/bin/csh -c \") s (\") ] cat /stmp set "); |
sm1(" [ (/bin/csh -c \") s (\") ] cat /stmp set "); |
sm1(" stmp message "); |
sm1(" stmp message "); |
Line 89 class OXcontrol extends Object { |
|
Line 114 class OXcontrol extends Object { |
|
def popCMO() { |
def popCMO() { |
return(control.channel.popCMO()); |
return(control.channel.popCMO()); |
} |
} |
|
def popString() { |
|
return(control.channel.popString()); |
|
} |
|
|
} |
} |
|
|
Line 106 class OX extends OXcontrol { |
|
Line 134 class OX extends OXcontrol { |
|
return(engineIDs); |
return(engineIDs); |
} |
} |
/* OX.generate("ox_sm1"); or OX.generate("ox_sm1",null) */ |
/* OX.generate("ox_sm1"); or OX.generate("ox_sm1",null) */ |
def generate(name,control) { |
def generate(name,control,useX) { |
local c,e, pass, peer, data, s, stmp, engineID; |
local c,e, pass, peer, data, s, stmp, engineID,nn; |
if (Length(Arglist) == 0) { |
nn = Length(Arglist); |
name = "ox_sm1"; control = null; |
if (nn == 0) { |
|
name = "ox_sm1"; control = null; useX = true; |
} |
} |
if (Length(Arglist) == 1) { |
if (nn == 1) { |
control = null; |
control = null; useX = true; |
} |
} |
this = new(super.generate(control)); |
if (nn == 2) { |
control = super.getControl(); |
useX = true; |
|
} |
|
this = new(OXcontrol.generate(control,useX)); |
|
control = this.getControl(); |
sm1(" [(oxGetPort1) (localhost)] extension /peer set "); |
sm1(" [(oxGetPort1) (localhost)] extension /peer set "); |
sm1(" /data peer 1 get def "); |
sm1(" /data peer 1 get def "); |
/* BUG: control.pushCMO(data) does not work. |
/* BUG: control.pushCMO(data) does not work. |
Line 141 class OX extends OXcontrol { |
|
Line 173 class OX extends OXcontrol { |
|
def popCMO() { |
def popCMO() { |
return(engine.channel.popCMO()); |
return(engine.channel.popCMO()); |
} |
} |
|
def popString() { |
|
return(engine.channel.popString()); |
|
} |
|
|
def rpc(func,ar) { |
def rpc_submit(func,ar) { |
local n,i,one,comm; |
local n,i,one,comm; |
if (! IsString(func)) { |
if (! IsString(func)) { |
Error("The first argument of rpc must be a string."); |
Error("The first argument of rpc must be a string."); |
Line 170 class OX extends OXcontrol { |
|
Line 205 class OX extends OXcontrol { |
|
this.pushCMO(func); |
this.pushCMO(func); |
this.pushCMD(SM_executeFunction); |
this.pushCMD(SM_executeFunction); |
|
|
|
} |
|
|
|
def rpc(func,ar) { |
|
local one; |
|
sm1(" /one 1 def "); |
|
rpc_submit(func,ar); |
this.pushCMO(one); |
this.pushCMO(one); |
this.pushCMO("ox_ptod"); |
this.pushCMO("ox_ptod"); |
this.pushCMD(SM_executeFunction); |
this.pushCMD(SM_executeFunction); |
return(this.popCMO()); |
return(this.popCMO()); |
} |
} |
|
|
|
def rpc_str(func,ar) { |
|
rpc_submit(func,ar); |
|
return(this.popString()); |
|
} |
|
def executeString(s) { |
|
this.pushCMO(s); |
|
this.pushCMD(SM_executeStringByLocalParser); |
|
} |
} |
} |
|
|
/* |
/* |
Line 185 class OX extends OXcontrol { |
|
Line 234 class OX extends OXcontrol { |
|
Println(f); |
Println(f); |
*/ |
*/ |
def startAsir() { |
def startAsir() { |
local a,asirpeer; |
return(Asir.generate()); |
a = OX.generate("ox_asir"); |
|
asirpeer = (a.getEngine()).getChannel(); |
|
Println(asirpeer); |
|
sm1(" [asirpeer oxasirpath.asirlib] loadAsirFile "); |
|
return(a); |
|
} |
} |
|
|
|
class Asir extends OX { |
|
local ; |
|
def generate(useX) { |
|
local asirpeer,a; |
|
if (Length(Arglist) == 0) { useX = true; } |
|
this = new(OX.generate("ox_asir",null,useX)); |
|
a = this; |
|
asirpeer = (a.getEngine()).getChannel(); |
|
Println(asirpeer); |
|
sm1(" [asirpeer oxasirpath.asirlib] loadAsirFile "); |
|
return(this); |
|
} |
|
def OnTimer() { |
|
local a; |
|
a = this; |
|
a.executeString("K0_timer=time();"); |
|
a.popString(); |
|
a.executeString("K0_timer_CPU=K0_timer[0];"); |
|
a.popString(); |
|
a.executeString("K0_timer_GC=K0_timer[1];"); |
|
a.popString(); |
|
} |
|
def OffTimer() { |
|
local a; |
|
a = this; |
|
a.executeString("map(rtostr,[time()[0]-K0_timer_CPU, |
|
time()[1]-K0_timer_GC]);"); |
|
return(a.popCMO()); |
|
} |
|
} |