summaryrefslogtreecommitdiff
path: root/com32/cmenu
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-04 16:59:53 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-04 16:59:53 -0700
commit3f86e5ec0954aa2b2da60f007705cbe996820fc4 (patch)
tree8ddad87b56195539d3bd7a59a1861251b6db477e /com32/cmenu
parent4873366ee31786f10381427c5522543a82a9e2ab (diff)
parent1c50caaf9086cedc0af481094045f32a8f63e0a1 (diff)
downloadsyslinux-3f86e5ec0954aa2b2da60f007705cbe996820fc4.tar.gz
Merge commit 'origin/libansi' into cmenu-video
Diffstat (limited to 'com32/cmenu')
-rw-r--r--com32/cmenu/libmenu/com32io.c98
-rw-r--r--com32/cmenu/libmenu/com32io.h62
2 files changed, 1 insertions, 159 deletions
diff --git a/com32/cmenu/libmenu/com32io.c b/com32/cmenu/libmenu/com32io.c
index 3c4f9219..b910959f 100644
--- a/com32/cmenu/libmenu/com32io.c
+++ b/com32/cmenu/libmenu/com32io.c
@@ -18,104 +18,6 @@
com32sys_t inreg, outreg; // Global register sets for use
-/**
- * cprint_vga2ansi - given a VGA attribute, print a character
- * @chr: character to print
- * @attr: vga attribute
- *
- * Convert the VGA attribute @attr to an ANSI escape sequence and
- * print it.
- **/
-static void cprint_vga2ansi(const char chr, const char attr)
-{
- static const char ansi_char[8] = "04261537";
- static uint8_t last_attr = 0x300;
- char buf[16], *p;
-
- if (attr != last_attr) {
- p = buf;
- *p++ = '\033';
- *p++ = '[';
-
- if (last_attr & ~attr & 0x88) {
- *p++ = '0';
- *p++ = ';';
- /* Reset last_attr to unknown to handle
- * background/foreground attributes correctly */
- last_attr = 0x300;
- }
- if (attr & 0x08) {
- *p++ = '1';
- *p++ = ';';
- }
- if (attr & 0x80) {
- *p++ = '4';
- *p++ = ';';
- }
- if ((attr ^ last_attr) & 0x07) {
- *p++ = '3';
- *p++ = ansi_char[attr & 7];
- *p++ = ';';
- }
- if ((attr ^ last_attr) & 0x70) {
- *p++ = '4';
- *p++ = ansi_char[(attr >> 4) & 7];
- *p++ = ';';
- }
- p[-1] = 'm'; /* We'll have generated at least one semicolon */
- p[0] = '\0';
-
- last_attr = attr;
-
- fputs(buf, stdout);
- }
-
- putchar(chr);
-}
-
-/**
- * cprint - given a VGA attribute, print a single character at cursor
- * @chr: character to print
- * @attr: VGA attribute
- * @times: number of times to print @chr
- *
- * Note: @attr is a VGA attribute.
- **/
-void cprint(const char chr, const char attr, unsigned int times)
-{
- while (times--)
- cprint_vga2ansi(chr, attr);
-}
-
-/**
- * csprint - given a VGA attribute, print a NULL-terminated string
- * @str: string to print
- * @attr: VGA attribute
- **/
-void csprint(const char *str, const char attr)
-{
- while (*str) {
- cprint(*str, attr, 1);
- str++;
- }
-}
-
-/**
- * clearwindow - fill a given a region on the screen
- * @top, @left, @bot, @right: coordinates to fill
- * @fillchar: character to use to fill the region
- * @fillattr: character attribute (VGA)
- **/
-void clearwindow(const char top, const char left, const char bot,
- const char right, const char fillchar, const char fillattr)
-{
- char x;
- for (x = top; x < bot + 1; x++) {
- gotoxy(x, left);
- cprint(fillchar, fillattr, right - left + 1);
- }
-}
-
void getpos(char *row, char *col, char page)
{
REG_AH(inreg) = 0x03;
diff --git a/com32/cmenu/libmenu/com32io.h b/com32/cmenu/libmenu/com32io.h
index 91324d77..6a1b670b 100644
--- a/com32/cmenu/libmenu/com32io.h
+++ b/com32/cmenu/libmenu/com32io.h
@@ -15,59 +15,14 @@
#include <com32.h>
#include <stdio.h>
+#include <libansi.h>
#ifndef NULL
#define NULL ((void *)0)
#endif
-#define CSI "\e["
-
-static inline void beep(void)
-{
- fputs("\007", stdout);
-}
-
/* BIOS Assisted output routines */
-// Print a C str (NUL-terminated) respecting the left edge of window
-// i.e. \n in str will move cursor to column left
-// Print a C str (NUL-terminated)
-
-void csprint(const char *, const char);
-
-//static inline void cswprint(const char *str, const char attr)
-//{
-// csprint(str, attr);
-//}
-
-void cprint(const char, const char, unsigned int);
-
-static inline void putch(const char x, char attr)
-{
- cprint(x, attr, 1);
-}
-
-void clearwindow(const char, const char, const char, const char,
- const char, const char);
-
-/*
- * cls - clear and initialize the entire screen
- *
- * Note: when initializing xterm, one has to specify that
- * G1 points to the alternate character set (this is not true
- * by default). Without the initial printf "\033)0", line drawing
- * characters won't be displayed.
- */
-static inline void cls(void)
-{
- fputs("\033e\033%@\033)0\033(B\1#0\033[?25l\033[2J", stdout);
-}
-
-static inline void gotoxy(const char row, const char col)
-{
- printf(CSI "%d;%dH", row + 1, col + 1);
-}
-
void getpos(char *row, char *col, char page);
char inputc(char *scancode); // Return ASCII char by val, and scancode by reference
@@ -78,16 +33,6 @@ void getcursorshape(char *start, char *end); // Get shape for current page
// Get char displayed at current position in specified page
unsigned char getcharat(char page);
-static inline void cursoroff(void)
-{ /* Turns off cursor */
- setcursorshape(32, 33);
-}
-
-static inline void cursoron(void)
-{ /* Turns on cursor */
- setcursorshape(6, 7);
-}
-
static inline unsigned char readbiosb(unsigned int ofs)
{
return *((unsigned char *)MK_PTR(0, ofs));
@@ -100,11 +45,6 @@ static inline char getshiftflags(void)
void scrollupwindow(char top, char left, char bot, char right, char attr, char numlines); //Scroll up given window
-static inline void scrollup(void) //Scroll up display screen by one line
-{
- printf(CSI "S");
-}
-
void setvideomode(char mode); // Set the video mode.
static inline char getvideomode(void) // Get the current video mode