?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>Procyon AVRlib: cmdline.h Source File</title>
4 <link href="dox.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.4.2 -->
7 <div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
8 <h1>cmdline.h</h1><a href="cmdline_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file cmdline.h \brief Command-Line Interface Library. */</span>
9 00002 <span class="comment">//*****************************************************************************</span>
10 00003 <span class="comment">//</span>
11 00004 <span class="comment">// File Name : 'cmdline.h'</span>
12 00005 <span class="comment">// Title : Command-Line Interface Library</span>
13 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2003</span>
14 00007 <span class="comment">// Created : 2003.07.16</span>
15 00008 <span class="comment">// Revised : 2003.07.16</span>
16 00009 <span class="comment">// Version : 0.1</span>
17 00010 <span class="comment">// Target MCU : Atmel AVR Series</span>
18 00011 <span class="comment">// Editor Tabs : 4</span>
19 00012 <span class="comment">//</span><span class="comment"></span>
20 00013 <span class="comment">/// \ingroup general</span>
21 00014 <span class="comment">/// \defgroup cmdline Command-line Implementation (cmdline.c)</span>
22 00015 <span class="comment">/// \code #include "cmdline.h" \endcode</span>
23 00016 <span class="comment">/// \par Overview</span>
24 00017 <span class="comment">/// This Command-Line interface library is meant to provide a reusable</span>
25 00018 <span class="comment">/// terminal-like user interface much like a DOS command line or UNIX terminal.</span>
26 00019 <span class="comment">/// A terminal with VT100 support is assumed on the user's end. Common</span>
27 00020 <span class="comment">/// line-editing is supported, including backspace, arrow keys, and even a</span>
28 00021 <span class="comment">/// small command-history buffer.</span>
29 00022 <span class="comment">///</span>
30 00023 <span class="comment">/// \note One can imagine more efficient ways to implement the command and </span>
31 00024 <span class="comment">/// function database contained in this library, however, this is a decent</span>
32 00025 <span class="comment">/// and functional first cut. I may someday get around to making some</span>
33 00026 <span class="comment">/// improvements.</span>
34 00027 <span class="comment">///</span>
35 00028 <span class="comment">/// \par Operation</span>
36 00029 <span class="comment">/// The cmdline library does the following things for you:</span>
37 00030 <span class="comment">/// - Prints command prompts</span>
38 00031 <span class="comment">/// - Gathers a command string from the user (with editing features)</span>
39 00032 <span class="comment">/// - Parses the command string when the user presses [ENTER]</span>
40 00033 <span class="comment">/// - Compares the entered command to the command database</span>
41 00034 <span class="comment">/// -- Executes the corresponding function if a match is found</span>
42 00035 <span class="comment">/// -- Reports an error if no match is found</span>
43 00036 <span class="comment">/// -Provides functions to retrieve the command arguments:</span>
44 00037 <span class="comment">/// --as strings</span>
45 00038 <span class="comment">/// --as decimal integers</span>
46 00039 <span class="comment">/// --as hex integers</span>
47 00040 <span class="comment">///</span>
48 00041 <span class="comment">/// Supported editing features include:</span>
49 00042 <span class="comment">/// - Backspace support</span>
50 00043 <span class="comment">/// - Mid-line editing, inserting and deleting (left/right-arrows)</span>
51 00044 <span class="comment">/// - Command History (up-arrow) (currently only one command deep)</span>
52 00045 <span class="comment">///</span>
53 00046 <span class="comment">/// To use the cmdline system, you will need to associate command strings</span>
54 00047 <span class="comment">/// (commands the user will be typing) with your function that you wish to have</span>
55 00048 <span class="comment">/// called when the user enters that command. This is done by using the</span>
56 00049 <span class="comment">/// cmdlineAddCommand() function.</span>
57 00050 <span class="comment">///</span>
58 00051 <span class="comment">/// To setup the cmdline system, you must do these things:</span>
59 00052 <span class="comment">/// - Initialize it: cmdlineInit()</span>
60 00053 <span class="comment">/// - Add one or more commands to the database: cmdlineAddCommand()</span>
61 00054 <span class="comment">/// - Set an output function for your terminal: cmdlineSetOutputFunc()</span>
62 00055 <span class="comment">///</span>
63 00056 <span class="comment">/// To operate the cmdline system, you must do these things repeatedly:</span>
64 00057 <span class="comment">/// - Pass user input from the terminal to: cmdlineSetOutputFunc()</span>
65 00058 <span class="comment">/// - Call cmdlineMainLoop() from your program's main loop</span>
66 00059 <span class="comment">///</span>
67 00060 <span class="comment">/// The cmdline library does not assume an input or output device, but can be</span>
68 00061 <span class="comment">/// configured to use any user function for output using cmdlineSetOutputFunc()</span>
69 00062 <span class="comment">/// and accepts input by calling cmdlineInputFunc(). This means the cmdline</span>
70 00063 <span class="comment">/// library can operate over any interface including UART (serial port),</span>
71 00064 <span class="comment">/// I2c, ethernet, etc.</span>
72 00065 <span class="comment">///</span>
73 00066 <span class="comment">/// ***** FOR MORE INFORMATION ABOUT USING cmdline SEE THE AVRLIB EXAMPLE *****</span>
74 00067 <span class="comment">/// ***** CODE IN THE avrlib/examples DIRECTORY *****</span>
75 00068 <span class="comment"></span><span class="comment">//</span>
76 00069 <span class="comment">// NOTE: This code is currently below version 1.0, and therefore is considered</span>
77 00070 <span class="comment">// to be lacking in some functionality or documentation, or may not be fully</span>
78 00071 <span class="comment">// tested. Nonetheless, you can expect most functions to work.</span>
79 00072 <span class="comment">//</span>
80 00073 <span class="comment">// This code is distributed under the GNU Public License</span>
81 00074 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>
82 00075 <span class="comment">//</span>
83 00076 <span class="comment">//*****************************************************************************</span><span class="comment"></span>
84 00077 <span class="comment">//@{</span>
85 00078 <span class="comment"></span>
86 00079 <span class="preprocessor">#ifndef CMDLINE_H</span>
87 00080 <span class="preprocessor"></span><span class="preprocessor">#define CMDLINE_H</span>
88 00081 <span class="preprocessor"></span>
89 00082 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>
90 00083
91 00084 <span class="comment">// constants/macros/typdefs</span>
92 00085 <span class="keyword">typedef</span> void (*CmdlineFuncPtrType)(void);
93 00086
94 00087 <span class="comment">// functions</span>
95 00088 <span class="comment"></span>
96 00089 <span class="comment">//! initalize the command line system</span>
97 00090 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__cmdline.html#ga1">cmdlineInit</a>(<span class="keywordtype">void</span>);
98 00091 <span class="comment"></span>
99 00092 <span class="comment">//! add a new command to the database of known commands</span>
100 00093 <span class="comment"></span><span class="comment">// newCmdString should be a null-terminated command string with no whitespace</span>
101 00094 <span class="comment">// newCmdFuncPtr should be a pointer to the function to execute when</span>
102 00095 <span class="comment">// the user enters the corresponding command tring</span>
103 00096 <span class="keywordtype">void</span> <a class="code" href="group__cmdline.html#ga2">cmdlineAddCommand</a>(u08* newCmdString, CmdlineFuncPtrType newCmdFuncPtr);
104 00097 <span class="comment"></span>
105 00098 <span class="comment">//! sets the function used for sending characters to the user terminal</span>
106 00099 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__cmdline.html#ga3">cmdlineSetOutputFunc</a>(<span class="keywordtype">void</span> (*output_func)(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c));
107 00100 <span class="comment"></span>
108 00101 <span class="comment">//! call this function to pass input charaters from the user terminal</span>
109 00102 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__cmdline.html#ga4">cmdlineInputFunc</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c);
110 00103 <span class="comment"></span>
111 00104 <span class="comment">//! call this function in your program's main loop</span>
112 00105 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__cmdline.html#ga5">cmdlineMainLoop</a>(<span class="keywordtype">void</span>);
113 00106
114 00107 <span class="comment">// internal commands</span>
115 00108 <span class="keywordtype">void</span> cmdlineRepaint(<span class="keywordtype">void</span>);
116 00109 <span class="keywordtype">void</span> cmdlineDoHistory(u08 action);
117 00110 <span class="keywordtype">void</span> cmdlineProcessInputString(<span class="keywordtype">void</span>);
118 00111 <span class="keywordtype">void</span> cmdlinePrintPrompt(<span class="keywordtype">void</span>);
119 00112 <span class="keywordtype">void</span> cmdlinePrintError(<span class="keywordtype">void</span>);
120 00113
121 00114 <span class="comment">// argument retrieval commands</span><span class="comment"></span>
122 00115 <span class="comment">//! returns a string pointer to argument number [argnum] on the command line</span>
123 00116 <span class="comment"></span>u08* <a class="code" href="group__cmdline.html#ga11">cmdlineGetArgStr</a>(u08 argnum);<span class="comment"></span>
124 00117 <span class="comment">//! returns the decimal integer interpretation of argument number [argnum]</span>
125 00118 <span class="comment"></span><span class="keywordtype">long</span> <a class="code" href="group__cmdline.html#ga12">cmdlineGetArgInt</a>(u08 argnum);<span class="comment"></span>
126 00119 <span class="comment">//! returns the hex integer interpretation of argument number [argnum]</span>
127 00120 <span class="comment"></span><span class="keywordtype">long</span> <a class="code" href="group__cmdline.html#ga13">cmdlineGetArgHex</a>(u08 argnum);
128 00121
129 00122 <span class="preprocessor">#endif</span>
130 00123 <span class="preprocessor"></span><span class="comment">//@}</span>
131 </span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by&nbsp;
132 <a href="http://www.doxygen.org/index.html">
133 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
134 </body>
135 </html>
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3