You are looking at historical revision 17269 of this page. It may differ significantly from its current revision.

progress-indicators

Introduction

Shows text-mode progress-indicators.

Usage

<scheme> (require-extension progress-indicators) </scheme>

Requirements

/eggref/4/defstruct

Documentation

[procedure] (make-progress-bar #!key fill empty head frame value mode max width port end-message)

Creates an object representing a progress-bar. The keyword arguments customize the appearance of the progress-bar, when it is shown and default to the following values:

fill #\=
empty #\space
head #\>
frame "[~a~a~a~a|~a]"
mode 'percentage
max 100
width 60
port (current-output-port)
end-message " finished"
[procedure] (progress-bar? X)

Returns #t if X is an object representing a progress-bar, or #f otherwise.

[procedure] (progress-bar-value PBAR)

Returns the current value of the given progress bar. You can also use SRFI-17 "setter" syntax to modify the current value (causing a redisplay):

 (set! (progress-bar-value PBAR) VALUE)
[procedure] (show-progress-bar PBAR)

Redisplays the progress-bar PBAR.

[procedure] (advance-progress-bar! PBAR [AMOUNT])

Increases the current value of the progress-bar PBAR by AMOUNT, which defaults to 1 and redisplays it.

[procedure] (finish-progress-bar! PBAR)

Sets the value of PBAR to the maximum, writes the end-message and prints a newline. The progress-bar should not be reused after this procedure has been called.

[procedure] (make-spinner #!key value port steps)

Creates an object representing a "spinner" progress-indicator. The keyword arguments customize the appearance of the progress-bar, when it is shown and default to the following values:

steps "[~a~a~a|~a]"
port (current-output-port)
[procedure] (spinner? X)

Returns #t if X is an object representing a spinner, or #f otherwise.

[procedure] (advance-spinner! SPINNER)

Advances the given spinner by 1 step and redisplays it.

[procedure] (finish-spinner! SPINNER)

Clears the spinner. It should not be used after this procedure has been called.

Author

felix winkelmann

License

This code is placed into the public domain.

Version History

0.1
initial release