comparison src/objects-tty.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 0293115a14e9
children 131b0175ea99
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
33 #if 0 /* This stuff doesn't quite work yet */ 33 #if 0 /* This stuff doesn't quite work yet */
34 Lisp_Object Vtty_dynamic_color_fg; 34 Lisp_Object Vtty_dynamic_color_fg;
35 Lisp_Object Vtty_dynamic_color_bg; 35 Lisp_Object Vtty_dynamic_color_bg;
36 #endif 36 #endif
37 37
38 DEFUN ("register-tty-color", Fregister_tty_color, Sregister_tty_color, 3, 3, 38 DEFUN ("register-tty-color", Fregister_tty_color, 3, 3, 0, /*
39 0 /*
40 Register COLOR as a recognized TTY color. 39 Register COLOR as a recognized TTY color.
41 COLOR should be a string. 40 COLOR should be a string.
42 Strings FG-STRING and BG-STRING should specify the escape sequences to 41 Strings FG-STRING and BG-STRING should specify the escape sequences to
43 set the foreground and background to the given color, respectively. 42 set the foreground and background to the given color, respectively.
44 */ ) 43 */
45 (color, fg_string, bg_string) 44 (color, fg_string, bg_string))
46 Lisp_Object color, fg_string, bg_string;
47 { 45 {
48 CHECK_STRING (color); 46 CHECK_STRING (color);
49 CHECK_STRING (fg_string); 47 CHECK_STRING (fg_string);
50 CHECK_STRING (bg_string); 48 CHECK_STRING (bg_string);
51 49
55 Vtty_color_alist); 53 Vtty_color_alist);
56 54
57 return Qnil; 55 return Qnil;
58 } 56 }
59 57
60 DEFUN ("unregister-tty-color", Funregister_tty_color, Sunregister_tty_color, 58 DEFUN ("unregister-tty-color", Funregister_tty_color, 1, 1, 0, /*
61 1, 1, 0 /*
62 Unregister COLOR as a recognized TTY color. 59 Unregister COLOR as a recognized TTY color.
63 */ ) 60 */
64 (color) 61 (color))
65 Lisp_Object color;
66 { 62 {
67 CHECK_STRING (color); 63 CHECK_STRING (color);
68 64
69 color = Fintern (color, Qnil); 65 color = Fintern (color, Qnil);
70 Vtty_color_alist = Fremassq (color, Vtty_color_alist); 66 Vtty_color_alist = Fremassq (color, Vtty_color_alist);
71 return Qnil; 67 return Qnil;
72 } 68 }
73 69
74 DEFUN ("find-tty-color", Ffind_tty_color, Sfind_tty_color, 1, 1, 0 /* 70 DEFUN ("find-tty-color", Ffind_tty_color, 1, 1, 0, /*
75 Look up COLOR in the list of registered TTY colors. 71 Look up COLOR in the list of registered TTY colors.
76 If it is found, return a list (FG-STRING BG-STRING) of the escape 72 If it is found, return a list (FG-STRING BG-STRING) of the escape
77 sequences used to set the foreground and background to the color, respectively. 73 sequences used to set the foreground and background to the color, respectively.
78 If it is not found, return nil. 74 If it is not found, return nil.
79 */ ) 75 */
80 (color) 76 (color))
81 Lisp_Object color;
82 { 77 {
83 Lisp_Object result; 78 Lisp_Object result;
84 79
85 CHECK_STRING (color); 80 CHECK_STRING (color);
86 81
89 return list2 (Fcar (Fcdr (result)), Fcdr (Fcdr (result))); 84 return list2 (Fcar (Fcdr (result)), Fcdr (Fcdr (result)));
90 else 85 else
91 return Qnil; 86 return Qnil;
92 } 87 }
93 88
94 DEFUN ("tty-color-list", Ftty_color_list, Stty_color_list, 0, 0, 0 /* 89 DEFUN ("tty-color-list", Ftty_color_list, 0, 0, 0, /*
95 Return a list of the registered TTY colors. 90 Return a list of the registered TTY colors.
96 */ ) 91 */
97 () 92 ())
98 { 93 {
99 Lisp_Object result = Qnil; 94 Lisp_Object result = Qnil;
100 Lisp_Object rest; 95 Lisp_Object rest;
101 96
102 LIST_LOOP (rest, Vtty_color_alist) 97 LIST_LOOP (rest, Vtty_color_alist)
111 106
112 /* This approach is too simplistic. The problem is that the 107 /* This approach is too simplistic. The problem is that the
113 dynamic color settings apply to *all* text in the default color, 108 dynamic color settings apply to *all* text in the default color,
114 not just the text output after the escape sequence has been given. */ 109 not just the text output after the escape sequence has been given. */
115 110
116 DEFUN ("set-tty-dynamic-color-specs", Fset_tty_dynamic_color_specs, 111 DEFUN ("set-tty-dynamic-color-specs", Fset_tty_dynamic_color_specs, 2, 2, 0, /*
117 Sset_tty_dynamic_color_specs, 2, 2, 0 /*
118 Set the dynamic color specifications for TTY's. 112 Set the dynamic color specifications for TTY's.
119 FG and BG should be either nil or vaguely printf-like strings, 113 FG and BG should be either nil or vaguely printf-like strings,
120 where each occurrence of %s is replaced with the color name and each 114 where each occurrence of %s is replaced with the color name and each
121 occurrence of %% is replaced with a single % character. 115 occurrence of %% is replaced with a single % character.
122 */ ) 116 */
123 (fg, bg) 117 (fg, bg))
124 Lisp_Object fg, bg;
125 { 118 {
126 if (!NILP (fg)) 119 if (!NILP (fg))
127 CHECK_STRING (fg); 120 CHECK_STRING (fg);
128 if (!NILP (bg)) 121 if (!NILP (bg))
129 CHECK_STRING (bg); 122 CHECK_STRING (bg);
132 Vtty_dynamic_color_bg = bg; 125 Vtty_dynamic_color_bg = bg;
133 126
134 return Qnil; 127 return Qnil;
135 } 128 }
136 129
137 DEFUN ("tty-dynamic-color-specs", Ftty_dynamic_color_specs, 130 DEFUN ("tty-dynamic-color-specs", Ftty_dynamic_color_specs, 0, 0, 0, /*
138 Stty_dynamic_color_specs, 0, 0, 0 /*
139 Return the dynamic color specifications for TTY's as a list of (FG BG). 131 Return the dynamic color specifications for TTY's as a list of (FG BG).
140 See `set-tty-dynamic-color-specs'. 132 See `set-tty-dynamic-color-specs'.
141 */ ) 133 */
142 () 134 ())
143 { 135 {
144 return list2 (Vtty_dynamic_color_fg, Vtty_dynamic_color_bg); 136 return list2 (Vtty_dynamic_color_fg, Vtty_dynamic_color_bg);
145 } 137 }
146 138
147 #endif /* 0 */ 139 #endif /* 0 */
278 /************************************************************************/ 270 /************************************************************************/
279 271
280 void 272 void
281 syms_of_objects_tty (void) 273 syms_of_objects_tty (void)
282 { 274 {
283 defsubr (&Sregister_tty_color); 275 DEFSUBR (Fregister_tty_color);
284 defsubr (&Sunregister_tty_color); 276 DEFSUBR (Funregister_tty_color);
285 defsubr (&Sfind_tty_color); 277 DEFSUBR (Ffind_tty_color);
286 defsubr (&Stty_color_list); 278 DEFSUBR (Ftty_color_list);
287 #if 0 279 #if 0
288 defsubr (&Sset_tty_dynamic_color_specs); 280 DEFSUBR (Fset_tty_dynamic_color_specs);
289 defsubr (&Stty_dynamic_color_specs); 281 DEFSUBR (Ftty_dynamic_color_specs);
290 #endif 282 #endif
291 } 283 }
292 284
293 void 285 void
294 console_type_create_objects_tty (void) 286 console_type_create_objects_tty (void)