- ((and (setq feature (intern (format "=>%s" uri-feature)))
- (find-charset feature))
- feature)
- ((and (setq feature (intern (format "=>>%s" uri-feature)))
- (find-charset feature))
- feature)
- ((and (setq feature (intern (format "=>>>%s" uri-feature)))
- (find-charset feature))
- feature)
- ((and (setq feature (intern (format "=%s" uri-feature)))
- (find-charset feature))
- feature)
- (t (intern uri-feature)))))
-
-(defun www-uri-encode-feature-name (feature-name)
- (setq feature-name (symbol-name feature-name))
- (cond
- ((string-match "^=\\([^=>]+\\)" feature-name)
- (concat "rep." (substring feature-name (match-beginning 1)))
- )
- ((string-match "^=>>\\([^=>]+\\)" feature-name)
- (concat "g." (substring feature-name (match-beginning 1)))
- )
- ((string-match "^=>>>\\([^=>]+\\)" feature-name)
- (concat "gi." (substring feature-name (match-beginning 1)))
- )
- ((string-match "^=>>\\(>+\\)" feature-name)
- (format "gi%d.%s"
- (length (match-string 1 feature-name))
- (substring feature-name (match-end 1)))
- )
- ((string-match "^=>\\([^=>]+\\)" feature-name)
- (concat "a." (substring feature-name (match-beginning 1)))
- )
- ((string-match "^\\(=+\\)>" feature-name)
- (format "a%d.%s"
- (length (match-string 1 feature-name))
- (substring feature-name (match-end 0)))
- )
- ((string-match "^->" feature-name)
- (concat "to." (substring feature-name (match-end 0)))
- )
- ((string-match "^<-" feature-name)
- (concat "from." (substring feature-name (match-end 0)))
- )
- (t feature-name)))
-
-(defun www-uri-decode-char (char-rep)
+ (t ; (= chars 256)
+ (setq mask #xFF
+ byte-min 0
+ byte-max #xFF)
+ ))
+ (setq bytes (make-vector dim 0))
+ (while (< i dim)
+ (aset bytes i (logand (lsh code (* i -8)) mask))
+ (setq i (1+ i)))
+ (setq i 0)
+ (while (and (< i dim)
+ (progn
+ (aset bytes i (1+ (aref bytes i)))
+ (> (aref bytes i) byte-max)))
+ (aset bytes i byte-min)
+ (setq i (1+ i)))
+ (when (< i dim)
+ (setq dest (aref bytes 0)
+ i 1)
+ (while (< i dim)
+ (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
+ i (1+ i)))
+ dest)))
+
+(defun find-previous-defined-code-point (ccs code)
+ (let ((i (get-previous-code-point ccs code))
+ char)
+ (cond
+ ((eq ccs '=jis-x0208)
+ (setq ccs '=jis-x0208@1990))
+ ((eq ccs '=jis-x0213-1)
+ (setq ccs '=jis-x0213-1@2004)))
+ (while (and i
+ (>= i 0)
+ (null (setq char (decode-char ccs i
+ (unless (eq ccs '=ucs)
+ 'defined-only)))))
+ (setq i (get-previous-code-point ccs i)))
+ char))
+
+(defun find-next-defined-code-point (ccs code)
+ (let ((i (get-next-code-point ccs code))
+ max char)
+ (setq max (+ code 1000))
+ (cond
+ ((eq ccs '=jis-x0208)
+ (setq ccs '=jis-x0208@1990))
+ ((eq ccs '=jis-x0213-1)
+ (setq ccs '=jis-x0213-1@2004)))
+ (while (and i
+ (<= i max)
+ (null (setq char (decode-char ccs i
+ (unless (eq ccs '=ucs)
+ 'defined-only)))))
+ (setq i (get-next-code-point ccs i)))
+ char))
+
+
+;;; @ URI representation
+;;;
+
+;; (defun est-uri-decode-feature-name-body (uri-feature)
+;; (let ((len (length uri-feature))
+;; (i 0)
+;; ch dest)
+;; (while (< i len)
+;; (setq dest
+;; (concat
+;; dest
+;; (if (eq (aref uri-feature i) ?\.)
+;; (if (and (< (+ i 2) len)
+;; (eq (aref uri-feature (+ i 2)) ?\.))
+;; (prog1
+;; (cond
+;; ((eq (setq ch (aref uri-feature (1+ i))) ?\.)
+;; "/")
+;; ((eq ch ?-)
+;; "*")
+;; ((eq ch ?_)
+;; "+")
+;; (t
+;; (substring uri-feature i (+ i 3))
+;; ))
+;; (setq i (+ i 3)))
+;; (setq i (1+ i))
+;; ".")
+;; (prog1
+;; (char-to-string (aref uri-feature i))
+;; (setq i (1+ i)))))))
+;; dest))
+
+;; (defun est-uri-encode-feature-name-body (feature)
+;; (mapconcat (lambda (c)
+;; (cond ((eq c ?*)
+;; ".-.")
+;; ((eq c ?/)
+;; "...")
+;; ((eq c ?+)
+;; "._.")
+;; (t (char-to-string c))))
+;; feature ""))
+
+;; (defun www-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 "^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)))))
+;; )
+;; ((and (setq uri-feature (est-uri-decode-feature-name-body uri-feature))
+;; (setq feature (intern (format "=>%s" uri-feature)))
+;; (find-charset feature))
+;; feature)
+;; ((and (setq feature (intern (format "=>>%s" uri-feature)))
+;; (find-charset feature))
+;; feature)
+;; ((and (setq feature (intern (format "=>>>%s" uri-feature)))
+;; (find-charset feature))
+;; feature)
+;; ((and (setq feature (intern (format "=%s" uri-feature)))
+;; (find-charset feature))
+;; feature)
+;; (t (intern uri-feature)))))
+
+;; (defun www-uri-encode-feature-name (feature-name)
+;; (setq feature-name (symbol-name feature-name))
+;; (cond
+;; ((string-match "^=\\+>\\([^=>]+\\)" feature-name)
+;; (concat "o."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-beginning 1))))
+;; )
+;; ((string-match "^=\\([^=>]+\\)" feature-name)
+;; (concat "rep."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-beginning 1))))
+;; )
+;; ((string-match "^==\\([^=>]+\\)" feature-name)
+;; (concat "g2."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-beginning 1))))
+;; )
+;; ((string-match "^===\\([^=>]+\\)" feature-name)
+;; (concat "repi."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-beginning 1))))
+;; )
+;; ((string-match "^=>>\\([^=>]+\\)" feature-name)
+;; (concat "g."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-beginning 1))))
+;; )
+;; ((string-match "^=>>>\\([^=>]+\\)" feature-name)
+;; (concat "gi."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-beginning 1))))
+;; )
+;; ((string-match "^=>>\\(>+\\)" feature-name)
+;; (format "gi%d.%s"
+;; (length (match-string 1 feature-name))
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-end 1))))
+;; )
+;; ((string-match "^=>\\([^=>]+\\)" feature-name)
+;; (concat "a."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-beginning 1))))
+;; )
+;; ((string-match "^\\(=+\\)>" feature-name)
+;; (format "a%d.%s"
+;; (length (match-string 1 feature-name))
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-end 0))))
+;; )
+;; ((string-match "^->" feature-name)
+;; (concat "to."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-end 0))))
+;; )
+;; ((string-match "^<-" feature-name)
+;; (concat "from."
+;; (est-uri-encode-feature-name-body
+;; (substring feature-name (match-end 0))))
+;; )
+;; (t (est-uri-encode-feature-name-body feature-name))))
+
+(defun www-uri-make-feature-name-url (uri-genre uri-feature-name uri-object)
+ (if est-hide-cgi-mode
+ (format "../feature/%s&%s/%s"
+ uri-feature-name uri-genre uri-object)
+ (format "%s?feature=%s&%s=%s"
+ chise-wiki-view-url uri-feature-name uri-genre uri-object)))
+
+(defun www-uri-decode-object (genre char-rep)