cutil/debug.cpp

Go to the documentation of this file.
00001 
00020 /*----------------------------------------------------------------------
00021               I n c l u d e s
00022 ----------------------------------------------------------------------*/
00023 #include <stdio.h>
00024 #include "debug.h"
00025 #include "callcpp.h"
00026 
00027 /*----------------------------------------------------------------------
00028               V a r i a b l e s
00029 ----------------------------------------------------------------------*/
00030 MENU_ITEM menu_table[NUM_MENUS][NUM_MENU_ITEMS];
00031 
00032 /*----------------------------------------------------------------------
00033               F u n c t i o n s
00034 ----------------------------------------------------------------------*/
00038 int set_float_value(const char *message, float *variable) { 
00039   char this_string[CHARS_PER_LINE];
00040 
00041   cprintf ("%s (%7.5f) ? ", message, *variable);
00042   fflush(stdout); 
00043 
00044   if (fgets (this_string, CHARS_PER_LINE, stdin) == NULL)
00045     return (1);
00046 
00047   if (fgets (this_string, CHARS_PER_LINE, stdin) != NULL) {
00048     sscanf (this_string, "%f", variable);
00049     cprintf ("%s = %7.5f\n", message, *variable);
00050   }
00051   return (1);
00052 }
00053 
00054 
00058 int set_int_value(const char *message, int *variable) { 
00059   char this_string[CHARS_PER_LINE];
00060 
00061   cprintf ("%s (%d) ? ", message, *variable);
00062   fflush(stdout); 
00063 
00064   if (fgets (this_string, CHARS_PER_LINE, stdin) == NULL)
00065     return (1);
00066 
00067   if (fgets (this_string, CHARS_PER_LINE, stdin) != NULL) {
00068     sscanf (this_string, "%d", variable);
00069     cprintf ("%s = %d\n", message, *variable);
00070   }
00071   return (1);
00072 }
00073 
00074 
00079 void make_menu_item(int menu,
00080                     int menu_item,
00081                     const char *menu_string,
00082                     int_void menu_funct) {
00083   menu_table[menu][menu_item].menu_string = menu_string;
00084   menu_table[menu][menu_item].menu_function = (void_proc) menu_funct;
00085 }

Generated on Wed Feb 28 19:49:10 2007 for Tesseract by  doxygen 1.5.1