Minor code cleanup. - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 1f00bb49321a12889dd8b2b9291a3dffe5e201fa
 (DIR) parent dbfb1d9c444e1772980d77e59d1e312a115ae662
 (HTM) Author: Rob King <jking@deadpixi.com>
       Date:   Thu,  8 Sep 2016 14:30:08 -0500
       
       Minor code cleanup.
       
       Diffstat:
         include/commands.h                  |      61 ++++++++++++++++---------------
         include/u.h                         |       1 +
         libXg/gwin.c                        |       4 +++-
         sam/regexp.c                        |      10 +++-------
       
       4 files changed, 38 insertions(+), 38 deletions(-)
       ---
 (DIR) diff --git a/include/commands.h b/include/commands.h
       @@ -2,41 +2,42 @@
        #define _COMMANDS_H
        
        enum{
       -    Knone,
       -    Kraw,
       -    Kcomposed,
       -    Kcommand,
       -    Kend
       +    Knone,      /* invalid command type */
       +    Kdefault,   /* perform default command action */
       +    Kraw,       /* insert raw character code, subject to transformation (e.g. tab expansion) */
       +    Kcomposed,  /* insert composed character code */
       +    Kcommand,   /* execute command (see below) */
       +    Kend        /* mark the end of a command list */
        };
        
        enum{
       -    Cnone,
       -    Cescape,
       -    Cscrolldown,
       -    Cscrollup,
       -    Cscrolldownline,
       -    Cscrollupline,
       -    Cjump,
       -    Ccharright,
       -    Ccharleft,
       -    Clinedown,
       -    Clineup,
       -    Cdelword,
       -    Cdelbol,
       -    Cdel,
       -    Csnarf,
       -    Ccut,
       -    Cpaste,
       -    Cexchange,
       -    Cwrite,
       -    Ceol,
       -    Cbol,
       -    Cmax
       -}; /* virtual command keystrokes */
       +    Cnone,              /* invalid command */
       +    Cescape,            /* highlight recently typed text */
       +    Cscrolldown,        /* scroll file down by screen */
       +    Cscrollup,          /* scroll file up by screen */
       +    Cscrolldownline,    /* scroll file down by line */
       +    Cscrollupline,      /* scroll file up by line */
       +    Cjump,              /* jump to/from command file */
       +    Ccharright,         /* move dot right by character */
       +    Ccharleft,          /* move dot left by character */
       +    Clinedown,          /* move dot down by line */
       +    Clineup,            /* move dot up by line */
       +    Cdelword,           /* delete word to left of dot */
       +    Cdelbol,            /* delete to beginning of line */
       +    Cdel,               /* delete character to left of dot */
       +    Csnarf,             /* snarf dot */
       +    Ccut,               /* cut dot */
       +    Cpaste,             /* paste from snarf buffer */
       +    Cexchange,          /* exchange snarf buffer with OS */
       +    Cwrite,             /* write file */
       +    Ceol,               /* move to beginning of line */
       +    Cbol,               /* move to end of line */
       +    Cmax                /* invalid command */
       +};
        
        enum{
       -    Tcurrent,
       -    Tmouse
       +    Tcurrent,   /* command is sent to focused layer */
       +    Tmouse      /* command is sent to layer containing the mouse */
        };
        
        #endif
 (DIR) diff --git a/include/u.h b/include/u.h
       @@ -1,4 +1,5 @@
        #include <fcntl.h>
       +#include <stdbool.h>
        #include <setjmp.h>
        #include <stdint.h>
        #include <stdio.h>
 (DIR) diff --git a/libXg/gwin.c b/libXg/gwin.c
       @@ -221,7 +221,7 @@ Keyaction(Widget w, XEvent *e, String *p, Cardinal *np)
        
            /* Check to see if it's a specially-handled key first. */
            for (Keymapping *m = keymappings; m && m->kind != Kend; m++){
       -        if (k == m->sym){
       +        if (k == m->sym && m->kind != Kdefault){
                    if ((e->xkey.state & m->mask) || m->mask == 0){
                        f = ((GwinWidget)w)->gwin.gotchar;
                        if (f)
       @@ -333,6 +333,8 @@ Mouseaction(Widget w, XEvent *e, String *p, Cardinal *np)
            int s = 0;
            int ps = 0; /* the previous state */
            int ob = 0;
       +    static bool ignore = false;
       +
            XButtonEvent *be = (XButtonEvent *)e;
            XMotionEvent *me = (XMotionEvent *)e;
            Gwinmouse m;
 (DIR) diff --git a/sam/regexp.c b/sam/regexp.c
       @@ -3,6 +3,7 @@
        
        Rangeset    sel;
        String      lastregexp;
       +
        /*
         * Machine Information
         */
       @@ -12,7 +13,6 @@ struct Inst
        {
            long    type;   /* < 0x10000 ==> literal, otherwise action */
            union {
       -        int rsid;
                int rsubid;
                int class;
                struct Inst *rother;
       @@ -92,11 +92,11 @@ Node    andstack[NSTACK];
        Node    *andp;
        int atorstack[NSTACK];
        int *atorp;
       -int lastwasand; /* Last token was operand */
       +bool lastwasand; /* Last token was operand */
        int cursubid;
        int subidstack[NSTACK];
        int *subidp;
       -int backwards;
       +bool backwards;
        int nbra;
        Rune    *exprp;     /* pointer to next character in source expression */
        #define DCLASS  10  /* allocation increment */
       @@ -219,10 +219,6 @@ operator(int t)
            if(t==RBRA && --nbra<0)
                regerror(Erightpar);
            if(t==LBRA){
       -/*
       - *      if(++cursubid >= NSUBEXP)
       - *          regerror(Esubexp);
       - */
                cursubid++; /* silently ignored */
                nbra++;
                if(lastwasand)