Overview
Comment: | .tclshrc pkgMkIndex vimrc Makefile.in tclreadline.c |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
199260e23f4ee76f9649cb19253f078f |
User & Date: | johannes@zellner.org on 1999-08-20 16:55:03 |
Other Links: | manifest | tags |
Context
1999-08-20
| ||
22:43 | share/vim/ft/c_ft.vim share/vim/ft/cpp_ft.vim src/tclreadline/configure.in src/tclreadline/tclreadline.n.in src/tclreadline/tclreadlineSetup.tcl.in Added Files: src/tclreadline/Makefile.in src/tclreadline/tclreadline.c src/tclreadline/tclreadlineConfig.sh.in src/tclreadline/tclreadlineInit.tcl.in check-in: d6ac1c38a3 user: johannes@zellner.org tags: trunk | |
16:55 | .tclshrc pkgMkIndex vimrc Makefile.in tclreadline.c check-in: 199260e23f user: johannes@zellner.org tags: trunk | |
14:02 | Makefile.in check-in: f21c4d1a65 user: johannes@zellner.org tags: trunk | |
Changes
Modified Makefile.in from [4740529900] to [b22049b06e].
1 2 | # -*- make -*- # FILE: "/diska/home/joze/src/tclreadline/Makefile.in" | | | 1 2 3 4 5 6 7 8 9 10 | # -*- make -*- # FILE: "/diska/home/joze/src/tclreadline/Makefile.in" # LAST MODIFICATION: "Fri Aug 20 17:22:45 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org> # $Id$ # --- # # tclreadline -- gnu readline for tcl # Copyright (C) 1999 Johannes Zellner # |
︙ | ︙ | |||
248 249 250 251 252 253 254 | $(CC) -c $(CC_SWITCHES) $(TOP_DIR)/tclreadline.c ctags: ctags -R tcltags: ctags $(TCLFILES) | | | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | $(CC) -c $(CC_SWITCHES) $(TOP_DIR)/tclreadline.c ctags: ctags -R tcltags: ctags $(TCLFILES) tcltags -a $(TCLFILES) vimtags: tcltags vimtags tags: vimtags |
︙ | ︙ |
Modified tclreadline.c from [c635fda5be] to [4a41886173].
1 2 3 | /* ================================================================== | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | /* ================================================================== FILE: "/diska/home/joze/src/tclreadline/tclreadline.c" LAST MODIFICATION: "Fri Aug 20 18:14:57 1999 (joze)" (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org> $Id$ --- tclreadline -- gnu readline for tcl Copyright (C) 1999 Johannes Zellner |
︙ | ︙ | |||
92 93 94 95 96 97 98 99 | char** TclReadlineCompletion (char *text, int start, int end); char* TclReadline0generator (char *text, int state); char* TclReadline1generator (char *text, int state); char* TclReadlineKnownCommands (char *text, int state, int mode); int TclReadlineEventHook (void); int TclReadlineParse (char **args, int maxargs, char *buf); | > > > > > | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | char** TclReadlineCompletion (char *text, int start, int end); char* TclReadline0generator (char *text, int state); char* TclReadline1generator (char *text, int state); char* TclReadlineKnownCommands (char *text, int state, int mode); int TclReadlineEventHook (void); int TclReadlineParse (char **args, int maxargs, char *buf); enum { LINE_PENDING, LINE_CONTROL_D, LINE_COMPLETE }; static int line_complete = LINE_PENDING; static char *line = (char *) NULL; /* * Script to set the tclreadline library path in the * variable global "tclreadline_library" */ |
︙ | ︙ | |||
129 130 131 132 133 134 135 | if (c == 'r' && strncmp (argv[1], "read", length) == 0) { char *expansion = (char *) NULL; int status; | | | | | | < | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | if (c == 'r' && strncmp (argv[1], "read", length) == 0) { char *expansion = (char *) NULL; int status; line_complete = LINE_PENDING; rl_callback_handler_install (argc == 3 ? argv[2] : "%", TclReadlineLineCompleteHandler); Tcl_CreateFileHandler (0, TCL_READABLE, TclReadlineDataAvailableHandler, (ClientData) NULL); while (LINE_PENDING == line_complete) { Tcl_DoOneEvent (0); } Tcl_DeleteFileHandler (0); if (LINE_CONTROL_D == line_complete) { Tcl_Eval (interp, "puts {}; exit"); } status = history_expand (line, &expansion); if (status == 1) printf ("%s\n", expansion); else if (status == -1) Tcl_AppendResult (interp, "error in history expansion\n", (char *) NULL); if (expansion && *expansion) add_history (expansion); Tcl_AppendResult (interp, expansion, (char *) NULL); FREE (line); FREE (expansion); return TCL_OK; } else if (c == 'i' && strncmp (argv[1], "initialize", length) == 0) { if (argc != 3) goto BAD_COMMAND; else Tcl_AppendResult (interp, TclReadlineInitialize (argv[2]), (char *) NULL); |
︙ | ︙ | |||
202 203 204 205 206 207 208 | return TCL_OK; BAD_COMMAND: Tcl_AppendResult (interp, "wrong # args: should be \"readline option ?arg ...?\"", (char *) NULL); | | > > > | > > > > > > > | | | | | | | | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | return TCL_OK; BAD_COMMAND: Tcl_AppendResult (interp, "wrong # args: should be \"readline option ?arg ...?\"", (char *) NULL); return TCL_ERROR; } void TclReadlineDataAvailableHandler (ClientData clientData, int mask) { #if 1 fprintf (stderr, "(TclReadlineDataAvailableHandler) mask = %d\n", mask); #endif if (mask & TCL_READABLE) { rl_callback_read_char (); rl_redisplay (); } } void TclReadlineLineCompleteHandler (char *ptr) { #if 0 fprintf (stderr, "(TclReadlineLineCompleteHandler) ptr = %p\n", ptr); if (ptr) fprintf (stderr, "(TclReadlineLineCompleteHandler) *ptr = %p\n", *ptr); #endif if (!ptr) { /* <c-d> */ line_complete = LINE_CONTROL_D; rl_callback_handler_remove (); } else if (*ptr) { line_complete = LINE_COMPLETE; rl_callback_handler_remove (); line = ptr; } } int Tclreadline_SafeInit (Tcl_Interp *interp) { return Tclreadline_Init (interp); } int Tclreadline_Init (Tcl_Interp *interp) { Tcl_CreateCommand (interp, "::tclreadline::readline", TclReadlineCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); return Tcl_PkgProvide (interp, "tclreadline", TCLREADLINE_VERSION); } char *TclReadlineInitialize (char *historyfile) { rl_readline_name = "tclreadline"; using_history (); /* * try to read historyfile in home * directory. If this failes, this * is *not* an error. */ rl_attempted_completion_function = (CPPFunction *) TclReadlineCompletion; if (read_history (historyfile)) return "unable to read history file"; else return ""; } char **TclReadlineCompletion (char *text, int start, int end) { char **matches = (char **) NULL; static char local_line[BUFSIZ]; |
︙ | ︙ | |||
276 277 278 279 280 281 282 | */ if (start == 0 || !strlen (local_line)) matches = completion_matches (text, TclReadline0generator); else matches = completion_matches (text, TclReadline1generator); | | | | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | */ if (start == 0 || !strlen (local_line)) matches = completion_matches (text, TclReadline0generator); else matches = completion_matches (text, TclReadline1generator); return matches; } char *TclReadline0generator (char *text, int state) { return TclReadlineKnownCommands (text, state, _CMD_GET); } char *TclReadline1generator (char *text, int state) { return TclReadlineKnownCommands (text, state, _CMD_SUB_GET); } char *TclReadlineKnownCommands (char *text, int state, int mode) { static int len; static cmds_t *cmds = (cmds_t *) NULL, *new; char *tmp, *args[256]; |
︙ | ︙ | |||
338 339 340 341 342 343 344 | new = cmds; len = strlen (text); } while (new && (name = new->cmd)) { new = new->next; if (!strncmp (name[0], text, len)) | | | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | new = cmds; len = strlen (text); } while (new && (name = new->cmd)) { new = new->next; if (!strncmp (name[0], text, len)) return strdup (name[0]); } return (char *) NULL; break; case _CMD_SUB_GET: |
︙ | ︙ | |||
376 377 378 379 380 381 382 | if (!new) return (char *) NULL; for (i = 0; new->cmd[i]; i++) /* EMPTY */; if (sub < i && !strncmp (new->cmd[sub], text, len)) | | | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | if (!new) return (char *) NULL; for (i = 0; new->cmd[i]; i++) /* EMPTY */; if (sub < i && !strncmp (new->cmd[sub], text, len)) return strdup (new->cmd[sub]); else return (char *) NULL; } else return (char *) NULL; |
︙ | ︙ | |||
401 402 403 404 405 406 407 | /* NOTREACHED */ } int TclReadlineEventHook (void) { Tcl_DoOneEvent (TCL_ALL_EVENTS | TCL_DONT_WAIT); | | | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | /* NOTREACHED */ } int TclReadlineEventHook (void) { Tcl_DoOneEvent (TCL_ALL_EVENTS | TCL_DONT_WAIT); return TCL_OK; } int TclReadlineParse (char **args, int maxargs, char *buf) { int nr = 0; while (*buf != '\0' && nr < maxargs) { |
︙ | ︙ |