# eev/libeeg/fast - a library for eeg4.
# By edrx, 2001nov28.
# Htmlized version: <http://angg.twu.net/eev/libeeg/fast.html>.
# This file defines some functions to let parts of e-scripts run in
# full speed, without waiting for "M-l"s.
#
# If you want to use both "msg" and this library in the same e-script
# then this one must be loaded after msg, as it redefines some of
# msg's functions.

# (find-eev "")
# (find-eev "eeg4")
# (find-eev "libeeg/")
# (find-eev "libeeg/msg")

set fast 0
proc _fast {{newvalue 1}} { gset fast $newvalue }

proc _msg {str} { if {![gset fast]} {__msg [yrstr $str]} }

proc dounitaction {} {
  global actions actions_i
  uplevel #0 [lindex $actions $actions_i]
  incr actions_i
}
proc doaction {} {
  global fast actions actions_i
  while 1 {
    dounitaction
    if {!$fast || $actions_i > [llength $actions]} break
  }
}

proc lfast {value} { appendaction "_fast $value"; glue }
proc rfast {value} { appendaction "_fast $value; dounitaction" }
proc lrfast {value} { lfast $value; rfast $value }


#
#  Local Variables:
#  mode:		 tcl
#  coding:               no-conversion
#  ee-anchor-format:     "%s"
#  ee-charset-indicator: ""
#  End:
