Changeset 553


Ignore:
Timestamp:
Feb 21, 2004, 5:16:38 PM (21 years ago)
Author:
Gary Byers
Message:

Process single events.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/hemlock/src/interp.lisp

    r6 r553  
    1717
    1818(in-package :hemlock-internals)
     19
     20(defstruct command-interpreter-info
     21  (current-command (make-array 10 :fill-pointer 0 :adjustable t))
     22  (current-translation (make-array 10 :fill-pointer 0 :adjustable t))
     23  (last-command-type nil)
     24  (command-type-set nil)
     25  (prefix-argument nil)
     26  (prefix-argument-supplied nil)
     27  frame
     28  )
     29
    1930
    2031(defun %print-hcommand (obj stream depth)
     
    419430
    420431
     432(defun interpret-key-event (key-event info)
     433  (setf (command-interpreter-info-prefix-argument info) nil)
     434  (let* ((*last-key-event-typed* key-event)
     435         (cmd (command-interpreter-info-current-command info))
     436         (trans (command-interpreter-info-current-translation info)))
     437    (vector-push-extend key-event cmd)
     438    (setf (fill-pointer trans) 0)
     439    (multiple-value-bind (trans-result prefix-p)
     440                             (translate-key cmd trans)
     441      (format t "~& trans-result = ~s, prefix-p = ~s" trans-result prefix-p)
     442          (multiple-value-bind (res t-bindings)
     443                               (get-current-binding trans-result)
     444            (etypecase res
     445              (command
     446               (let ((punt t))
     447                 (format t "~& key-event = ~s, res = ~s, t-bindings = ~s, prefix = ~s"
     448                         key-event
     449                         res t-bindings
     450                         (command-interpreter-info-prefix-argument info))
     451                 (catch 'command-loop-catcher
     452                   (dolist (c t-bindings)
     453                     (funcall *invoke-hook* c (command-interpreter-info-prefix-argument info)))
     454                   (funcall *invoke-hook* res (command-interpreter-info-prefix-argument info))
     455                   (setf punt nil))
     456                 (when punt (invoke-hook hemlock::command-abort-hook)))
     457               (if (command-interpreter-info-command-type-set info)
     458                 (setf (command-interpreter-info-command-type-set info) nil)
     459                 (setf (command-interpreter-info-last-command-type info) nil))
     460               (if (command-interpreter-info-prefix-argument-supplied info)
     461                   (setf (command-interpreter-info-prefix-argument-supplied info) nil)
     462                   (setf (command-interpreter-info-prefix-argument info) nil))
     463               (setf (fill-pointer cmd) 0))
     464              (null
     465               (unless prefix-p
     466                 (beep)
     467                 (setf (command-interpreter-info-prefix-argument info) nil)
     468                 (setf (fill-pointer cmd) 0)))
     469              (hash-table))))))   
     470   
    421471;;; %COMMAND-LOOP  --  Internal
    422472;;;
Note: See TracChangeset for help on using the changeset viewer.