concept-environment.tex 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. % -*- Mode: TeX -*-
  2. %% Interface with the Programming Environment
  3. \beginSubsection{Top level loop}
  4. \DefineSection{TopLevelLoop}
  5. %% 20.2.0 1
  6. The top level loop is the \clisp\ mechanism by which the user normally
  7. interacts with the \clisp\ system. This loop is sometimes referred to
  8. as the \term{Lisp read-eval-print loop}
  9. because it typically consists of an endless loop that reads an expression,
  10. evaluates it and prints the results.
  11. %% 20.2.0 2
  12. The top level loop is not completely specified; thus the user
  13. interface is \term{implementation-defined}.
  14. %% 20.2.0 3
  15. %% Moon deleted the following sentence
  16. %The top level loop
  17. %traps all attempts to \term{throw} and recovers from them.
  18. The top level loop
  19. prints all values resulting from the evaluation of a
  20. \term{form}.
  21. %% 20.2.0 4
  22. \Thenextfigure\ lists variables that are maintained by the \term{Lisp read-eval-print loop}.
  23. \displayfour{Variables maintained by the Read-Eval-Print Loop}{
  24. *&+&/&-\cr
  25. **&++&//&\cr
  26. ***&+++&///&\cr
  27. }
  28. \endSubsection%{Top level loop}
  29. \beginsubsection{Debugging Utilities}
  30. \Thenextfigure\ shows \term{defined names} relating to
  31. debugging.
  32. \displaythree{Defined names relating to debugging}{
  33. *debugger-hook*&documentation&step\cr
  34. apropos&dribble&time\cr
  35. apropos-list&ed&trace\cr
  36. break&inspect&untrace\cr
  37. describe&invoke-debugger&\cr
  38. }
  39. \endsubsection%{Debugging Utilities}
  40. \beginSubsection{Environment Inquiry}
  41. %% 25.4.0 1
  42. Environment inquiry \term{defined names} provide information about
  43. the hardware and software configuration on which a \clisp\ program is
  44. being executed.
  45. \Thenextfigure\ shows \term{defined names} relating to environment inquiry.
  46. \displaythree{Defined names relating to environment inquiry.}{
  47. *features*&machine-instance&short-site-name\cr
  48. lisp-implementation-type&machine-type&software-type\cr
  49. lisp-implementation-version&machine-version&software-version\cr
  50. long-site-name&room&\cr
  51. }
  52. %Removed identity! -kmp 3-Jan-91
  53. \endSubsection%{Environment Inquiry}
  54. \beginsubsection{Time}
  55. \DefineSection{Time}
  56. %% 25.4.1 1
  57. Time is represented in four different ways in \clisp:
  58. \term{decoded time},
  59. \term{universal time},
  60. \term{internal time},
  61. and seconds.
  62. \term{Decoded time} and \term{universal time} are used primarily to represent calendar time,
  63. and are precise only to one second.
  64. \term{Internal time} is used primarily to represent measurements of computer
  65. time (such as run time) and is precise to some \term{implementation-dependent}
  66. fraction of a second called an \term{internal time unit},
  67. as specified by \conref{internal-time-units-per-second}.
  68. %Actually, relative universal times aren't actually used for anything.
  69. %But it didn't seem worth removing the mention, since it's a legit concept. -kmp 9-Sep-91
  70. %% Moon wanted this shifted to say that Universal time is only absolute.
  71. % \term{Decoded time} is used only for \term{absolute} \term{time} indications.
  72. % \term{Universal time} and \term{internal time} formats are used for both \term{absolute}
  73. % and \term{relative} \term{times}.
  74. An \term{internal time} can be used
  75. for either \term{absolute} and \term{relative} \term{time} measurements.
  76. Both a \term{universal time} and a \term{decoded time} can be used
  77. only for \term{absolute} \term{time} measurements.
  78. %This may be gratuitous, but I just want to be clear.
  79. In the case of one function, \funref{sleep},
  80. time intervals are represented as a non-negative \term{real} number of seconds.
  81. \Thenextfigure\ shows \term{defined names} relating to \term{time}.
  82. \displaytwo{Defined names involving Time.}{
  83. decode-universal-time&get-internal-run-time\cr
  84. encode-universal-time&get-universal-time\cr
  85. get-decoded-time&internal-time-units-per-second\cr
  86. get-internal-real-time&sleep\cr
  87. }
  88. \beginsubsubsection{Decoded Time}
  89. \DefineSection{DecodedTime}
  90. %% 25.4.1 2
  91. A \newterm{decoded time} is an ordered series of nine values that, taken together,
  92. represent a point in calendar time (ignoring \term{leap seconds}):
  93. %% 25.4.1 3
  94. \beginlist
  95. \itemitem{\b{Second}}
  96. An \term{integer} between 0 and~59, inclusive.
  97. %% 25.4.1 4
  98. \itemitem{\b{Minute}}
  99. An \term{integer} between 0 and~59, inclusive.
  100. %% 25.4.1 5
  101. \itemitem{\b{Hour}}
  102. An \term{integer} between 0 and~23, inclusive.
  103. %% 25.4.1 6
  104. \itemitem{\b{Date}}
  105. An \term{integer} between 1 and~31, inclusive (the upper limit actually
  106. depends on the month and year, of course).
  107. %% 25.4.1 7
  108. \itemitem{\b{Month}}
  109. An \term{integer} between 1 and 12, inclusive;
  110. 1~means January, 2~means February, and so on; 12~means December.
  111. %% 25.4.1 8
  112. \itemitem{\b{Year}}
  113. An \term{integer} indicating the year A.D. However, if this
  114. \term{integer}
  115. is between 0 and 99, the ``obvious'' year is used; more precisely,
  116. that year is assumed that is equal to the
  117. \term{integer} modulo 100 and
  118. within fifty years of the current year (inclusive backwards
  119. and exclusive forwards).
  120. Thus, in the year 1978, year 28 is 1928
  121. but year 27 is 2027. (Functions that return time in this format always return
  122. a full year number.)
  123. %% 25.4.1 10
  124. \itemitem{\b{Day of week}}
  125. An \term{integer} between~0 and~6, inclusive;
  126. 0~means Monday, 1~means Tuesday, and so on; 6~means Sunday.
  127. %% 25.4.1 11
  128. \itemitem{\b{Daylight saving time flag}}
  129. A \term{generalized boolean} that,
  130. if \term{true}, indicates that daylight saving time is in effect.
  131. %% 25.4.1 12
  132. \itemitem{\b{Time zone}}
  133. A \term{time zone}.
  134. \endlist
  135. \Thenextfigure\ shows \term{defined names} relating to \term{decoded time}.
  136. \displaytwo{Defined names involving time in Decoded Time.}{
  137. decode-universal-time&get-decoded-time\cr
  138. }
  139. \endsubsubsection%{Decoded Time}
  140. \beginsubsubsection{Universal Time}
  141. \DefineSection{UniversalTime}
  142. %% 25.4.1 13
  143. % \newtermidx{Universal time}{universal time} represents time as a single non-negative \term{integer}.
  144. % For \term{relative} time purposes, this is a number of seconds.
  145. % For absolute time, this is the
  146. % number of seconds since midnight, January 1, 1900 GMT (ignoring \term{leap seconds}).
  147. \newtermidx{Universal time}{universal time} is an \term{absolute} \term{time} represented as a
  148. single non-negative \term{integer}---the number of seconds since
  149. midnight, January 1, 1900 GMT (ignoring \term{leap seconds}).
  150. Thus the time 1 is 00:00:01 (that is, 12:00:01 a.m.) on January 1, 1900 GMT.
  151. Similarly, the time 2398291201 corresponds to time 00:00:01 on January 1,
  152. 1976 GMT.
  153. Recall that the year 1900 was not a leap year; for the purposes of
  154. \clisp, a year is a leap year if and only if its number is divisible by 4,
  155. except that years divisible by 100 are not leap years, except that years
  156. divisible by 400 are leap years. Therefore the year 2000 will
  157. be a leap year.
  158. Because \term{universal time} must be a non-negative \term{integer},
  159. times before the base time of midnight, January 1, 1900 GMT cannot be processed by \clisp.
  160. \displaytwo{Defined names involving time in Universal Time.}{
  161. decode-universal-time&get-universal-time\cr
  162. encode-universal-time&\cr
  163. }
  164. \endsubsubsection%{Universal Time}
  165. \beginsubsubsection{Internal Time}
  166. \DefineSection{InternalTime}
  167. %% 25.4.1 14
  168. \newtermidx{Internal time}{internal time} represents time as a single \term{integer},
  169. in terms of an \term{implementation-dependent} unit called an \term{internal time unit}.
  170. Relative time is measured as a number of these units.
  171. Absolute time is relative to an arbitrary time base.
  172. \Thenextfigure\ shows \term{defined names} related to \term{internal time}.
  173. \displaytwo{Defined names involving time in Internal Time.}{
  174. get-internal-real-time&internal-time-units-per-second\cr
  175. get-internal-run-time&\cr
  176. }
  177. \endsubsubsection%{Internal Time}
  178. \beginsubsubsection{Seconds}
  179. One function, \funref{sleep}, takes its argument as a non-negative \term{real} number
  180. of seconds. Informally, it may be useful to think of this as
  181. a \term{relative} \term{universal time}, but it differs in one important way:
  182. \term{universal times} are always non-negative \term{integers}, whereas the argument to
  183. \funref{sleep} can be any kind of non-negative \term{real}, in order to allow for
  184. the possibility of fractional seconds.
  185. \displaytwo{Defined names involving time in Seconds.}{
  186. sleep&\cr
  187. }
  188. \endsubsubsection%{Seconds}
  189. \endsubsection%{Time}