source: asp3_tinet_ecnl_arm/trunk/ntshell/ntshell/util/ntstdio.h@ 374

Last change on this file since 374 was 374, checked in by coas-nagasima, 5 years ago

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 3.3 KB
Line 
1/**
2 * @file ntstdio.h
3 * @author CuBeatSystems
4 * @author Shinichiro Nakamura
5 * @copyright
6 * ===============================================================
7 * Natural Tiny Shell (NT-Shell) Version 0.3.1
8 * ===============================================================
9 * Copyright (c) 2010-2016 Shinichiro Nakamura
10 *
11 * Permission is hereby granted, free of charge, to any person
12 * obtaining a copy of this software and associated documentation
13 * files (the "Software"), to deal in the Software without
14 * restriction, including without limitation the rights to use,
15 * copy, modify, merge, publish, distribute, sublicense, and/or
16 * sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following
18 * conditions:
19 *
20 * The above copyright notice and this permission notice shall be
21 * included in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30 * OTHER DEALINGS IN THE SOFTWARE.
31 */
32
33/*------------------------------------------------------------------------/
34/ Universal string handler for user console interface
35/-------------------------------------------------------------------------/
36/
37/ Copyright (C) 2011, ChaN, all right reserved.
38/
39/ * This software is a free software and there is NO WARRANTY.
40/ * No restriction on use. You can use, modify and redistribute it for
41/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
42/ * Redistributions of source code must retain the above copyright notice.
43/
44/-------------------------------------------------------------------------*/
45
46#ifndef NTSTDIO_H
47#define NTSTDIO_H
48
49/**
50 * 1: Convert \n ==> \r\n in the output char.
51 */
52#define NTSTDIO_OPTION_LF_CRLF (1 << 0)
53
54/**
55 * 1: Echo back input chars in ntstdio_gets function.
56 */
57#define NTSTDIO_OPTION_LINE_ECHO (1 << 1)
58
59/**
60 * 1: canonical mode.
61 */
62#define NTSTDIO_OPTION_CANON (1 << 2)
63
64/**
65 * 1: Convert \r ==> \n in ntstdio_getc function.
66 */
67#define NTSTDIO_OPTION_LF_CR (1 << 3)
68
69struct ntstdio_t;
70typedef unsigned char (*NTSTDIO_XI)(struct ntstdio_t *handle);
71typedef void (*NTSTDIO_XO)(struct ntstdio_t *handle, unsigned char c);
72
73typedef struct ntstdio_t {
74 NTSTDIO_XI xi;
75 NTSTDIO_XO xo;
76 char *outptr;
77 int len;
78 int pos;
79 unsigned int option;
80 void *exinf;
81} ntstdio_t;
82
83void ntstdio_init(ntstdio_t *handle, unsigned int option, NTSTDIO_XI xi, NTSTDIO_XO xo);
84
85void ntstdio_putc(ntstdio_t *handle, char c);
86void ntstdio_puts(ntstdio_t *handle, const char *str);
87void ntstdio_fputs(ntstdio_t *handle, NTSTDIO_XO xo, const char *str);
88int ntstdio_printf(ntstdio_t *handle, const char *fmt, ...);
89int ntstdio_snprintf(char *buf, int len, const char *fmt, ...);
90int ntstdio_fprintf(ntstdio_t *handle, NTSTDIO_XO xo, const char *fmt, ...);
91
92int ntstdio_getc(ntstdio_t *handle);
93int ntstdio_gets(ntstdio_t *handle, char *buf, int len);
94int ntstdio_fgets(ntstdio_t *handle, NTSTDIO_XI xi, char *buf, int len);
95
96#endif
97
Note: See TracBrowser for help on using the repository browser.