Sentence Pointer Handling


;   *sent*     = remainder of sentence
;   *word*     = current word
;   *savesent* = saved positions for backup

; initialize for a new sentence
(defun init-sent (sent) (setq *sent* sent)
                        (setword))

;   set *word* for current position
(defun setword () (setq *word* (car *sent*)))

;   move to next word
(defun next    () (pop *sent*) (setword) t)

;   save the current position
(defun saveptr () (push *sent* *savesent*))

;   pop the stack on success
(defun success () (pop *savesent*) t)

;   restore position on failure, return nil
(defun fail    ()
   (setq *sent* (pop *savesent*))
   (setword)  nil)

Contents    Page-10    Prev    Next    Page+10    Index