home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
me34exe.zip
/
mutt
/
package
/
webindex.mut
< prev
next >
Wrap
Text File
|
1995-01-14
|
4KB
|
177 lines
;; webindex.mut : Indexer for web for ME.
;; See also: web.mut
;; C Durland 5/93 Public Domain
(include me.mh)
;; Need additional indexes for:
;; package.doc
(const
INDEX-BUFFER "*web-index*"
INDEX-FILE-NAME "web.idx"
)
(const ;; Index tags
ZIP-TAG "0"
DOC-TAG "1"
PACKAGE-TAG "2"
MISC-MUTT-CODE "7"
MAN-TAGO "8"
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;; Create Index ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Index format:
;; =#=file-name=#=tag
;; index-entry-in-file
;; ...
;; <space><key>[<space><key>...]<space>index-entry
;; ...
;; Example:
;; =#=me2.doc=#=1
;; beginning-of-buffer
;; visit-file
;; C-a beginning-of-buffer
;; C-XC-F C-XC-V visit-file
(defun
make-index
{
(int index)
(if (== -2 (index (attached-buffer INDEX-BUFFER)))
(index (create-buffer INDEX-BUFFER BFHooHum)))
(current-buffer index)(clear-buffer)
(insert-text "=#=regexp.doc=#=" MAN-TAGO)
(process-doc-file "mutt2.doc")
(process-doc-file "me3mutt.doc")
(process-doc-file "me3.doc")
(process-package "package.doc")
(process-*Help*)
(current-buffer index TRUE)
}
process-doc-file (string fname) HIDDEN
{
(int index bf)
(string item)
(if (not (file-exists fname))
{ (msg "File " fname " doesn't exist.") FALSE (done) })
(current-buffer (bf (create-buffer "*web-file*" 0)))
(read-file fname)
(index (attached-buffer INDEX-BUFFER))
(current-buffer index)(end-of-buffer)
(insert-text "=#=" fname "=#=" DOC-TAG)
(while TRUE
{
(current-buffer bf)
(if (not (re-search-forward '^(\([^ )]+\)')) (break))
(item (get-matched '\1'))
(current-buffer index)
;; Don't add duplicates (not that it matters)
(beginning-of-buffer)
(if (not (search-forward (concat "^J" item "^J")))
{
(end-of-buffer)
(insert-text item)
})
})
}
;;!!!??? do I need this when i use describe-key?
process-*Help* HIDDEN
{
(int index help)
(string key pgm)
(if (== -2 (index (attached-buffer INDEX-BUFFER)))
{ (msg "No index buffer!")(halt) })
(describe-bindings)
(current-buffer (help (attached-buffer "*Help*")))
(while (re-search-forward '^\(.+\)\ +\.+\(.+\)$')
{
(pgm (get-matched '\1'))
(key (get-matched '\2'))
(current-buffer index)
;; if pgm doesn't exist, don't add key to index
(beginning-of-buffer)
(if (search-forward pgm)
{
(end-of-buffer)
(insert-text " " key " " pgm)
})
(current-buffer help)
})
}
process-package; (string fname) HIDDEN
{
(int index bf)
(string package function)
(string fname)
(fname (ask "package: "))
(if (not (file-exists fname))
{ (msg "File " fname " doesn't exist.") FALSE (done) })
(current-buffer (bf (create-buffer "*web-file*" 0)))
(read-file fname)
(index (attached-buffer INDEX-BUFFER))
(current-buffer index)(end-of-buffer)
(insert-text "=#=" fname "=#=" PACKAGE-TAG)
(current-buffer bf)
(if (not (re-search-forward '^Package:\ +\(.+\)')) (done))
(while (not (EoB))
{
; (current-buffer bf)
; (if (not (re-search-forward '^Package:\ +\(.+\)')) (break))
(package (get-matched '\1'))
(current-buffer index)
;; Don't add duplicates (not that it matters)
(beginning-of-buffer)
(if (not (search-forward (concat "^J" package "^J")))
{
(end-of-buffer)
(insert-text package)
})
(current-buffer bf)
(while (search-for ' (\([^ ]+\))')
{
(function (get-matched '\1'))
(current-buffer index)
(end-of-buffer)
(insert-text " " function " " package)
(current-buffer bf)
})
})
}
search-for (string re) HIDDEN
{
(while (forward-line 1)
{
(if (looking-at 'Package:\ +\(.+\)') (break))
(if (looking-at re) { TRUE (done) })
})
FALSE
}
)