[gnu.emacs] GNU Emacs Result Codes on Exit

chris@bpa.bell-atl.com (Christopher D. Orr) (01/28/89)

Can anybody tell me what the following line does in GNU Emacs when it
exits:

  exit ((XTYPE (arg) == Lisp_Int) ? XINT (arg)

It seems that it either exits with a one (1) result code or a zero
(0), but what does the result code mean ???

---
Christopher D. Orr                  | US MAIL: Electronic Data Systems (EDS)
UUCP: vu-vlsi!lxn!chris             |          Lanark Building
 or   chris%lxn.uucp@rutgers.edu    |          Center Valley, PA  18034
 or   lehi3b15!lxn!chris            | Voice:   (215) 282-1213

chris@bpa.bell-atl.com (Christopher D. Orr) (01/31/89)

>Can anybody tell me what the following line does in GNU Emacs when it
>exits:
>
>  exit ((XTYPE (arg) == Lisp_Int) ? XINT (arg)


I must have explained my original problem very badly.  I know what the
syntax of 'C' is.  I omitted the #ifdef within the GNU Emacs code to
save space within my message.  For those of you that caught that and
thought that was my problem, I apologize.

What I am seeking is information as to *what* XTYPE(arg)==Lisp_Int is
comparing and what it means.  I also am interested in finding out what
XINT(arg) is actually doing (although I can make an assumption).

The problem I am having is that GNU Emacs exits every oncce in a while
with a return code on one (1).  Why is the question.  I don't seem
able to reproduce is, so I'm not sure what the problem is.

If anybody has any information that they can provide me, I would
be a great help!!


			-Chris

---
Christopher D. Orr                  | US MAIL: Electronic Data Systems (EDS)
UUCP: vu-vlsi!lxn!chris             |          Lanark Building
 or   chris%lxn.uucp@rutgers.edu    |          Center Valley, PA  18034
 or   lehi3b15!lxn!chris            | Voice:   (215) 282-1213

biesack@godel.dg.com (Dave Biesack) (02/02/89)

In article <8901301143.AA09165@lxn.UUCP> lehi3b15!lxn!chris@bpa.bell-atl.com (Christopher D. Orr) writes:
> 
> >Can anybody tell me what the following line does in GNU Emacs when it
> >exits:
> >
> >  exit ((XTYPE (arg) == Lisp_Int) ? XINT (arg)
> 
> What I am seeking is information as to *what* XTYPE(arg)==Lisp_Int is
> comparing and what it means.  I also am interested in finding out what
> XINT(arg) is actually doing (although I can make an assumption).

XINT is a macro (defined in lisp.h) which extracts the integer value of
a lisp object. In this case, arg is a lisp object, which means it can be
a cons, a string, and array, a symbol, an integer, and many other
things. Lisp_Int is an enumerated literal from the type enum Lisp_Type,
also defined in lisp.h. XTYPE(arg) is a macro which extracts the type
tag of a lisp object. So, the code is checking to see that the lisp
object 'arg' is an integer. If it is, the integer value is extracted and
returned, otherwise, something else (1 for vms, 0 otherwise) is
returned. I missed your original posting... are you running GNU Emacs
under VMS?

> The problem I am having is that GNU Emacs exits every oncce in a while
> with a return code on one (1).  Why is the question.  I don't seem
> able to reproduce is, so I'm not sure what the problem is.
> 
There are many other places where GNU Emacs does an exit(1):
grep -n 'exit (' *.c
callproc.c:391:  _exit (1);
dispnew.c:1424:      exit (1);
emacs.c:521:  exit ((XTYPE (arg) == Lisp_Int) ? XINT (arg)
lread.c:1359:		  exit (1);
lread.c:1412:      exit (1);
regex.c:1794:  exit (1);
sysdep.c:560:      _exit (1);
sysdep.c:1074:    exit (1);
sysdep.c:2218:  exit (1);
sysdep.c:3498:  exit (1);
sysdep.c:3587:  exit (1);
term.c:1215:  exit (1);
termcap.c:139:  exit (1);

Most/all of these print a message before calling exit().
Do you get a message before Emacs exits?
 
> 			-Chris
> 
> ---
> Christopher D. Orr                  | US MAIL: Electronic Data Systems (EDS)
> UUCP: vu-vlsi!lxn!chris             |          Lanark Building
>  or   chris%lxn.uucp@rutgers.edu    |          Center Valley, PA  18034
>  or   lehi3b15!lxn!chris            | Voice:   (215) 282-1213
> 

djb
David J. Biesack  			Data General
{seismo, ...}!mcnc!rti!dg-rtp!biesack	Research Triangle Park, NC
biesack@dg-rtp.dg.com			(919) 248-5989