/* // This file is created by Template of umsCodeGenerator version 0.3 candidate */ import java.util.regex.*; /* // Definition of Classes */ abstract class textSample { /* // Definition of Member */ Vector vect = new Vector(); int hasComment; String comment; /* // Declartion of Reader */ abstract void userProgram(); /* // Decoder Common Routines // // 2004/11/28 - release 0.3 - Created by KM // modified from decorderStart.c */ int ums__found; int ums__pos; int ums__pos0; char [] ums__input; String ums__strInput; String ums__strOutput = ""; static void die(String msg){ System.out.println(msg); System.exit(1); } void ums__readReset(){ ums__strOutput = ""; } void ums__txtCopy(int spos, int epos){ ums__strOutput = ums__strOutput + String.copyValueOf(ums__input, spos/8, (epos-spos)/8); } String ums__txtRead(int spos, int epos){ return String.copyValueOf(ums__input, spos/8, (epos-spos)/8); } long ums__signedRead(int spos, int epos){ int i,n = ums__input[spos/8]; long tmp = ((n >> (7-spos%8)) & 1) * -1; for(i=spos+1; i < epos; i++ ){ n = ums__input[i/8]; tmp = tmp * 2; tmp += (n >> (7-i%8)) & 1; } return tmp; } long ums__unsignedRead(int spos, int epos){ int i,n = ums__input[spos/8]; long tmp = ((n >> (7-spos%8)) & 1); for(i=spos+1; i < epos; i++ ){ n = ums__input[i/8]; tmp = tmp * 2; tmp += (n >> (7-i%8)) & 1; } return tmp; } float ums__ieee754singleRead(int spos, int epos){ return Float.intBitsToFloat((int)ums__signedRead(spos,epos)); } double ums__ieee754doubleRead(int spos, int epos){ return Double.longBitsToDouble(ums__signedRead(spos,epos)); } /* // Definition of Decoder (matcher) */ /* < ojava:decoderSub> */ int match(int label, int epos1){ ums__pos0 = ums__pos; ums__found = match1(label, epos1); if(ums__found == 0 ){ ums__pos = ums__pos0; } return ums__found; } int match1(int label, int epos1){ int level = -1; while(true){ /* < group> */ { int found1 = 0; if (level >= 0 || label == 4){ level++; } while(true){ /* < ojava:readerSub> */ /* < group> */ { int found2 = 0; if (level >= 0 || label == 8){ level++; } while(true){ /* < value> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 9){ level++; } if (level >= 0 && found){ String literal = new String("Vector"); found = ums__strInput.startsWith( literal, ums__pos/8); eposd = ums__pos + literal.length()*8; } if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 10){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^[ \\t]+" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 13){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^[a-zA-Z_][a-zA-Z0-9_]*" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < value> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 15){ level++; } if (level >= 0 && found){ String literal = new String("("); found = ums__strInput.startsWith( literal, ums__pos/8); eposd = ums__pos + literal.length()*8; } if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 16){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^[ \\t]*" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 19){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^[0-9]+" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 21){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^[ \\t]*" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < value> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 23){ level++; } if (level >= 0 && found){ String literal = new String(")"); found = ums__strInput.startsWith( literal, ums__pos/8); eposd = ums__pos + literal.length()*8; } if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ if (level < 0){ break; } found2 = 1; break; } if (level >= 0){ level--; if (level < 0){ return found2; } if (found2==0){ break; } } } /* */ /* < zeroOrMore> */ { int pos1 = ums__pos; int i; int found2 = 0; if (level >= 0 || label == 24){ level++; } for(i=0; i < 3 ; i++){ /* < loopGroup> */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 26){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^[ \\t]+" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 30){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^[0-9]+" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* */ if (level < 0){ break; } pos1 = ums__pos; found2 ++; } if (level >= 0){ level--; ums__pos = pos1; if (level < 0){ if (found2 < 1){ found2 = 0; } return found2; } if (found2 < 0){ break; } } } /* */ /* < choice> */ { int pos1 = ums__pos; int found2 = 0; if (level >= 0 || label == 32){ level++; } /* < choiceGroup> */ if (level >= 0 || label == 33){ level++; } while(found2 == 0){ /* < value> */ /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 36){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^[ \\t]+" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 38){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^#" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ /* < data> */ { boolean found = true; int eposd = epos1; if (level >= 0 || label == 41){ level++; } /* < param> */ if (level >= 0 && found){ Pattern pattern = Pattern.compile( "^.+" ); Matcher matcher = pattern.matcher( ums__strInput.substring(ums__pos/8) ); found = matcher.find(); if(found){ eposd = ums__pos + matcher.end()*8;} } /* */ if (level >= 0){ level--; ums__pos = eposd; if (level < 0){ if(found){ return 1; }else{ return 0; }} if (!found){ break; } } } /* */ if (level < 0){ break; } found2 = 1; break; } if (level >= 0){ level--; if (found2==0){ ums__pos = pos1; } if (level < 0){ return found2; } } /* */ /* < choiceGroup> */ if (level >= 0 || label == 43){ level++; } while(found2 == 0){ /* < value> */ /* */ if (level < 0){ break; } found2 = 1; break; } if (level >= 0){ level--; if (found2==0){ ums__pos = pos1; } if (level < 0){ return found2; } } /* */ if (level >= 0){ level--; if (level < 0){ return found2; } if (found2==0){ break; } } } /* */ /* */ if (level < 0){ break; } found1 = 1; break; } if (level >= 0){ level--; if (level < 0){ return found1; } if (found1==0){ break; } } } /* */ } die("ums:match() - internal error"); return 0; } /* */ /* // Definition of Decoder (mapping decoder) */ /* < ojava:decoderSub> */ int parse(char[] input, int len){ ums__readReset(); ums__input = input; ums__strInput = new String(input); int epos1 = len; ums__pos = 0; /* < group> */ match(4, epos1); { int epos2 = ums__pos; ums__pos = ums__pos0; { /* < ojava:readerSub> */ /* < group> */ match(8, epos2); { int epos3 = ums__pos; ums__pos = ums__pos0; { /* < value> */ match(9, epos3); /* */ /* < data> */ match(10, epos3); /* < param> */ /* */ /* */ /* < data> */ match(13, epos3); /* < param> */ /* */ vect.name = ums__txtRead(ums__pos0, ums__pos); /* */ /* < value> */ match(15, epos3); /* */ /* < data> */ match(16, epos3); /* < param> */ /* */ /* */ /* < data> */ match(19, epos3); /* < param> */ /* */ vect.order = java.lang.Integer.parseInt(ums__txtRead(ums__pos0, ums__pos)); /* */ /* < data> */ match(21, epos3); /* < param> */ /* */ /* */ /* < value> */ match(23, epos3); /* */ } ums__pos = epos3; } /* */ /* < zeroOrMore> */ match(24, epos2); { int epos3 = ums__pos; ums__pos = ums__pos0; int i24, n = ums__found; for(i24=0; i24 < n; i24++ ){ /* < loopGroup> */ /* < data> */ match(26, epos3); /* < param> */ /* */ /* */ /* < data> */ match(30, epos3); /* < param> */ /* */ vect.value[i24] = java.lang.Integer.parseInt(ums__txtRead(ums__pos0, ums__pos)); /* */ /* */ } ums__pos = epos3; } /* */ /* < choice> */ match(32, epos2); { int epos3 = ums__pos; ums__pos = ums__pos0; if( false ){ ; } /* < choiceGroup> */ else if (match(33, epos3) != 0){ int epos4 = ums__pos; ums__pos = ums__pos0; { /* < value> */ hasComment = java.lang.Integer.parseInt("1"); /* */ /* < data> */ match(36, epos4); /* < param> */ /* */ /* */ /* < data> */ match(38, epos4); /* < param> */ /* */ /* */ /* < data> */ match(41, epos4); /* < param> */ /* */ comment = ums__txtRead(ums__pos0, ums__pos); /* */ } ums__pos = epos4; } /* */ /* < choiceGroup> */ else if (match(43, epos3) != 0){ int epos4 = ums__pos; ums__pos = ums__pos0; { /* < value> */ hasComment = java.lang.Integer.parseInt("0"); /* */ } ums__pos = epos4; } /* */ ums__pos = epos3; } /* */ userProgram(); /* */ } ums__pos = epos2; } /* */ return 0; } /* */ }; class Vector { /* // Definition of Member */ String name; int order; int[] value = new int[3]; /* // Declartion of Reader */ };