Annotation of OpenXM/src/OpenMath/OM2OXM.java, Revision 1.6
1.1 tam 1: /**
1.6 ! tam 2: * $OpenXM: OpenXM/src/OpenMath/OM2OXM.java,v 1.5 1999/11/12 11:36:09 tam Exp $
1.1 tam 3: *
4: * $B$3$N%/%i%9$G$O0J2<$N(B BNF $B$GI=$5$l$k9=J82r@O$r<BAu$7$F$$$k(B
5: * expr -> stag [expr | immediate]* etag
6: * immediate -> INTEGER
7: * | SYMBOL
8: * stag -> '<' SYMBOL '>'
9: * etag -> '<' '/' SYMBOL '>'
10: * $B=*C<5-9f(B: INTEGER, SYMBOL, '<', '/', '>'
11: * $BHs=*C<5-9f(B: expr, stag, etag, immediate
12: * $B3+;O5-9f(B: expr
13: *
14: * $B0J2<$N4X?t$r;HMQ(B:
15: * public void send(OutputStream os); - buffer $B$K$"$k(B OX message $B$rAw?.$9$k(B.
16: * public int parse(); - $B9=J82r@O$r3+;O$9$k(B.
17: * private int parse_expr(); - parser $B$N(B expr $BItJ,(B
18: * private Attribute parse_stag(); - parser $B$N(B stag $BItJ,(B
19: * private void parse_etag(Attribute tag,int argnum); - parser $B$N(B etag $BItJ,(B
20: * private int parse_immediate(); - parser $B$N(B immediate $BItJ,(B
21: * private void parse_error(String mesg); - parser $B$N(B error $B$rI=<($7$F=*N;$9$k(B
22: * public static void main(String[] args); - main $B4X?t(B.
23: *
24: * $B0J2<$NJQ?t$r;HMQ(B:
25: * Attribute Attribute; - $B;z6g2r@O4o$r8F$S=P$7(B, $B$=$NB0@-CM$rJ]B8$7$F$*$/(B
26: * int token; - $B8=:_FI$_9~$s$G$$$k(B token $B$rJ]B8$7$F$*$/$N$K;HMQ(B.
27: * CellStack stack; - $B%;%^%s%F%#%C%/%9$N%A%'%C%/$K;H$&FbIt%9%?%C%/(B.
28: * ByteArrayOutputStream buffer; - oxasir $B$KAw?.$9$k$^$($K%G!<%?$rN/$a$F$*$/(B
29: */
30:
31: import java.io.*;
32: import java.net.*;
33: import java.util.Vector;
34: import JP.ac.kobe_u.math.tam.OpenXM.*;
35:
36: final class OM2OXM implements Runnable{
37: private PushbackInputStream is;
38: private String attribute;
39: private int token = TT_NULL;
40: private boolean lexPushbackFlag = false;
41: private OpenXM asir; // for debug
1.3 tam 42: private boolean debug = true;
1.1 tam 43:
44: // Token Type for lexical analyzer
45: final static int TT_NULL = 0;
46: final static int TT_String = -1;
47: final static int TT_StartTag = -2;
48: final static int TT_EndTag = -3;
49: final static int TT_SingleTag = -4;
50:
51: public void run(){ // for debug
52: //$B%5!<%PB&$+$iAw?.$5$l$?J8;zNs$r<u?.$7$^$9!#(B
53: try{
54: while(true){
55: CMO tmp;
56:
57: Thread.yield();
58:
59: switch(asir.receiveOXtag()){
60: case OpenXM.OX_COMMAND:
61: asir.receiveSM();
62: break;
63:
64: case OpenXM.OX_DATA:
65: tmp = asir.receiveCMO();
1.2 tam 66: System.out.println("=> "+ CMO2OM(tmp));
1.1 tam 67: break;
68: }
69:
70: }
71: }catch(IOException e){}
72: }
73:
74: public static String CMO2OM(CMO cmo){
1.2 tam 75: return "<OMOBJ>"+ CMO2OM_sub(cmo) +"</OMOBJ>";
76: }
77:
78: private static String CMO2OM_sub(CMO cmo){
1.1 tam 79: String ret = "";
80:
81: switch(cmo.getDISCRIMINATOR()){
82: case CMO.CMO_NULL:
83: return "<OMI>0</OMI>";
84:
85: case CMO.CMO_INT32:
86: return "<OMI>"+ ((CMO_INT32)cmo).intValue() +"</OMI>";
87:
88: // case CMO.CMO_DATUM:
89:
90: case CMO.CMO_STRING:
91: return "<OMSTR>"+ ((CMO_STRING)cmo).getString() +"</OMSTR>";
92:
93: // case CMO.CMO_LIST:
94:
95: case CMO.CMO_MONOMIAL32:
96: ret += "<OMA><OMS name=\"Monom\" cd=\"poly\"/>";
1.2 tam 97: ret += CMO2OM_sub(((CMO_MONOMIAL32)cmo).getCoefficient());
1.1 tam 98: for(int i=0;i<((CMO_MONOMIAL32)cmo).getDegree().length;i++){
99: ret += "<OMI>"+ ((CMO_MONOMIAL32)cmo).getDegree()[i] +"</OMI>";
100: }
101: ret += "</OMA>";
102: return ret;
103:
104: case CMO.CMO_ZZ:
105: return "<OMI>"+ ((CMO_ZZ)cmo).BigIntValue() +"</OMI>";
106:
107: case CMO.CMO_QQ:
108: return "<OMA><OMS name=\"over\" cd=\"basic\"/>"+
1.2 tam 109: CMO2OM_sub(((CMO_QQ)cmo).getBunshi())+
110: CMO2OM_sub(((CMO_QQ)cmo).getBunbo())+
111: "</OMA>";
1.1 tam 112:
113: case CMO.CMO_ZERO:
114: return "<OMI> 0 </OMI>";
115:
116: // case CMO.CMO_DMS:
117:
118: case CMO.CMO_DMS_GENERIC:
119: ret += "<OMA><OMS name=\"PolyRing\" cd=\"poly\"/>";
1.4 tam 120: ret += "<OMI>2</OMI></OMA>";
1.1 tam 121: return ret;
122:
123: case CMO.CMO_DISTRIBUTED_POLYNOMIAL:
124: ret += "<OMA><OMS name=\"DMP\" cd=\"poly\"/>";
1.2 tam 125: ret += CMO2OM_sub(((CMO_DISTRIBUTED_POLYNOMIAL)cmo).getRing());
1.1 tam 126: ret += "<OMA><OMS name=\"SDMP\" cd=\"poly\"/>";
1.2 tam 127: for(int i=0;i<((CMO_DISTRIBUTED_POLYNOMIAL)cmo).getMonomials().length;
128: i++){
129: ret += CMO2OM_sub(((CMO_DISTRIBUTED_POLYNOMIAL)cmo).getMonomials()[i]);
1.1 tam 130: }
131: ret += "</OMA></OMA>";
132: return ret;
133:
134: case CMO.CMO_INDETERMINATE:
135: return "<OMV name=\""+ ((CMO_INDETERMINATE)cmo).getString() +"\"/>";
136:
137: /*
138: case CMO.CMO_TREE:
139: return "<OMA><OMS name=\""+ "\"/>"+
140: "</OMA>";
141: */
142:
143: default:
144: return "<OMSTR>"+ cmo.toCMOexpression() +"</OMSTR>";
145: }
146: }
147:
148: private boolean isSpace(int ch){ // use from lex
149: return (ch==' ' || ch=='\t' || ch=='\n' || ch=='\r');
150: }
151:
152: private int skipSpace() throws IOException{ // use from lex
153: int ch;
154:
155: do{
156: ch = is.read();
157: }while(isSpace(ch));
158: is.unread(ch);
159:
160: return ch;
161: }
162:
163: private void pushbackLex(){
164: if(lexPushbackFlag){
165: System.err.println("lex pushback error!");
166: }
167: lexPushbackFlag = true;
168: }
169:
170: private int readNextToken() throws IOException{ // lexical analyzer
171: String buf = "";
172: int ch;
173:
174: if(lexPushbackFlag){
175: lexPushbackFlag = false;
176: return token;
177: }
178:
179: token = TT_NULL;
180: attribute = "";
181: skipSpace();
182: ch = is.read();
183:
184: if(ch == '<'){ // for tag
185: ch = skipSpace();
186: if(ch == '/'){
187: is.read();
188: token = TT_EndTag;
189: skipSpace();
190: }else{
191: token = TT_StartTag;
192: }
193: while((ch = is.read()) != '>' && ch != '/' && ch != -1){
194: if(isSpace(ch)){
195: if((ch = skipSpace()) != '>' && ch != '/'){
196: buf += " ";
197: }
198: continue;
199: }
200:
201: buf += Character.toUpperCase((char)ch);
202:
203: if(ch == '"'){
204: do{
205: ch = is.read();
206: buf += (char)ch;
207: }while(ch != '"' && ch != -1);
208: }
209: }
210: if(ch == '>'){ // for StartTag and EndTag
211: attribute = buf;
212: return token;
213: }else if(ch == '/'){
214: skipSpace();
215: if((ch = is.read()) == '>'){ // for SingleTag
216: attribute = buf;
217: return token = TT_SingleTag;
218: }
219: }
220: return token = TT_NULL;
221: }else if(ch != -1){
222: is.unread(ch);
223: while((ch = is.read()) != '<' && ch != -1){
1.3 tam 224: debug("debug: "+ch);
1.1 tam 225: if(isSpace(ch)){
1.5 tam 226: String spaces = String.valueOf((char)ch);
1.1 tam 227:
228: while(isSpace(ch = is.read())){
229: spaces += (char)ch;
230: }
231: if(ch != '<' && ch != -1){
232: buf += spaces;
233: }
234: is.unread(ch);
235: }else{
236: buf += (char)ch;
237: }
238: }
239: is.unread(ch);
240:
241: attribute = buf;
242: return token = TT_String;
243: }
244:
245: return token = TT_NULL;
246: }
247:
248: private boolean exceptTokenTypeInParse(int type) throws IOException{
249: // use from parse
250: if(readNextToken() != type){
251: parse_error("We expect type :'"+ type
252: +"', but we got type :'"+ token +"'("+ attribute +").");
253: }
1.3 tam 254: //debug(":"+token+":"+attribute+":"+type);
1.1 tam 255: return true;
256: }
257:
258: public CMO parse(InputStream stream) throws IOException{
259: // start -> '<OMOBJ>' object '</OMOBJ>'
260: CMO ret;
261:
262: is = new PushbackInputStream(stream);
263:
264: exceptTokenTypeInParse(TT_StartTag);
265: if(!attribute.equals("OMOBJ")){
266: parse_error("We expect '<OMOBJ>'.");
267: }
268:
269: ret = parse_object();
1.3 tam 270:
1.1 tam 271: exceptTokenTypeInParse(TT_EndTag);
272: if(!attribute.equals("OMOBJ")){
273: parse_error("We expect '</OMOBJ>'.");
274: }
275:
276: return ret;
277: }
278:
279: private CMO parse_object() throws IOException{
280: // object -> variable
281: // | '<OMI>' S? integer S? '</OMI>'
1.3 tam 282: // | '<OMSTR>' S? utf7 S? '</OMSTR>'
1.1 tam 283: // | '<OMA>' S? symbol S? objects S? '</OMA>'
284: CMO ret;
285:
286: if(readNextToken() != TT_StartTag && token != TT_SingleTag){
287: parse_error("We expect '<OMI> or '<OMA>' or '<OMV>'.");
288: }
289:
290: if(attribute.startsWith("OMV")){
291: pushbackLex();
292: ret = parse_variable();
293: }else if(attribute.equals("OMI")){
294: pushbackLex();
295: ret = parse_OMI();
1.3 tam 296: }else if(attribute.equals("OMSTR")){
297: pushbackLex();
298: ret = parse_OMSTR();
1.1 tam 299: }else if(attribute.equals("OMA")){
300: String name,cdname;
301: int argnum = 0;
302:
303: name = parse_symbol();
304:
305: if(name.equals("DMP")){
306: ret = parse_symb_DMP();
1.6 ! tam 307: debug("poly: "+ret);
1.1 tam 308: }else{
309: ret = new CMO_TREE(name,"Basic",parse_objects());
310: }
311:
312: exceptTokenTypeInParse(TT_EndTag);
313: if(!attribute.equals("OMA")){
314: parse_error("We expect '</OMA>'.");
315: }
316: }else{
317: parse_error("???");
318: ret = null;
319: }
320:
321: return ret;
322: }
323:
324: private CMO_ZZ parse_OMI() throws IOException{
325: CMO_ZZ ret;
326:
327: exceptTokenTypeInParse(TT_StartTag);
328: if(!attribute.equals("OMI")){
329: parse_error("We expect '<OMI>'.");
330: }
331:
332: ret = (CMO_ZZ)parse_integer();
333:
334: exceptTokenTypeInParse(TT_EndTag);
335: if(!attribute.equals("OMI")){
336: parse_error("We expect '</OMI>'.");
337: }
338:
339: return ret;
340: }
341:
1.3 tam 342: private CMO_STRING parse_OMSTR() throws IOException{
343: CMO_STRING ret;
344:
345: exceptTokenTypeInParse(TT_StartTag);
346: if(!attribute.equals("OMSTR")){
347: parse_error("We expect '<OMSTR>'.");
348: }
349:
350: if(readNextToken() == TT_String){
351: //ret = (CMO_STRING)parse_utf7();
352: ret = new CMO_STRING(attribute);
353: }else{
354: ret = new CMO_STRING("");
355: pushbackLex();
356: }
357:
358: exceptTokenTypeInParse(TT_EndTag);
359: if(!attribute.equals("OMSTR")){
360: parse_error("We expect '</OMSTR>'.");
361: }
362:
363: return ret;
364: }
365:
1.1 tam 366: private CMO parse_symb_DMP() throws IOException{
367: parse_object();
368: return new CMO_DISTRIBUTED_POLYNOMIAL(new CMO_DMS_GENERIC(),
369: parse_symb_SDMP());
370: }
371:
372: private CMO_MONOMIAL32[] parse_symb_SDMP() throws IOException{
373: Vector mono = new Vector();
374: CMO_MONOMIAL32[] ret;
375:
376: exceptTokenTypeInParse(TT_StartTag);
377: if(!attribute.equals("OMA")){
378: parse_error("We expect '<OMA>'.");
379: }
380:
381: if(!parse_symbol().equals("SDMP")){
382: parse_error("We expect '<SDMP>'");
383: }
384:
385: while(readNextToken() != TT_EndTag){
386: pushbackLex();
387: mono.addElement(parse_symb_Monom());
388: }
389:
390: if(!attribute.equals("OMA")){
391: parse_error("We expect '</OMA>'.");
392: }
393:
394: ret = new CMO_MONOMIAL32[mono.size()];
395: mono.copyInto((Object[])ret);
396:
397: return ret;
398: }
399:
400: private CMO_MONOMIAL32 parse_symb_Monom() throws IOException{
401: Vector degree = new Vector();
402: int[] array;
403:
404: exceptTokenTypeInParse(TT_StartTag);
405: if(!attribute.equals("OMA")){
406: parse_error("We expect '<OMA>'.");
407: }
408:
409: if(!parse_symbol().equals("Monom")){
410: parse_error("We expect '<Monom>'");
411: }
412:
413: while(readNextToken() != TT_EndTag){
414: pushbackLex();
415: degree.addElement(parse_OMI());
416: }
417:
418: if(!attribute.equals("OMA")){
419: parse_error("We expect '<OMA>'.");
420: }
421:
422: array = new int[degree.size()-1];
423: for(int i=0;i<array.length;i++){
424: array[i] = ((CMO_ZZ)degree.elementAt(i+1)).intValue();
425: }
426:
1.6 ! tam 427: //debug("monom: "+ new CMO_MONOMIAL32(array,(CMO_ZZ)degree.elementAt(0)));
1.1 tam 428: return new CMO_MONOMIAL32(array,(CMO_ZZ)degree.elementAt(0));
429: }
430:
431: private CMO parse_objects() throws IOException{
432: // $B2r@O$5$l$?(B object $B$r(B LIST $B$GJV$9(B
433: Vector objects = new Vector();
434: CMO[] array;
435:
436: while(readNextToken() != TT_EndTag){
437: pushbackLex();
438: objects.addElement(parse_object());
439: }
440: pushbackLex();
441:
442: objects.trimToSize();
443: array = new CMO[objects.size()];
444: objects.copyInto((Object[])array);
445:
446: System.out.println("debug :"+ new CMO_LIST(array));
447: return new CMO_LIST(array);
448: }
449:
450: private String parse_symbol() throws IOException{
451: // symbname $B$rJV$9(B
452: String ret = "";
453: StreamTokenizer para;
454:
455: exceptTokenTypeInParse(TT_SingleTag);
456:
457: para = new StreamTokenizer(new StringReader(attribute));
458: para.resetSyntax();
459: para.wordChars('A','Z');
460: para.wordChars('a','z');
461: para.wordChars('0','9');
462: para.wordChars('\u00A0','\u00FF');
463: para.whitespaceChars('\u0000','\u0020');
464: para.quoteChar('"');
465: para.eolIsSignificant(false);
466: para.lowerCaseMode(true);
467: para.slashStarComments(false);
468: para.slashSlashComments(false);
469: para.ordinaryChar('=');
470:
471: if(para.nextToken() != StreamTokenizer.TT_WORD
472: || !para.sval.equalsIgnoreCase("OMS")){
473: parse_error("We expect '<OMS>', but '"+ para.sval +"'.");
474: }
475:
476: if(para.nextToken() != StreamTokenizer.TT_WORD){
477: parse_error("We expect 'name' or 'cd'.");
478: }
479: if(para.sval.equals("name")){
480: if(para.nextToken() != '='){
481: parse_error("We expect '='.");
482: }
483: if(para.nextToken() != '"'){
484: parse_error("We expect '\"'.");
485: }
486: ret = parse_symbname(para.sval);
487:
488: if(para.nextToken() != StreamTokenizer.TT_WORD
489: || !para.sval.equals("cd")){
490: parse_error("We expect 'cd'.");
491: }
492: if(para.nextToken() != '='){
493: parse_error("We expect '='.");
494: }
495: if(para.nextToken() != '"'){
496: parse_error("We expect '\"'.");
497: }
498: parse_cdname(para.sval);
499:
500: }else if(para.sval.equals("cd")){
501: if(para.nextToken() != '='){
502: parse_error("We expect '='.");
503: }
504: if(para.nextToken() != '"'){
505: parse_error("We expect '\"'.");
506: }
507: parse_cdname(para.sval);
508:
509: if(para.nextToken() != StreamTokenizer.TT_WORD
510: || !para.sval.equals("name")){
511: parse_error("We expect 'cd'.");
512: }
513: if(para.nextToken() != '='){
514: parse_error("We expect '='.");
515: }
516: if(para.nextToken() != '"'){
517: parse_error("We expect '\"'.");
518: }
519: ret = parse_symbname(para.sval);
520:
521: }else{
522: parse_error("We expect 'name' or 'cd'.");
523: }
524:
525: if(para.nextToken() != StreamTokenizer.TT_EOF){
526: parse_error("We expect '/>'.");
527: }
528:
529: return ret;
530: }
531:
532: private CMO parse_integer() throws IOException{
533: //Attribute integer = new Attribute(value);
534: String str;
535: int i=0;
536:
537: exceptTokenTypeInParse(TT_String);
538: str = attribute;
539:
540: if(str.charAt(i)=='-'){
541: i++;
542: }
543: if(str.length()>=i+2 && str.charAt(i)=='x'){ // for HEX
544: String strhex = str.substring(0,i) + str.substring(i+1);
545: for(i++;i<str.length();i++){
546: if("0123456789ABCDEF".indexOf((int)str.charAt(i)) == -1){
547: parse_error("We expect integer.");
548: }
549: }
550: // 10 $B?J?t$KJQ49(B
551: str = (new java.math.BigInteger(strhex,16)).toString();
552: }else if(str.length()>=i+1){ // for DEC
553: for(;i<str.length();i++){
554: if("0123456789".indexOf((int)str.charAt(i)) == -1){
555: parse_error("We expect integer.");
556: }
557: }
558: }else{
559: parse_error("We expect integer.");
560: }
561:
562: return new CMO_ZZ(str);
563: }
564:
565: private CMO parse_variable() throws IOException{
566: StreamTokenizer para;
567: CMO ret;
568:
569: exceptTokenTypeInParse(TT_SingleTag);
570:
571: para = new StreamTokenizer(new StringReader(attribute));
572: para.resetSyntax();
573: para.wordChars('A','Z');
574: para.wordChars('a','z');
575: para.wordChars('0','9');
576: para.wordChars('\u00A0','\u00FF');
577: para.whitespaceChars('\u0000','\u0020');
578: para.quoteChar('"');
579: para.eolIsSignificant(false);
580: para.lowerCaseMode(true);
581: para.slashStarComments(false);
582: para.slashSlashComments(false);
583: para.ordinaryChar('=');
584:
585: if(para.nextToken() != StreamTokenizer.TT_WORD
586: || !para.sval.equalsIgnoreCase("OMV")){
587: parse_error("We expect '<OMV>'.");
588: }
589:
590: if(para.nextToken() != StreamTokenizer.TT_WORD
591: || !para.sval.equals("name")){
592: parse_error("We expect 'name', but obtain '"+ para.sval +"'.");
593: }
594: if(para.nextToken() != '='){
595: parse_error("We expect '='.");
596: }
597: if(para.nextToken() != '"'){
598: parse_error("We expect '\"'.");
599: }
600: ret = new CMO_INDETERMINATE(parse_varname(para.sval));
601:
602: if(para.nextToken() != StreamTokenizer.TT_EOF){
603: parse_error("We expect '/>'.");
604: }
605:
606: return ret;
607: }
608:
609: private String parse_varname(String str){
610: String words = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
611: + "0123456789+='(),-./:?!#$%*;@[]^_`{|}";
612:
613: for(int i=0;i<str.length();i++){
614: if(words.indexOf((int)str.charAt(i))==-1){
615: parse_error("string \""+ str +"\" is not varname.");
616: }
617: }
618:
619: return str;
620: }
621:
622: private String parse_cdname(String str){
623: String alphabet = "abcdefghijklmnopqrstuvwxyz";
624: int i=0;
625:
626: if(alphabet.indexOf((int)str.charAt(i))==-1){
627: parse_error("cdname \""+ str +"\" must begin small alphabet.");
628: }
629: for(i++;i<str.length();i++){
630: if((alphabet + "0123456789_").indexOf((int)str.charAt(i))==-1){
631: parse_error("string \""+ str +"\" is not cdname.");
632: }
633: }
634:
635: return str;
636: }
637:
638: private String parse_symbname(String str) throws IOException{
639: String Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
640: int i=0;
641:
642: if(Alphabet.indexOf((int)str.charAt(i))==-1){
643: parse_error("symbname \""+ str +"\" must begin alphabet.");
644: }
645: for(i++;i<str.length();i++){
646: if((Alphabet + "0123456789_").indexOf((int)str.charAt(i))==-1){
647: parse_error("string \""+ str +"\" is not symbname.");
648: }
649: }
650:
651: return str;
652: }
653:
654: private void parse_error(String mesg){
655: System.err.println(mesg);
656: System.err.print("error occuered near :");
657: try{
658: for(int i=0;i<10;i++){
659: System.err.print((char)is.read());
660: }
661: System.err.println((char)is.read());
662: }catch(IOException e){}
663: System.exit(1);
1.3 tam 664: }
665:
666: private void debug(String str){
667: if(debug){
668: System.err.println(str);
669: }
1.1 tam 670: }
671:
672: public static void main(String[] argv) throws IOException{
673: OM2OXM P = new OM2OXM();
674: OpenXM asir;
675: String host = "localhost";
676: int CtrlPort = 1200,StreamPort = 1300;
677:
678: for(int i=0;i<argv.length;i++){
679: if(argv[i].equals("-h")){
680: System.out.println("");
681: System.exit(0);
682: }else if(argv[i].equals("-host")){
683: host = argv[++i];
684: }else if(argv[i].equals("-data")){
685: StreamPort = Integer.valueOf(argv[++i]).intValue();
686: }else if(argv[i].equals("-control")){
687: CtrlPort = Integer.valueOf(argv[++i]).intValue();
688: }else{
689: System.err.println("unknown option :"+ argv[i]);
690: System.exit(1);
691: }
692: }
693:
694: try{
695: asir = new OpenXM(host,CtrlPort,StreamPort);
696: asir.sendSM(new SM(SM.SM_mathcap));
697: }catch(UnknownHostException e){
698: System.err.println("host unknown.");
699: System.err.println(e.getMessage());
700: return;
701: }catch(IOException e){
702: System.err.println("connection failed.");
703: System.err.println("IOException occuer !!");
704: System.err.println(e.getMessage());
705: return;
706: }
707:
708: P.asir = asir;
709: new Thread(P).start();
710: System.out.println("start");
711:
712: try{
713: //P.value = new Attribute(System.in);
714:
715: //$B%5!<%PB&$+$iAw?.$5$l$?J8;zNs$r<u?.$7$^$9!#(B
716: while(true){
717: CMO obj = P.parse(System.in);
718: asir.send(obj);
719: asir.sendSM(new SM(SM.SM_popCMO));
720: }
721:
722: //System.out.println("breaking...");
723:
724: }catch(IOException e){
725: e.printStackTrace();
726: }
727: }
728: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>