/[LeafOK_CVS]/lbbs/include/io.h
ViewVC logotype

Diff of /lbbs/include/io.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.5 by sysadm, Wed Mar 2 16:33:49 2005 UTC Revision 1.29 by sysadm, Wed Nov 5 02:48:48 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                              io.h  -  description  /*
3                               -------------------   * io
4      begin                : Mon Oct 18 2004   *   - basic terminal-based user input / output features
5      copyright            : (C) 2004 by Leaflet   *
6      email                : leaflet@leafok.com   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7   ***************************************************************************/   */
   
 /***************************************************************************  
  *                                                                         *  
  *   This program is free software; you can redistribute it and/or modify  *  
  *   it under the terms of the GNU General Public License as published by  *  
  *   the Free Software Foundation; either version 2 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
8    
9    #ifndef _IO_H_
10    #define _IO_H_
11    
12    #include <iconv.h>
13  #include <stdio.h>  #include <stdio.h>
14    
15  #define ESC_KEY         '\033'  enum io_key_t
16  #define CR              '\r'  {
17  #define LF              '\n'      CR = '\r',
18  #define BACKSPACE       '\b'      LF = '\n',
19  #define BELL            '\b'      BACKSPACE = '\b',
20  #define KEY_SPACE       '\040'      BELL = '\b',
21  #define KEY_CONTROL     0xff      KEY_TAB = 9,
22  #define KEY_UP          0x101      KEY_ESC = 27,
23  #define KEY_DOWN        0x102      KEY_SPACE = '\040',
24  #define KEY_LEFT        0x103  
25  #define KEY_RIGHT       0x104      // Expand key
26  #define KEY_HOME        0x105      KEY_NULL = 0xffff,
27  #define KEY_DEL         0x107      KEY_TIMEOUT = 0xfffe,
28  #define KEY_END         0x108      KEY_CONTROL = 0xff,
29  #define KEY_PGUP        0x109      KEY_UP = 0x0101,
30  #define KEY_PGDOWN      0x10a      KEY_DOWN = 0x0102,
31        KEY_RIGHT = 0x0103,
32        KEY_LEFT = 0x0104,
33        KEY_CSI = 0x011b, // ESC ESC
34        KEY_HOME = 0x0201,
35        KEY_INS = 0x0202,
36        KEY_DEL = 0x0203,
37        KEY_END = 0x0204,
38        KEY_PGUP = 0x0205,
39        KEY_PGDN = 0x0206,
40    
41        KEY_F1 = 0x0207,
42        KEY_F2 = 0x0208,
43        KEY_F3 = 0x0209,
44        KEY_F4 = 0x020a,
45        KEY_F5 = 0x020b,
46        KEY_F6 = 0x020c,
47        KEY_F7 = 0x020d,
48        KEY_F8 = 0x020e,
49        KEY_F9 = 0x020f,
50        KEY_F10 = 0x0210,
51        KEY_F11 = 0x0211,
52        KEY_F12 = 0x0212,
53    
54        KEY_SHIFT_F1 = 0x0213,
55        KEY_SHIFT_F2 = 0x0214,
56        KEY_SHIFT_F3 = 0x0215,
57        KEY_SHIFT_F4 = 0x0216,
58        KEY_SHIFT_F5 = 0x0217,
59        KEY_SHIFT_F6 = 0x0218,
60        KEY_SHIFT_F7 = 0x0219,
61        KEY_SHIFT_F8 = 0x021a,
62        KEY_SHIFT_F9 = 0x021b,
63        KEY_SHIFT_F10 = 0x021c,
64        KEY_SHIFT_F11 = 0x021d,
65        KEY_SHIFT_F12 = 0x021e,
66    
67        KEY_CTRL_F1 = 0x021f,
68        KEY_CTRL_F2 = 0x0220,
69        KEY_CTRL_F3 = 0x0221,
70        KEY_CTRL_F4 = 0x0222,
71        KEY_CTRL_F5 = 0x0223,
72        KEY_CTRL_F6 = 0x0224,
73        KEY_CTRL_F7 = 0x0225,
74        KEY_CTRL_F8 = 0x0226,
75        KEY_CTRL_F9 = 0x0227,
76        KEY_CTRL_F10 = 0x0228,
77        KEY_CTRL_F11 = 0x0229,
78        KEY_CTRL_F12 = 0x022a,
79    
80        KEY_CTRL_UP = 0x0230,
81        KEY_CTRL_DOWN = 0x0231,
82        KEY_CTRL_RIGHT = 0x0232,
83        KEY_CTRL_LEFT = 0x0233,
84        KEY_CTRL_HOME = 0x0234,
85        KEY_CTRL_END = 0x0235,
86    };
87    
88    #define Ctrl(C) ((C) - 'A' + 1)
89    
90    enum io_echo_t
91    {
92        NOECHO = 0,
93        DOECHO = 1,
94    };
95    
96    enum io_iconv_t
97    {
98        CHARSET_MAX_LEN = 20,
99    };
100    
101    extern const char BBS_default_charset[CHARSET_MAX_LEN + 1];
102    extern char stdio_charset[CHARSET_MAX_LEN + 1];
103    
104    extern int prints(const char *format, ...);
105    extern int outc(char c);
106    extern int iflush(void);
107    
108    extern int igetch(int timeout);
109    extern int igetch_t(int sec);
110    extern void igetch_reset(void);
111    
112  #define Ctrl(C)         ((C) - 'A' + 1)  extern int io_buf_conv(iconv_t cd, char *p_buf, int *p_buf_len, int *p_buf_offset, char *p_conv, size_t conv_size, int *p_conv_len);
113    extern int io_conv_init(const char *charset);
114    extern int io_conv_cleanup(void);
115    
116  extern int screen_lines;  #endif //_IO_H_


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1