123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=9"/>
- <meta name="generator" content="Doxygen 1.8.17"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>Bugz Door Project: getkey.cpp File Reference</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="dynsections.js"></script>
- <link href="search/search.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="search/searchdata.js"></script>
- <script type="text/javascript" src="search/search.js"></script>
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
- <div id="titlearea">
- <table cellspacing="0" cellpadding="0">
- <tbody>
- <tr style="height: 56px;">
- <td id="projectalign" style="padding-left: 0.5em;">
- <div id="projectname">Bugz Door Project
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.17 -->
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- /* @license-end */
- </script>
- <script type="text/javascript" src="menudata.js"></script>
- <script type="text/javascript" src="menu.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(function() {
- initMenu('',true,false,'search.php','Search');
- $(document).ready(function() { init_search(); });
- });
- /* @license-end */</script>
- <div id="main-nav"></div>
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- </div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <iframe src="javascript:void(0)" frameborder="0"
- name="MSearchResults" id="MSearchResults">
- </iframe>
- </div>
- </div><!-- top -->
- <div class="header">
- <div class="summary">
- <a href="#define-members">Macros</a> |
- <a href="#func-members">Functions</a> |
- <a href="#var-members">Variables</a> </div>
- <div class="headertitle">
- <div class="title">getkey.cpp File Reference</div> </div>
- </div><!--header-->
- <div class="contents">
- <p>Key and door input routines.
- <a href="#details">More...</a></p>
- <div class="textblock"><code>#include <iostream></code><br />
- <code>#include <termios.h></code><br />
- <code>#include <unistd.h></code><br />
- <code>#include "door.h"</code><br />
- <code>#include <signal.h></code><br />
- <code>#include <ctype.h></code><br />
- </div><div class="textblock"><div class="dynheader">
- Include dependency graph for getkey.cpp:</div>
- <div class="dyncontent">
- <div class="center"><img src="getkey_8cpp__incl.png" border="0" usemap="#getkey_8cpp" alt=""/></div>
- <map name="getkey_8cpp" id="getkey_8cpp">
- <area shape="rect" title="Key and door input routines." alt="" coords="373,5,464,32"/>
- <area shape="rect" title=" " alt="" coords="5,155,85,181"/>
- <area shape="rect" title=" " alt="" coords="110,155,194,181"/>
- <area shape="rect" title=" " alt="" coords="219,155,293,181"/>
- <area shape="rect" href="door_8h_source.html" title=" " alt="" coords="442,80,505,107"/>
- <area shape="rect" title=" " alt="" coords="529,80,602,107"/>
- <area shape="rect" title=" " alt="" coords="626,80,697,107"/>
- <area shape="rect" title=" " alt="" coords="317,155,416,181"/>
- <area shape="rect" title=" " alt="" coords="440,155,507,181"/>
- <area shape="rect" title=" " alt="" coords="531,155,589,181"/>
- <area shape="rect" title=" " alt="" coords="614,155,687,181"/>
- <area shape="rect" title=" " alt="" coords="711,155,798,181"/>
- <area shape="rect" title=" " alt="" coords="823,155,884,181"/>
- <area shape="rect" title=" " alt="" coords="908,155,985,181"/>
- <area shape="rect" title=" " alt="" coords="1010,155,1086,181"/>
- <area shape="rect" title=" " alt="" coords="1110,155,1173,181"/>
- </map>
- </div>
- </div><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
- Macros</h2></td></tr>
- <tr class="memitem:a05e8779289398e4e8028b7f94f6b8009"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#a05e8779289398e4e8028b7f94f6b8009">CRNL</a>   "\r\n"</td></tr>
- <tr class="memdesc:a05e8779289398e4e8028b7f94f6b8009"><td class="mdescLeft"> </td><td class="mdescRight">used by output routines. <a href="getkey_8cpp.html#a05e8779289398e4e8028b7f94f6b8009">More...</a><br /></td></tr>
- <tr class="separator:a05e8779289398e4e8028b7f94f6b8009"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
- Functions</h2></td></tr>
- <tr class="memitem:a4d28072fff7bfaa3de3d1a6357fba261"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#a4d28072fff7bfaa3de3d1a6357fba261">raw</a> (void)</td></tr>
- <tr class="memdesc:a4d28072fff7bfaa3de3d1a6357fba261"><td class="mdescLeft"> </td><td class="mdescRight">Enable terminal raw mode. <a href="getkey_8cpp.html#a4d28072fff7bfaa3de3d1a6357fba261">More...</a><br /></td></tr>
- <tr class="separator:a4d28072fff7bfaa3de3d1a6357fba261"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a3aea9deb2a0bfea9ff05a898f4822e31"><td class="memItemLeft" align="right" valign="top"><a id="a3aea9deb2a0bfea9ff05a898f4822e31"></a>
- void </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#a3aea9deb2a0bfea9ff05a898f4822e31">reset</a> (void)</td></tr>
- <tr class="memdesc:a3aea9deb2a0bfea9ff05a898f4822e31"><td class="mdescLeft"> </td><td class="mdescRight">Reset the terminal termios to the original values. <br /></td></tr>
- <tr class="separator:a3aea9deb2a0bfea9ff05a898f4822e31"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:abbfe4f963938c288581211cdee6cb818"><td class="memItemLeft" align="right" valign="top">signed int </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#abbfe4f963938c288581211cdee6cb818">getch</a> (void)</td></tr>
- <tr class="memdesc:abbfe4f963938c288581211cdee6cb818"><td class="mdescLeft"> </td><td class="mdescRight">low level getch key read <a href="getkey_8cpp.html#abbfe4f963938c288581211cdee6cb818">More...</a><br /></td></tr>
- <tr class="separator:abbfe4f963938c288581211cdee6cb818"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a37118b1ee911d1447a495aa49f2926a5"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#a37118b1ee911d1447a495aa49f2926a5">unget</a> (char c)</td></tr>
- <tr class="memdesc:a37118b1ee911d1447a495aa49f2926a5"><td class="mdescLeft"> </td><td class="mdescRight">ungets (pushes key back) <a href="getkey_8cpp.html#a37118b1ee911d1447a495aa49f2926a5">More...</a><br /></td></tr>
- <tr class="separator:a37118b1ee911d1447a495aa49f2926a5"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a5a392181fdf6b261a23c6996b6f65765"><td class="memItemLeft" align="right" valign="top">char </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#a5a392181fdf6b261a23c6996b6f65765">get</a> (void)</td></tr>
- <tr class="memdesc:a5a392181fdf6b261a23c6996b6f65765"><td class="mdescLeft"> </td><td class="mdescRight">get a key from the pushback buffer. <a href="getkey_8cpp.html#a5a392181fdf6b261a23c6996b6f65765">More...</a><br /></td></tr>
- <tr class="separator:a5a392181fdf6b261a23c6996b6f65765"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a48210bb765c651a12818ca2551ace8e2"><td class="memItemLeft" align="right" valign="top">signed int </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#a48210bb765c651a12818ca2551ace8e2">getkey</a> (void)</td></tr>
- <tr class="memdesc:a48210bb765c651a12818ca2551ace8e2"><td class="mdescLeft"> </td><td class="mdescRight">high level getkey <a href="getkey_8cpp.html#a48210bb765c651a12818ca2551ace8e2">More...</a><br /></td></tr>
- <tr class="separator:a48210bb765c651a12818ca2551ace8e2"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
- Variables</h2></td></tr>
- <tr class="memitem:ac317ff25d1fad1066feec2dd66179eec"><td class="memItemLeft" align="right" valign="top"><a id="ac317ff25d1fad1066feec2dd66179eec"></a>
- struct termios </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#ac317ff25d1fad1066feec2dd66179eec">tio_default</a></td></tr>
- <tr class="memdesc:ac317ff25d1fad1066feec2dd66179eec"><td class="mdescLeft"> </td><td class="mdescRight">Original terminal termios defaults. <br /></td></tr>
- <tr class="separator:ac317ff25d1fad1066feec2dd66179eec"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a92dfe6e9243e862063a0c3869f784557"><td class="memItemLeft" align="right" valign="top"><a id="a92dfe6e9243e862063a0c3869f784557"></a>
- char </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#a92dfe6e9243e862063a0c3869f784557">buffer</a> [10]</td></tr>
- <tr class="memdesc:a92dfe6e9243e862063a0c3869f784557"><td class="mdescLeft"> </td><td class="mdescRight">pushback buffer to store keys we're not ready for yet. <br /></td></tr>
- <tr class="separator:a92dfe6e9243e862063a0c3869f784557"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:aaa0e5be04b9ee83acfdd443145061f47"><td class="memItemLeft" align="right" valign="top"><a id="aaa0e5be04b9ee83acfdd443145061f47"></a>
- int </td><td class="memItemRight" valign="bottom"><a class="el" href="getkey_8cpp.html#aaa0e5be04b9ee83acfdd443145061f47">bpos</a> = 0</td></tr>
- <tr class="memdesc:aaa0e5be04b9ee83acfdd443145061f47"><td class="mdescLeft"> </td><td class="mdescRight">pushback buffer position <br /></td></tr>
- <tr class="separator:aaa0e5be04b9ee83acfdd443145061f47"><td class="memSeparator" colspan="2"> </td></tr>
- </table>
- <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
- <div class="textblock"><p>Key and door input routines. </p>
- </div><h2 class="groupheader">Macro Definition Documentation</h2>
- <a id="a05e8779289398e4e8028b7f94f6b8009"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a05e8779289398e4e8028b7f94f6b8009">◆ </a></span>CRNL</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">#define CRNL   "\r\n"</td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>used by output routines. </p>
- <p>Sending "\n" isn't enough. </p>
- </div>
- </div>
- <h2 class="groupheader">Function Documentation</h2>
- <a id="a5a392181fdf6b261a23c6996b6f65765"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a5a392181fdf6b261a23c6996b6f65765">◆ </a></span>get()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">char get </td>
- <td>(</td>
- <td class="paramtype">void </td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>get a key from the pushback buffer. </p>
- <dl class="section return"><dt>Returns</dt><dd>char </dd></dl>
- </div>
- </div>
- <a id="abbfe4f963938c288581211cdee6cb818"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#abbfe4f963938c288581211cdee6cb818">◆ </a></span>getch()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">signed int getch </td>
- <td>(</td>
- <td class="paramtype">void </td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>low level getch key read </p>
- <p>This reads a key with a defined timeout value. This is called by other routines to handle arrow keys, F-keys. returns -1 on timeout (no key), -2 on error (connection closed) </p><dl class="section return"><dt>Returns</dt><dd>signed int </dd></dl>
- </div>
- </div>
- <a id="a48210bb765c651a12818ca2551ace8e2"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a48210bb765c651a12818ca2551ace8e2">◆ </a></span>getkey()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">signed int getkey </td>
- <td>(</td>
- <td class="paramtype">void </td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>high level getkey </p>
- <p>This returns function keys, arrow keys, see XKEY_* defines. returns -1 (no key avaiable) or -2 (hangup) or XKEY_UNKNOWN (don't know what it is)</p>
- <dl class="section return"><dt>Returns</dt><dd>signed int </dd></dl>
- </div>
- </div>
- <a id="a4d28072fff7bfaa3de3d1a6357fba261"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a4d28072fff7bfaa3de3d1a6357fba261">◆ </a></span>raw()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void raw </td>
- <td>(</td>
- <td class="paramtype">void </td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Enable terminal raw mode. </p>
- <p>This sets up the linux console so the door library will work correctly in local mode. </p>
- </div>
- </div>
- <a id="a37118b1ee911d1447a495aa49f2926a5"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a37118b1ee911d1447a495aa49f2926a5">◆ </a></span>unget()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void unget </td>
- <td>(</td>
- <td class="paramtype">char </td>
- <td class="paramname"><em>c</em></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>ungets (pushes key back) </p>
- <p>If we read ahead, and we can't use it, we push it back into the buffer for next time. </p><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">c</td><td></td></tr>
- </table>
- </dd>
- </dl>
- </div>
- </div>
- </div><!-- contents -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.17
- </small></address>
- </body>
- </html>
|