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_editor.h Source File

text_editor.h

Go to the documentation of this file.
00001 /**
00002  * @file text_editor.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_EDITOR_H_
00041 #define _TEXT_EDITOR_H_
00042 
00043 #define TEXTEDITOR_MAXLEN 64
00044 
00045 typedef struct {
00046     char buffer[TEXTEDITOR_MAXLEN];
00047     int pos;
00048     int len;
00049 } text_editor_t;
00050 
00051 void text_editor_init(text_editor_t *p);
00052 int text_editor_insert(text_editor_t *p, char c);
00053 int text_editor_backspace(text_editor_t *p);
00054 int text_editor_cursor_get_position(text_editor_t *p);
00055 int text_editor_cursor_head(text_editor_t *p);
00056 int text_editor_cursor_tail(text_editor_t *p);
00057 int text_editor_cursor_left(text_editor_t *p);
00058 int text_editor_cursor_right(text_editor_t *p);
00059 int text_editor_set_text(text_editor_t *p, char *buf);
00060 int text_editor_get_text(text_editor_t *p, char *buf, int siz);
00061 void text_editor_clear(text_editor_t *p);
00062 
00063 #endif
00064