[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a self-contained lisp environment, siod and micro emacs.



An "emacs" subr may be defined for siod-v2.3-shar (Scheme In One Day) with
trivial modifications to micro-emacs. The resulting behavior is that
when you exit emacs and re-enter, your buffers are in the same state as before.

How to call micro emacs from siod. (Done with MicroEMACS 3.7)

Modify DISPLAY.C
 - Make sure vscreen is initialized to NULL at top of file.
   VIDEO   **vscreen = NULL;
 - Then add a line to vtinit before the malloc of vscreen.
    if (vscreen != NULL) return(1);

Modify MAIN.C
 - rename the function main to main_hacked.
 - conditionalize the call to edinit to be
    if (argc > -1) edinit(bname);
 - before this line: viewflag = FALSE; add this line:
   sgarbf  = TRUE;
 - conditionalize the call to startup to be
    if (argc > -1) startup("");
 - in the function quit replace exit with exit_hacked.

Modify SLIB.C
 There are name conflicts on functions "eq" and "quit"
 so I just renamed these to "l_eq" and "l_quit" in slib.c
 Easier than modifying micro-emacs.

Add this new subr to siod.c:

#include <setjmp.h>

long uemacs_need_init = 1;
jmp_buf uemacs_exit;

exit_hacked(value)
     int value;
{longjmp(uemacs_exit,2);}

LISP uemacs_call()
{long flag,k;
 flag = no_interrupt(1);
 k = setjmp(uemacs_exit);
 if (k == 2)
   {uemacs_need_init = 0;
    no_interrupt(flag);
    return(NIL);}
 if (uemacs_need_init)
   {main_hacked(0,0);
    uemacs_need_init = 0;}
 else
   main_hacked(-1,0);
 no_interrupt(flag);
 return(NIL);}


 init_subr("emacs",tc_subr_0,uemacs_call);

Here are the diffs.

************
File UTIL$DISK:[UEMACS]MAIN_HACKED.C;5
  353   main_hacked(argc, argv)
  354   char    *argv[];
******
File UTIL$DISK:[UEMACS]MAIN_HACKED.C;1
  353   main(argc, argv)
  354   char    *argv[];
************
************
File UTIL$DISK:[UEMACS]MAIN_HACKED.C;5
  380   	if (argc > -1)
  381   	  edinit(bname);		/* Buffers, windows.    */
  382   	sgarbf  = TRUE; /* new */
  383   	viewflag = FALSE;	/* view mode defaults off in command line */
******
File UTIL$DISK:[UEMACS]MAIN_HACKED.C;1
  380           edinit(bname);		/* Buffers, windows.    */
  381   	viewflag = FALSE;	/* view mode defaults off in command line */
************
************
File UTIL$DISK:[UEMACS]MAIN_HACKED.C;5
  465   	  if (argc > -1) startup("");
  466   		startf = TRUE;
******
File UTIL$DISK:[UEMACS]MAIN_HACKED.C;1
  463   		startup("");
  464   		startf = TRUE;
************
************
File UTIL$DISK:[UEMACS]MAIN_HACKED.C;5
  753                   exit_hacked(GOOD);
  754           }
******
File UTIL$DISK:[UEMACS]MAIN_HACKED.C;1
  751                   exit(GOOD);
  752           }
************

************
File UTIL$DISK:[UEMACS]DISPLAY.C;2
   32   VIDEO   **vscreen = NULL;                      /* Virtual screen. */
   33   #if	IBMPC == 0
******
File UTIL$DISK:[UEMACS]DISPLAY.C;1
   32   VIDEO   **vscreen;                      /* Virtual screen. */
   33   #if	IBMPC == 0
************
************
File UTIL$DISK:[UEMACS]DISPLAY.C;2
   52   
   53       if (vscreen != NULL) return(1);
   54   
   55       vscreen = (VIDEO **) malloc(term.t_nrow*sizeof(VIDEO *));
******
File UTIL$DISK:[UEMACS]DISPLAY.C;1
   52       vscreen = (VIDEO **) malloc(term.t_nrow*sizeof(VIDEO *));
************