home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
editor
/
me_cd.arc
/
BSTATS.MUT
< prev
next >
Wrap
Text File
|
1988-09-14
|
2KB
|
64 lines
; bstats.mut : buffer stats
; C Durland
(include me.h)
(include tobase.mut)
(defun
show-buffer-stats
{
(INT buffer-size dot lines buffer-row wasted char-at-dot ratio)
(buffer-stats -1 (loc buffer-size))
(ratio 0)(if (!= 0 buffer-size)(ratio (/ (* 100 dot) buffer-size)))
(msg "Row: " buffer-row "/" lines " Column: " (current-column)
" CH: 0x" (tobase char-at-dot 16)
" (" ratio "% of " buffer-size ") Unused: " wasted)
}
)
(defun
popup-buffer(string name)(int flags) HIDDEN ; return window buffer is in
{
(int j)
(j 0)(while (< j (windows))
{
(if (== name (buffer-name (attached-buffer j))) { j (done) })
(+= j 1)
})
(if (== (windows) 1)(split-window))
(next-window)(switch-to-buffer name)(buffer-flags -1 flags)
(j (current-window))(previous-window)
j
}
switch-to-window(int n) HIDDEN
{ (arg-prefix (- n (current-window)))(next-window) }
list-buffers
{
(INT buffer-size dot lines row wasted char-at-dot ratio total)
(int j n cw bp wp)
(n (total 0))
(wp (popup-buffer "*buffer-list*" BFGone))
(cw (current-window))(switch-to-window wp)(bp (current-buffer))
(clear-buffer -1 "yes")
(insert-text "C Size Buffer File")(newline)
(insert-text "- ---- ------ ----")(newline)
(for (j 0) (< j (buffers)) (+= j 1)
{
(if (!= bp j)
{
(buffer-stats j (loc buffer-size))
(insert-text (if (buffer-modified j)("*")(" ")))
(to-col (- 9 (strlen (concat buffer-size))))(insert-text buffer-size)
(insert-text " " (buffer-name j))
(to-col 27)(insert-text (file-name j))
(newline)
(+= n 1)(+= total buffer-size)
})
})
(newline)(insert-text " " total " bytes in " n " files")
(beginning-of-buffer)(buffer-modified -1 FALSE)(switch-to-window cw)
}
)