Mercurial > hg > xemacs-beta
comparison lisp/itimer.el @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | 1ccc32a20af4 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
118 ;; Itimer access functions should behave as if they were subrs. These | 118 ;; Itimer access functions should behave as if they were subrs. These |
119 ;; macros are used to check the arguments to the itimer functions and | 119 ;; macros are used to check the arguments to the itimer functions and |
120 ;; signal errors appropriately if the arguments are not valid. | 120 ;; signal errors appropriately if the arguments are not valid. |
121 | 121 |
122 (defmacro check-itimer (var) | 122 (defmacro check-itimer (var) |
123 "If VAR is not bound to an itimer, signal wrong-type-argument. | 123 "If VAR is not bound to an itimer, signal `wrong-type-argument'. |
124 This is a macro." | 124 This is a macro." |
125 (list 'setq var | 125 (list 'setq var |
126 (list 'if (list 'itimerp var) var | 126 (list 'if (list 'itimerp var) var |
127 (list 'signal ''wrong-type-argument | 127 (list 'signal ''wrong-type-argument |
128 (list 'list ''itimerp var))))) | 128 (list 'list ''itimerp var))))) |
137 (list (list 'stringp var) (list 'get-itimer var)) | 137 (list (list 'stringp var) (list 'get-itimer var)) |
138 (list t (list 'signal ''wrong-type-argument | 138 (list t (list 'signal ''wrong-type-argument |
139 (list 'list ''string-or-itimer-p var)))))) | 139 (list 'list ''string-or-itimer-p var)))))) |
140 | 140 |
141 (defmacro check-nonnegative-number (var) | 141 (defmacro check-nonnegative-number (var) |
142 "If VAR is not bound to a number, signal wrong-type-argument. | 142 "If VAR is not bound to a number, signal `wrong-type-argument'. |
143 If VAR is not bound to a positive number, signal args-out-of-range. | 143 If VAR is not bound to a positive number, signal args-out-of-range. |
144 This is a macro." | 144 This is a macro." |
145 (list 'setq var | 145 (list 'setq var |
146 (list 'if (list 'not (list 'numberp var)) | 146 (list 'if (list 'not (list 'numberp var)) |
147 (list 'signal ''wrong-type-argument | 147 (list 'signal ''wrong-type-argument |
149 (list 'if (list '< var 0) | 149 (list 'if (list '< var 0) |
150 (list 'signal ''args-out-of-range (list 'list var)) | 150 (list 'signal ''args-out-of-range (list 'list var)) |
151 var)))) | 151 var)))) |
152 | 152 |
153 (defmacro check-string (var) | 153 (defmacro check-string (var) |
154 "If VAR is not bound to a string, signal wrong-type-argument. | 154 "If VAR is not bound to a string, signal `wrong-type-argument'. |
155 This is a macro." | 155 This is a macro." |
156 (list 'setq var | 156 (list 'setq var |
157 (list 'if (list 'stringp var) var | 157 (list 'if (list 'stringp var) var |
158 (list 'signal ''wrong-type-argument | 158 (list 'signal ''wrong-type-argument |
159 (list 'list ''stringp var))))) | 159 (list 'list ''stringp var))))) |
160 | 160 |
161 ;; Functions to access and modify itimer attributes. | 161 ;; Functions to access and modify itimer attributes. |
162 | 162 |
163 (defun itimerp (obj) | 163 (defun itimerp (object) |
164 "Return non-nil if OBJ is an itimer." | 164 "Return non-nil if OBJECT is an itimer." |
165 (and (consp obj) (eq (length obj) 8))) | 165 (and (consp object) (eq (length object) 8))) |
166 | 166 |
167 (defun itimer-live-p (obj) | 167 (defun itimer-live-p (object) |
168 "Return non-nil if OBJ is an itimer and is active. | 168 "Return non-nil if OBJECT is an itimer and is active. |
169 ``Active'' means Emacs will run it when it expires. | 169 ``Active'' means Emacs will run it when it expires. |
170 `activate-timer' must be called on an itimer to make it active. | 170 `activate-timer' must be called on an itimer to make it active. |
171 Itimers started with `start-itimer' are automatically active." | 171 Itimers started with `start-itimer' are automatically active." |
172 (and (itimerp obj) (memq obj itimer-list))) | 172 (and (itimerp object) (memq object itimer-list))) |
173 | 173 |
174 (defun itimer-name (itimer) | 174 (defun itimer-name (itimer) |
175 "Return the name of ITIMER." | 175 "Return the name of ITIMER." |
176 (check-itimer itimer) | 176 (check-itimer itimer) |
177 (car itimer)) | 177 (car itimer)) |
327 If your version of Emacs supports floating point numbers then | 327 If your version of Emacs supports floating point numbers then |
328 VALUE can be a floating point number. Otherwise it | 328 VALUE can be a floating point number. Otherwise it |
329 must be an integer. | 329 must be an integer. |
330 Optional fourth arg RESTART non-nil means that this itimer should be | 330 Optional fourth arg RESTART non-nil means that this itimer should be |
331 restarted automatically after its function is called. Normally an itimer | 331 restarted automatically after its function is called. Normally an itimer |
332 is deleted at expiration after its function has returned. | 332 is deleted at expiration after its function has returned. |
333 If non-nil RESTART should be a number indicating the value at which the | 333 If non-nil RESTART should be a number indicating the value at which the |
334 itimer should be set at restart time. | 334 itimer should be set at restart time. |
335 Optional fifth arg IS-IDLE specifies if this is an idle timer. | 335 Optional fifth arg IS-IDLE specifies if this is an idle timer. |
336 Normal timers expire after a set interval. Idle timers expire | 336 Normal timers expire after a set interval. Idle timers expire |
337 only after Emacs has been idle for specific interval. ``Idle'' | 337 only after Emacs has been idle for specific interval. ``Idle'' |