aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii1999-07-30 08:15:13 +0000
committerEli Zaretskii1999-07-30 08:15:13 +0000
commite4441df01c386c7ce3e4092c9acd71c61b79862e (patch)
treee9d9e1dc256f822cd91c9e741028d391e22abed8 /src
parentab39b7a5d5d0cccbdb23377428a4f4e3c755c915 (diff)
downloademacs-e4441df01c386c7ce3e4092c9acd71c61b79862e.tar.gz
emacs-e4441df01c386c7ce3e4092c9acd71c61b79862e.zip
(msdos_stdcolor_name, msdos_stdcolor_idx): New
functions.
Diffstat (limited to 'src')
-rw-r--r--src/dosfns.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/dosfns.c b/src/dosfns.c
index d0f5f18dd01..be287493e16 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */
26/* The entire file is within this conditional */ 26/* The entire file is within this conditional */
27 27
28#include <stdio.h> 28#include <stdio.h>
29#include <string.h>
29#include <dos.h> 30#include <dos.h>
30#include "lisp.h" 31#include "lisp.h"
31#include "buffer.h" 32#include "buffer.h"
@@ -36,6 +37,7 @@ Boston, MA 02111-1307, USA. */
36#include "window.h" 37#include "window.h"
37#include "dosfns.h" 38#include "dosfns.h"
38#include "msdos.h" 39#include "msdos.h"
40#include "dispextern.h"
39#include <dpmi.h> 41#include <dpmi.h>
40#include <go32.h> 42#include <go32.h>
41#include <dirent.h> 43#include <dirent.h>
@@ -401,6 +403,44 @@ init_dosfns ()
401} 403}
402 404
403#ifndef HAVE_X_WINDOWS 405#ifndef HAVE_X_WINDOWS
406
407/* Emulation of some X window features from xfns.c and xfaces.c. */
408
409/* Standard VGA colors, in the order of their standard numbering
410 in the default VGA palette. */
411static char *vga_colors[16] = {
412 "black", "blue", "green", "cyan", "red", "magenta", "brown",
413 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan",
414 "lightred", "lightmagenta", "yellow", "white"
415};
416
417/* Given a color name, return its index, or -1 if not found. Note
418 that this only performs case-insensitive comparison against the
419 standard names. For anything more sophisticated, like matching
420 "gray" with "grey" or translating X color names into their MSDOS
421 equivalents, call the Lisp function Qmsdos_color_translate (defined
422 on lisp/term/pc-win.el). */
423int
424msdos_stdcolor_idx (const char *name)
425{
426 int i;
427
428 for (i = 0; i < sizeof (vga_colors) / sizeof (vga_colors[0]); i++)
429 if (strcasecmp (name, vga_colors[i]) == 0)
430 return i;
431
432 return FACE_TTY_DEFAULT_COLOR;
433}
434
435/* Given a color index, return its standard name. */
436const char *
437msdos_stdcolor_name (int idx)
438{
439 if (idx < 0 || idx >= sizeof (vga_colors) / sizeof (vga_colors[0]))
440 return ""; /* meaning the default */
441 return vga_colors[idx];
442}
443
404/* Support for features that are available when we run in a DOS box 444/* Support for features that are available when we run in a DOS box
405 on MS-Windows. */ 445 on MS-Windows. */
406int 446int