File indexing completed on 2024-05-18 08:30:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifndef _HISTEDIT_H_
0041 #define _HISTEDIT_H_
0042
0043 #define LIBEDIT_MAJOR 2
0044 #define LIBEDIT_MINOR 11
0045
0046 #include <sys/types.h>
0047 #include <stdio.h>
0048
0049 #ifdef __cplusplus
0050 extern "C" {
0051 #endif
0052
0053
0054
0055
0056
0057 typedef struct editline EditLine;
0058
0059
0060
0061
0062 typedef struct lineinfo {
0063 const char *buffer;
0064 const char *cursor;
0065 const char *lastchar;
0066 } LineInfo;
0067
0068
0069
0070
0071
0072 #define CC_NORM 0
0073 #define CC_NEWLINE 1
0074 #define CC_EOF 2
0075 #define CC_ARGHACK 3
0076 #define CC_REFRESH 4
0077 #define CC_CURSOR 5
0078 #define CC_ERROR 6
0079 #define CC_FATAL 7
0080 #define CC_REDISPLAY 8
0081 #define CC_REFRESH_BEEP 9
0082
0083
0084
0085
0086 EditLine *el_init(const char *, FILE *, FILE *, FILE *);
0087 EditLine *el_init_fd(const char *, FILE *, FILE *, FILE *,
0088 int, int, int);
0089 void el_end(EditLine *);
0090 void el_reset(EditLine *);
0091
0092
0093
0094
0095 const char *el_gets(EditLine *, int *);
0096 int el_getc(EditLine *, char *);
0097 void el_push(EditLine *, const char *);
0098
0099
0100
0101
0102 void el_beep(EditLine *);
0103
0104
0105
0106
0107
0108 int el_parse(EditLine *, int, const char **);
0109
0110
0111
0112
0113 int el_set(EditLine *, int, ...);
0114 int el_get(EditLine *, int, ...);
0115 unsigned char _el_fn_complete(EditLine *, int);
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134 #define EL_PROMPT 0
0135 #define EL_TERMINAL 1
0136 #define EL_EDITOR 2
0137 #define EL_SIGNAL 3
0138 #define EL_BIND 4
0139 #define EL_TELLTC 5
0140 #define EL_SETTC 6
0141 #define EL_ECHOTC 7
0142 #define EL_SETTY 8
0143 #define EL_ADDFN 9
0144
0145 #define EL_HIST 10
0146 #define EL_EDITMODE 11
0147 #define EL_RPROMPT 12
0148 #define EL_GETCFN 13
0149 #define EL_CLIENTDATA 14
0150 #define EL_UNBUFFERED 15
0151 #define EL_PREP_TERM 16
0152 #define EL_GETTC 17
0153 #define EL_GETFP 18
0154 #define EL_SETFP 19
0155 #define EL_REFRESH 20
0156 #define EL_PROMPT_ESC 21
0157 #define EL_RPROMPT_ESC 22
0158 #define EL_RESIZE 23
0159 #define EL_ALIAS_TEXT 24
0160
0161 #define EL_BUILTIN_GETCFN (NULL)
0162
0163
0164
0165
0166 int el_source(EditLine *, const char *);
0167
0168
0169
0170
0171
0172
0173 void el_resize(EditLine *);
0174
0175
0176
0177
0178 const LineInfo *el_line(EditLine *);
0179 int el_insertstr(EditLine *, const char *);
0180 void el_deletestr(EditLine *, int);
0181
0182
0183
0184
0185
0186
0187 typedef struct history History;
0188
0189 typedef struct HistEvent {
0190 int num;
0191 const char *str;
0192 } HistEvent;
0193
0194
0195
0196
0197 History * history_init(void);
0198 void history_end(History *);
0199
0200 int history(History *, HistEvent *, int, ...);
0201
0202 #define H_FUNC 0
0203 #define H_SETSIZE 1
0204 #define H_GETSIZE 2
0205 #define H_FIRST 3
0206 #define H_LAST 4
0207 #define H_PREV 5
0208 #define H_NEXT 6
0209 #define H_CURR 8
0210 #define H_SET 7
0211 #define H_ADD 9
0212 #define H_ENTER 10
0213 #define H_APPEND 11
0214 #define H_END 12
0215 #define H_NEXT_STR 13
0216 #define H_PREV_STR 14
0217 #define H_NEXT_EVENT 15
0218 #define H_PREV_EVENT 16
0219 #define H_LOAD 17
0220 #define H_SAVE 18
0221 #define H_CLEAR 19
0222 #define H_SETUNIQUE 20
0223 #define H_GETUNIQUE 21
0224 #define H_DEL 22
0225 #define H_NEXT_EVDATA 23
0226 #define H_DELDATA 24
0227 #define H_REPLACE 25
0228 #define H_SAVE_FP 26
0229 #define H_NSAVE_FP 27
0230
0231
0232
0233
0234
0235
0236
0237 typedef struct tokenizer Tokenizer;
0238
0239
0240
0241
0242 Tokenizer *tok_init(const char *);
0243 void tok_end(Tokenizer *);
0244 void tok_reset(Tokenizer *);
0245 int tok_line(Tokenizer *, const LineInfo *,
0246 int *, const char ***, int *, int *);
0247 int tok_str(Tokenizer *, const char *,
0248 int *, const char ***);
0249
0250
0251
0252
0253 #include <wchar.h>
0254 #include <wctype.h>
0255
0256
0257
0258
0259 typedef struct lineinfow {
0260 const wchar_t *buffer;
0261 const wchar_t *cursor;
0262 const wchar_t *lastchar;
0263 } LineInfoW;
0264
0265 typedef int (*el_rfunc_t)(EditLine *, wchar_t *);
0266
0267 const wchar_t *el_wgets(EditLine *, int *);
0268 int el_wgetc(EditLine *, wchar_t *);
0269 void el_wpush(EditLine *, const wchar_t *);
0270
0271 int el_wparse(EditLine *, int, const wchar_t **);
0272
0273 int el_wset(EditLine *, int, ...);
0274 int el_wget(EditLine *, int, ...);
0275
0276 int el_cursor(EditLine *, int);
0277 const LineInfoW *el_wline(EditLine *);
0278 int el_winsertstr(EditLine *, const wchar_t *);
0279 #define el_wdeletestr el_deletestr
0280
0281
0282
0283
0284 typedef struct histeventW {
0285 int num;
0286 const wchar_t *str;
0287 } HistEventW;
0288
0289 typedef struct historyW HistoryW;
0290
0291 HistoryW * history_winit(void);
0292 void history_wend(HistoryW *);
0293
0294 int history_w(HistoryW *, HistEventW *, int, ...);
0295
0296
0297
0298
0299 typedef struct tokenizerW TokenizerW;
0300
0301
0302 TokenizerW *tok_winit(const wchar_t *);
0303 void tok_wend(TokenizerW *);
0304 void tok_wreset(TokenizerW *);
0305 int tok_wline(TokenizerW *, const LineInfoW *,
0306 int *, const wchar_t ***, int *, int *);
0307 int tok_wstr(TokenizerW *, const wchar_t *,
0308 int *, const wchar_t ***);
0309
0310 #ifdef __cplusplus
0311 }
0312 #endif
0313
0314 #endif