2003-09-25 Yoshinori K. Okuji <okuji@enbug.org>
I forgot to check in these changes for a long time. This adds incomplete support for VGA console, and this is still very buggy. Also, a lot of consideration is required for I18N, UNICODE, and VGA font issues. Therefore, assume that this is such that "better than nothing". * font/manager.c: New file. * include/pupa/font.h: Likewise. * include/pupa/i386/pc/vga.h: Likewise. * term/i386/pc/vga.c: Likewise. * util/unifont2pff.rb: Likewise. * conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/vga.h. (pkgdata_MODULES): Added vga.mod and font.mod. (vga_mod_SOURCES): New variables. (vga_mod_CFLAGS): Likewise. (font_mod_SOURCES): Likewise. (font_mod_CFLAGS): Likewise. * include/pupa/err.h (PUPA_ERR_BAD_FONT): New constant. * include/pupa/term.h: Include pupa/err.h. (struct pupa_term): Added init and fini. Changed the argument of putchar to pupa_uint32_t. * include/pupa/i386/pc/console.h: Include pupa/symbol.h. (pupa_console_real_putchar): New prototype. (pupa_console_putchar): Removed. (pupa_console_checkkey): Exported. (pupa_console_getkey): Likewise. * kern/misc.c (pupa_vsprintf): Add support for UNICODE characters. * kern/term.c (pupa_term_set_current): Rewritten. (pupa_putchar): Likewise. (pupa_putcode): New function. * kern/i386/pc/startup.S (pupa_console_putchar): Renamed to ... (pupa_console_real_putchar): ... this. (pupa_vga_set_mode): New function. (pupa_vga_get_font): Likewise. * normal/command.c: Include pupa/term.h. (terminal_command): New function. (pupa_command_init): Register the command "terminal". * normal/menu.c (DISP_LEFT): Changed to a UNICODE value. (DISP_UP): Likewise. (DISP_RIGHT): Likewise. (DISP_DOWN): Likewise. (DISP_HLINE): Likewise. (DISP_VLINE): Likewise. (DISP_UL): Likewise. (DISP_UR): Likewise. (DISP_LL): Likewise. (DISP_LR): Likewise. * term/i386/pc/console.c (pupa_console_putchar): New function.
This commit is contained in:
parent
977329f5fa
commit
18d9c7cd53
17 changed files with 1443 additions and 50 deletions
|
@ -21,6 +21,7 @@
|
|||
#include <pupa/misc.h>
|
||||
#include <pupa/mm.h>
|
||||
#include <pupa/err.h>
|
||||
#include <pupa/term.h>
|
||||
|
||||
static pupa_command_t pupa_command_list;
|
||||
|
||||
|
@ -164,6 +165,51 @@ rescue_command (int argc __attribute__ ((unused)),
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
terminal_command (int argc, char *argv[])
|
||||
{
|
||||
pupa_term_t term = 0;
|
||||
|
||||
auto int print_terminal (pupa_term_t);
|
||||
auto int find_terminal (pupa_term_t);
|
||||
|
||||
int print_terminal (pupa_term_t t)
|
||||
{
|
||||
pupa_printf (" %s", t->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find_terminal (pupa_term_t t)
|
||||
{
|
||||
if (pupa_strcmp (t->name, argv[0]) == 0)
|
||||
{
|
||||
term = t;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
pupa_printf ("Available terminal(s):");
|
||||
pupa_term_iterate (print_terminal);
|
||||
pupa_putchar ('\n');
|
||||
|
||||
pupa_printf ("Current terminal: %s\n", pupa_term_get_current ()->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
pupa_term_iterate (find_terminal);
|
||||
if (! term)
|
||||
return pupa_error (PUPA_ERR_BAD_ARGUMENT, "no such terminal");
|
||||
|
||||
pupa_term_set_current (term);
|
||||
}
|
||||
|
||||
return PUPA_ERR_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
pupa_command_init (void)
|
||||
{
|
||||
|
@ -173,4 +219,7 @@ pupa_command_init (void)
|
|||
pupa_register_command ("rescue", rescue_command, PUPA_COMMAND_FLAG_BOTH,
|
||||
"rescue",
|
||||
"Enter into the rescue mode.");
|
||||
pupa_register_command ("terminal", terminal_command, PUPA_COMMAND_FLAG_BOTH,
|
||||
"terminal [TERM...]",
|
||||
"Select a terminal.");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue