Commit 4c9c3b10 authored by Linus Tolke's avatar Linus Tolke
Browse files

Rewound to before prefetch.

parent 4a9642b0
No preview for this file type
......@@ -24,7 +24,10 @@
#
# $Id$
# $Log$
# Revision 35.21 1993/02/04 04:00:48 linus
# Revision 35.22 1993/04/26 19:30:54 linus
# Rewound to before prefetch.
#
# Revision 35.21 1993/02/04 04:00:48 linus
# Removed the import.make dependencie of the Makefile.
#
# Revision 35.20 1992/07/30 19:49:22 linus
......@@ -100,7 +103,7 @@ EMACS-BATCH = emacs -batch -l /usr/local/var/elisp/bytecomp
# NOTE: lyskom-rest.el must be the last file in PARTS-EL and SRC-ELC.
PARTS-EL = komtypes.el clienttypes.el startup.el \
reading.el prefetch.el \
reading.el \
internal.el parse.el services.el cache.el\
commands1.el commands2.el review.el edit-text.el \
view-text.el async.el completing-read.el \
......@@ -114,7 +117,7 @@ SWEDISH-ELC = swedish-strings.elc
ENGLISH-EL = english-strings.el
ENGLISH-ELC = english-strings.elc
SRC-ELC = komtypes.elc clienttypes.elc startup.elc \
reading.elc prefetch.elc \
reading.elc \
internal.elc parse.elc services.elc cache.elc\
commands1.elc commands2.elc review.elc edit-text.elc \
view-text.elc async.elc completing-read.elc \
......
No preview for this file type
......@@ -254,146 +254,55 @@ Optional argument CONF-STAT is used to check for a msg-of-day on the person."
(zerop (conf-stat->presentation conf-stat))
(not (zerop (conf-stat->no-of-texts conf-stat))))
(lyskom-insert-string 'presentation-encouragement))
(lyskom-setup-prefetch)
(lyskom-stop-prefetch)
(setq lyskom-membership-is-read 0)
(setq lyskom-membership nil)
(setq lyskom-command-to-do 'unknown)
(setq lyskom-unread-confs)
(setq lyskom-options-done)
(setq lyskom-to-do-list (lyskom-create-read-list))
(setq lyskom-reading-list (lyskom-create-read-list))
(initiate-get-unread-confs 'main 'lyskom-register-unread-confs
lyskom-pers-no)
(lyskom-read-options) ; Check this to be finished before
; printing the first prompt
(initiate-get-part-of-membership 'main 'lyskom-start-anew-login-3
lyskom-pers-no
lyskom-membership-is-read
lyskom-fetch-membership-length)
(lyskom-prefetch-all-conf-stats)
(lyskom-prefetch-marks)
(lyskom-prefetch-who-is-on)
(lyskom-prefetch-membership pers-no)
;; Don't start prefetching until we have the first prompt.
)))
(defun lyskom-register-unread-confs (unread-confs)
"Saves the list of UNREADCONFS in a variable for later use."
(setq lyskom-unread-confs unread-confs))
(defun lyskom-start-anew-login-3 (part-of-membership)
"Puts the membersship, or part of it in the lyskom-to-do-list.
If we have got enough information to be able to decide upon the first
prompt the prompt is printed and this function is left. If not, fetch
more membership.
Information required for this:
- lyskom-unread-confs
- lyskom-options-done
- an article in one of the conferences in the membership."
(if (symbolp part-of-membership)
nil
(if (< (length part-of-membership) lyskom-fetch-membership-length) ; all
(setq lyskom-membership-is-read 'almost)
(setq lyskom-membership-is-read (+ lyskom-membership-is-read
lyskom-fetch-membership-length)))
(lyskom-append-to-membership part-of-membership))
(if (and lyskom-unread-confs
lyskom-options-done ; We have the fundamental stuff
(or (not (read-list-isempty lyskom-to-do-list))
(eq lyskom-membership-is-read t))
)
(lyskom-collect 'main)
(initiate-get-membership 'main nil pers-no)
(initiate-get-unread-confs 'main nil pers-no)
(initiate-get-marks 'main nil)
(initiate-who-is-on 'main nil)
(initiate-who-am-i 'main nil)
(lyskom-use 'main 'lyskom-prefetch nil)
(lyskom-read-options))))
(defun lyskom-refetch ()
"Refetch membership-list and dependent structures."
(setq lyskom-membership-is-read nil)
(setq lyskom-membership nil)
(setq lyskom-command-to-do 'unknown)
(set-read-list-empty lyskom-reading-list)
(lyskom-collect 'main)
(initiate-get-membership 'main nil lyskom-pers-no)
(initiate-get-unread-confs 'main nil lyskom-pers-no)
(lyskom-use 'main 'lyskom-prefetch))
(defun lyskom-prefetch (membership conf-no-list
&optional marks who-info-list session-no noend)
"Prefetch conf-stats for the first lyskom-prefetch-confs confs.
Args: MEMBERSHIP, CONF-NO-LIST, MARKS, WHO-INFO-LIST SESSION-NO NOEND
If optional NOEND is non-nil then do not do lyskom-end-of-command."
(lyskom-set-membership membership)
(if marks
(cache-set-marked-texts marks))
(if who-info-list
(cache-initiate-who-info-buffer who-info-list))
(if session-no
(setq lyskom-session-no session-no))
(setq lyskom-unread-confs conf-no-list)
(setq lyskom-last-conf-fetched -1)
(setq lyskom-last-conf-received -1)
(setq lyskom-to-do-list (lyskom-create-read-list))
(setq lyskom-reading-list (lyskom-create-read-list))
(if (not noend)
(lyskom-end-of-command)))
; obsolete
;(defun lyskom-set-membership (membership)
; "Sets lyskom-membership to a new value.
;Args: MEMBERSHIP."
; (setq lyskom-membership (sort (lyskom-array-to-list membership)
; 'lyskom-membership-<))
; (setq lyskom-membership-is-read t))
(defun lyskom-append-to-membership (membership)
"Adds a PART last in the membership-list."
(let ((list (lyskom-array-to-list membership))
sent)
(lyskom-add-membership-to-membership membership)
(lyskom-fetch-until-we-have-an-unread list)))
(defun lyskom-fetch-until-we-have-an-unread (&optional list)
"Call to fetch info until we have decided if we have an unread. (or are done."
(let ((sent))
(while (and (not sent) list)
(if (and lyskom-unread-confs
(not (memq (membership->conf-no (car list))
(lyskom-array-to-list
(conf-no-list->conf-nos lyskom-unread-confs)))))
nil
(initiate-get-conf-stat 'main 'lyskom-decide-unread-conf
(membership->conf-no (car list))
(car list)
(cdr list))
(setq sent t))
(setq list (cdr list)))
(if sent
nil
(if (numberp lyskom-membership-is-read)
(initiate-get-part-of-membership 'main 'lyskom-start-anew-login-3
lyskom-pers-no
lyskom-membership-is-read
lyskom-fetch-membership-length)
(setq lyskom-membership-is-read t)))
(let ((reverse (reverse lyskom-membership)))
(while reverse
(lyskom-prefetch-conf (membership->conf-no (car reverse)))
(setq reverse (cdr reverse))))))
(defun lyskom-decide-unread-conf (conf-stat membship rest-memblist)
"Checks if we have unread in the conf CONF-STAT using MEMBERSHIP.
If not, fetch next conf-stat from REST-MEMBERSHIPLIST."
(if (cond
((not conf-stat) ; error
nil)
((> (+ (conf-stat->first-local-no conf-stat)
(conf-stat->no-of-texts conf-stat)
-1)
(membership->last-text-read membship))
;; There are (probably) some unread texts in this conf.
(lyskom-prefetch-map (conf-stat->conf-no conf-stat)
(+ lyskom-fetch-map-nos
(membership->last-text-read membship)))
(initiate-get-map 'main 'lyskom-decide-unread-map
(conf-stat->conf-no conf-stat)
(1+ (membership->last-text-read membship))
lyskom-fetch-map-nos
conf-stat)
t))
nil
(if rest-memblist
(progn
(initiate-get-conf-stat 'main 'lyskom-decide-unread-conf
(membership->conf-no (car rest-memblist))
(car rest-memblist)
(cdr rest-memblist))
(lyskom-run 'main 'lyskom-start-anew-login-3 'cont))
(if (numberp lyskom-membership-is-read)
(initiate-get-part-of-membership 'main 'lyskom-start-anew-login-3
lyskom-membership-is-read
lyskom-fetch-membership-length)
(setq lyskom-membership-is-read t)
(lyskom-run 'main 'lyskom-start-anew-login-3 'cont)))))
(defun lyskom-decide-unread-map (map conf)
"Enters this map in the lyskom-to-do-list and returns to lyskom-start-anew-login-3."
(lyskom-enter-map-in-to-do-list map conf)
(lyskom-fetch-until-we-have-an-unread))
(defun lyskom-set-membership (membership)
"Sets lyskom-membership to a new value.
Args: MEMBERSHIP."
(setq lyskom-membership (sort (lyskom-array-to-list membership)
'lyskom-membership-<))
(setq lyskom-membership-is-read t))
(defun lyskom-print-name (conf-stat)
......@@ -600,7 +509,8 @@ Entry to this mode runs lyskom-mode-hook."
(last-viewed lyskom-last-viewed)
(replies-buffer lyskom-unparsed-buffer)
(replies-marker lyskom-unparsed-marker)
(server-info lyskom-server-info))
(server-info lyskom-server-info)
)
(kill-all-local-variables)
(make-local-variable 'lyskom-unparsed-buffer)
(make-local-variable 'lyskom-unparsed-marker)
......@@ -631,6 +541,7 @@ Entry to this mode runs lyskom-mode-hook."
(make-local-variable 'lyskom-membership)
(make-local-variable 'lyskom-prefetch-texts)
(make-local-variable 'lyskom-prefetch-conf-tresh)
(make-local-variable 'lyskom-no-prompt)
(make-local-variable 'lyskom-reading-list)
(make-local-variable 'lyskom-to-do-list)
(make-local-variable 'lyskom-fetched-texts)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment