File indexing completed on 2025-01-17 09:55:34
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 unsigned char _el_fn_sh_complete(EditLine *, int);
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135 #define EL_PROMPT 0
0136 #define EL_TERMINAL 1
0137 #define EL_EDITOR 2
0138 #define EL_SIGNAL 3
0139 #define EL_BIND 4
0140 #define EL_TELLTC 5
0141 #define EL_SETTC 6
0142 #define EL_ECHOTC 7
0143 #define EL_SETTY 8
0144 #define EL_ADDFN 9
0145
0146 #define EL_HIST 10
0147 #define EL_EDITMODE 11
0148 #define EL_RPROMPT 12
0149 #define EL_GETCFN 13
0150 #define EL_CLIENTDATA 14
0151 #define EL_UNBUFFERED 15
0152 #define EL_PREP_TERM 16
0153 #define EL_GETTC 17
0154 #define EL_GETFP 18
0155 #define EL_SETFP 19
0156 #define EL_REFRESH 20
0157 #define EL_PROMPT_ESC 21
0158 #define EL_RPROMPT_ESC 22
0159 #define EL_RESIZE 23
0160 #define EL_ALIAS_TEXT 24
0161 #define EL_SAFEREAD 25
0162
0163 #define EL_BUILTIN_GETCFN (NULL)
0164
0165
0166
0167
0168 int el_source(EditLine *, const char *);
0169
0170
0171
0172
0173
0174
0175 void el_resize(EditLine *);
0176
0177
0178
0179
0180 const LineInfo *el_line(EditLine *);
0181 int el_insertstr(EditLine *, const char *);
0182 void el_deletestr(EditLine *, int);
0183 int el_replacestr(EditLine *, const char *);
0184 int el_deletestr1(EditLine *, int, int);
0185
0186
0187
0188
0189
0190 typedef struct history History;
0191
0192 typedef struct HistEvent {
0193 int num;
0194 const char *str;
0195 } HistEvent;
0196
0197
0198
0199
0200 History * history_init(void);
0201 void history_end(History *);
0202
0203 int history(History *, HistEvent *, int, ...);
0204
0205 #define H_FUNC 0
0206 #define H_SETSIZE 1
0207 #define H_GETSIZE 2
0208 #define H_FIRST 3
0209 #define H_LAST 4
0210 #define H_PREV 5
0211 #define H_NEXT 6
0212 #define H_CURR 8
0213 #define H_SET 7
0214 #define H_ADD 9
0215 #define H_ENTER 10
0216 #define H_APPEND 11
0217 #define H_END 12
0218 #define H_NEXT_STR 13
0219 #define H_PREV_STR 14
0220 #define H_NEXT_EVENT 15
0221 #define H_PREV_EVENT 16
0222 #define H_LOAD 17
0223 #define H_SAVE 18
0224 #define H_CLEAR 19
0225 #define H_SETUNIQUE 20
0226 #define H_GETUNIQUE 21
0227 #define H_DEL 22
0228 #define H_NEXT_EVDATA 23
0229 #define H_DELDATA 24
0230 #define H_REPLACE 25
0231 #define H_SAVE_FP 26
0232 #define H_NSAVE_FP 27
0233
0234
0235
0236
0237
0238
0239
0240 typedef struct tokenizer Tokenizer;
0241
0242
0243
0244
0245 Tokenizer *tok_init(const char *);
0246 void tok_end(Tokenizer *);
0247 void tok_reset(Tokenizer *);
0248 int tok_line(Tokenizer *, const LineInfo *,
0249 int *, const char ***, int *, int *);
0250 int tok_str(Tokenizer *, const char *,
0251 int *, const char ***);
0252
0253
0254
0255
0256 #include <wchar.h>
0257 #include <wctype.h>
0258
0259 #ifndef HAVE_WCSDUP
0260 wchar_t * wcsdup(const wchar_t *str);
0261 #endif
0262
0263
0264
0265
0266 typedef struct lineinfow {
0267 const wchar_t *buffer;
0268 const wchar_t *cursor;
0269 const wchar_t *lastchar;
0270 } LineInfoW;
0271
0272 typedef int (*el_rfunc_t)(EditLine *, wchar_t *);
0273
0274 const wchar_t *el_wgets(EditLine *, int *);
0275 int el_wgetc(EditLine *, wchar_t *);
0276 void el_wpush(EditLine *, const wchar_t *);
0277
0278 int el_wparse(EditLine *, int, const wchar_t **);
0279
0280 int el_wset(EditLine *, int, ...);
0281 int el_wget(EditLine *, int, ...);
0282
0283 int el_cursor(EditLine *, int);
0284 const LineInfoW *el_wline(EditLine *);
0285 int el_winsertstr(EditLine *, const wchar_t *);
0286 #define el_wdeletestr el_deletestr
0287 int el_wreplacestr(EditLine *, const wchar_t *);
0288
0289
0290
0291
0292 typedef struct histeventW {
0293 int num;
0294 const wchar_t *str;
0295 } HistEventW;
0296
0297 typedef struct historyW HistoryW;
0298
0299 HistoryW * history_winit(void);
0300 void history_wend(HistoryW *);
0301
0302 int history_w(HistoryW *, HistEventW *, int, ...);
0303
0304
0305
0306
0307 typedef struct tokenizerW TokenizerW;
0308
0309
0310 TokenizerW *tok_winit(const wchar_t *);
0311 void tok_wend(TokenizerW *);
0312 void tok_wreset(TokenizerW *);
0313 int tok_wline(TokenizerW *, const LineInfoW *,
0314 int *, const wchar_t ***, int *, int *);
0315 int tok_wstr(TokenizerW *, const wchar_t *,
0316 int *, const wchar_t ***);
0317
0318 #ifdef __cplusplus
0319 }
0320 #endif
0321
0322 #endif