(defvar hide-ifdef-mode-map nil "\ Keymap used with hide-ifdef mode") (defconst hide-ifdef-mode-prefix-key "" "\ Prefix key for all hide-ifdef-mode commands.") (defvar hide-ifdef-mode-map-before nil "\ Buffer-local variable to store a copy of the local keymap before hide-ifdef-mode modifies it.") (defun define-hide-ifdef-mode-map nil (byte-code " p #################M" [hide-ifdef-mode-map nil t make-sparse-keymap define-key "d" hide-ifdef-define "u" hide-ifdef-undef "D" hide-ifdef-set-define-alist "U" hide-ifdef-use-define-alist "h" hide-ifdefs "s" show-ifdefs "" hide-ifdef-block "" show-ifdef-block "" forward-ifdef "" backward-ifdef "" down-ifdef "" up-ifdef "" next-ifdef "" previous-ifdef "" hide-ifdef-toggle-read-only where-is-internal toggle-read-only hide-ifdef-toggle-outside-read-only] 22)) (defun hif-update-mode-line nil "\ Update mode-line by setting buffer-modified to itself." (byte-code " !" [set-buffer-modified-p buffer-modified-p] 3)) (defvar hide-ifdef-mode nil "\ non-nil when hide-ifdef-mode is activated.") (defvar hide-ifdef-hiding nil "\ non-nil when text may be hidden.") (or (assq (quote hide-ifdef-hiding) minor-mode-alist) (setq minor-mode-alist (cons (quote (hide-ifdef-hiding " Hiding")) minor-mode-alist))) (or (assq (quote hide-ifdef-mode) minor-mode-alist) (setq minor-mode-alist (cons (quote (hide-ifdef-mode " Ifdef")) minor-mode-alist))) (defun hide-ifdef-mode (arg) "\ Toggle hide-ifdef-mode. Thus this is a minor mode, albeit a large one. With arg, turn hide-ifdef-mode on iff arg is positive. In hide-ifdef-mode, code within #ifdef constructs that the C preprocessor would eliminate may be hidden from view. Several variables affect how the hiding is done: hide-ifdef-env An association list of defined and undefined symbols for the current buffer. Initially, the global value of hide-ifdef-env is used. hide-ifdef-define-alist An association list of defined symbol lists. Use hide-ifdef-set-define-alist to save the current hide-ifdef-env and hide-ifdef-use-define-alist to set the current hide-ifdef-env from one of the lists in hide-ifdef-define-alist. hide-ifdef-lines Set to non-nil to not show #if, #ifdef, #ifndef, #else, and #endif lines when hiding. hide-ifdef-initially Indicates whether hide-ifdefs should be called when hide-ifdef-mode is activated. hide-ifdef-read-only Set to non-nil if you want to make buffers read only while hiding. After show-ifdefs, read-only status is restored to previous value. \\{hide-ifdef-mode-map}" (interactive "P") (byte-code "Ɉ! ? ? !V \"\"\"!!!!! ! !!!\" !w y ! !!" [hide-ifdef-mode arg hide-ifdef-env hide-ifdef-hiding hif-outside-read-only buffer-read-only hide-ifdef-mode-map-before hide-ifdef-mode-prefix-key hide-ifdef-initially nil make-local-variable prefix-numeric-value 0 hif-update-mode-line modify-syntax-entry 95 "w" 38 "." 124 default-value ide-ifdef-mode-map-before current-local-map use-local-map copy-keymap local-unset-key local-set-key hide-ifdef-mode-map define-hide-ifdef-mode-map run-hooks hide-ifdef-mode-hook hide-ifdefs show-ifdefs message "Enter hide-ifdef-mode." "Exit hide-ifdef-mode."] 27)) (defun hif-outline-flag-region (from to flag) "\ Hides or shows lines from FROM to TO, according to FLAG. If FLAG is \\n (newline character) then text is shown, while if FLAG is \\^M (control-M) the text is hidden." (byte-code " Ǝ U ɂ %))" [modp from to flag t buffer-modified-p ((byte-code "!" [modp set-buffer-modified-p] 2)) subst-char-in-region 10 13] 7)) (defun hif-show-all nil "\ Show all of the text in the current buffer." (interactive) (byte-code "ed#" [nil hif-outline-flag-region 10] 4)) (defun hide-ifdef-region (start end) "\ START is the start of a #if or #else form. END is the ending part. Everything including these lines is made invisible." (byte-code " #" [start end hif-outline-flag-region 13] 4)) (defun hif-show-ifdef-region (start end) "\ Everything between START and END is made visible." (byte-code " #" [start end hif-outline-flag-region 10] 4)) (defvar hide-ifdef-evaluator (quote eval) "\ The evaluator is given a canonical form and returns T if text under that form should be displayed.") (defvar hif-undefined-symbol nil "\ ...is by default considered to be false.") (defvar hide-ifdef-env nil "\ An alist of defined symbols and their values.") (defun hif-set-var (var value) "\ Prepend (var value) pair to hide-ifdef-env." (byte-code " BB" [hide-ifdef-env var value] 2)) (defun hif-lookup (var) (byte-code " \" A )" [val var hide-ifdef-env hif-undefined-symbol assoc] 3)) (defun hif-defined (var) (byte-code "!" [var hif-lookup] 2)) (defconst hif-cpp-prefix "\\(^\\| \\)[ ]*#[ ]*") (defconst hif-ifndef-regexp (concat hif-cpp-prefix "ifndef")) (defconst hif-ifx-regexp (concat hif-cpp-prefix "if\\(n?def\\)?[ ]+")) (defconst hif-else-regexp (concat hif-cpp-prefix "else")) (defconst hif-endif-regexp (concat hif-cpp-prefix "endif")) (defconst hif-ifx-else-endif-regexp (concat hif-ifx-regexp "\\|" hif-else-regexp "\\|" hif-endif-regexp)) (defun hif-infix-to-prefix (token-list) "\ Convert list of tokens in infix into prefix list" (byte-code "GU @DD !" [token-list 1 hif-lookup quote hif-parse-if-exp] 3)) (defconst hif-token-regexp "^\\(!\\|&&\\|||\\|[()]\\|\\w+\\)") (defconst hif-end-of-comment "\\*/") (defun hif-tokenize (expr-string) "\ Separate string into a list of tokens" (byte-code "G W ## ! SI #S ! SI #D #! SI # !O! SI\"| ҂ \"