%PDF- %PDF-
Direktori : /usr/local/share/emacs/27.2/lisp/progmodes/ |
Current File : //usr/local/share/emacs/27.2/lisp/progmodes/hideif.elc |
;ELC ;;; Compiled ;;; in Emacs version 27.2 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307\310%\210\311\312\313\314\315DD\316\317\320%\210\311\321\313\314\322DD\323\317\320%\210\311\324\313\314\325DD\326\317\320%\210\311\327\313\314\330DD\331\317\320\332\333&\210\334\327\335\336\332\333%\210\311\337\313\314\340DD\341\317\342\332\343&\210\311\344\313\314\345DD\346\317\320\332\343&\210\311\347\313\314\350DD\351\317\352\332\343&\207" [require cc-mode cl-lib custom-declare-group hide-ifdef nil "Hide selected code within `ifdef'." :group c custom-declare-variable hide-ifdef-initially funcall function #[0 "\300\207" [nil] 1] "Non-nil means call `hide-ifdefs' when Hide-Ifdef mode is first activated." :type boolean hide-ifdef-read-only #[0 "\300\207" [nil] 1] "Set to non-nil if you want buffer to be read-only while hiding text." hide-ifdef-lines #[0 "\300\207" [nil] 1] "Non-nil means hide the #ifX, #else, and #endif lines." hide-ifdef-shadow #[0 "\300\207" [nil] 1] "Non-nil means shadow text instead of hiding it." :version "23.1" custom-declare-face ((t (:inherit shadow))) "Face for shadowing ifdef blocks." hide-ifdef-exclude-define-regexp #[0 "\300\207" [nil] 1] "Ignore #define names if those names match this exclusion pattern." (choice (const nil) string) "25.1" hide-ifdef-expand-reinclusion-protection #[0 "\300\207" [t] 1] "Non-nil means don't hide an entire header file enclosed by #ifndef...#endif.\nMost C/C++ headers are usually wrapped with ifdefs to prevent re-inclusion:\n\n ----- beginning of file -----\n #ifndef _XXX_HEADER_FILE_INCLUDED_\n #define _XXX_HEADER_FILE_INCLUDED_\n xxx\n xxx\n xxx...\n #endif\n ----- end of file -----\n\nThe first time we visit such a file, _XXX_HEADER_FILE_INCLUDED_ is\nundefined, and so nothing is hidden. The next time we visit it, everything will\nbe hidden.\n\nThis behavior is generally undesirable. If this option is non-nil, the outermost\n#if is always visible." hide-ifdef-header-regexp #[0 "\300\207" [#1="\\.h\\(h\\|xx\\|pp\\|\\+\\+\\)?\\'"] 1 #1#] "C/C++ header file name patterns to determine if current buffer is a header.\nEffective only if `hide-ifdef-expand-reinclusion-protection' is t." string] 8) #@70 Keymap used by `hide-ifdef-mode' under `hide-ifdef-mode-prefix-key'. (defvar hide-ifdef-mode-submap (byte-code "\300 \301\302\303#\210\301\304\305#\210\301\306\307#\210\301\310\311#\210\301\312\313#\210\301\314\315#\210\301\316\317#\210\301\320\321#\210\301\322\323#\210\301\324\325#\210\301\326\327#\210\301\330\331#\210\332\333\334#\210\332\335\334#\210\211\207" [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 "e" hif-evaluate-macro "C" hif-clear-all-ifdef-defined "" hide-ifdef-toggle-read-only "" hide-ifdef-toggle-shadowing substitute-key-definition read-only-mode hide-ifdef-toggle-outside-read-only toggle-read-only] 5) (#$ . 2576)) (byte-code "\300\301\302\303\304DD\305\306\307\310\311&\207" [custom-declare-variable hide-ifdef-mode-prefix-key funcall function #[0 "\300\207" [#1="@"] 1 #1#] "Prefix key for all Hide-Ifdef mode commands." :type key-sequence :version "27.1"] 8) #@37 Keymap used with `hide-ifdef-mode'. (defvar hide-ifdef-mode-map (byte-code "\302 \303 #\210\211\207" [hide-ifdef-mode-prefix-key hide-ifdef-mode-submap make-sparse-keymap define-key] 5) (#$ . 3652)) #@29 Menu for `hide-ifdef-mode'. (defvar hide-ifdef-mode-menu nil (#$ . 3859)) (easy-menu-do-define 'hide-ifdef-mode-menu hide-ifdef-mode-map "Menu for `hide-ifdef-mode'." '("Hide-Ifdef" ["Hide some ifdefs" hide-ifdefs :help "Hide the contents of some #ifdefs"] ["Show all ifdefs" show-ifdefs :help "Cancel the effects of `hide-ifdef': show the contents of all #ifdefs"] ["Hide ifdef block" hide-ifdef-block :help "Hide the ifdef block (true or false part) enclosing or before the cursor"] ["Show ifdef block" show-ifdef-block :help "Show the ifdef block (true or false part) enclosing or before the cursor"] ["Define a variable..." hide-ifdef-define :help "Define a VAR so that #ifdef VAR would be included"] ["Undefine a variable..." hide-ifdef-undef :help "Undefine a VAR so that #ifdef VAR would not be included"] ["Define an alist..." hide-ifdef-set-define-alist :help "Set the association for NAME to `hide-ifdef-env'"] ["Use an alist..." hide-ifdef-use-define-alist :help "Set `hide-ifdef-env' to the define list specified by NAME"] ["Toggle read only" hide-ifdef-toggle-read-only :style toggle :selected hide-ifdef-read-only :help "Buffer should be read-only while hiding text"] ["Toggle shadowing" hide-ifdef-toggle-shadowing :style toggle :selected hide-ifdef-shadow :help "Text should be shadowed instead of hidden"])) #@34 Non-nil when text may be hidden. (defvar hide-ifdef-hiding nil (#$ . 5190)) (byte-code "\301\236\204\n \302B\301\207" [minor-mode-alist hide-ifdef-hiding (hide-ifdef-hiding " Hiding")] 2) #@51 Syntax table used for tokenizing #if expressions. (defvar hide-ifdef-syntax-table (byte-code "\301!\302\303\304#\210\302\305\306#\210\302\307\306#\210\211\207" [c-mode-syntax-table copy-syntax-table modify-syntax-entry 95 "w" 38 "." 124] 5) (#$ . 5387)) #@47 An alist of defined symbols and their values. (defvar hide-ifdef-env nil (#$ . 5651)) #@171 This variable is a backup of the previously cleared `hide-ifdef-env'. This backup prevents any accidental clearance of `hide-ifdef-env' by `hif-clear-all-ifdef-defined'. (defvar hide-ifdef-env-backup nil (#$ . 5744)) #@73 Internal variable. Saves the value of `buffer-read-only' while hiding. (defvar hif-outside-read-only nil (#$ . 5967)) #@99 Non-nil if Hide-Ifdef mode is enabled. Use the command `hide-ifdef-mode' to change this variable. (defvar hide-ifdef-mode nil (#$ . 6092)) (make-variable-buffer-local 'hide-ifdef-mode) #@1846 Toggle features to hide/show #ifdef blocks (Hide-Ifdef mode). If called interactively, enable Hide-Ifdef mode if ARG is positive, and disable it if ARG is zero or negative. If called from Lisp, also enable the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'; disable the mode otherwise. Hide-Ifdef mode is a buffer-local minor mode for use with C and C-like major modes. When enabled, 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 project. Initially, the global value of `hide-ifdef-env' is used. This variable was a buffer-local variable, which limits hideif to parse only one C/C++ file at a time. We've extended hideif to support parsing a C/C++ project containing multiple C/C++ source files opened simultaneously in different buffers. Therefore `hide-ifdef-env' can no longer be buffer local but must be global. `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} (fn &optional ARG) (defalias 'hide-ifdef-mode #[256 "\306 \307=\203 ?\202 \310!\311V\211\203T \312\301!\313\302!\210\312\302!\313\303!\210\312\303!\313\305!\210\f\313\314!\210\315\f\316\317\320\321\315$\210\322\323!\210%\203N \324 \210\202c \325 \210\202c \326\314!\210\327\330!\210\203c \325 \210\331\332\203m \333\202n \334\"\210\335\336!\203\222 \306 \203\202 \211\306 \232\203\222 \337\340\341\203\215 \342\202\216 \343#\266\210\344 \210\207" [hide-ifdef-mode hide-ifdef-env hide-ifdef-expand-reinclusion-protection hide-ifdef-hiding buffer-read-only hif-outside-read-only current-message toggle prefix-numeric-value 0 default-value make-local-variable line-move-ignore-invisible t add-hook change-major-mode-hook #[0 "\300\301!\207" [hide-ifdef-mode -1] 2] nil add-to-invisibility-spec (hide-ifdef . t) hide-ifdefs show-ifdefs kill-local-variable remove-from-invisibility-spec (hide-ifdef . t) run-hooks hide-ifdef-mode-hook hide-ifdef-mode-on-hook hide-ifdef-mode-off-hook called-interactively-p any " in current buffer" message "Hide-Ifdef mode %sabled%s" "en" "dis" force-mode-line-update hide-ifdef-initially] 8 (#$ . 6285) (byte-code "\206 \301C\207" [current-prefix-arg toggle] 1)]) (defvar hide-ifdef-mode-hook nil) (byte-code "\301\302N\204\f \303\301\302\304#\210\305\306\307\310\300!\205 \311\211%\207" [hide-ifdef-mode-map hide-ifdef-mode-hook variable-documentation put "Hook run after entering or leaving `hide-ifdef-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" add-minor-mode hide-ifdef-mode " Ifdef" boundp nil] 6) #@154 Clears all symbols defined in `hide-ifdef-env'. It will backup this variable to `hide-ifdef-env-backup' before clearing to prevent accidental clearance. (defalias 'hif-clear-all-ifdef-defined #[0 "\302\303!\205 \304\211\207" [hide-ifdef-env hide-ifdef-env-backup y-or-n-p "Clear all #defined symbols? " nil] 2 (#$ . 9765) nil]) #@45 Show all of the text in the current buffer. (defalias 'hif-show-all #[0 "\300ed\"\207" [hif-show-ifdef-region] 3 (#$ . 10103) nil]) (defalias 'hif-after-revert-function #[0 "\205 \205 \302\303!\207" [hide-ifdef-mode hide-ifdef-hiding hide-ifdefs t] 2]) (add-hook 'after-revert-hook 'hif-after-revert-function) (defalias 'hif-end-of-line #[0 "\300\210\301\302\303\300x\"\302U\205 \304\210\202 \207" [nil logand 1 "\\\\" 2] 4]) #@177 This function merges nearby ifdef regions to form a bigger overlay. The region is defined by START and END. This will decrease the number of overlays created. (fn START END) (defalias 'hif-merge-ifdef-region #[514 "\214~\210\300\301Ze]Se]\"\300Td^\301\\d^\"\302\211\211\211\211\203P \211@\303\304\"\203I \305!^\262\306!]\262\307#\210\310\"\210\211\262A\266\202\202 \210\211\203\204 \211@\303\304\"\203} \305!^\262\306!]\262\307#\210\310\"\210\211\262A\266\202\202R \210\203\254 \203\254 \305!\305!^\306!\306!]\311!\210\307#\210\310\"\266\206\261 \266\206)\207" [overlays-in 2 nil overlay-get hide-ifdef overlay-start overlay-end move-overlay hif-merge-ifdef-region delete-overlay] 14 (#$ . 10544)]) #@18 (fn START END) (defalias 'hide-ifdef-region-internal #[514 "\301\"?\205% \302\"\303\304\305#\210\203 \303\306\300#\202# \303\307\304#\262\207" [hide-ifdef-shadow hif-merge-ifdef-region make-overlay overlay-put hide-ifdef t face invisible] 7 (#$ . 11306)]) #@145 START is the start of a #if, #elif, or #else form. END is the ending part. Everything including these lines is made invisible. (fn START END) (defalias 'hide-ifdef-region #[514 "\212b\210\300 \210`\262\211b\210\300 \210`\262\301\")\207" [hif-end-of-line hide-ifdef-region-internal] 5 (#$ . 11581)]) #@67 Everything between START and END is made visible. (fn START END) (defalias 'hif-show-ifdef-region #[514 "\300\"G\301\302\303$\210\211\300\"GU?\207" [overlays-in remove-overlays hide-ifdef t] 8 (#$ . 11893)]) #@140 The function to use to evaluate a form. The evaluator is given a canonical form and returns t if text under that form should be displayed. (defvar hide-ifdef-evaluator 'eval (#$ . 12115)) #@42 ...is by default considered to be false. (defvar hif-undefined-symbol nil (#$ . 12309)) #@63 Prepend (VAR VALUE) pair to `hide-ifdef-env'. (fn VAR VALUE) (defalias 'hif-set-var #[514 "BB\211\207" [hide-ifdef-env] 4 (#$ . 12403)]) #@12 (fn VAR) (defalias 'hif-lookup #[257 "\303\300!\203 \203 \304!\206 \305 \"\211\203 \211A\202 \n\262\207" [semantic-c-takeover-hideif hide-ifdef-env hif-undefined-symbol boundp semantic-c-hideif-lookup assoc] 4 (#$ . 12551)]) #@12 (fn VAR) (defalias 'hif-defined #[257 "\302\300!\203 \203 \303!\207\304 \"\203 \305\207\306\207" [semantic-c-takeover-hideif hide-ifdef-env boundp semantic-c-hideif-defined assoc 1 0] 4 (#$ . 12793)]) (defconst hif-cpp-prefix "\\(^\\| \\)[ ]*#[ ]*") (defconst hif-ifxdef-regexp (concat hif-cpp-prefix "if\\(n\\)?def")) (defconst hif-ifndef-regexp (concat hif-cpp-prefix "ifndef")) (defconst hif-ifx-regexp (concat hif-cpp-prefix "if\\(n?def\\)?[ ]+")) (defconst hif-elif-regexp (concat hif-cpp-prefix "elif")) (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 #1="\\|" hif-elif-regexp #1# hif-else-regexp #1# hif-endif-regexp)) (defconst hif-macro-expr-prefix-regexp (concat hif-cpp-prefix "\\(if\\(n?def\\)?\\|elif\\|define\\)[ ]+")) (defconst hif-white-regexp "[ ]*") (defconst hif-define-regexp (concat hif-cpp-prefix "\\(define\\|undef\\)")) (defconst hif-id-regexp "[[:alpha:]_][[:alnum:]_]*") (defconst hif-macroref-regexp (concat hif-white-regexp #1="\\(" hif-id-regexp "\\)" hif-white-regexp "\\((" hif-white-regexp #1# hif-id-regexp "\\)?" hif-white-regexp "\\(," hif-white-regexp hif-id-regexp hif-white-regexp "\\)*\\(\\.\\.\\.\\)?" hif-white-regexp ")\\)?")) (defconst hif-token-alist '(("||" . hif-or) ("&&" . hif-and) ("|" . hif-logior) ("^" . hif-logxor) ("&" . hif-logand) ("<<" . hif-shiftleft) (">>" . hif-shiftright) ("==" . hif-equal) ("=" . hif-assign) ("!=" . hif-notequal) ("##" . hif-token-concat) ("!" . hif-not) ("~" . hif-lognot) ("(" . hif-lparen) (")" . hif-rparen) (">" . hif-greater) ("<" . hif-less) (">=" . hif-greater-equal) ("<=" . hif-less-equal) ("+" . hif-plus) ("-" . hif-minus) ("*" . hif-multiply) ("/" . hif-divide) ("%" . hif-modulo) ("?" . hif-conditional) (":" . hif-colon) ("," . hif-comma) ("#" . hif-stringify) ("..." . hif-etc))) (defconst hif-valid-token-list (mapcar 'cdr hif-token-alist)) (defconst hif-token-regexp (byte-code "\301\302\303\"!\304P\207" [hif-token-alist regexp-opt mapcar car "\\|0x[[:xdigit:]]+\\.?[[:xdigit:]]*\\|[0-9]+\\.?[0-9]*\\|\\w+"] 4)) (defconst hif-string-literal-regexp "\\(\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\)") #@93 Like `string-to-number', but it understands non-decimal floats. (fn STRING &optional BASE) (defalias 'hif-string-to-number #[513 "\211\203\n \211\300U\203 \301\"\207\302\303\304\305$\211A@\211G\306\307U\203% \202( \310_\"\301@P\"\245\207" [10 string-to-number split-string "\\." t "[ ]+" expt 0 1.0] 9 (#$ . 15028)]) #@78 Separate string between START and END into a list of tokens. (fn START END) (defalias 'hif-tokenize #[514 "\305\306\307 p\310\311\312\313\314\"\315\"\316$\216\317 !\210\212b\210\320d!\210`W\203\270 \321\322!\2033 \316u\210\202 \321\n!\203I \323\324\325!!B\262\311\225b\210\202 \321!\203\243 \326`\311\225\"\311\225b\210\327\f\"A\206\233 \211\330\230\203j \331\202\233 \332\333\"\203{ \334\324\325\"\335\"\206\233 \332\336\"\203\211 \334\337\"\206\233 \332\340\"\203\226 \341!\206\233 \342!\305B\262\210\202 \321\343!\203\257 \325u\210\202 \344\345\346 \"\210\202 *\266\211\237\207" [hif-simple-token-only hide-ifdef-syntax-table hif-string-literal-regexp hif-token-regexp hif-token-alist nil t syntax-table make-byte-code 0 "r\301q\210\302\300!)\207" vconcat vector [set-syntax-table] 2 set-syntax-table forward-comment looking-at "\\\\\n" substring-no-properties match-string 1 buffer-substring-no-properties assoc "defined" hif-defined string-match "0x\\([[:xdigit:]]+\\.?[[:xdigit:]]*\\)" hif-string-to-number 16 "\\`0[0-9]+\\(\\.[0-9]+\\)?\\'" 8 "\\`[1-9][0-9]*\\(\\.[0-9]+\\)?\\'" string-to-number intern " " error "Bad #if expression: %s" buffer-string] 12 (#$ . 15366)]) #@71 Pop the next token from token-list into the let variable `hif-token'. (defalias 'hif-nexttoken #[0 "\211A\242\211\207" [hif-token-list hif-token] 2 (#$ . 16578)]) (put 'hif-nexttoken 'byte-optimizer 'byte-compile-inline-expand) #@11 (fn ID) (defalias 'hif-if-valid-identifier-p #[257 "\211\247\206 \211;?\207" [] 2 (#$ . 16815)]) (put 'hif-if-valid-identifier-p 'byte-optimizer 'byte-compile-inline-expand) #@89 "Upgrade" hif-define XXX to `(hif-define XXX)' so it won't be substituted. (fn TOKENS) (defalias 'hif-define-operator #[257 "\300\211\211A\262\242\211\262\203r \211\301=\203j A@\262@\302=\203G \211\211\247\206( \211;?\262\203? \3038\304=\203? AAA\262\202b \305\306\"\210\202b @\262A\262\211\211\247\206W \211;?\262\204b \305\306\"\210\301\302\304F\202k \211B\262\202 \237\207" [nil hif-defined hif-lparen 2 hif-rparen error "#define followed by non-identifier: %S"] 7 (#$ . 16998)]) (byte-code "\300\301\302\303#\210\304\301\302\305#\207" [defalias hif-flatten flatten-tree nil make-obsolete "27.1"] 4) #@265 Perform expansion on TOKENS till everything expanded. Self-reference (directly or indirectly) tokens are not expanded. EXPAND_LIST is the list of macro names currently being expanded, used for detecting self-reference. (fn TOKENS &optional MACRONAME EXPAND_LIST) (defalias 'hif-expand-token-list #[769 "\3032\260 \304\305\306\307!!!\304\211\203 B\262\211A\262\242\211\262\203\251 >\2030 \310\303\"\210>\204@ \247\204@ ;\203D \202\242 \311!\211\262\203\241 \211<\203\235 \211@\312=\203\235 \211A@\203\210 @\313=\204j \202\242 A\304\314\315\316 \"\315\317\"#\n B\262*\262\202\242 \315\3208#\262\321#\262\211\202\242 \211\202\242 B\262\202 \322\237!\266\2040\207" [hif-valid-token-list hif-token-list hif-token self-referencing nil hif-define-operator hif-token-concatenation hif-token-stringification throw hif-lookup hif-define-macro hif-lparen mapcar hif-expand-token-list hif-get-argument-list hif-macro-supply-arguments 2 cl-substitute flatten-tree] 12 (#$ . 17631)]) #@169 Parse the TOKEN-LIST. Return translated list in prefix form. MACRONAME is applied when invoking macros to prevent self-reference. (fn TOKEN-LIST &optional MACRONAME) (defalias 'hif-parse-exp #[513 "\302\"\211\211A\242\211\205 \303 \203 \304\305 \"\210)\207" [hif-token-list hif-token hif-expand-token-list hif-exprlist error "Error: unexpected token: %s"] 7 (#$ . 18656)]) #@38 Parse an exprlist: expr { `,' expr}. (defalias 'hif-exprlist #[0 "\302 \303=\203% \211C \211A\242\302 B\262\303=\204\n \303\237B\262\202&