;ELC ;;; Compiled by proclus@darwintel on Wed Jan 2 15:45:52 2008 ;;; from file /mnt/gmirror/ports/deskutils/howm/work/howm-1.3.4/gfunc.el ;;; in Emacs version 21.2.1 ;;; with bytecomp version 1.1.1.4 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`gfunc.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #@18 For internal use (defvar *gfunc-dispatchers-var* nil (#$ . 623)) (defalias 'gfunc-call #[(base-name dispatchers args) "\301\302\303\215)\207" [type nil done (byte-code "\203&\304@ \"\211\203\305\306\304\307\310\311 \n#! \"\"\210\202A\211\204\312\313 #\207" [dispatchers args type base-name apply throw done intern-soft format "%s%s" error "Can't detect type of %s for %s."] 9)] 2]) #@460 Define generic function. BASE-NAME is name of generic function. ARGS-DECLARATION has no effect; it is merely note for programmers. DISPATCHERS-VAR is name of variable whose value is list of type-detectors. Type-detector receives arguments to the function BASE-NAME, and returns its 'type' symbol. Then, BASE-NAME + type is the name of real function. Type detector must return nil if it cannot determine the type, so that the task is chained to next detector. (defalias 'gfunc-define-function '(macro . #[(base-name args-declaration dispatchers-var &optional description) "\305\306\206\307 \n %\310\n\311\f\312\313\nD \314BBB\257)\207" [description args-declaration base-name dispatchers-var desc-str format "%s\n\nARGS = %s\n\nInternally, %s___ is called according to the type of ARGS.\nThe type part ___ is determined by functions in the list `%s'.\nThis function is generated by `gfunc-define-function'." "Generic function." defun (&rest args) gfunc-call quote (args)] 8 (#$ . 1026)])) (put 'gfunc-def 'lisp-indent-hook 2) #@149 Define generic function like `gfunc-define-function'. The only difference is omission of dispatchers; it must be specified by `gfunc-with' outside. (defalias 'gfunc-def '(macro . #[(base-name args-declaration &optional description) "\304 \n \257\207" [base-name args-declaration *gfunc-dispatchers-var* description gfunc-define-function] 5 (#$ . 2063)])) (put 'gfunc-with 'lisp-indent-hook 1) #@168 With the defalut DISPATCHERS-VAR, execute BODY. BODY is typically a set of `gfunc-def', and DISPATCHERS-VAR is used as their dispatchers. This macro cannot be nested. (defalias 'gfunc-with '(macro . #[(dispatchers-var &rest body) "\302\303\304\305DE BB\207" [dispatchers-var body eval-and-compile setq *gfunc-dispatchers-var* quote] 5 (#$ . 2465)])) (provide 'gfunc)