Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Conklin E.K.Forth programmer's handbook.2000.pdf
Скачиваний:
321
Добавлен:
23.08.2013
Размер:
2.04 Mб
Скачать
Facility Ext

Forth Programmer’s Handbook

3.6 TIME AND TIMING FUNCTIONS

Many Forth systems support an asynchronous, free-running milliseconds timer, and retrieval of date and time from a host operating system (if the host provides this function). The precision of the milliseconds timer depends on the resolution of the system clock and on relevant hardware characteristics. A task executing MS is suspended until its time-out period has elapsed.

Glossary

MS ( u — ) Facility Ext

Wait for at least u milliseconds, but not more than u plus twice the resolution of the system clock. “M-S”

TIME&DATE ( — u1 u2 u3 u4 u5 u6 )

Return the current time and date: u1=seconds (0–59), u2=minutes (0–59), u3=hours (0–23), u4=days (0–31), u5=months (1–12), and u6=years (0–9999).

3.7 DYNAMIC MEMORY MANAGEMENT

In some applications, the need arises for dynamic data storage. For example, a large number of asynchronous tasks may be taking data intermittently. When one of these tasks receives a burst of data, it needs a temporary buffer to hold and process the data, but can relinquish the buffer when processing is complete.

The words in this section allocate, resize, and free regions of data space. Memory regions allocated in this way are located at arbitrary addresses, and so are useful only for data. They cannot be used, for example, for the Forth dictionary, because there is no way for an application to manage the dictionary pointer. Although a given region will be internally contiguous, it is not guaranteed to be contiguous with any other regions, so no operations should be performed that attempt to cross a region’s boundary.

102 System Functions

Соседние файлы в предмете Электротехника