home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / emacs / 4108 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.3 KB  |  45 lines

  1. Newsgroups: comp.emacs
  2. Path: sparky!uunet!ukma!darwin.sura.net!ra!ra.nrl.navy.mil!hoffman
  3. From: hoffman@cmf.nrl.navy.mil (Eric Hoffman)
  4. Subject: Adding C source to 18.59
  5. Message-ID: <HOFFMAN.93Jan28193429@tesuji.cmf.nrl.navy.mil>
  6. Sender: usenet@ra.nrl.navy.mil
  7. Organization: Connection Machine Facility, NRL
  8. Date: Fri, 29 Jan 1993 00:34:29 GMT
  9. Lines: 34
  10.  
  11.  
  12. I've been having difficulty adding C code to emacs (18.59). Any attempt
  13. to use a function that I have written, even if it is exactly the same
  14. as an emacs internal, results in a segv and trashing of the stack 
  15. if I try to execute it. I am unable to use gdb because of the
  16. stack-trashing feature, and I suspect that it has more to do with
  17. the loading and dumping of the executable image, rather than 
  18. the function that I copied verbatim from data.c.
  19.  
  20. Is there a special procedure required to link new C into emacs? Is
  21. there a programming guide which explains extending emacs from the 
  22. C side? 
  23.  
  24. What follows is my attempt to re-implement "int-to-string":
  25.  
  26.   #include "lisp.h"
  27.  
  28.   DEFUN ("bar", Fbar, Sbar, 1, 1, 0,"test")(obj)
  29.        register Lisp_Object obj;
  30.   {
  31.     char buffer[20];
  32.  
  33.     CHECK_NUMBER (obj, 0);
  34.     sprintf (buffer, "%d", XINT (obj));
  35.     return build_string (buffer);
  36.   }
  37.  
  38.   syms_of_bar ()
  39.   {
  40.     defsubr (&Sbar);
  41.   }
  42.  
  43.  
  44.  
  45.