Mercurial > hg > xemacs-beta
comparison src/process.c @ 5133:444a448b2f53
Merge branch ben-lisp-object into default branch
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sun, 07 Mar 2010 06:47:37 -0600 |
parents | a9c41067dd88 |
children | f965e31a35f0 |
comparison
equal
deleted
inserted
replaced
5113:b2dcf6a6d8ab | 5133:444a448b2f53 |
---|---|
1 /* Asynchronous subprocess control for XEmacs. | 1 /* Asynchronous subprocess control for XEmacs. |
2 Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993, 1994, 1995 | 2 Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993, 1994, 1995 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 Copyright (C) 1995 Sun Microsystems, Inc. | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 Copyright (C) 1995, 1996, 2001, 2002, 2004, 2005 Ben Wing. | 5 Copyright (C) 1995, 1996, 2001, 2002, 2004, 2005, 2010 Ben Wing. |
6 | 6 |
7 This file is part of XEmacs. | 7 This file is part of XEmacs. |
8 | 8 |
9 XEmacs is free software; you can redistribute it and/or modify it | 9 XEmacs is free software; you can redistribute it and/or modify it |
10 under the terms of the GNU General Public License as published by the | 10 under the terms of the GNU General Public License as published by the |
174 #ifdef HAVE_WINDOW_SYSTEM | 174 #ifdef HAVE_WINDOW_SYSTEM |
175 extern void debug_process_finalization (Lisp_Process *p); | 175 extern void debug_process_finalization (Lisp_Process *p); |
176 #endif /* HAVE_WINDOW_SYSTEM */ | 176 #endif /* HAVE_WINDOW_SYSTEM */ |
177 | 177 |
178 static void | 178 static void |
179 finalize_process (void *header, int for_disksave) | 179 finalize_process (Lisp_Object obj) |
180 { | 180 { |
181 /* #### this probably needs to be tied into the tty event loop */ | 181 /* #### this probably needs to be tied into the tty event loop */ |
182 /* #### when there is one */ | 182 /* #### when there is one */ |
183 Lisp_Process *p = (Lisp_Process *) header; | 183 Lisp_Process *p = XPROCESS (obj); |
184 #ifdef HAVE_WINDOW_SYSTEM | 184 #ifdef HAVE_WINDOW_SYSTEM |
185 if (!for_disksave) | 185 debug_process_finalization (p); |
186 { | |
187 debug_process_finalization (p); | |
188 } | |
189 #endif /* HAVE_WINDOW_SYSTEM */ | 186 #endif /* HAVE_WINDOW_SYSTEM */ |
190 | 187 |
191 if (p->process_data) | 188 if (p->process_data) |
192 { | 189 { |
193 MAYBE_PROCMETH (finalize_process_data, (p, for_disksave)); | 190 MAYBE_PROCMETH (finalize_process_data, (p)); |
194 if (!for_disksave) | 191 xfree (p->process_data); |
195 xfree (p->process_data); | 192 } |
196 } | 193 } |
197 } | 194 |
198 | 195 DEFINE_NODUMP_LISP_OBJECT ("process", process, |
199 DEFINE_LRECORD_IMPLEMENTATION ("process", process, | 196 mark_process, print_process, finalize_process, |
200 0, /*dumpable-flag*/ | 197 0, 0, process_description, Lisp_Process); |
201 mark_process, print_process, finalize_process, | |
202 0, 0, process_description, Lisp_Process); | |
203 | 198 |
204 /************************************************************************/ | 199 /************************************************************************/ |
205 /* basic process accessors */ | 200 /* basic process accessors */ |
206 /************************************************************************/ | 201 /************************************************************************/ |
207 | 202 |
466 } | 461 } |
467 | 462 |
468 Lisp_Object | 463 Lisp_Object |
469 make_process_internal (Lisp_Object name) | 464 make_process_internal (Lisp_Object name) |
470 { | 465 { |
471 Lisp_Object val, name1; | 466 Lisp_Object name1; |
472 int i; | 467 int i; |
473 Lisp_Process *p = ALLOC_LCRECORD_TYPE (Lisp_Process, &lrecord_process); | 468 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (process); |
469 Lisp_Process *p = XPROCESS (obj); | |
474 | 470 |
475 #define MARKED_SLOT(x) p->x = Qnil; | 471 #define MARKED_SLOT(x) p->x = Qnil; |
476 #include "process-slots.h" | 472 #include "process-slots.h" |
477 | 473 |
478 /* If name is already in use, modify it until it is unused. */ | 474 /* If name is already in use, modify it until it is unused. */ |
493 p->stderr_mark = Fmake_marker (); | 489 p->stderr_mark = Fmake_marker (); |
494 p->status_symbol = Qrun; | 490 p->status_symbol = Qrun; |
495 | 491 |
496 MAYBE_PROCMETH (alloc_process_data, (p)); | 492 MAYBE_PROCMETH (alloc_process_data, (p)); |
497 | 493 |
498 val = wrap_process (p); | 494 Vprocess_list = Fcons (obj, Vprocess_list); |
499 | 495 return obj; |
500 Vprocess_list = Fcons (val, Vprocess_list); | |
501 return val; | |
502 } | 496 } |
503 | 497 |
504 void | 498 void |
505 init_process_io_handles (Lisp_Process *p, void* in, void* out, void* err, | 499 init_process_io_handles (Lisp_Process *p, void* in, void* out, void* err, |
506 int flags) | 500 int flags) |
2489 } | 2483 } |
2490 | 2484 |
2491 void | 2485 void |
2492 syms_of_process (void) | 2486 syms_of_process (void) |
2493 { | 2487 { |
2494 INIT_LRECORD_IMPLEMENTATION (process); | 2488 INIT_LISP_OBJECT (process); |
2495 | 2489 |
2496 DEFSYMBOL (Qprocessp); | 2490 DEFSYMBOL (Qprocessp); |
2497 DEFSYMBOL (Qprocess_live_p); | 2491 DEFSYMBOL (Qprocess_live_p); |
2498 DEFSYMBOL (Qrun); | 2492 DEFSYMBOL (Qrun); |
2499 DEFSYMBOL (Qstop); | 2493 DEFSYMBOL (Qstop); |