User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:read-char-no-hang [2019/07/14 17:00]
cl:functions:read-char-no-hang [2019/10/17 13:00] (current)
Line 1: Line 1:
 +====== Function READ-CHAR-NO-HANG ======
 +
 +====Syntax====
 +  * **read-char-no-hang** ''&​optional''​ //​input-stream//​ //​eof-error-p//​ //​eof-value//​ //​recursive-p//​ → //char//
 +
 +====Arguments and Values====
 +  * //​input-stream//​ -- an //​[[CL:​Glossary:​input]]//​ //​[[CL:​Glossary:​stream designator]]//​. The default is //​[[CL:​Glossary:​standard input]]//.
 +  * //​eof-error-p//​ - a //​[[CL:​Glossary:​generalized boolean]]//​. The default is //​[[CL:​Glossary:​true]]//​.
 +  * //​eof-value//​ - an //​[[CL:​Glossary:​object]]//​. The default is **[[CL:​Constant Variables:​nil]]**.
 +  * //​recursive-p//​ - a //​[[CL:​Glossary:​generalized boolean]]//​. The default is //​[[CL:​Glossary:​false]]//​.
 +  * //char// - a //​[[CL:​Glossary:​character]]//​ or **[[CL:​Constant Variables:​nil]]** or the //​eof-value//​.
 +
 +====Description====
 +**read-char-no-hang** returns a character from //​input-stream//​ if such a character is available. If no character is available, **read-char-no-hang** returns **[[CL:​Constant Variables:​nil]]**.
 +
 +If //​recursive-p//​ is //​[[CL:​Glossary:​true]]//,​ this call is expected to be embedded in a higher-level call to **[[CL:​Functions:​read]]** or a similar //​[[CL:​Glossary:​function]]//​ used by the //​[[CL:​Glossary:​Lisp reader]]//.
 +
 +If an //​[[CL:​Glossary:​end of file]]// occurs and //​eof-error-p//​ is //​[[CL:​Glossary:​false]]//,​ //​eof-value//​ is returned.
 +
 +====Examples====
 +<​blockquote> ​
 +([[CL:​Macros:​defun]] test-it () 
 +  ([[CL:​Functions:​unread-char]] ([[CL:​Functions:​read-char]])) ​
 +  ([[CL:​Functions:​list]] (read-char-no-hang) ​
 +        (read-char-no-hang) ​
 +        (read-char-no-hang))) <​r>​TEST-IT </r>
 +</​blockquote> ​
 +
 +//​[[CL:​Glossary:​Implementation]]//​ A, where a //​[[CL:​Glossary:​newline]]//​ is not required to terminate //​[[CL:​Glossary:​interactive input]]// on the console. ​
 +
 +<​blockquote> ​
 +(test-it)
 +<​o>​__a__ </o>
 +<​r>​(#​\a NIL NIL) </r>
 +</​blockquote> ​
 +
 +//​[[CL:​Glossary:​Implementation]]//​ B, where a //​[[CL:​Glossary:​newline]]//​ is required to terminate //​[[CL:​Glossary:​interactive input]]// on the console, and where that //​[[CL:​Glossary:​newline]]//​ remains on the input stream.
 + 
 +<​blockquote> ​
 +(test-it)
 +<​o>​__a↵ __</​o> ​
 +<​r>​(#​\a #\Newline NIL) </r>
 +</​blockquote>​
 +
 +====Affected By====
 +**[[CL:​Variables:​star-standard-input-star|*standard-input*]]**,​ **[[CL:​Variables:​star-terminal-io-star|*terminal-io*]]**.
 +
 +====Exceptional Situations====
 +If an //​[[CL:​Glossary:​end of file]]// occurs when //​eof-error-p//​ is //​[[CL:​Glossary:​true]]//,​ an error of type **[[CL:​Types:​end-of-file]]** is signaled .
 +
 +====See Also====
 +  * **[[CL:​Functions:​listen|Function LISTEN]]**
 +
 +====Notes====
 +**read-char-no-hang** is exactly like **[[CL:​Functions:​read-char]]**,​ except that if it would be necessary to wait in order to get a character (as from a keyboard), **[[CL:​Constant Variables:​nil]]** is immediately returned without waiting.
 +
 +\issue{ARGUMENTS-UNDERSPECIFIED:​SPECIFY}