Natural Tiny Shell (NT-Shell) library is a tiny shell library for a small embedded system. The interface is really simple. You should only know ntshell_execute in ntshell.h. So you can port it to any embedded system easily. Please enjoy your small embedded system with it. :)

Dependents:   NaturalTinyShell_TestProgram

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers text_history.h Source File

text_history.h

Go to the documentation of this file.
00001 /**
00002  * @file text_history.h
00003  * @author Shinichiro Nakamura
00004  * @brief NT-Shell用テキストヒストリモジュールの定義。
00005  * @details
00006  * 文字列の入力履歴を論理的に扱うためのモジュール。
00007  * このモジュールはビューに関して一切感知しない。
00008  */
00009 
00010 /*
00011  * ===============================================================
00012  *  Natural Tiny Shell (NT-Shell)
00013  *  Version 0.0.6
00014  * ===============================================================
00015  * Copyright (c) 2010-2011 Shinichiro Nakamura
00016  *
00017  * Permission is hereby granted, free of charge, to any person
00018  * obtaining a copy of this software and associated documentation
00019  * files (the "Software"), to deal in the Software without
00020  * restriction, including without limitation the rights to use,
00021  * copy, modify, merge, publish, distribute, sublicense, and/or
00022  * sell copies of the Software, and to permit persons to whom the
00023  * Software is furnished to do so, subject to the following
00024  * conditions:
00025  *
00026  * The above copyright notice and this permission notice shall be
00027  * included in all copies or substantial portions of the Software.
00028  *
00029  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00030  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
00031  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00032  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
00033  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
00034  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00035  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00036  * OTHER DEALINGS IN THE SOFTWARE.
00037  * ===============================================================
00038  */
00039 
00040 #ifndef TEXT_HISTORY_H
00041 #define TEXT_HISTORY_H
00042 
00043 #define TEXTHISTORY_MAXLEN 64   /**< テキストヒストリあたりの最大文字列長。 */
00044 #define TEXTHISTORY_DEPTH 8     /**< テキストヒストリのヒストリ数。 */
00045 
00046 /**
00047  * @brief テキストヒストリ構造体。
00048  */
00049 typedef struct {
00050     char history[TEXTHISTORY_MAXLEN * TEXTHISTORY_DEPTH];
00051     int rp;
00052     int wp;
00053 } text_history_t;
00054 
00055 void text_history_init(text_history_t *p);
00056 int text_history_write(text_history_t *p, char *buf);
00057 int text_history_read(text_history_t *p, char *buf, const int siz);
00058 int text_history_read_point_next(text_history_t *p);
00059 int text_history_read_point_prev(text_history_t *p);
00060 int text_history_find(text_history_t *p,
00061         const int index, const char *text,
00062         char *buf, const int siz);
00063 
00064 #endif
00065