Annotation of OpenXM/src/k097/lib/ox/ox.k, Revision 1.3
1.3 ! takayama 1: /* $OpenXM: OpenXM/src/k097/lib/ox/ox.k,v 1.2 2000/12/06 23:45:32 takayama Exp $ */
! 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: }
! 37: sm1(" cc ob oxpushcmd ");
! 38: }
! 39: }
1.1 takayama 40:
1.2 takayama 41: class OXcontrol extends Object {
42: local control;
1.3 ! takayama 43: def generate(c) {
1.2 takayama 44: if (Tag(c) != 0) {
45: control = c;
46: return(this);
47: }else{
48: return(start());
49: }
50: }
51: def start() {
1.1 takayama 52: local c,e, pass, peer, data, s, stmp;
53: this = new(super.new0());
54: sm1(" [(oxGenPass)] extension /pass set ");
55: sm1(" [(oxGetPort1) (localhost)] extension /peer set ");
56: sm1(" /data peer 1 get toString def ");
57: s = AddString(
58: ["/home/nobuki/OpenXM/src/oxc/oxc",
59: " -c ", pass, " -h "," localhost ", " -p ", data, " -x ",
60: " & "]);
61: sm1(" [ (/bin/csh -c \") s (\") ] cat /stmp set ");
62: sm1(" stmp message ");
63: sm1(" stmp system ");
64: sm1(" [(oxCreateControl_RFC_101) peer 0 pass] extension /c set ");
1.3 ! takayama 65: control = OXchannel.generate(c);
1.1 takayama 66: return(this);
1.2 takayama 67: }
1.3 ! takayama 68: def pushCMO(a) {
! 69: control.channel.pushCMO(a);
! 70: }
! 71: def pushCMD(a) {
! 72: control.channel.pushCMD(a);
! 73: }
1.2 takayama 74:
1.1 takayama 75: }
76:
77:
1.3 ! takayama 78: class OX extends OXcontrol {
1.2 takayama 79: local engine;
1.3 ! takayama 80: /* OX.generate(null,"ox_sm1"); */
! 81: def generate(control,name) {
1.2 takayama 82: local c,e, pass, peer, data, s, stmp, engineID;
1.3 ! takayama 83: this = new(super.generate(control));
1.2 takayama 84: control = this.control;
85: sm1(" [(oxGetPort1) (localhost)] extension /peer set ");
86: sm1(" /data peer 1 get def ");
87: control.pushCMO(data);
88: control.pushCMO(name);
89: control.pushCMD(SM_control_spawn_server);
90: engineID = control.popCMO();
91: sm1(" [(oxCreateEngine_RFC_101) peer 0 (Empty) engineID] extension /c set ");
1.3 ! takayama 92: engine = OXchannel.generate(c);
1.2 takayama 93: return(this);
1.3 ! takayama 94: }
1.2 takayama 95:
96: }
1.1 takayama 97:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>