??? 03/15/05 08:34 Read: times |
#89701 - as a starter... Responding to: ???'s previous message |
As a "quick fix," avoiding the need to modify every one of your hundred(!) individual character functions, you could try something like: unsigned char print_character( unsigned char code_to_print ) { switch( code_to_print ) { case code_A: A(); return WIDTH_OF_A; case code_B: B(); return WIDTH_OF_B; case code_C: C(); return WIDTH_OF_C; case code_D: D(); return WIDTH_OF_D; etc, etc,... default: /* invalid code - print nothing */ return 0; } // switch } // print_charactereven with this, it should be immediately obvious why having an individual function for each character is a Bad Idea! Note: The above is somewhat unstructured, in having multiple returns in the switch. Purists would do it like this: unsigned char print_character( unsigned char code_to_print ) { unsigned char width_just_printed; switch( code_to_print ) { case code_A: A(); width_just_printed = WIDTH_OF_A; break; case code_B: B(); width_just_printed = WIDTH_OF_B; break; case code_C: C(); width_just_printed = WIDTH_OF_C; break; case code_D: D(); width_just_printed = WIDTH_OF_D; break; etc, etc,... default: /* invalid code - print nothing */ width_just_printed = 0; break; } // switch return width_just_printed; } // print_character |