#include "variables.h"
#include "callcpp.h"
#include <stdio.h>
Go to the source code of this file.
#define float_value | ( | proc, | |||
string, | |||||
variable, | |||||
default | ) |
Value:
\ float variable = default; \ \ int proc () \ { \ return (set_float_value (string, &variable)); \ } \
#define handle_menu | ( | menu, | |||
handle_menu_x | ) |
Value:
\ int handle_menu_x () \ { \ int x; \ cprintf ("\t 0. Continue\n"); \ for (x = 0; x < NUM_MENU_ITEMS; x++) { \ if (menu_table[menu][x].menu_string) \ cprintf ("\t%2d. %s\n", x, menu_table[menu][x].menu_string); \ } \ \ scanf ("%d", &x); \ \ if (x == 0) return (0); \ if ((0 < x && x < NUM_MENU_ITEMS) && \ (menu_table[menu][x].menu_function)) { \ (*menu_table[menu][x].menu_function) ();\ return (1); \ } \ else { \ cprintf ("Bad menu selection"); \ return (0); \ } \ } \
#define int_value | ( | proc, | |||
string, | |||||
variable, | |||||
default | ) |
Value:
\ int variable = default; \ \ int proc () \ { \ return (set_int_value (string, &variable)); \ } \
#define make_float_const | ( | name, | |||
default, | |||||
installer | ) |
Value:
\ float name = default; \ \ void installer () \ { \ float_variable (name, #name, default); \ } \
#define make_float_var | ( | name, | |||
default, | |||||
installer, | |||||
menu, | |||||
menuitem, | |||||
menufunct, | |||||
menustring | ) |
Value:
\ float_value (menufunct, menustring, name, default); \ \ void installer () \ { \ float_variable (name, #name, default); \ make_menu_item (menu, menuitem, menustring, menufunct); \ } \
#define make_int_const | ( | name, | |||
default, | |||||
installer | ) |
Value:
\ int name = default; \ \ void installer () \ { \ int_variable (name, #name, default); \ } \
#define make_int_var | ( | name, | |||
default, | |||||
installer, | |||||
menu, | |||||
menuitem, | |||||
menufunct, | |||||
menustring | ) |
Value:
\ int_value (menufunct, menustring, name, default); \ \ void installer () \ { \ int_variable (name, #name, default); \ make_menu_item (menu, menuitem, menustring, menufunct); \ } \
#define make_toggle_const | ( | name, | |||
default, | |||||
installer | ) |
Value:
\ int name = default; \ \ void installer () \ { \ int_variable (name, #name, default); \ } \
#define make_toggle_var | ( | name, | |||
default, | |||||
installer, | |||||
menu, | |||||
menuitem, | |||||
menufunct, | |||||
menustring | ) |
Value:
\ toggle_value (menufunct, menustring, name, default);\ \ void installer () \ { \ int_variable (name, #name, default); \ make_menu_item (menu, menuitem, menustring, menufunct); \ } \
#define toggle_value | ( | proc, | |||
string, | |||||
variable, | |||||
default | ) |
void make_menu_item | ( | int | menu, | |
int | menu_item, | |||
const char * | menu_string, | |||
int_void | menu_funct | |||
) |
Create an entry in the menu handler table that will create a menu entry; which, when selected, will invoke the requested function.
Definition at line 79 of file debug.cpp.
References MENU_ITEM::menu_function, MENU_ITEM::menu_string, and menu_table.
00082 { 00083 menu_table[menu][menu_item].menu_string = menu_string; 00084 menu_table[menu][menu_item].menu_function = (void_proc) menu_funct; 00085 }
int set_float_value | ( | const char * | message, | |
float * | variable | |||
) |
Set the value of a floating point variable from the break handler.
Definition at line 38 of file debug.cpp.
References CHARS_PER_LINE, cprintf(), and NULL.
00038 { 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 }
int set_int_value | ( | const char * | message, | |
int * | variable | |||
) |
Set the value of a floating point variable from the break handler.
Definition at line 58 of file debug.cpp.
References CHARS_PER_LINE, cprintf(), and NULL.
00058 { 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 }
MENU_ITEM menu_table[NUM_MENUS][NUM_MENU_ITEMS] |
* (c) Copyright 1989, Hewlett-Packard Company. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
Definition at line 30 of file debug.cpp.
Referenced by make_menu_item().