Changeset 74 for lang/elisp
- Timestamp:
- 01/31/09 00:20:29 (16 years ago)
- Location:
- lang/elisp/pdicv-mode/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/elisp/pdicv-mode/trunk/pdicv-core.el
r71 r74 215 215 216 216 (32bit-address-mode (if (= (-> header 'index-blkbit) 32) t nil)) 217 (tab-sep-p ( if (eq 'unicode-bocu-6 (-> header 'version)) t nil))217 (tab-sep-p (eq 'unicode-bocu-6 (-> header 'version))) 218 218 219 219 (ix 0) (ix-max (-> header 'nindex)) … … 297 297 (let* ((result ()) ;(match-count 0) 298 298 (header (pdicv-get-header-info filename)) 299 (tab-sep-p (eq 'unicode-bocu-6 (-> header 'version))) 299 300 (block-size (-> header 'block-size)) 300 301 (offset (+ (-> header 'datablock-begins-at) (* phys block-size))) … … 340 341 (concat (substring eword 0 compress-length) eword-compressed) )) 341 342 (setq q (1+ eword-len)) 342 343 ;; �����В�������� 343 344 (when (not aligned) 344 345 (setq eword-attrib (nt:read-uchar rest q)) … … 384 385 ) ; if extended 385 386 386 ; (insert (format "- %s\n" eword)) 387 (when (funcall criteria-func eword pron jword example) 388 (push (list eword pron jword example) result)) 387 (if tab-sep-p 388 (let* ((splitted (split-string eword "\t")) 389 (eword (car splitted)) 390 (entry (cadr splitted))) 391 (when (funcall criteria-func entry eword pron jword example) 392 (push (list entry pron jword example) result))) 393 (when (funcall criteria-func eword eword pron jword example) 394 (push (list eword pron jword example) result))) 395 ;;(when (funcall criteria-func eword pron jword example) 396 ;; (push (list eword pron jword example) result)) 389 397 );let 390 398 ); wend -
lang/elisp/pdicv-mode/trunk/pdicv-search.el
r71 r74 60 60 (message "Loading index-table for %s (\"%s\")..." dicname path) 61 61 (setq index-table (pdicv-get-index-list path word-encoding)) 62 (push (cons dicname index-table) pdicv-index-table-list)) 63 );fi 64 );let* 65 (setq diclist (cdr diclist)) 66 );wend 62 (push (cons dicname index-table) pdicv-index-table-list)) )) 63 (setq diclist (cdr diclist))) 67 64 (setq pdicv-inited-p t) 68 (message "Done.") 69 ); let 70 );caught 71 ) 65 (message "Done.") ))) 72 66 73 67 (defun pdicv-search-regexp (dicname regexp-to-search &optional field-to-search) … … 137 131 ; (string-match needle1 word))) 138 132 ; ) 139 `(lambda (e p j x) (string-match ,needle1 ,field-to-search))133 `(lambda (e_ e p j x) (string-match ,needle1 ,field-to-search)) 140 134 );list 141 135 (list … … 144 138 ; (string< word needle2)))) 145 139 (if just-p 146 `(lambda (e p j x) (zerop (nt:strcmp ,field-to-search ,needle1))) 147 `(lambda (e p j x) (and (not (string< ,field-to-search ,needle1)) 148 (string< ,field-to-search ,needle2))) ; �ǡ����֥�������� 149 );just-p 150 );list 151 ));fi,criteria 152 153 );let* 140 `(lambda (e_ e p j x) (zerop (nt:strcmp ,field-to-search ,needle1))) 141 `(lambda (e_ e p j x) (and (not (string< ,field-to-search ,needle1)) 142 (string< ,field-to-search ,needle2))) ; �ǡ����֥�������� 143 ))))) 154 144 ; (insert (format "%s" criteria)) 155 145 (pdicv-core-search dicinfo criteria simple-mode-p (not first-round-p)) ; clear only at the first time 156 );let* 157 );fi 158 (setq first-round-p nil) 159 );wend 160 );let 161 );caught 162 ) 163 ;;debug 146 )) 147 (setq first-round-p nil))))) 164 148 165 149 (defun pdicv-search-interactive () … … 174 158 (read-from-minibuffer "Word to search: ")) 175 159 (if (> (length word-to-search) 0) 176 (pdicv-search (intern dicname) word-to-search)) 177 );let 178 );caught 179 ) 180 160 (pdicv-search (intern dicname) word-to-search)) ))) 181 161 182 162 (defun pdicv-search-region (from to) … … 184 164 (interactive "r") 185 165 (let ((dicname (completing-read "Target dictionary: " pdicv-dictionary-list nil t ""))) 186 (if dicname (pdicv-search (intern dicname) (buffer-substring from to))) 187 );let 188 ) 166 (if dicname (pdicv-search (intern dicname) (buffer-substring from to))) )) 189 167 190 168 (defun pdicv-set-target-dictionary () … … 192 170 (interactive) 193 171 (let ((dicname (completing-read "Target dictionary: " pdicv-dictionary-list nil t ""))) 194 (if dicname (setq pdicv-target-dictionary (intern dicname))) 195 );let 196 ) 172 (if dicname (setq pdicv-target-dictionary (intern dicname))) )) 197 173 198 174 (defun pdicv-search-current-word () … … 204 180 (if word;(and word (not (nt:skipit-p word-to-search))) 205 181 (pdicv-search-just pdicv-target-dictionary word) 206 (message "no word at cursor")) 207 );let 208 ) 182 (message "no word at cursor")) )) 209 183 210 184 (defun pdicv-search-next-word () … … 224 198 (if (and word (not (nt:skipit-p word))) 225 199 (pdicv-search-just pdicv-target-dictionary word) 226 (message "no word at cursor"));fi 227 );progn 228 );fi 229 );let 230 ) 200 (message "no word at cursor")) )))) 231 201 232 202 (defun pdicv-search-previous-word () … … 234 204 (interactive) 235 205 (forward-word -1) ; (backward-word 1) 236 (pdicv-search-current-word) 237 ) 206 (pdicv-search-current-word)) 238 207 239 208 ;;; pdicv-search.el ends here