grub/include/grub/term.h
okuji 8367695cff shinori K. Okuji <okuji@enbug.org>
* genkernsyms.sh: Updated copyright information.
	* genmk.rb: Likewise.
	* genmodsrc.sh: Likewise.
	* gensymlist.sh: Likewise.
	* boot/i386/pc/boot.S: Likewise.
	* boot/i386/pc/diskboot.S: Likewise.
	* disk/i386/pc/biosdisk.c: Likewise.
	* disk/i386/pc/partition.c: Likewise.
	* font/manager.c: Likewise.
	* fs/ext2.c: Likewise.
	* fs/fat.c: Likewise.
	* include/pupa/boot.h: Likewise.
	* include/pupa/device.h: Likewise.
	* include/pupa/disk.h: Likewise.
	* include/pupa/dl.h: Likewise.
	* include/pupa/elf.h: Likewise.
	* include/pupa/err.h: Likewise.
	* include/pupa/file.h: Likewise.
	* include/pupa/font.h: Likewise.
	* include/pupa/fs.h: Likewise.
	* include/pupa/kernel.h: Likewise.
	* include/pupa/loader.h: Likewise.
	* include/pupa/misc.h: Likewise.
	* include/pupa/mm.h: Likewise.
	* include/pupa/net.h: Likewise.
	* include/pupa/normal.h: Likewise.
	* include/pupa/rescue.h: Likewise.
	* include/pupa/setjmp.h: Likewise.
	* include/pupa/symbol.h: Likewise.
	* include/pupa/term.h: Likewise.
	* include/pupa/types.h: Likewise.
	* include/pupa/i386/setjmp.h: Likewise.
	* include/pupa/i386/types.h: Likewise.
	* include/pupa/i386/pc/biosdisk.h: Likewise.
	* include/pupa/i386/pc/boot.h: Likewise.
	* include/pupa/i386/pc/console.h: Likewise.
	* include/pupa/i386/pc/init.h: Likewise.
	* include/pupa/i386/pc/kernel.h: Likewise.
	* include/pupa/i386/pc/linux.h: Likewise.
	* include/pupa/i386/pc/loader.h: Likewise.
	* include/pupa/i386/pc/memory.h: Likewise.
	* include/pupa/i386/pc/multiboot.h: Likewise.
	* include/pupa/i386/pc/partition.h: Likewise.
	* include/pupa/i386/pc/time.h: Likewise.
	* include/pupa/i386/pc/vga.h: Likewise.
	* include/pupa/i386/pc/util/biosdisk.h: Likewise.
	* include/pupa/util/getroot.h: Likewise.
	* include/pupa/util/misc.h: Likewise.
	* include/pupa/util/resolve.h: Likewise.
	* kern/device.c: Likewise.
	* kern/disk.c: Likewise.
	* kern/dl.c: Likewise.
	* kern/err.c: Likewise.
	* kern/file.c: Likewise.
	* kern/fs.c: Likewise.
	* kern/loader.c: Likewise.
	* kern/main.c: Likewise.
	* kern/misc.c: Likewise.
	* kern/mm.c: Likewise.
	* kern/rescue.c: Likewise.
	* kern/term.c: Likewise.
	* kern/i386/dl.c: Likewise.
	* kern/i386/pc/init.c: Likewise.
	* kern/i386/pc/lzo1x.S: Likewise.
	* kern/i386/pc/startup.S: Likewise.
	* loader/i386/pc/chainloader.c: Likewise.
	* loader/i386/pc/linux.c: Likewise.
	* loader/i386/pc/multiboot.c: Likewise.
	* normal/cmdline.c: Likewise.
	* normal/command.c: Likewise.
	* normal/main.c: Likewise.
	* normal/menu.c: Likewise.
	* normal/i386/setjmp.S: Likewise.
	* term/i386/pc/console.c: Likewise.
	* term/i386/pc/vga.c: Likewise.
	* util/console.c: Likewise.
	* util/genmoddep.c: Likewise.
	* util/misc.c: Likewise.
	* util/pupa-emu.c: Likewise.
	* util/resolve.c: Likewise.
	* util/unifont2pff.rb: Likewise.
	* util/i386/pc/biosdisk.c: Likewise.
	* util/i386/pc/getroot.c: Likewise.
	* util/i386/pc/pupa-mkimage.c: Likewise.
	* util/i386/pc/pupa-setup.c: Likewise.
2004-02-24 17:21:53 +00:00

131 lines
4.2 KiB
C

/*
* PUPA -- Preliminary Universal Programming Architecture for GRUB
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
*
* PUPA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PUPA; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PUPA_TERM_HEADER
#define PUPA_TERM_HEADER 1
#include <pupa/err.h>
#include <pupa/symbol.h>
#include <pupa/types.h>
/* These are used to represent the various color states we use. */
typedef enum
{
/* The color used to display all text that does not use the
user defined colors below. */
PUPA_TERM_COLOR_STANDARD,
/* The user defined colors for normal text. */
PUPA_TERM_COLOR_NORMAL,
/* The user defined colors for highlighted text. */
PUPA_TERM_COLOR_HIGHLIGHT
}
pupa_term_color_state;
/* Flags for representing the capabilities of a terminal. */
/* Some notes about the flags:
- These flags are used by higher-level functions but not terminals
themselves.
- If a terminal is dumb, you may assume that only putchar, getkey and
checkkey are called.
- Some fancy features (setcolorstate, setcolor and setcursor) can be set
to NULL. */
/* Set when input characters shouldn't be echoed back. */
#define PUPA_TERM_NO_ECHO (1 << 0)
/* Set when the editing feature should be disabled. */
#define PUPA_TERM_NO_EDIT (1 << 1)
/* Set when the terminal cannot do fancy things. */
#define PUPA_TERM_DUMB (1 << 2)
/* Set when the terminal needs to be initialized. */
#define PUPA_TERM_NEED_INIT (1 << 16)
struct pupa_term
{
/* The terminal name. */
const char *name;
/* Initialize the terminal. */
pupa_err_t (*init) (void);
/* Clean up the terminal. */
pupa_err_t (*fini) (void);
/* Put a character. C is encoded in Unicode. */
void (*putchar) (pupa_uint32_t c);
/* Check if any input character is available. */
int (*checkkey) (void);
/* Get a character. */
int (*getkey) (void);
/* Get the cursor position. The return value is ((X << 8) | Y). */
pupa_uint16_t (*getxy) (void);
/* Go to the position (X, Y). */
void (*gotoxy) (pupa_uint8_t x, pupa_uint8_t y);
/* Clear the screen. */
void (*cls) (void);
/* Set the current color to be used */
void (*setcolorstate) (pupa_term_color_state state);
/* Set the normal color and the highlight color. The format of each
color is VGA's. */
void (*setcolor) (pupa_uint8_t normal_color, pupa_uint8_t highlight_color);
/* Turn on/off the cursor. */
void (*setcursor) (int on);
/* Update the screen. */
void (*refresh) (void);
/* The feature flags defined above. */
pupa_uint32_t flags;
/* The next terminal. */
struct pupa_term *next;
};
typedef struct pupa_term *pupa_term_t;
void EXPORT_FUNC(pupa_term_register) (pupa_term_t term);
void EXPORT_FUNC(pupa_term_unregister) (pupa_term_t term);
void EXPORT_FUNC(pupa_term_iterate) (int (*hook) (pupa_term_t term));
pupa_err_t EXPORT_FUNC(pupa_term_set_current) (pupa_term_t term);
pupa_term_t EXPORT_FUNC(pupa_term_get_current) (void);
void EXPORT_FUNC(pupa_putchar) (int c);
void EXPORT_FUNC(pupa_putcode) (pupa_uint32_t code);
int EXPORT_FUNC(pupa_getkey) (void);
int EXPORT_FUNC(pupa_checkkey) (void);
pupa_uint16_t EXPORT_FUNC(pupa_getxy) (void);
void EXPORT_FUNC(pupa_gotoxy) (pupa_uint8_t x, pupa_uint8_t y);
void EXPORT_FUNC(pupa_cls) (void);
void EXPORT_FUNC(pupa_setcolorstate) (pupa_term_color_state state);
void EXPORT_FUNC(pupa_setcolor) (pupa_uint8_t normal_color,
pupa_uint8_t highlight_color);
int EXPORT_FUNC(pupa_setcursor) (int on);
void EXPORT_FUNC(pupa_refresh) (void);
/* For convenience. */
#define PUPA_TERM_ASCII_CHAR(c) ((c) & 0xff)
#endif /* ! PUPA_TERM_HEADER */