From 457f7ea4bdf729ec24563b27426184cb031a3d56 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Thu, 6 Mar 2008 21:15:40 +0000 Subject: [PATCH] coding style changes --- bochs/gui/rfb.cc | 33 +-- bochs/gui/sdl.cc | 20 +- bochs/gui/svga.cc | 31 +- bochs/gui/term.cc | 622 ++++++++++++++++++---------------------- bochs/gui/textconfig.cc | 47 ++- 5 files changed, 323 insertions(+), 430 deletions(-) diff --git a/bochs/gui/rfb.cc b/bochs/gui/rfb.cc index 6b39c8e40..8bc3b1196 100644 --- a/bochs/gui/rfb.cc +++ b/bochs/gui/rfb.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: rfb.cc,v 1.56 2008-02-15 22:05:40 sshwarts Exp $ +// $Id: rfb.cc,v 1.57 2008-03-06 21:15:40 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2000 Psyon.Org! @@ -662,7 +662,6 @@ void bx_rfb_gui_c::handle_events(void) rfbUpdateRegion.updated = false; } - // ::FLUSH() // // Called periodically, requesting that the gui code flush all pending @@ -672,7 +671,6 @@ void bx_rfb_gui_c::flush(void) { } - // ::CLEAR_SCREEN() // // Called to request that the VGA region is cleared. Don't @@ -682,8 +680,6 @@ void bx_rfb_gui_c::clear_screen(void) memset(&rfbScreen[rfbWindowX * rfbHeaderbarY], 0, rfbWindowX * rfbDimensionY); } - - // ::TEXT_UPDATE() // // Called in a VGA text mode, to update the screen with @@ -782,19 +778,16 @@ void bx_rfb_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, unsigned long c rfbCursorY = cursor_y; } - int -bx_rfb_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) +int bx_rfb_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) { return 0; } - int -bx_rfb_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len) +int bx_rfb_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len) { return 0; } - // ::PALETTE_CHANGE() // // Allocate a color in the native GUI, for this color, and put @@ -808,7 +801,6 @@ bx_bool bx_rfb_gui_c::palette_change(unsigned index, unsigned red, unsigned gree return(1); } - // ::GRAPHICS_TILE_UPDATE() // // Called to request that a tile of graphics be drawn to the @@ -833,9 +825,7 @@ void bx_rfb_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0) rfbUpdateRegion.updated = true; } - - bx_svga_tileinfo_t * -bx_rfb_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info) +bx_svga_tileinfo_t *bx_rfb_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info) { if (!info) { info = (bx_svga_tileinfo_t *)malloc(sizeof(bx_svga_tileinfo_t)); @@ -858,8 +848,7 @@ bx_rfb_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info) return info; } - Bit8u * -bx_rfb_gui_c::graphics_tile_get(unsigned x0, unsigned y0, +Bit8u *bx_rfb_gui_c::graphics_tile_get(unsigned x0, unsigned y0, unsigned *w, unsigned *h) { if (x0+rfbTileX > rfbDimensionX) { @@ -879,8 +868,7 @@ bx_rfb_gui_c::graphics_tile_get(unsigned x0, unsigned y0, return (Bit8u *)rfbScreen + (rfbHeaderbarY + y0) * rfbWindowX + x0; } - void -bx_rfb_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0, +void bx_rfb_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0, unsigned w, unsigned h) { if(x0 < rfbUpdateRegion.x) rfbUpdateRegion.x = x0; @@ -903,8 +891,7 @@ bx_rfb_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0, // fwidth : new VGA character width in text mode // bpp : bits per pixel in graphics mode - void -bx_rfb_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp) +void bx_rfb_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp) { if (bpp > 8) { BX_PANIC(("%d bpp graphics mode not supported yet", bpp)); @@ -1739,13 +1726,11 @@ void rfbMouseMove(int x, int y, int bmask) } } - void -bx_rfb_gui_c::mouse_enabled_changed_specific (bx_bool val) +void bx_rfb_gui_c::mouse_enabled_changed_specific (bx_bool val) { } - void -bx_rfb_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp) +void bx_rfb_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp) { *xres = BX_RFB_MAX_XDIM; *yres = BX_RFB_MAX_YDIM; diff --git a/bochs/gui/sdl.cc b/bochs/gui/sdl.cc index a4ef99327..e479e3ae0 100644 --- a/bochs/gui/sdl.cc +++ b/bochs/gui/sdl.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: sdl.cc,v 1.73 2008-02-15 22:05:40 sshwarts Exp $ +// $Id: sdl.cc,v 1.74 2008-03-06 21:15:40 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -49,10 +49,10 @@ class bx_sdl_gui_c : public bx_gui_c { public: - bx_sdl_gui_c (void); + bx_sdl_gui_c(void); DECLARE_GUI_VIRTUAL_METHODS() DECLARE_GUI_NEW_VIRTUAL_METHODS() - virtual void set_display_mode (disp_mode_t newmode); + virtual void set_display_mode(disp_mode_t newmode); virtual void statusbar_setitem(int element, bx_bool active); #if BX_SHOW_IPS virtual void show_ips(Bit32u ips_count); @@ -698,8 +698,7 @@ void bx_sdl_gui_c::graphics_tile_update(Bit8u *snapshot, } } - bx_svga_tileinfo_t * -bx_sdl_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info) +bx_svga_tileinfo_t *bx_sdl_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info) { if (!info) { info = (bx_svga_tileinfo_t *)malloc(sizeof(bx_svga_tileinfo_t)); @@ -740,8 +739,7 @@ bx_sdl_gui_c::graphics_tile_info(bx_svga_tileinfo_t *info) return info; } - Bit8u * -bx_sdl_gui_c::graphics_tile_get(unsigned x0, unsigned y0, +Bit8u *bx_sdl_gui_c::graphics_tile_get(unsigned x0, unsigned y0, unsigned *w, unsigned *h) { if (x0+tilewidth > res_x) { @@ -770,8 +768,7 @@ bx_sdl_gui_c::graphics_tile_get(unsigned x0, unsigned y0, } } - void -bx_sdl_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0, +void bx_sdl_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0, unsigned w, unsigned h) { } @@ -1360,7 +1357,6 @@ unsigned bx_sdl_gui_c::headerbar_bitmap( return hb_index; } - void bx_sdl_gui_c::replace_bitmap( unsigned hbar_id, unsigned bmap_id) @@ -1473,7 +1469,6 @@ void bx_sdl_gui_c::show_headerbar(void) } } - void bx_sdl_gui_c::mouse_enabled_changed_specific (bx_bool val) { if(val == 1) @@ -1551,8 +1546,7 @@ static Bit32u convertStringToSDLKey (const char *string) return BX_KEYMAP_UNKNOWN; } -void -bx_sdl_gui_c::set_display_mode (disp_mode_t newmode) +void bx_sdl_gui_c::set_display_mode(disp_mode_t newmode) { // if no mode change, do nothing. if (disp_mode == newmode) return; diff --git a/bochs/gui/svga.cc b/bochs/gui/svga.cc index e06958571..2e130f106 100644 --- a/bochs/gui/svga.cc +++ b/bochs/gui/svga.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: svga.cc,v 1.16 2008-02-15 22:05:40 sshwarts Exp $ +// $Id: svga.cc,v 1.17 2008-03-06 21:15:40 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // This library is free software; you can redistribute it and/or @@ -90,7 +90,7 @@ void create_vga_font() } } -bx_svga_gui_c::bx_svga_gui_c () +bx_svga_gui_c::bx_svga_gui_c() { put("SVGA"); } @@ -230,23 +230,17 @@ void bx_svga_gui_c::text_update( prev_cursor_y = cursor_y; } - int -bx_svga_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) +int bx_svga_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) { return 0; } - int -bx_svga_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len) +int bx_svga_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len) { return 0; } - -void bx_svga_gui_c::graphics_tile_update( - Bit8u *snapshot, - unsigned x, - unsigned y) +void bx_svga_gui_c::graphics_tile_update(Bit8u *snapshot, unsigned x, unsigned y) { if ((y + tileheight) > res_y) { gl_putbox(x, y, tilewidth, (res_y - y), snapshot); @@ -543,14 +537,10 @@ unsigned bx_svga_gui_c::headerbar_bitmap( return 0; } - -void bx_svga_gui_c::replace_bitmap( - unsigned hbar_id, - unsigned bmap_id) +void bx_svga_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id) { } - void bx_svga_gui_c::show_headerbar(void) { } @@ -567,13 +557,12 @@ void headerbar_click(int x) void bx_svga_gui_c::exit(void) { - vga_setmode(TEXT); - keyboard_close(); - mouse_close(); + vga_setmode(TEXT); + keyboard_close(); + mouse_close(); } -void -bx_svga_gui_c::set_display_mode (disp_mode_t newmode) +void bx_svga_gui_c::set_display_mode (disp_mode_t newmode) { // if no mode change, do nothing. if (disp_mode == newmode) return; diff --git a/bochs/gui/term.cc b/bochs/gui/term.cc index 0c8a54eeb..d160cd18d 100644 --- a/bochs/gui/term.cc +++ b/bochs/gui/term.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: term.cc,v 1.39 2008-02-05 22:57:41 sshwarts Exp $ +// $Id: term.cc,v 1.40 2008-03-06 21:15:40 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2000 MandrakeSoft S.A. @@ -44,15 +44,16 @@ extern "C" { class bx_term_gui_c : public bx_gui_c { public: - bx_term_gui_c (void) {} + bx_term_gui_c(void) {} DECLARE_GUI_VIRTUAL_METHODS() #if BX_USE_IDLE_HACK virtual void sim_is_idle(void); #endif - virtual Bit32u get_sighandler_mask (); + virtual Bit32u get_sighandler_mask(); + // called when registered signal arrives - virtual void sighandler (int sig); + virtual void sighandler(int sig); }; // declare one instance of the gui object and call macro to insert the @@ -95,54 +96,49 @@ static chtype vga_to_term[128] = { 0xb0, ' ', ' ', ' ', ' ', 0xb2, ' ', ' ' }; -static void -do_scan(int key_event, int shift, int ctrl, int alt) +static void do_scan(int key_event, int shift, int ctrl, int alt) { - /* XXX At some point, cache alt/ctrl/shift so only when the state - changes do we simulate a press or release, to cut down on - keyboard input to the simulated machine */ + /* At some point, cache alt/ctrl/shift so only when the state + changes do we simulate a press or release, to cut down on + keyboard input to the simulated machine */ - BX_DEBUG(("key_event %d/0x%x %s%s%s", - key_event,key_event, - shift?"(shift)":"", - ctrl?"(ctrl)":"", - alt?"(alt)":"")); - if(shift) - DEV_kbd_gen_scancode(BX_KEY_SHIFT_L); - if(ctrl) - DEV_kbd_gen_scancode(BX_KEY_CTRL_L); - if(alt) - DEV_kbd_gen_scancode(BX_KEY_ALT_L); - DEV_kbd_gen_scancode(key_event); - key_event |= BX_KEY_RELEASED; + BX_DEBUG(("key_event %d/0x%x %s%s%s", key_event, key_event, + shift ? "(shift)" : "", + ctrl ? "(ctrl)" : "", + alt ? "(alt)" : "")); + if(shift) + DEV_kbd_gen_scancode(BX_KEY_SHIFT_L); + if(ctrl) + DEV_kbd_gen_scancode(BX_KEY_CTRL_L); + if(alt) + DEV_kbd_gen_scancode(BX_KEY_ALT_L); + DEV_kbd_gen_scancode(key_event); + key_event |= BX_KEY_RELEASED; - DEV_kbd_gen_scancode(key_event); - if(alt) - DEV_kbd_gen_scancode(BX_KEY_ALT_L|BX_KEY_RELEASED); - if(ctrl) - DEV_kbd_gen_scancode(BX_KEY_CTRL_L|BX_KEY_RELEASED); - if(shift) - DEV_kbd_gen_scancode(BX_KEY_SHIFT_L|BX_KEY_RELEASED); + DEV_kbd_gen_scancode(key_event); + if(alt) + DEV_kbd_gen_scancode(BX_KEY_ALT_L|BX_KEY_RELEASED); + if(ctrl) + DEV_kbd_gen_scancode(BX_KEY_CTRL_L|BX_KEY_RELEASED); + if(shift) + DEV_kbd_gen_scancode(BX_KEY_SHIFT_L|BX_KEY_RELEASED); } -Bit32u -bx_term_gui_c::get_sighandler_mask () +Bit32u bx_term_gui_c::get_sighandler_mask() { - return - (1<set_log_action(LOGLEV_PANIC, ACT_FATAL); + // logfile should be different from stderr, otherwise terminal mode + // really ends up having fun + if (!strcmp(SIM->get_param_string(BXPN_LOG_FILENAME)->getptr(), "-")) + BX_PANIC(("cannot log to stderr in term mode")); - // the ask menu causes trouble - io->set_log_action(LOGLEV_PANIC, ACT_FATAL); - // logfile should be different from stderr, otherwise terminal mode - // really ends up having fun - if (!strcmp(SIM->get_param_string(BXPN_LOG_FILENAME)->getptr(), "-")) - BX_PANIC(("cannot log to stderr in term mode")); - - initscr(); - start_color(); - cbreak(); - curs_set(2); - keypad(stdscr,TRUE); - nodelay(stdscr, TRUE); - noecho(); + initscr(); + start_color(); + cbreak(); + curs_set(2); + keypad(stdscr,TRUE); + nodelay(stdscr, TRUE); + noecho(); #if BX_HAVE_COLOR_SET - if (has_colors()) { - for (int i=0; iget_param_bool(BXPN_PRIVATE_COLORMAP)->get()) BX_ERROR(("WARNING: private_colormap option ignored.")); + initialized = 1; } - - -void -do_char(int character,int alt) +void do_char(int character, int alt) { - switch (character) { - // control keys - case 0x9: do_scan(BX_KEY_TAB,0,0,alt); break; - case 0xa: do_scan(BX_KEY_KP_ENTER,0,0,alt); break; - case 0xd: do_scan(BX_KEY_KP_DELETE,0,0,alt); break; - case 0x1: do_scan(BX_KEY_A,0,1,alt); break; - case 0x2: do_scan(BX_KEY_B,0,1,alt); break; - case 0x3: do_scan(BX_KEY_C,0,1,alt); break; - case 0x4: do_scan(BX_KEY_D,0,1,alt); break; - case 0x5: do_scan(BX_KEY_E,0,1,alt); break; - case 0x6: do_scan(BX_KEY_F,0,1,alt); break; - case 0x7: do_scan(BX_KEY_G,0,1,alt); break; - case 0x8: do_scan(BX_KEY_H,0,1,alt); break; - case 0xb: do_scan(BX_KEY_K,0,1,alt); break; - case 0xc: do_scan(BX_KEY_L,0,1,alt); break; - case 0xe: do_scan(BX_KEY_N,0,1,alt); break; - case 0xf: do_scan(BX_KEY_O,0,1,alt); break; - case 0x10: do_scan(BX_KEY_P,0,1,alt); break; - case 0x11: do_scan(BX_KEY_Q,0,1,alt); break; - case 0x12: do_scan(BX_KEY_R,0,1,alt); break; - case 0x13: do_scan(BX_KEY_S,0,1,alt); break; - case 0x14: do_scan(BX_KEY_T,0,1,alt); break; - case 0x15: do_scan(BX_KEY_U,0,1,alt); break; - case 0x16: do_scan(BX_KEY_V,0,1,alt); break; - case 0x17: do_scan(BX_KEY_W,0,1,alt); break; - case 0x18: do_scan(BX_KEY_X,0,1,alt); break; - case 0x19: do_scan(BX_KEY_Y,0,1,alt); break; - case 0x1a: do_scan(BX_KEY_Z,0,1,alt); break; - case 0x20: do_scan(BX_KEY_SPACE,0,0,alt); break; - case 0x107: do_scan(BX_KEY_BACKSPACE,0,0,alt); break; - case 0x102: do_scan(BX_KEY_DOWN,0,0,alt); break; - case 0x103: do_scan(BX_KEY_UP,0,0,alt); break; - case 0x104: do_scan(BX_KEY_LEFT,0,0,alt); break; - case 0x105: do_scan(BX_KEY_RIGHT,0,0,alt); break; - case 0x152: do_scan(BX_KEY_PAGE_DOWN,0,0,alt); break; - case 0x153: do_scan(BX_KEY_PAGE_UP,0,0,alt); break; - case 0x106: do_scan(BX_KEY_HOME,0,0,alt); break; - case 0x168: do_scan(BX_KEY_END,0,0,alt); break; - case 0x14b: do_scan(BX_KEY_INSERT,0,0,alt); break; - case 0x7f: do_scan(BX_KEY_DELETE,0,0,alt); break; - case 0x1b: do_scan(BX_KEY_ESC,0,0,alt); break; - case '!': do_scan(BX_KEY_1,1,0,alt); break; - case '\'': do_scan(BX_KEY_SINGLE_QUOTE,0,0,alt); break; - case '#': do_scan(BX_KEY_3,1,0,alt); break; - case '$': do_scan(BX_KEY_4,1,0,alt); break; - case '%': do_scan(BX_KEY_5,1,0,alt); break; - case '^': do_scan(BX_KEY_6,1,0,alt); break; - case '&': do_scan(BX_KEY_7,1,0,alt); break; - case '"': do_scan(BX_KEY_SINGLE_QUOTE,1,0,alt); break; + switch (character) { + // control keys + case 0x9: do_scan(BX_KEY_TAB,0,0,alt); break; + case 0xa: do_scan(BX_KEY_KP_ENTER,0,0,alt); break; + case 0xd: do_scan(BX_KEY_KP_DELETE,0,0,alt); break; + case 0x1: do_scan(BX_KEY_A,0,1,alt); break; + case 0x2: do_scan(BX_KEY_B,0,1,alt); break; + case 0x3: do_scan(BX_KEY_C,0,1,alt); break; + case 0x4: do_scan(BX_KEY_D,0,1,alt); break; + case 0x5: do_scan(BX_KEY_E,0,1,alt); break; + case 0x6: do_scan(BX_KEY_F,0,1,alt); break; + case 0x7: do_scan(BX_KEY_G,0,1,alt); break; + case 0x8: do_scan(BX_KEY_H,0,1,alt); break; + case 0xb: do_scan(BX_KEY_K,0,1,alt); break; + case 0xc: do_scan(BX_KEY_L,0,1,alt); break; + case 0xe: do_scan(BX_KEY_N,0,1,alt); break; + case 0xf: do_scan(BX_KEY_O,0,1,alt); break; + case 0x10: do_scan(BX_KEY_P,0,1,alt); break; + case 0x11: do_scan(BX_KEY_Q,0,1,alt); break; + case 0x12: do_scan(BX_KEY_R,0,1,alt); break; + case 0x13: do_scan(BX_KEY_S,0,1,alt); break; + case 0x14: do_scan(BX_KEY_T,0,1,alt); break; + case 0x15: do_scan(BX_KEY_U,0,1,alt); break; + case 0x16: do_scan(BX_KEY_V,0,1,alt); break; + case 0x17: do_scan(BX_KEY_W,0,1,alt); break; + case 0x18: do_scan(BX_KEY_X,0,1,alt); break; + case 0x19: do_scan(BX_KEY_Y,0,1,alt); break; + case 0x1a: do_scan(BX_KEY_Z,0,1,alt); break; + case 0x20: do_scan(BX_KEY_SPACE,0,0,alt); break; + case 0x107: do_scan(BX_KEY_BACKSPACE,0,0,alt); break; + case 0x102: do_scan(BX_KEY_DOWN,0,0,alt); break; + case 0x103: do_scan(BX_KEY_UP,0,0,alt); break; + case 0x104: do_scan(BX_KEY_LEFT,0,0,alt); break; + case 0x105: do_scan(BX_KEY_RIGHT,0,0,alt); break; + case 0x152: do_scan(BX_KEY_PAGE_DOWN,0,0,alt); break; + case 0x153: do_scan(BX_KEY_PAGE_UP,0,0,alt); break; + case 0x106: do_scan(BX_KEY_HOME,0,0,alt); break; + case 0x168: do_scan(BX_KEY_END,0,0,alt); break; + case 0x14b: do_scan(BX_KEY_INSERT,0,0,alt); break; + case 0x7f: do_scan(BX_KEY_DELETE,0,0,alt); break; + case 0x1b: do_scan(BX_KEY_ESC,0,0,alt); break; + case '!': do_scan(BX_KEY_1,1,0,alt); break; + case '\'': do_scan(BX_KEY_SINGLE_QUOTE,0,0,alt); break; + case '#': do_scan(BX_KEY_3,1,0,alt); break; + case '$': do_scan(BX_KEY_4,1,0,alt); break; + case '%': do_scan(BX_KEY_5,1,0,alt); break; + case '^': do_scan(BX_KEY_6,1,0,alt); break; + case '&': do_scan(BX_KEY_7,1,0,alt); break; + case '"': do_scan(BX_KEY_SINGLE_QUOTE,1,0,alt); break; - // ()*+,-./ - case '(': do_scan(BX_KEY_9,1,0,alt); break; - case ')': do_scan(BX_KEY_0,1,0,alt); break; - case '*': do_scan(BX_KEY_8,1,0,alt); break; - case '+': do_scan(BX_KEY_EQUALS,1,0,alt); break; - case ',': do_scan(BX_KEY_COMMA,0,0,alt); break; - case '-': do_scan(BX_KEY_MINUS,0,0,alt); break; - case '.': do_scan(BX_KEY_PERIOD,0,0,alt); break; - case '/': do_scan(BX_KEY_SLASH,0,0,alt); break; + // ()*+,-./ + case '(': do_scan(BX_KEY_9,1,0,alt); break; + case ')': do_scan(BX_KEY_0,1,0,alt); break; + case '*': do_scan(BX_KEY_8,1,0,alt); break; + case '+': do_scan(BX_KEY_EQUALS,1,0,alt); break; + case ',': do_scan(BX_KEY_COMMA,0,0,alt); break; + case '-': do_scan(BX_KEY_MINUS,0,0,alt); break; + case '.': do_scan(BX_KEY_PERIOD,0,0,alt); break; + case '/': do_scan(BX_KEY_SLASH,0,0,alt); break; - // 01234567 - case '0': do_scan(BX_KEY_0,0,0,alt); break; - case '1': do_scan(BX_KEY_1,0,0,alt); break; - case '2': do_scan(BX_KEY_2,0,0,alt); break; - case '3': do_scan(BX_KEY_3,0,0,alt); break; - case '4': do_scan(BX_KEY_4,0,0,alt); break; - case '5': do_scan(BX_KEY_5,0,0,alt); break; - case '6': do_scan(BX_KEY_6,0,0,alt); break; - case '7': do_scan(BX_KEY_7,0,0,alt); break; + // 01234567 + case '0': do_scan(BX_KEY_0,0,0,alt); break; + case '1': do_scan(BX_KEY_1,0,0,alt); break; + case '2': do_scan(BX_KEY_2,0,0,alt); break; + case '3': do_scan(BX_KEY_3,0,0,alt); break; + case '4': do_scan(BX_KEY_4,0,0,alt); break; + case '5': do_scan(BX_KEY_5,0,0,alt); break; + case '6': do_scan(BX_KEY_6,0,0,alt); break; + case '7': do_scan(BX_KEY_7,0,0,alt); break; - // 89:;<=>? - case '8': do_scan(BX_KEY_8,0,0,alt); break; - case '9': do_scan(BX_KEY_9,0,0,alt); break; - case ':': do_scan(BX_KEY_SEMICOLON,1,0,alt); break; - case ';': do_scan(BX_KEY_SEMICOLON,0,0,alt); break; - case '<': do_scan(BX_KEY_COMMA,1,0,alt); break; - case '=': do_scan(BX_KEY_EQUALS,0,0,alt); break; - case '>': do_scan(BX_KEY_PERIOD,1,0,alt); break; - case '?': do_scan(BX_KEY_SLASH,1,0,alt); break; + // 89:;<=>? + case '8': do_scan(BX_KEY_8,0,0,alt); break; + case '9': do_scan(BX_KEY_9,0,0,alt); break; + case ':': do_scan(BX_KEY_SEMICOLON,1,0,alt); break; + case ';': do_scan(BX_KEY_SEMICOLON,0,0,alt); break; + case '<': do_scan(BX_KEY_COMMA,1,0,alt); break; + case '=': do_scan(BX_KEY_EQUALS,0,0,alt); break; + case '>': do_scan(BX_KEY_PERIOD,1,0,alt); break; + case '?': do_scan(BX_KEY_SLASH,1,0,alt); break; - // @ABCDEFG - case '@': do_scan(BX_KEY_2,1,0,alt); break; - case 'A': do_scan(BX_KEY_A,1,0,alt); break; - case 'B': do_scan(BX_KEY_B,1,0,alt); break; - case 'C': do_scan(BX_KEY_C,1,0,alt); break; - case 'D': do_scan(BX_KEY_D,1,0,alt); break; - case 'E': do_scan(BX_KEY_E,1,0,alt); break; - case 'F': do_scan(BX_KEY_F,1,0,alt); break; - case 'G': do_scan(BX_KEY_G,1,0,alt); break; + // @ABCDEFG + case '@': do_scan(BX_KEY_2,1,0,alt); break; + case 'A': do_scan(BX_KEY_A,1,0,alt); break; + case 'B': do_scan(BX_KEY_B,1,0,alt); break; + case 'C': do_scan(BX_KEY_C,1,0,alt); break; + case 'D': do_scan(BX_KEY_D,1,0,alt); break; + case 'E': do_scan(BX_KEY_E,1,0,alt); break; + case 'F': do_scan(BX_KEY_F,1,0,alt); break; + case 'G': do_scan(BX_KEY_G,1,0,alt); break; + // HIJKLMNO + case 'H': do_scan(BX_KEY_H,1,0,alt); break; + case 'I': do_scan(BX_KEY_I,1,0,alt); break; + case 'J': do_scan(BX_KEY_J,1,0,alt); break; + case 'K': do_scan(BX_KEY_K,1,0,alt); break; + case 'L': do_scan(BX_KEY_L,1,0,alt); break; + case 'M': do_scan(BX_KEY_M,1,0,alt); break; + case 'N': do_scan(BX_KEY_N,1,0,alt); break; + case 'O': do_scan(BX_KEY_O,1,0,alt); break; - // HIJKLMNO - case 'H': do_scan(BX_KEY_H,1,0,alt); break; - case 'I': do_scan(BX_KEY_I,1,0,alt); break; - case 'J': do_scan(BX_KEY_J,1,0,alt); break; - case 'K': do_scan(BX_KEY_K,1,0,alt); break; - case 'L': do_scan(BX_KEY_L,1,0,alt); break; - case 'M': do_scan(BX_KEY_M,1,0,alt); break; - case 'N': do_scan(BX_KEY_N,1,0,alt); break; - case 'O': do_scan(BX_KEY_O,1,0,alt); break; + // PQRSTUVW + case 'P': do_scan(BX_KEY_P,1,0,alt); break; + case 'Q': do_scan(BX_KEY_Q,1,0,alt); break; + case 'R': do_scan(BX_KEY_R,1,0,alt); break; + case 'S': do_scan(BX_KEY_S,1,0,alt); break; + case 'T': do_scan(BX_KEY_T,1,0,alt); break; + case 'U': do_scan(BX_KEY_U,1,0,alt); break; + case 'V': do_scan(BX_KEY_V,1,0,alt); break; + case 'W': do_scan(BX_KEY_W,1,0,alt); break; + // XYZ[\]^_ + case 'X': do_scan(BX_KEY_X,1,0,alt); break; + case 'Y': do_scan(BX_KEY_Y,1,0,alt); break; + case 'Z': do_scan(BX_KEY_Z,1,0,alt); break; + case '{': do_scan(BX_KEY_LEFT_BRACKET,1,0,alt); break; + case '|': do_scan(BX_KEY_BACKSLASH,1,0,alt); break; + case '}': do_scan(BX_KEY_RIGHT_BRACKET,1,0,alt); break; + case '_': do_scan(BX_KEY_MINUS,1,0,alt); break; - // PQRSTUVW - case 'P': do_scan(BX_KEY_P,1,0,alt); break; - case 'Q': do_scan(BX_KEY_Q,1,0,alt); break; - case 'R': do_scan(BX_KEY_R,1,0,alt); break; - case 'S': do_scan(BX_KEY_S,1,0,alt); break; - case 'T': do_scan(BX_KEY_T,1,0,alt); break; - case 'U': do_scan(BX_KEY_U,1,0,alt); break; - case 'V': do_scan(BX_KEY_V,1,0,alt); break; - case 'W': do_scan(BX_KEY_W,1,0,alt); break; + // `abcdefg + case '`': do_scan(BX_KEY_GRAVE,0,0,alt); break; + case 'a': do_scan(BX_KEY_A,0,0,alt); break; + case 'b': do_scan(BX_KEY_B,0,0,alt); break; + case 'c': do_scan(BX_KEY_C,0,0,alt); break; + case 'd': do_scan(BX_KEY_D,0,0,alt); break; + case 'e': do_scan(BX_KEY_E,0,0,alt); break; + case 'f': do_scan(BX_KEY_F,0,0,alt); break; + case 'g': do_scan(BX_KEY_G,0,0,alt); break; - // XYZ[\]^_ - case 'X': do_scan(BX_KEY_X,1,0,alt); break; - case 'Y': do_scan(BX_KEY_Y,1,0,alt); break; - case 'Z': do_scan(BX_KEY_Z,1,0,alt); break; - case '{': do_scan(BX_KEY_LEFT_BRACKET,1,0,alt); break; - case '|': do_scan(BX_KEY_BACKSLASH,1,0,alt); break; - case '}': do_scan(BX_KEY_RIGHT_BRACKET,1,0,alt); break; - case '_': do_scan(BX_KEY_MINUS,1,0,alt); break; + // hijklmno + case 'h': do_scan(BX_KEY_H,0,0,alt); break; + case 'i': do_scan(BX_KEY_I,0,0,alt); break; + case 'j': do_scan(BX_KEY_J,0,0,alt); break; + case 'k': do_scan(BX_KEY_K,0,0,alt); break; + case 'l': do_scan(BX_KEY_L,0,0,alt); break; + case 'm': do_scan(BX_KEY_M,0,0,alt); break; + case 'n': do_scan(BX_KEY_N,0,0,alt); break; + case 'o': do_scan(BX_KEY_O,0,0,alt); break; - // `abcdefg - case '`': do_scan(BX_KEY_GRAVE,0,0,alt); break; - case 'a': do_scan(BX_KEY_A,0,0,alt); break; - case 'b': do_scan(BX_KEY_B,0,0,alt); break; - case 'c': do_scan(BX_KEY_C,0,0,alt); break; - case 'd': do_scan(BX_KEY_D,0,0,alt); break; - case 'e': do_scan(BX_KEY_E,0,0,alt); break; - case 'f': do_scan(BX_KEY_F,0,0,alt); break; - case 'g': do_scan(BX_KEY_G,0,0,alt); break; + // pqrstuvw + case 'p': do_scan(BX_KEY_P,0,0,alt); break; + case 'q': do_scan(BX_KEY_Q,0,0,alt); break; + case 'r': do_scan(BX_KEY_R,0,0,alt); break; + case 's': do_scan(BX_KEY_S,0,0,alt); break; + case 't': do_scan(BX_KEY_T,0,0,alt); break; + case 'u': do_scan(BX_KEY_U,0,0,alt); break; + case 'v': do_scan(BX_KEY_V,0,0,alt); break; + case 'w': do_scan(BX_KEY_W,0,0,alt); break; - // hijklmno - case 'h': do_scan(BX_KEY_H,0,0,alt); break; - case 'i': do_scan(BX_KEY_I,0,0,alt); break; - case 'j': do_scan(BX_KEY_J,0,0,alt); break; - case 'k': do_scan(BX_KEY_K,0,0,alt); break; - case 'l': do_scan(BX_KEY_L,0,0,alt); break; - case 'm': do_scan(BX_KEY_M,0,0,alt); break; - case 'n': do_scan(BX_KEY_N,0,0,alt); break; - case 'o': do_scan(BX_KEY_O,0,0,alt); break; + // xyz{|}~ + case 'x': do_scan(BX_KEY_X,0,0,alt); break; + case 'y': do_scan(BX_KEY_Y,0,0,alt); break; + case 'z': do_scan(BX_KEY_Z,0,0,alt); break; + case '[': do_scan(BX_KEY_LEFT_BRACKET,0,0,alt); break; + case '\\': do_scan(BX_KEY_BACKSLASH,0,0,alt); break; + case ']': do_scan(BX_KEY_RIGHT_BRACKET,0,0,alt); break; + case '~': do_scan(BX_KEY_GRAVE,1,0,alt); break; - // pqrstuvw - case 'p': do_scan(BX_KEY_P,0,0,alt); break; - case 'q': do_scan(BX_KEY_Q,0,0,alt); break; - case 'r': do_scan(BX_KEY_R,0,0,alt); break; - case 's': do_scan(BX_KEY_S,0,0,alt); break; - case 't': do_scan(BX_KEY_T,0,0,alt); break; - case 'u': do_scan(BX_KEY_U,0,0,alt); break; - case 'v': do_scan(BX_KEY_V,0,0,alt); break; - case 'w': do_scan(BX_KEY_W,0,0,alt); break; + // function keys + case KEY_F(1): do_scan(BX_KEY_F1,0,0,alt); break; + case KEY_F(2): do_scan(BX_KEY_F2,0,0,alt); break; + case KEY_F(3): do_scan(BX_KEY_F3,0,0,alt); break; + case KEY_F(4): do_scan(BX_KEY_F4,0,0,alt); break; + case KEY_F(5): do_scan(BX_KEY_F5,0,0,alt); break; + case KEY_F(6): do_scan(BX_KEY_F6,0,0,alt); break; + case KEY_F(7): do_scan(BX_KEY_F7,0,0,alt); break; + case KEY_F(8): do_scan(BX_KEY_F8,0,0,alt); break; + case KEY_F(9): do_scan(BX_KEY_F9,0,0,alt); break; + case KEY_F(10): do_scan(BX_KEY_F10,0,0,alt); break; + case KEY_F(11): do_scan(BX_KEY_F11,0,0,alt); break; + case KEY_F(12): do_scan(BX_KEY_F12,0,0,alt); break; - // xyz{|}~ - case 'x': do_scan(BX_KEY_X,0,0,alt); break; - case 'y': do_scan(BX_KEY_Y,0,0,alt); break; - case 'z': do_scan(BX_KEY_Z,0,0,alt); break; - case '[': do_scan(BX_KEY_LEFT_BRACKET,0,0,alt); break; - case '\\': do_scan(BX_KEY_BACKSLASH,0,0,alt); break; - case ']': do_scan(BX_KEY_RIGHT_BRACKET,0,0,alt); break; - case '~': do_scan(BX_KEY_GRAVE,1,0,alt); break; + // shifted function keys + case KEY_F(13): do_scan(BX_KEY_F1,1,0,alt); break; + case KEY_F(14): do_scan(BX_KEY_F2,1,0,alt); break; + case KEY_F(15): do_scan(BX_KEY_F3,1,0,alt); break; + case KEY_F(16): do_scan(BX_KEY_F4,1,0,alt); break; + case KEY_F(17): do_scan(BX_KEY_F5,1,0,alt); break; + case KEY_F(18): do_scan(BX_KEY_F6,1,0,alt); break; + case KEY_F(19): do_scan(BX_KEY_F7,1,0,alt); break; + case KEY_F(20): do_scan(BX_KEY_F8,1,0,alt); break; - // function keys - case KEY_F(1): do_scan(BX_KEY_F1,0,0,alt); break; - case KEY_F(2): do_scan(BX_KEY_F2,0,0,alt); break; - case KEY_F(3): do_scan(BX_KEY_F3,0,0,alt); break; - case KEY_F(4): do_scan(BX_KEY_F4,0,0,alt); break; - case KEY_F(5): do_scan(BX_KEY_F5,0,0,alt); break; - case KEY_F(6): do_scan(BX_KEY_F6,0,0,alt); break; - case KEY_F(7): do_scan(BX_KEY_F7,0,0,alt); break; - case KEY_F(8): do_scan(BX_KEY_F8,0,0,alt); break; - case KEY_F(9): do_scan(BX_KEY_F9,0,0,alt); break; - case KEY_F(10): do_scan(BX_KEY_F10,0,0,alt); break; - case KEY_F(11): do_scan(BX_KEY_F11,0,0,alt); break; - case KEY_F(12): do_scan(BX_KEY_F12,0,0,alt); break; + default: + if(character > 0x79) { + do_char(character - 0x80,1); + break; + } - // shifted function keys - case KEY_F(13): do_scan(BX_KEY_F1,1,0,alt); break; - case KEY_F(14): do_scan(BX_KEY_F2,1,0,alt); break; - case KEY_F(15): do_scan(BX_KEY_F3,1,0,alt); break; - case KEY_F(16): do_scan(BX_KEY_F4,1,0,alt); break; - case KEY_F(17): do_scan(BX_KEY_F5,1,0,alt); break; - case KEY_F(18): do_scan(BX_KEY_F6,1,0,alt); break; - case KEY_F(19): do_scan(BX_KEY_F7,1,0,alt); break; - case KEY_F(20): do_scan(BX_KEY_F8,1,0,alt); break; - - default: - if(character > 0x79) { - do_char(character - 0x80,1); - break; - } - - BX_INFO(("character unhandled: 0x%x",character)); - break; - } + BX_INFO(("character unhandled: 0x%x",character)); + break; + } } - // ::HANDLE_EVENTS() // // Called periodically (vga_update_interval in .bochsrc) so the // the gui code can poll for keyboard, mouse, and other // relevant events. - void -bx_term_gui_c::handle_events(void) +void bx_term_gui_c::handle_events(void) { - int character; - while((character = getch()) != ERR) { - BX_DEBUG(("scancode(0x%x)",character)); - do_char(character,0); - } + int character; + while((character = getch()) != ERR) { + BX_DEBUG(("scancode(0x%x)",character)); + do_char(character,0); + } } - - // ::FLUSH() // // Called periodically, requesting that the gui code flush all pending // screen update requests. - void -bx_term_gui_c::flush(void) +void bx_term_gui_c::flush(void) { - if (initialized) - refresh(); + if (initialized) refresh(); } - // ::CLEAR_SCREEN() // // Called to request that the VGA region is cleared. Don't // clear the area that defines the headerbar. - void -bx_term_gui_c::clear_screen(void) +void bx_term_gui_c::clear_screen(void) { clear(); #if BX_HAVE_COLOR_SET @@ -485,18 +460,14 @@ bx_term_gui_c::clear_screen(void) } } -int -get_color_pair(Bit8u vga_attr) +int get_color_pair(Bit8u vga_attr) { - int term_attr; - - term_attr = curses_color[vga_attr & 0x07]; - term_attr |= (curses_color[(vga_attr & 0x70) >> 4] << 3); - return term_attr; + int term_attr = curses_color[vga_attr & 0x07]; + term_attr |= (curses_color[(vga_attr & 0x70) >> 4] << 3); + return term_attr; } -chtype -get_term_char(Bit8u vga_char[]) +chtype get_term_char(Bit8u vga_char[]) { int term_char; @@ -562,6 +533,7 @@ get_term_char(Bit8u vga_char[]) term_char = ' '; } } + return term_char; } @@ -585,8 +557,8 @@ get_term_char(Bit8u vga_char[]) // features in text mode (cursor shape, line offset,...) void bx_term_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, - unsigned long cursor_x, unsigned long cursor_y, - bx_vga_tminfo_t tm_info) + unsigned long cursor_x, unsigned long cursor_y, + bx_vga_tminfo_t tm_info) { unsigned char *old_line, *new_line, *new_start; unsigned char cAttr; @@ -653,19 +625,16 @@ void bx_term_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, } } - int -bx_term_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) +int bx_term_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) { return 0; } - int -bx_term_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len) +int bx_term_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len) { return 0; } - // ::PALETTE_CHANGE() // // Allocate a color in the native GUI, for this color, and put @@ -673,12 +642,10 @@ bx_term_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len) // returns: 0=no screen update needed (color map change has direct effect) // 1=screen updated needed (redraw using current colormap) - bx_bool -bx_term_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsigned blue) +bx_bool bx_term_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsigned blue) { - BX_DEBUG(("color pallete request (%d,%d,%d,%d) ignored", - index,red,green,blue)); - return(0); + BX_DEBUG(("color pallete request (%d,%d,%d,%d) ignored", index,red,green,blue)); + return(0); } @@ -697,16 +664,10 @@ bx_term_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsi // note: origin of tile and of window based on (0,0) being in the upper // left of the window. - void -bx_term_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0) +void bx_term_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0) { - UNUSED(tile); - UNUSED(x0); - UNUSED(y0); } - - // ::DIMENSION_UPDATE() // // Called when the VGA mode changes it's X,Y dimensions. @@ -719,8 +680,7 @@ bx_term_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0) // fwidth : new VGA character width in text mode // bpp : bits per pixel in graphics mode - void -bx_term_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp) +void bx_term_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp) { if (bpp > 8) { BX_PANIC(("%d bpp graphics mode not supported", bpp)); @@ -747,7 +707,6 @@ bx_term_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsign } } - // ::CREATE_BITMAP() // // Create a monochrome bitmap of size 'xdim' by 'ydim', which will @@ -759,16 +718,11 @@ bx_term_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsign // xdim: x dimension of bitmap // ydim: y dimension of bitmap - unsigned -bx_term_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim) +unsigned bx_term_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim) { - UNUSED(bmap); - UNUSED(xdim); - UNUSED(ydim); - return(0); + return(0); } - // ::HEADERBAR_BITMAP() // // Called to install a bitmap in the bochs headerbar (toolbar). @@ -783,27 +737,20 @@ bx_term_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned // f: a 'C' function pointer to callback when the mouse is clicked in // the boundaries of this bitmap. - unsigned -bx_term_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void)) +unsigned bx_term_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void)) { - UNUSED(bmap_id); - UNUSED(alignment); - UNUSED(f); - return(0); + return(0); } - // ::SHOW_HEADERBAR() // // Show (redraw) the current headerbar, which is composed of // currently installed bitmaps. - void -bx_term_gui_c::show_headerbar(void) +void bx_term_gui_c::show_headerbar(void) { } - // ::REPLACE_BITMAP() // // Replace the bitmap installed in the headerbar ID slot 'hbar_id', @@ -817,41 +764,35 @@ bx_term_gui_c::show_headerbar(void) // hbar_id: headerbar slot ID // bmap_id: bitmap ID - void -bx_term_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id) +void bx_term_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id) { - UNUSED(hbar_id); - UNUSED(bmap_id); } - // ::EXIT() // // Called before bochs terminates, to allow for a graceful // exit from the native GUI mechanism. - void -bx_term_gui_c::exit(void) +void bx_term_gui_c::exit(void) { - if (!initialized) return; - clear(); - flush(); - endwin(); - BX_DEBUG(("exiting")); + if (!initialized) return; + clear(); + flush(); + endwin(); + BX_DEBUG(("exiting")); } - void -bx_term_gui_c::mouse_enabled_changed_specific (bx_bool val) +void bx_term_gui_c::mouse_enabled_changed_specific(bx_bool val) { } #if BX_USE_IDLE_HACK -void bx_term_gui_c::sim_is_idle () { +void bx_term_gui_c::sim_is_idle() +{ + int res; + fd_set readfds; - int res; - fd_set readfds; - - struct timeval timeout; + struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 1000; /* 1/1000 s */ @@ -861,19 +802,16 @@ void bx_term_gui_c::sim_is_idle () { res = select(1, &readfds, NULL, NULL, &timeout); switch(res) - { + { case -1: /* select() error - should not happen */ // This can happen when we have a alarm running, lets return // perror("sim_is_idle: select() failure\n"); - //fprintf (stderr,"Interrupted...\n"); //handle_events(); return; case 0: /* timeout */ - // fprintf (stderr,"Timeout...\n"); //handle_events(); return; - } - //fprintf (stderr,"Input...\n"); + } //handle_events(); } #endif diff --git a/bochs/gui/textconfig.cc b/bochs/gui/textconfig.cc index e517198b5..cb16f53c4 100644 --- a/bochs/gui/textconfig.cc +++ b/bochs/gui/textconfig.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: textconfig.cc,v 1.68 2008-02-05 22:57:41 sshwarts Exp $ +// $Id: textconfig.cc,v 1.69 2008-03-06 21:15:40 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // This is code for a text-mode configuration interface. Note that this file @@ -55,8 +55,7 @@ void bx_dbg_exit(int code); /* lots of code stolen from bximage.c */ /* remove leading spaces, newline junk at end. returns pointer to cleaned string, which is between s0 and the null */ -char * -clean_string(char *s0) +char *clean_string(char *s0) { char *s = s0; char *ptr; @@ -72,8 +71,7 @@ clean_string(char *s0) } /* returns 0 on success, -1 on failure. The value goes into out. */ -int -ask_uint(const char *prompt, const char *help, Bit32u min, Bit32u max, Bit32u the_default, Bit32u *out, int base) +int ask_uint(const char *prompt, const char *help, Bit32u min, Bit32u max, Bit32u the_default, Bit32u *out, int base) { Bit32u n = max + 1; char buffer[1024]; @@ -118,8 +116,7 @@ ask_uint(const char *prompt, const char *help, Bit32u min, Bit32u max, Bit32u th } // identical to ask_uint, but uses signed comparisons -int -ask_int(const char *prompt, const char *help, Bit32s min, Bit32s max, Bit32s the_default, Bit32s *out) +int ask_int(const char *prompt, const char *help, Bit32s min, Bit32s max, Bit32s the_default, Bit32s *out) { int n = max + 1; char buffer[1024]; @@ -152,8 +149,7 @@ ask_int(const char *prompt, const char *help, Bit32s min, Bit32s max, Bit32s the } } -int -ask_menu(const char *prompt, const char *help, int n_choices, const char *choice[], int the_default, int *out) +int ask_menu(const char *prompt, const char *help, int n_choices, const char *choice[], int the_default, int *out) { char buffer[1024]; char *clean; @@ -189,8 +185,7 @@ ask_menu(const char *prompt, const char *help, int n_choices, const char *choice } } -int -ask_yn(const char *prompt, const char *help, Bit32u the_default, Bit32u *out) +int ask_yn(const char *prompt, const char *help, Bit32u the_default, Bit32u *out) { char buffer[16]; char *clean; @@ -707,15 +702,15 @@ ask: assert(0); // switch statement should return } -void bx_config_interface_init() { +void bx_config_interface_init() +{ SIM->set_notify_callback(config_interface_notify_callback, NULL); } ///////////////////////////////////////////////////////////////////// // implement the text_* methods for bx_param types. -void -bx_param_num_c::text_print(FILE *fp) +void bx_param_num_c::text_print(FILE *fp) { if (get_long_format()) { fprintf(fp, get_long_format(), get()); @@ -731,8 +726,7 @@ bx_param_num_c::text_print(FILE *fp) } } -void -bx_param_bool_c::text_print(FILE *fp) +void bx_param_bool_c::text_print(FILE *fp) { if (get_format()) { fprintf(fp, get_format(), get() ? "yes" : "no"); @@ -746,8 +740,7 @@ bx_param_bool_c::text_print(FILE *fp) } } -void -bx_param_enum_c::text_print(FILE *fp) +void bx_param_enum_c::text_print(FILE *fp) { int n = get(); assert(n >= min && n <= max); @@ -764,8 +757,7 @@ bx_param_enum_c::text_print(FILE *fp) } } -void -bx_param_string_c::text_print(FILE *fp) +void bx_param_string_c::text_print(FILE *fp) { char *value = getptr(); int opts = options->get(); @@ -796,8 +788,7 @@ bx_param_string_c::text_print(FILE *fp) } } -void -bx_list_c::text_print(FILE *fp) +void bx_list_c::text_print(FILE *fp) { fprintf(fp, "%s: ", get_name()); for (int i=0; i