[Firebug-cvs] fireboard/tools/src/xlisten xpacket.c,1.2,1.3
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2004-07-21 13:49:00
|
Update of /cvsroot/firebug/fireboard/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26449 Modified Files: xpacket.c Log Message: Added a parse table to xlisten. Index: xpacket.c =================================================================== RCS file: /cvsroot/firebug/fireboard/tools/src/xlisten/xpacket.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xpacket.c 21 Jul 2004 13:25:52 -0000 1.2 --- xpacket.c 21 Jul 2004 13:48:51 -0000 1.3 *************** *** 36,40 **** void xpacket_depacketize(unsigned char *tos_packet) { - if (g_datastart > XPACKET_DATASTART) { int i = 0, o = 2; // index and offset while(i < XPACKET_SIZE) { --- 36,39 ---- *************** *** 47,51 **** } } - } } --- 46,49 ---- *************** *** 171,189 **** ! // This typedef eventually gets moved to a header file typedef struct _packetprinter Packetprinter; // Keep this as incomplete type to eliminate unnecessary ! // meddling. The definition can probably be expanded to ! // include more than cooked. struct _packetprinter { unsigned int type; ! void (*print)(XbowSensorboardPacket *packet); }; // Add XTYPE and function for cooking up output anywhere ! // before the last (0,NULL) entry. You're done. ! Packetprinter pp[] = { {XTYPE_MDA500,mda500_print_cooked}, {XTYPE_MDA400,mda400_print_cooked}, --- 169,189 ---- ! // This typedef eventually gets moved to a header file. typedef struct _packetprinter Packetprinter; // Keep this as incomplete type to eliminate unnecessary ! // meddling. The definition can be expanded to ! // include more than cooked. Also, if the arguments change ! // to the print function, it's relatively easy to change. struct _packetprinter { + unsigned int type; ! void (*print_cooked)(XbowSensorboardPacket * packet); }; // Add XTYPE and function for cooking up output anywhere ! // before the last {0,NULL} entry. You're done. ! Packetprinter packet_printer [] = { {XTYPE_MDA500,mda500_print_cooked}, {XTYPE_MDA400,mda400_print_cooked}, *************** *** 201,205 **** ! void xpacket_print_cooked(unsigned char *tos_packet) { XbowSensorboardPacket *packet = xpacket_get_sensor_data(tos_packet); --- 201,205 ---- ! void xpacket_print_cooked_new(unsigned char *tos_packet) { XbowSensorboardPacket *packet = xpacket_get_sensor_data(tos_packet); *************** *** 214,221 **** } ! while (pp[i].type != 0) { ! if (pp[i].type == sensorboard_id) { ! pp[i].print(packet); break; } --- 214,224 ---- } ! // Since the array of printing functions is static ! // data declared above, the while loop has almost the ! // same overhead as the switchyard. ! while (packet_printer[i].type != 0) { ! if (packet_printer[i].type == sensorboard_id) { ! packet_printer[i].print_cooked(packet); break; } *************** *** 232,236 **** * @version 2004/3/11 mturon Intial version */ ! void xpacket_print_cooked_old(unsigned char *tos_packet) { XbowSensorboardPacket *packet = xpacket_get_sensor_data(tos_packet); --- 235,239 ---- * @version 2004/3/11 mturon Intial version */ ! void xpacket_print_cooked(unsigned char *tos_packet) { XbowSensorboardPacket *packet = xpacket_get_sensor_data(tos_packet); *************** *** 318,322 **** case XTYPE_MTS420: ! mts420_print_tabbed(packet); break; --- 321,325 ---- case XTYPE_MTS420: ! //mts420_print_tabbed(packet); break; |