From: Fredrik H. <fr...@us...> - 2004-08-27 14:25:35
|
Update of /cvsroot/rccparser/rccparser/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20601 Modified Files: rcclexer.lpp rccparse.ypp rccparser.h rccptest.cpp v8-sensor_data.txt Log Message: Added support for (ok team_names ...) Index: rcclexer.lpp =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/rcclexer.lpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** rcclexer.lpp 23 Aug 2004 13:28:49 -0000 1.10 --- rcclexer.lpp 27 Aug 2004 14:25:26 -0000 1.11 *************** *** 70,73 **** --- 70,75 ---- see { return SEE_KW; } see_global { return SEE_GLOBAL_KW; } + team_names { return TEAM_NAMES_KW; } + team { return TEAM_KW; } score { return SCORE_KW; } init { return INIT_KW; } *************** *** 79,82 **** --- 81,87 ---- warning { return WARN_KW; } + left { return LEFT_KW; } + right { return RIGHT_KW; } + self { return SELF_KW; } pmode { return P_MODE_KW; } Index: rccparse.ypp =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/rccparse.ypp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** rccparse.ypp 23 Aug 2004 19:24:00 -0000 1.19 --- rccparse.ypp 27 Aug 2004 14:25:26 -0000 1.20 *************** *** 187,190 **** --- 187,192 ---- %token SEE_KW "see" %token SEE_GLOBAL_KW "see_global" + %token TEAM_NAMES_KW "team_names" + %token TEAM_KW "team" %token SCORE_KW "score" %token INIT_KW "init" *************** *** 206,211 **** %token V_MODE_KW "vmode" %token BALL_KW "ball" ! %token L_KW "left" ! %token R_KW "right" %token OUR_KW "our" %token OPP_KW "opp" --- 208,215 ---- %token V_MODE_KW "vmode" %token BALL_KW "ball" ! %token LEFT_KW "left" ! %token RIGHT_KW "right" ! %token L_KW "l" ! %token R_KW "r" %token OUR_KW "our" %token OPP_KW "opp" *************** *** 640,644 **** side: L_KW { PARAM.buildLeftSide(); } ! | R_KW { PARAM.buildRightSide(); } | OUR_KW { PARAM.buildOurSide(); } | OPP_KW { PARAM.buildOppSide(); } --- 644,650 ---- side: L_KW { PARAM.buildLeftSide(); } ! | LEFT_KW { PARAM.buildLeftSide(); } ! | R_KW { PARAM.buildRightSide(); } ! | RIGHT_KW { PARAM.buildRightSide(); } | OUR_KW { PARAM.buildOurSide(); } | OPP_KW { PARAM.buildOppSide(); } *************** *** 1316,1319 **** --- 1322,1327 ---- ref_audio: LP HEAR_KW INT REF_KW play_mode RP { PARAM.buildRefAudio( getInt( $3 ) ); } + | LP HEAR_KW REF_KW INT play_mode RP + { PARAM.buildRefAudio( getInt( $3 ) ); } | LP HEAR_KW INT REF_KW side INT RP { *************** *** 1388,1392 **** ; ! error_msg: LP CANT_KW INIT_KW RP { PARAM.buildCantReconnect(); } | LP ERROR_KW INIT_KW RP --- 1396,1411 ---- ; ! ! team: LP TEAM_KW side STR RP ! { PARAM.buildTeamName( getString( $4 ) ); } ! ; ! ! teams: /* empty */ ! | team ! | team team ! ; ! ! ! error_msg: LP CANT_KW INIT_KW RP { PARAM.buildCantReconnect(); } | LP ERROR_KW INIT_KW RP *************** *** 1466,1469 **** --- 1485,1490 ---- | LP OK_KW SAY_KW RP { PARAM.buildSayOK( ); } + | LP OK_KW TEAM_NAMES_KW teams RP + { PARAM.buildTeamNamesOK( ); } | LP OK_KW STR RP { PARAM.buildUnknownOK( getString( $3 ) ); } Index: rccparser.h =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/rccparser.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** rccparser.h 23 Aug 2004 19:24:00 -0000 1.41 --- rccparser.h 27 Aug 2004 14:25:26 -0000 1.42 *************** *** 1611,1614 **** --- 1611,1618 ---- void + buildTeamNamesOK( ) + { M_parser.doBuildTeamNamesOK( ); } + + void buildChangePlayerTypeOK( int unum, int type ) { M_parser.doBuildChangePlayerTypeOK( unum, type ); } *************** *** 8600,8603 **** --- 8604,8625 ---- doBuildSayOK( ) {} + /** This function is called after parsing a \c team_names OK + * message. + * + * Override this function in your subclass to handle + * \c team_names OK messages. + * + * \pre The client is an online or offline coach + * + * \pre The client sent a \c team_names command + * + * \pre An entire \c team_names OK + * message has been parsed. + * + */ + virtual + void + doBuildTeamNamesOK( ) { std::cout << "HEJ!" << std::endl; } + /** This function is called after parsing an \c change_player_type * OK message Index: rccptest.cpp =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/rccptest.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** rccptest.cpp 24 Mar 2003 18:15:22 -0000 1.5 --- rccptest.cpp 27 Aug 2004 14:25:26 -0000 1.6 *************** *** 2080,2083 **** --- 2080,2111 ---- virtual void + doBuildTeamNamesOK( ) + { + std::ostringstream strm; + strm << "(ok team_names"; + if( !M_stack.empty() ) + { + std::string team_name1 = M_stack.top(); + team_name1 = team_name1.substr(1, team_name1.size()-2); + M_stack.pop(); + std::string side1 = M_stack.top(); + M_stack.pop(); + if ( !M_stack.empty() ) + { + std::string team_name2 = M_stack.top(); + team_name2 = team_name2.substr(1, team_name2.size()-2); + M_stack.pop(); + std::string side2 = M_stack.top(); + M_stack.pop(); + strm << " (team " << side2 << " " << team_name2 << ")"; + } + strm << " (team " << side1 << " " << team_name1 << ")"; + } + strm << ")"; + M_stack.push( strm.str() ); + } + + virtual + void doBuildChangePlayerTypeOK( int unum, int type ) { Index: v8-sensor_data.txt =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/v8-sensor_data.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** v8-sensor_data.txt 28 Sep 2002 14:13:58 -0000 1.1 --- v8-sensor_data.txt 27 Aug 2004 14:25:26 -0000 1.2 *************** *** 163,164 **** --- 163,170 ---- (fullstate 29 (pmode kick_off_l) (vmode high normal) (count 0 0 0 0 0 0 0 0) (arm (movable 0) (expires 0) (target 0 0) (count 0)) (score 0 0) ((b) 0 0 0 0) ((p l 1 0) -3 -37 0 0 0 0 (stamina 4000 1 1))) (see 29 ((g r) 66.7 34) ((f r t) 55.7 3) ((f g r b) 70.8 38) ((f g r t) 62.8 28) ((f p r c) 53.5 43) ((f p r t) 42.5 23) ((f t 0) 3.6 -34 0 0) ((f t r 10) 13.2 -9 0 0) ((f t r 20) 23.1 -5) ((f t r 30) 33.1 -3) ((f t r 40) 42.9 -3) ((f t r 50) 53 -2) ((f r 0) 70.8 31) ((f r t 10) 66 24) ((f r t 20) 62.8 16) ((f r t 30) 60.9 7) ((f r b 10) 76.7 38) ((f r b 20) 83.1 43)) + + (ok team_names) + + (ok team_names (team l RoboSoc)) + + (ok team_names (team l RoboSoc) (team r BobbySoc)) |