summaryrefslogtreecommitdiff
path: root/lisp/progmodes/hideif.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/hideif.el')
-rw-r--r--lisp/progmodes/hideif.el28
1 files changed, 8 insertions, 20 deletions
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el
index 442fdedf372..1b06077005c 100644
--- a/lisp/progmodes/hideif.el
+++ b/lisp/progmodes/hideif.el
@@ -263,9 +263,6 @@ This backup prevents any accidental clearance of `hide-fidef-env' by
;;;###autoload
(define-minor-mode hide-ifdef-mode
"Toggle features to hide/show #ifdef blocks (Hide-Ifdef mode).
-With a prefix argument ARG, enable Hide-Ifdef mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
Hide-Ifdef mode is a buffer-local minor mode for use with C and
C-like major modes. When enabled, code within #ifdef constructs
@@ -543,7 +540,7 @@ that form should be displayed.")
(defconst hif-token-regexp
(concat (regexp-opt (mapcar 'car hif-token-alist))
- "\\|0x[0-9a-fA-F]+\\.?[0-9a-fA-F]*"
+ "\\|0x[[:xdigit:]]+\\.?[[:xdigit:]]*"
"\\|[0-9]+\\.?[0-9]*" ;; decimal/octal
"\\|\\w+"))
@@ -598,7 +595,7 @@ that form should be displayed.")
;; 1. postfix 'l', 'll', 'ul' and 'ull'
;; 2. floating number formats (like 1.23e4)
;; 3. 098 is interpreted as octal conversion error
- (if (string-match "0x\\([0-9a-fA-F]+\\.?[0-9a-fA-F]*\\)"
+ (if (string-match "0x\\([[:xdigit:]]+\\.?[[:xdigit:]]*\\)"
token)
(hif-string-to-number (match-string 1 token) 16)) ;; hex
(if (string-match "\\`0[0-9]+\\(\\.[0-9]+\\)?\\'" token)
@@ -675,12 +672,7 @@ that form should be displayed.")
result))
(nreverse result)))
-(defun hif-flatten (l)
- "Flatten a tree."
- (apply #'nconc
- (mapcar (lambda (x) (if (listp x)
- (hif-flatten x)
- (list x))) l)))
+(define-obsolete-function-alias 'hif-flatten #'flatten-tree "27.1")
(defun hif-expand-token-list (tokens &optional macroname expand_list)
"Perform expansion on TOKENS till everything expanded.
@@ -751,7 +743,7 @@ detecting self-reference."
expanded))
- (hif-flatten (nreverse expanded)))))
+ (flatten-tree (nreverse expanded)))))
(defun hif-parse-exp (token-list &optional macroname)
"Parse the TOKEN-LIST.
@@ -1042,16 +1034,12 @@ preprocessing token"
(defun hif-shiftleft (a b)
(setq a (hif-mathify a))
(setq b (hif-mathify b))
- (if (< a 0)
- (ash a b)
- (lsh a b)))
+ (ash a b))
(defun hif-shiftright (a b)
(setq a (hif-mathify a))
(setq b (hif-mathify b))
- (if (< a 0)
- (ash a (- b))
- (lsh a (- b))))
+ (ash a (- b)))
(defalias 'hif-multiply (hif-mathify-binop *))
@@ -1173,7 +1161,7 @@ preprocessing token"
(setq actual-parms (cdr actual-parms)))
;; Replacement completed, flatten the whole token list
- (setq macro-body (hif-flatten macro-body))
+ (setq macro-body (flatten-tree macro-body))
;; Stringification and token concatenation happens here
(hif-token-concatenation (hif-token-stringification macro-body)))))
@@ -1628,7 +1616,7 @@ not be expanded."
((integerp result)
(if (or (= 0 result) (= 1 result))
(message "%S <= `%s'" result exprstring)
- (message "%S (0x%x) <= `%s'" result result exprstring)))
+ (message "%S (%#x) <= `%s'" result result exprstring)))
((null result) (message "%S <= `%s'" 'false exprstring))
((eq t result) (message "%S <= `%s'" 'true exprstring))
(t (message "%S <= `%s'" result exprstring)))