Annotation of OpenXM/src/k097/lib/ox/ox.k, Revision 1.4
1.4 ! takayama 1: /* $OpenXM: OpenXM/src/k097/lib/ox/ox.k,v 1.3 2000/12/10 11:07:45 takayama Exp $ */
1.3 takayama 2:
3: Load_sm1(["ox.sm1",AddString([GetEnv("OpenXM_HOME"),"/lib/sm1/ox.sm1"])],
4: "ox.sm1.loaded");
5: def void Error(s) {
6: sm1(" s error ");
7: }
8:
9: class OXchannel extends Object {
10: local channel;
11: /* Just add a tag. */
12: def generate(c) {
13: this = new();
14: if (IsArray(c)) {
15: if (c[0] != "client") {
16: Error("OXchannel.generate(c) : c is not client object.");
17: }
18: }else{
19: Error("OXchannel.generate(c) : c is not client object.");
20: }
21: channel = c;
22: return(this);
23: }
24:
25: def pushCMO(ob) {
26: local cc;
27: cc = channel;
28: sm1(" cc ob oxpushcmo ");
29: }
30:
31: def pushCMD(ob) {
32: local cc;
33: cc = channel;
34: if (IsInteger(ob)) {
35: ob = IntegerToSm1Integer(ob);
36: }
1.4 ! takayama 37: sm1(" [(oxPushCMD) cc ob] extension ");
1.3 takayama 38: }
1.4 ! takayama 39:
! 40: def popCMO() {
! 41: local cc,r;
! 42: cc = channel;
! 43: sm1(" cc oxpopcmo /r set ");
! 44: return(r);
! 45: }
! 46:
1.3 takayama 47: }
1.1 takayama 48:
1.2 takayama 49: class OXcontrol extends Object {
50: local control;
1.3 takayama 51: def generate(c) {
1.2 takayama 52: if (Tag(c) != 0) {
53: control = c;
54: return(this);
55: }else{
56: return(start());
57: }
58: }
59: def start() {
1.1 takayama 60: local c,e, pass, peer, data, s, stmp;
61: this = new(super.new0());
62: sm1(" [(oxGenPass)] extension /pass set ");
63: sm1(" [(oxGetPort1) (localhost)] extension /peer set ");
64: sm1(" /data peer 1 get toString def ");
65: s = AddString(
66: ["/home/nobuki/OpenXM/src/oxc/oxc",
67: " -c ", pass, " -h "," localhost ", " -p ", data, " -x ",
68: " & "]);
69: sm1(" [ (/bin/csh -c \") s (\") ] cat /stmp set ");
70: sm1(" stmp message ");
71: sm1(" stmp system ");
72: sm1(" [(oxCreateControl_RFC_101) peer 0 pass] extension /c set ");
1.3 takayama 73: control = OXchannel.generate(c);
1.1 takayama 74: return(this);
1.2 takayama 75: }
1.3 takayama 76: def pushCMO(a) {
77: control.channel.pushCMO(a);
78: }
79: def pushCMD(a) {
80: control.channel.pushCMD(a);
81: }
1.4 ! takayama 82: def popCMO() {
! 83: return(control.channel.popCMO());
! 84: }
1.2 takayama 85:
1.1 takayama 86: }
87:
1.4 ! takayama 88: /* How to debug?
! 89: sm1(" OX { vname } sendmsg /aaa set ");
! 90: Get the value of vname in the context OX and set it to aaa.
! 91: */
1.1 takayama 92:
1.3 takayama 93: class OX extends OXcontrol {
1.2 takayama 94: local engine;
1.3 takayama 95: /* OX.generate(null,"ox_sm1"); */
96: def generate(control,name) {
1.2 takayama 97: local c,e, pass, peer, data, s, stmp, engineID;
1.3 takayama 98: this = new(super.generate(control));
1.2 takayama 99: control = this.control;
100: sm1(" [(oxGetPort1) (localhost)] extension /peer set ");
101: sm1(" /data peer 1 get def ");
102: control.pushCMO(data);
103: control.pushCMO(name);
104: control.pushCMD(SM_control_spawn_server);
105: engineID = control.popCMO();
1.4 ! takayama 106: print("engineID=");Println(engineID);
! 107: HOGE = control;
1.2 takayama 108: sm1(" [(oxCreateEngine_RFC_101) peer 0 (Empty) engineID] extension /c set ");
1.3 takayama 109: engine = OXchannel.generate(c);
1.2 takayama 110: return(this);
1.3 takayama 111: }
1.2 takayama 112:
113: }
1.1 takayama 114:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>