comparison src/device.c @ 5178:97eb4942aec8

merge
author Ben Wing <ben@xemacs.org>
date Mon, 29 Mar 2010 21:28:13 -0500
parents 8b2f75cecb89 88bd4f3ef8e4
children 71ee43b8a74d
comparison
equal deleted inserted replaced
5177:b785049378e3 5178:97eb4942aec8
1 /* Generic device functions. 1 /* Generic device functions.
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc. 3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
4 Copyright (C) 1995, 1996, 2002 Ben Wing. 4 Copyright (C) 1995, 1996, 2002, 2010 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
158 int UNUSED (escapeflag)) 158 int UNUSED (escapeflag))
159 { 159 {
160 struct device *d = XDEVICE (obj); 160 struct device *d = XDEVICE (obj);
161 161
162 if (print_readably) 162 if (print_readably)
163 printing_unreadable_lcrecord (obj, XSTRING_DATA (d->name)); 163 printing_unreadable_lisp_object (obj, XSTRING_DATA (d->name));
164 164
165 write_fmt_string (printcharfun, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" : 165 write_fmt_string (printcharfun, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" :
166 DEVICE_TYPE_NAME (d)); 166 DEVICE_TYPE_NAME (d));
167 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d))) 167 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d)))
168 write_fmt_string_lisp (printcharfun, " on %S", 1, DEVICE_CONNECTION (d)); 168 write_fmt_string_lisp (printcharfun, " on %S", 1, DEVICE_CONNECTION (d));
169 write_fmt_string (printcharfun, " 0x%x>", d->header.uid); 169 write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj));
170 } 170 }
171 171
172 DEFINE_LRECORD_IMPLEMENTATION ("device", device, 172 DEFINE_NODUMP_LISP_OBJECT ("device", device,
173 0, /*dumpable-flag*/ 173 mark_device, print_device, 0, 0, 0,
174 mark_device, print_device, 0, 0, 0, 174 device_description,
175 device_description, 175 struct device);
176 struct device);
177 176
178 int 177 int
179 valid_device_class_p (Lisp_Object class_) 178 valid_device_class_p (Lisp_Object class_)
180 { 179 {
181 return !NILP (memq_no_quit (class_, Vdevice_class_list)); 180 return !NILP (memq_no_quit (class_, Vdevice_class_list));
199 } 198 }
200 199
201 static void 200 static void
202 nuke_all_device_slots (struct device *d, Lisp_Object zap) 201 nuke_all_device_slots (struct device *d, Lisp_Object zap)
203 { 202 {
204 ZERO_LCRECORD (d); 203 zero_nonsized_lisp_object (wrap_device (d));
205 204
206 #define MARKED_SLOT(x) d->x = zap; 205 #define MARKED_SLOT(x) d->x = zap;
207 #include "devslots.h" 206 #include "devslots.h"
208 } 207 }
209 208
210 static struct device * 209 static struct device *
211 allocate_device (Lisp_Object console) 210 allocate_device (Lisp_Object console)
212 { 211 {
213 Lisp_Object device; 212 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (device);
214 struct device *d = ALLOC_LCRECORD_TYPE (struct device, &lrecord_device); 213 struct device *d = XDEVICE (obj);
215 struct gcpro gcpro1; 214 struct gcpro gcpro1;
216 215
217 device = wrap_device (d); 216 GCPRO1 (obj);
218 GCPRO1 (device);
219 217
220 nuke_all_device_slots (d, Qnil); 218 nuke_all_device_slots (d, Qnil);
221 219
222 d->console = console; 220 d->console = console;
223 d->infd = d->outfd = -1; 221 d->infd = d->outfd = -1;
1396 /************************************************************************/ 1394 /************************************************************************/
1397 1395
1398 void 1396 void
1399 syms_of_device (void) 1397 syms_of_device (void)
1400 { 1398 {
1401 INIT_LRECORD_IMPLEMENTATION (device); 1399 INIT_LISP_OBJECT (device);
1402 1400
1403 DEFSUBR (Fvalid_device_class_p); 1401 DEFSUBR (Fvalid_device_class_p);
1404 DEFSUBR (Fdevice_class_list); 1402 DEFSUBR (Fdevice_class_list);
1405 1403
1406 DEFSUBR (Fdfw_device); 1404 DEFSUBR (Fdfw_device);