home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / emacs / src / mexeq.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-07  |  1.6 KB  |  62 lines

  1. #include "metab.h"
  2.  
  3. /* This is the general command execution
  4.  * routine. It handles the fake binding of all the
  5.  * keys to "self-insert". It also clears out the "thisflag"
  6.  * word, and arranges to move it to the "lastflag", so that
  7.  * the next command can look at it. Return the status of
  8.  * command.
  9.  */
  10. execute()
  11. #define cmdchar (*(int *)0x100)
  12. #define cmdflag (*(int *)0x102)
  13. #define cmdparm (*(int *)0x104)
  14. {
  15.     register char * gp;
  16. #define ktp ((KEYTAB *)gp)
  17. #define otp ((OVERTAB *)gp)
  18.     register int status;
  19.     extern int currow;
  20.  
  21.     thisflag = 0;
  22.     if ( isinsert( cmdchar ))
  23.     {    /* Self inserting. */
  24. #ifdef NEVER
  25.         /* If space typed, fill column defined, argument non-
  26.          * negative, and past fill column, word wrap.
  27.         */
  28.         if (cmdchar == ' ' && fillcol > 0 
  29.         && cmdparm >= 0 && currow >= fillcol )
  30.             ovloader( 21, 4 ); /* wrapword(); */
  31. This doesn't work anyway, so... out with it!
  32. #endif
  33.         if (cmdparm <= 0)    /* Fenceposts. */
  34.         {    lastflag = 0;
  35.             return ( cmdparm < 0 ? FALSE : TRUE);
  36.         }
  37.         status   = linsert( cmdparm, cmdchar );
  38. byebye:        lastflag = thisflag;
  39.         return (status);
  40.     }
  41.  
  42.     ktp = &keytab[0];    /* Look in key table.    */
  43.     while (ktp < &keytab[NKEYTAB])
  44.     {    if (ktp->k_code == cmdchar)
  45.         {    status   = (*ktp->k_fp)( cmdflag, cmdparm);
  46.             goto byebye;
  47.         }
  48.         ++ktp;
  49.     }
  50.     otp = &overtab[0];
  51.     while ( otp < &overtab[NOVERTAB])
  52.     {    if (otp->k_code == cmdchar)
  53.         {    status = ovloader( otp->ovcode,
  54.                 otp->ovparm, cmdflag, cmdparm );
  55.             goto byebye;
  56.         }
  57.         ++otp;
  58.     }
  59.     lastflag = 0;                /* Fake last flags.    */
  60.     return (ctrlg());
  61. }
  62.