From: MORIOKA Tomohiko Date: Thu, 11 Feb 2021 15:56:52 +0000 (+0900) Subject: (est-uri-decode-feature-name): New function. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=764c4f5e775b3933076130b5b9100b5d74579db3;p=chise%2Ftomoyo-tools.git (est-uri-decode-feature-name): New function. --- diff --git a/chiset-common.el b/chiset-common.el index de5f723..4d147f2 100644 --- a/chiset-common.el +++ b/chiset-common.el @@ -91,6 +91,75 @@ (t (char-to-string c)))) feature "")) +(defun est-uri-decode-feature-name (uri-feature) + (let (feature) + (setq uri-feature (decode-uri-string uri-feature 'utf-8-mcs-er)) + (cond + ((string-match "^from\\." uri-feature) + (intern (format "<-%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^to\\." uri-feature) + (intern (format "->%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^meta\\." uri-feature) + (intern (format "*%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^rep\\." uri-feature) + (intern (format "=%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^rep[2i]\\." uri-feature) + (intern (format "===%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^g\\." uri-feature) + (intern (format "=>>%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^g[i2]\\." uri-feature) + (intern (format "==%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^gi\\([0-9]+\\)\\." uri-feature) + (intern (format "=>>%s%s" + (make-string (string-to-int + (match-string 1 uri-feature)) + ?>) + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^o\\." uri-feature) + (intern (format "=+>%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^a\\." uri-feature) + (intern (format "=>%s" + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + ((string-match "^a\\([0-9]+\\)\\." uri-feature) + (intern (format "%s>%s" + (make-string (string-to-int + (match-string 1 uri-feature)) + ?=) + (est-uri-decode-feature-name-body + (substring uri-feature (match-end 0))))) + ) + (t + (intern (est-uri-decode-feature-name-body uri-feature)) + )))) + (defun www-uri-decode-feature-name (uri-feature) (let (feature) (setq uri-feature (decode-uri-string uri-feature 'utf-8-mcs-er))