mirror of https://github.com/bochs-emu/Bochs
- prepared implementation of display library specific options
- fixed bug #890734 (commas in strings enclosed with double quotes)
This commit is contained in:
parent
d748f22ed0
commit
d5f337e1ef
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: bochs.h,v 1.136 2004-02-06 22:27:59 danielg4 Exp $
|
||||
// $Id: bochs.h,v 1.137 2004-02-22 18:51:36 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
|
@ -681,6 +681,7 @@ typedef struct BOCHSAPI {
|
|||
bx_gdbstub_t gdbstub;
|
||||
bx_param_enum_c *Osel_config;
|
||||
bx_param_enum_c *Osel_displaylib;
|
||||
bx_param_string_c *Odisplaylib_options;
|
||||
} bx_options_t;
|
||||
|
||||
BOCHSAPI extern bx_options_t bx_options;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.118 2004-02-06 22:28:00 danielg4 Exp $
|
||||
// $Id: siminterface.h,v 1.119 2004-02-22 18:51:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Before I can describe what this file is for, I have to make the
|
||||
|
@ -473,6 +473,7 @@ typedef enum {
|
|||
#endif
|
||||
BXP_SEL_CONFIG_INTERFACE,
|
||||
BXP_SEL_DISPLAY_LIBRARY,
|
||||
BXP_DISPLAYLIB_OPTIONS,
|
||||
BXP_THIS_IS_THE_LAST // used to determine length of list
|
||||
} bx_id;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: vga.cc,v 1.96 2004-02-22 13:02:59 vruppert Exp $
|
||||
// $Id: vga.cc,v 1.97 2004-02-22 18:51:38 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
|
@ -126,6 +126,8 @@ bx_vga_c::init(void)
|
|||
#if BX_SUPPORT_VBE
|
||||
Bit16u max_xres, max_yres, max_bpp;
|
||||
#endif
|
||||
int argc;
|
||||
char *argv[2];
|
||||
|
||||
unsigned addr;
|
||||
for (addr=0x03B4; addr<=0x03B5; addr++) {
|
||||
|
@ -240,9 +242,13 @@ bx_vga_c::init(void)
|
|||
SET_TILE_UPDATED (x, y, 0);
|
||||
|
||||
{
|
||||
/* ??? should redo this to pass X args */
|
||||
char *argv[1] = { "bochs" };
|
||||
bx_gui->init(1, &argv[0], BX_VGA_THIS s.x_tilesize, BX_VGA_THIS s.y_tilesize);
|
||||
argc = 1;
|
||||
argv[0] = "bochs";
|
||||
if (strlen(bx_options.Odisplaylib_options->getptr())) {
|
||||
argc = 2;
|
||||
argv[1] = bx_options.Odisplaylib_options->getptr();
|
||||
}
|
||||
bx_gui->init(argc, argv, BX_VGA_THIS s.x_tilesize, BX_VGA_THIS s.y_tilesize);
|
||||
}
|
||||
|
||||
BX_INFO(("interval=%u", bx_options.Ovga_update_interval->get ()));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.270 2004-02-17 21:40:05 vruppert Exp $
|
||||
// $Id: main.cc,v 1.271 2004-02-22 18:51:37 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
|
@ -1205,9 +1205,15 @@ void bx_init_options ()
|
|||
0);
|
||||
bx_options.Osel_displaylib->set_by_name (BX_DEFAULT_DISPLAY_LIBRARY);
|
||||
bx_options.Osel_displaylib->set_ask_format ("Choose which library to use for the Bochs display: [%s] ");
|
||||
bx_options.Odisplaylib_options = new bx_param_string_c (BXP_DISPLAYLIB_OPTIONS,
|
||||
"Display Library options",
|
||||
"Options passed to Display Library",
|
||||
"",
|
||||
BX_PATHNAME_LEN);
|
||||
bx_param_c *interface_init_list[] = {
|
||||
bx_options.Osel_config,
|
||||
bx_options.Osel_displaylib,
|
||||
bx_options.Odisplaylib_options,
|
||||
bx_options.Ovga_update_interval,
|
||||
bx_options.Omouse_enabled,
|
||||
bx_options.Oips,
|
||||
|
@ -2814,7 +2820,7 @@ parse_line_unformatted(char *context, char *line)
|
|||
{
|
||||
#define MAX_PARAMS_LEN 40
|
||||
char *ptr;
|
||||
unsigned i, string_i;
|
||||
unsigned i, string_i = 0;
|
||||
char string[512];
|
||||
char *params[MAX_PARAMS_LEN];
|
||||
int num_params;
|
||||
|
@ -2838,7 +2844,11 @@ parse_line_unformatted(char *context, char *line)
|
|||
else
|
||||
ptr = strtok(line, ":");
|
||||
while ((ptr) && (!comment)) {
|
||||
string_i = 0;
|
||||
if (!inquotes) {
|
||||
string_i = 0;
|
||||
} else {
|
||||
string[string_i++] = ',';
|
||||
}
|
||||
for (i=0; i<strlen(ptr); i++) {
|
||||
if (ptr[i] == '"')
|
||||
inquotes = !inquotes;
|
||||
|
@ -2880,20 +2890,18 @@ parse_line_unformatted(char *context, char *line)
|
|||
}
|
||||
string[string_i] = '\0';
|
||||
if (string_i == 0) break;
|
||||
if ( params[num_params] != NULL )
|
||||
{
|
||||
if (!inquotes) {
|
||||
if (params[num_params] != NULL) {
|
||||
free(params[num_params]);
|
||||
params[num_params] = NULL;
|
||||
}
|
||||
if ( num_params < MAX_PARAMS_LEN )
|
||||
{
|
||||
params[num_params++] = strdup (string);
|
||||
ptr = strtok(NULL, ",");
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
if (num_params < MAX_PARAMS_LEN) {
|
||||
params[num_params++] = strdup (string);
|
||||
} else {
|
||||
BX_PANIC (("too many parameters, max is %d\n", MAX_PARAMS_LEN));
|
||||
}
|
||||
}
|
||||
ptr = strtok(NULL, ",");
|
||||
}
|
||||
Bit32s retval = parse_line_formatted(context, num_params, ¶ms[0]);
|
||||
for (i=0; i < MAX_PARAMS_LEN; i++)
|
||||
|
@ -4136,11 +4144,16 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
|||
PARSE_ERR(("%s: config_interface '%s' not available", context, params[1]));
|
||||
}
|
||||
else if (!strcmp(params[0], "display_library")) {
|
||||
if (num_params != 2) {
|
||||
if ((num_params < 2) || (num_params > 3)) {
|
||||
PARSE_ERR(("%s: display_library directive: wrong # args.", context));
|
||||
}
|
||||
if (!bx_options.Osel_displaylib->set_by_name (params[1]))
|
||||
PARSE_ERR(("%s: display library '%s' not available", context, params[1]));
|
||||
if (num_params == 3) {
|
||||
if (!strncmp(params[2], "options=", 8)) {
|
||||
bx_options.Odisplaylib_options->set (strdup(¶ms[2][8]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
PARSE_ERR(( "%s: directive '%s' not understood", context, params[0]));
|
||||
|
|
Loading…
Reference in New Issue