Mercurial > emacs
comparison src/dosfns.c @ 25113:73c54061f4bb
(msdos_stdcolor_name, msdos_stdcolor_idx): New
functions.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 30 Jul 1999 08:15:13 +0000 |
parents | 3229c65a13c5 |
children | f0cb2d2e49f2 |
comparison
equal
deleted
inserted
replaced
25112:8bf9ad7816a8 | 25113:73c54061f4bb |
---|---|
24 | 24 |
25 #ifdef MSDOS | 25 #ifdef MSDOS |
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" |
32 #include "termchar.h" | 33 #include "termchar.h" |
33 #include "termhooks.h" | 34 #include "termhooks.h" |
34 #include "frame.h" | 35 #include "frame.h" |
35 #include "blockinput.h" | 36 #include "blockinput.h" |
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> |
42 | 44 |
43 #ifndef __DJGPP_MINOR__ | 45 #ifndef __DJGPP_MINOR__ |
399 #endif /* __DJGPP_MINOR__ == 0 */ | 401 #endif /* __DJGPP_MINOR__ == 0 */ |
400 #endif /* __DJGPP__ >= 2 */ | 402 #endif /* __DJGPP__ >= 2 */ |
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. */ | |
411 static 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). */ | |
423 int | |
424 msdos_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. */ | |
436 const char * | |
437 msdos_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. */ |
406 int | 446 int |
407 ms_windows_version (void) | 447 ms_windows_version (void) |
408 { | 448 { |