;ELC ;;; compiled by jimb@geech.gnu.ai.mit.edu on Mon Jul 5 23:18:14 1993 ;;; from file /gd/gnu/emacs/19.0/lisp/hideif.el ;;; emacs version 19.15.16. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19")) (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.") (defalias (quote define-hide-ifdef-mode-map) #[nil "u ###############$%t%#)M" [hide-ifdef-mode-map 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 nil t where hide-ifdef-toggle-outside-read-only] 6]) (defalias 'hif-update-mode-line #[nil " !" [set-buffer-modified-p buffer-modified-p] 2 "\ Update mode-line by setting buffer-modified to itself."]) (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.") (byte-code " \n B  B" [hide-ifdef-hiding minor-mode-alist (hide-ifdef-hiding " Hiding") hide-ifdef-mode (hide-ifdef-mode " Ifdef")] 2) (defalias 'hide-ifdef-mode #[(arg) "!\n ?\n!V v\"\"\"!! !!!!  !!!\" !o r !~ !!" [make-local-variable hide-ifdef-mode arg prefix-numeric-value 0 hif-update-mode-line modify-syntax-entry 95 "w" 38 "." 124 hide-ifdef-env default-value hide-ifdef-hiding hif-outside-read-only buffer-read-only hide-ifdef-mode-map-before current-local-map use-local-map copy-keymap local-unset-key hide-ifdef-mode-prefix-key local-set-key hide-ifdef-mode-map define-hide-ifdef-mode-map run-hooks hide-ifdef-mode-hook hide-ifdef-initially hide-ifdefs show-ifdefs message "Enter hide-ifdef-mode." "Exit hide-ifdef-mode."] 3 "\ Toggle Hide-Ifdef mode. 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}" "P"]) (defalias 'hif-outline-flag-region #[(from to flag) " Ž UȂ%*" [buffer-modified-p modp ((set-buffer-modified-p modp)) subst-char-in-region from to flag 10 13 t] 6 "\ 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."]) (defalias 'hif-show-all #[nil "ed#" [hif-outline-flag-region 10] 4 "\ Show all of the text in the current buffer." nil]) (defalias 'hide-ifdef-region #[(start end) " \n#" [hif-outline-flag-region start end 13] 4 "\ START is the start of a #if or #else form. END is the ending part. Everything including these lines is made invisible."]) (defalias 'hif-show-ifdef-region #[(start end) " \n#" [hif-outline-flag-region start end 10] 4 "\ Everything between START and END is made visible."]) (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.") (defalias 'hif-set-var #[(var value) " B\nB" [var value hide-ifdef-env] 2 "\ Prepend (var value) pair to hide-ifdef-env."]) (byte-code "\"\"PP\nP P\n " [defalias hif-lookup #[(var) " \n\" A )" [assoc var hide-ifdef-env val hif-undefined-symbol] 4] hif-defined #[(var) " !" [hif-lookup var] 2] "\\(^\\| \\)[ ]*#[ ]*" hif-cpp-prefix "ifndef" hif-ifndef-regexp "if\\(n?def\\)?[ ]+" hif-ifx-regexp "else" hif-else-regexp "endif" hif-endif-regexp "\\|" hif-ifx-else-endif-regexp] 5) (defalias 'hif-infix-to-prefix #[(token-list) "GU@DD!" [token-list 1 hif-lookup quote hif-parse-if-exp] 3 "\ Convert list of tokens in infix into prefix list"]) (byte-code "ć" ["^\\(!\\|&&\\|||\\|[()]\\|\\w+\\)" hif-token-regexp "\\*/" hif-end-of-comment nil] 1) (defalias 'hif-tokenize #[(expr-string) "\nG W\n #!\n SI\n #M\n SI\n\n #A\n #\n SI \n #\n O \n SI Θqς И|т Ҙӂ ԘՂ ׂ֘ ؘق ! B)\n\" +" [nil 0 expr-string expr-length expr-start token-list string-match "^[ ]+" 10 "^/\\*" hif-end-of-comment "$" hif-token-regexp token "||" or "&&" and "!" not "defined" hif-defined "(" lparen ")" rparen intern error "Bad #if expression: %s"] 4 "\ Separate string into a list of tokens"]) (defalias 'hif-parse-if-exp #[(token-list) " \n\n\"" [hif-nexttoken hif-expr token error "Error: unexpected token: %s"] 4 "\ Parse the TOKEN-LIST. Return translated list in prefix form."]) (defalias 'hif-nexttoken #[nil "@A " [token-list token] 1 "\ Pop the next token from token-list into the let variable \"token\"."]) (defalias 'hif-expr #[nil " \n= E )" [hif-term result token or hif-nexttoken] 3 "\ Parse and expression of the form expr : term | expr '||' term."]) (defalias 'hif-term #[nil " \n= E )" [hif-factor result token and hif-nexttoken] 3 "\ Parse a term of the form term : factor | term '&&' factor."]) (defalias 'hif-factor #[nil "= D=/ =(\"- )=k =B!  >S\" =`!  )DD >x!  )DD" [token not hif-nexttoken hif-factor lparen hif-expr result rparen error "Bad token in parenthesized expression: %s" hif-defined "Error: expected \"(\" after \"defined\"" ident (or and not hif-defined lparen rparen) "Error: unexpected token: %s" "Error: expected \")\" after identifier" quote (or and) "Error: missing identifier" hif-lookup] 4 "\ Parse a factor of the form factor : '!' factor | '(' expr ')' | 'defined(' id ')' | id."]) (defalias 'hif-canonicalize #[nil " ! !`w`{!!\n\n%\nD'\n," [looking-at hif-ifndef-regexp negate re-search-forward hif-ifx-regexp "^\n " nil expr-string hif-infix-to-prefix hif-tokenize expr not] 3 "\ When at beginning of #ifX, returns a canonical (evaluatable) form for the expression."]) (defalias 'hif-find-any-ifX #[nil " d#y" [re-search-forward hif-ifx-regexp t 0] 4 "\ Position at beginning of next #if, #ifdef, or #ifndef, including one on this line."]) (defalias 'hif-find-next-relevant #[nil "\nd#y" [nil re-search-forward hif-ifx-else-endif-regexp t 0] 4 "\ Position at beginning of next #ifdef, #ifndef, #else, #endif, NOT including one on this line."]) (defalias 'hif-find-previous-relevant #[nil "y\ne#yć" [0 re-search-backward hif-ifx-else-endif-regexp t nil] 4 "\ Position at beginning of previous #ifdef, #ifndef, #else, #endif, NOT including one on this line."]) (byte-code "\"\"\"" [defalias hif-looking-at-ifX #[nil " !" [looking-at hif-ifx-regexp] 2] hif-looking-at-endif #[nil " !" [looking-at hif-endif-regexp] 2] hif-looking-at-else #[nil " !" [looking-at hif-else-regexp] 2]] 3) (defalias 'hif-ifdef-to-endif #[nil "   Ň!" [hif-find-next-relevant hif-looking-at-ifX hif-ifdef-to-endif hif-looking-at-else hif-looking-at-endif done error "Mismatched #ifdef #endif pair"] 2 "\ If positioned at #ifX or #else form, skip to corresponding #endif."]) (defalias 'hif-endif-to-ifdef #[nil "` `U!)  # *ȇɇ" [start hif-find-previous-relevant error "Mismatched #ifdef #endif pair" hif-looking-at-endif hif-endif-to-ifdef hif-looking-at-else hif-looking-at-ifX done t] 2 "\ If positioned at #endif form, skip backward to corresponding #ifX."]) (defalias 'forward-ifdef #[(&optional arg) "W[!W:[` $ / 6 b!)" [arg 1 0 backward-ifdef start hif-looking-at-ifX hif-find-next-relevant hif-ifdef-to-endif error "No following #ifdef"] 2 "\ Move point to beginning of line of the next ifdef-endif. With argument, do this that many times." "p"]) (defalias 'backward-ifdef #[(&optional arg) "W[!W=Sy` ' 2 9 b!)" [arg 1 0 forward-ifdef start hif-looking-at-endif hif-find-previous-relevant hif-endif-to-ifdef error "No previous #ifdef"] 2 "\ Move point to beginning of the previous ifdef-endif. With argument, do this that many times." "p"]) (defalias 'down-ifdef #[nil "` ?b!)" [start hif-find-next-relevant hif-looking-at-ifX hif-looking-at-else error "No following #ifdef"] 2 "\ Move point to beginning of nested ifdef or else-part." nil]) (defalias 'up-ifdef #[nil "y`  `U!)" [0 start hif-looking-at-endif hif-find-previous-relevant hif-endif-to-ifdef error "No previous #ifdef"] 2 "\ Move point to beginning of enclosing ifdef or else-part." nil]) (defalias 'next-ifdef #[(&optional arg) "W[!W+S ly!" [arg 1 0 previous-ifdef hif-find-next-relevant error "No following #ifdefs, #elses, or #endifs"] 2 "\ Move to the beginning of the next #ifX, #else, or #endif. With argument, do this that many times." "p"]) (defalias 'previous-ifdef #[(&optional arg) "W[!W-S` `U)!)" [arg 1 0 next-ifdef start hif-find-previous-relevant error "No previous #ifdefs, #elses, or #endifs"] 2 "\ Move to the beginning of the previous #ifX, #else, or #endif. With argument, do this that many times." "p"]) (byte-code "\"\"\"\"\"" [defalias hif-make-range #[(else-p start end &optional else) " \n F" [else-p start else end] 4] hif-range-else-p #[(range) "" [range 0] 2] hif-range-start #[(range) "" [range 1] 2] hif-range-else #[(range) "" [range 2] 2] hif-range-end #[(range) "" [range 3] 2]] 3) (defalias 'hif-find-range #[nil "y`   )`+` K @ 2 I!` \n $-" [0 nil end else else-p start hif-find-next-relevant hif-looking-at-ifX hif-ifdef-to-endif hif-looking-at-else t error "Found two elses in a row? Broken!" hif-make-range] 5 "\ Returns a Range structure describing the current #if region. Point is left unchanged."]) (defalias 'hif-hide-line #[(point) " b Ďy`U?`S`\"+" [hide-ifdef-lines point buffer-modified-p modp ((set-buffer-modified-p modp)) 0 1 hide-ifdef-region] 3 "\ Hide the line containing point. Does nothing if `hide-ifdef-lines' is nil."]) (defalias 'hif-recurse-on #[(start end) "b`\n} *" [start nil end hide-ifdef-guts] 2 "\ Call `hide-ifdef-guts' after narrowing to end of START line and END line."]) (defalias 'hif-possibly-hide #[nil " \n!! !A\n!5\n!!\n!\n!S\"\n!\n!\"k\n!\n!\"k\n!c\n!!\n!\n!S\"\n!\n!\"k`\n!S\"\n!!\n!b*" [hif-canonicalize hif-find-range range test hif-hide-line hif-range-end hide-ifdef-evaluator hif-range-else-p hif-range-else hide-ifdef-region hif-recurse-on hif-range-start nil] 4 "\ Called at #ifX expression, this hides those parts that should be hidden, according to judgement of `hide-ifdef-evaluator'."]) (defalias 'hide-ifdef-guts #[nil "eb  )" [hif-find-any-ifX hif-possibly-hide] 1 "\ Does the work of `hide-ifdefs', except for the work that's pointless to redo on a recursive entry."]) (defvar hide-ifdef-initially nil "\ *Non-nil if `hide-ifdefs' should be called when Hide-Ifdef mode is first activated.") (defvar hide-ifdef-hiding nil "\ Non-nil if text might be hidden.") (defvar hide-ifdef-read-only nil "\ *Set to non-nil if you want buffer to be read-only while hiding text.") (defvar hif-outside-read-only nil "\ Internal variable. Saves the value of `buffer-read-only' while hiding.") (defvar hide-ifdef-lines nil "\ *Set to t if you don't want to see the #ifX, #else, and #endif lines.") (defalias 'hide-ifdef-toggle-read-only #[nil "? Â\"  " [hide-ifdef-read-only message "Hide-Read-Only %s" "ON" "OFF" hide-ifdef-hiding hif-outside-read-only buffer-read-only hif-update-mode-line] 3 "\ Toggle hide-ifdef-read-only." nil]) (defalias 'hide-ifdef-toggle-outside-read-only #[nil "? Â\"  " [hif-outside-read-only message "Read only %s" "ON" "OFF" hide-ifdef-hiding hide-ifdef-read-only buffer-read-only hif-update-mode-line] 3 "\ Replacement for `toggle-read-only' within Hide Ifdef mode." nil]) (defalias 'hide-ifdef-define #[(var) " \" " [hif-set-var var t hide-ifdef-hiding hide-ifdefs] 3 "\ Define a VAR so that #ifdef VAR would be included." "SDefine what? "]) (defalias 'hide-ifdef-undef #[(var) " \" " [hif-set-var var nil hide-ifdef-hiding hide-ifdefs] 3 "\ Undefine a VAR so that #ifdef VAR would not be included." "SUndefine what? "]) (defalias 'hide-ifdefs #[nil "!\n !      - 0 !" [message "Hiding..." hide-ifdef-mode 1 hide-ifdef-hiding show-ifdefs buffer-read-only toggle-read-only t selective-display hide-ifdef-guts hide-ifdef-read-only hif-outside-read-only "Hiding done"] 2 "\ Hide the contents of some #ifdefs. Assume that defined symbols have been added to `hide-ifdef-env'. The text hidden is the text that would not be included by the C preprocessor if it were given the file with those symbols defined. Turn off hiding by calling `show-ifdef'." nil]) (defalias 'show-ifdefs #[nil "   ‰" [buffer-read-only toggle-read-only nil selective-display hif-show-all hif-outside-read-only hide-ifdef-hiding] 2 "\ Cancel the effects of `hide-ifdef'. The contents of all #ifdefs is shown." nil]) (defalias 'hif-find-ifdef-block #[nil "y   ` `S)y ) 7 ) `S^\n*" [nil max-bottom 0 hif-looking-at-else hif-looking-at-ifX up-ifdef top hif-ifdef-to-endif hif-looking-at-endif hif-find-next-relevant bottom] 2 "\ Utility for hide and show `ifdef-block'. Set top and bottom of ifdef block."]) (defalias 'hide-ifdef-block #[nil "!\n Ɖ \" 1!T! *?A " [hide-ifdef-mode 1 buffer-read-only toggle-read-only t selective-display nil bottom top hif-find-ifdef-block hide-ifdef-region hide-ifdef-lines hif-hide-line hide-ifdef-hiding hide-ifdef-read-only hif-outside-read-only] 3 "\ Hide the ifdef block (true or false part) enclosing or before the cursor." nil]) (defalias 'show-ifdef-block #[nil " y`S`\")0Ɖ S\"* 6 )" [buffer-read-only old-read-only toggle-read-only hide-ifdef-lines 0 hif-show-ifdef-region nil bottom top hif-find-ifdef-block] 4 "\ Show the ifdef block (true or false part) enclosing or before the cursor." nil]) (defvar hide-ifdef-define-alist nil "\ A global assoc list of pre-defined symbol lists") (defalias 'hif-compress-define-list #[(env) "\n\" @ @ B A *" [mapcar #[(arg) " @! @" [hif-lookup arg] 2] env nil new-defs defs] 4 "\ Compress the define list ENV into a list of defined symbols only."]) (defalias 'hide-ifdef-set-define-alist #[(name) "\n!B B" [name hif-compress-define-list hide-ifdef-env hide-ifdef-define-alist] 3 "\ Set the association for NAME to `hide-ifdef-env'." "SSet define list: "]) (defalias 'hide-ifdef-use-define-alist #[(name) " \n\" A\" \"  )" [assoc name hide-ifdef-define-alist define-list mapcar #[(arg) "B" [arg t] 2] hide-ifdef-env error "No define list for %s" hide-ifdef-hiding hide-ifdefs] 4 "\ Set `hide-ifdef-env' to the define list specified by NAME." "SUse define list: "])