Initial support for scalable gfxmenu

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-29 17:31:02 +01:00
parent a2b4c09b1c
commit 9a17588459
13 changed files with 368 additions and 437 deletions

View file

@ -325,41 +325,3 @@ grub_gui_parse_color (const char *s, grub_gui_color_t *color)
*color = c;
return grub_errno;
}
/* Parse a value in the form "(x, y)", storing the first element (x) into
*PX and the second element (y) into *PY.
Returns GRUB_ERR_NONE if successfully parsed. */
grub_err_t
grub_gui_parse_2_tuple (const char *s, int *px, int *py)
{
int x;
int y;
while (*s && grub_isspace (*s))
s++;
if (*s != '(')
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"missing `(' in 2-tuple `%s'", s);
/* Skip the opening parentheses. */
s++;
if (*s == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"unexpected end of 2-tuple after `(' in `%s'", s);
/* Parse the first element. */
x = grub_strtol (s, 0, 10);
if ((s = grub_strchr (s, ',')) == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"missing comma in 2-tuple `%s'", s);
/* Skip the element separator (the comma). */
s++;
/* Parse the second element. */
y = grub_strtol (s, 0, 10);
*px = x;
*py = y;
return grub_errno;
}