lexical #3/3, collapse append(NULL) into cp_ccom()
the sequence
orig_wlist = wlist;
append(NULL);
cp_ccom(wlist, ...);
is transformed.
expressions to care about in cp_ccom()
C1 := (wlist->wl_next != NULL)
C2 := (wlist->wl_word != NULL)
C3 := wl_length(wlist)
D1 := (orig_wlist != NULL)
D2 := (orig_wlist->wl_word != NULL)
D3 := wl_length(orig_wlist);
cases and their significance in cp_ccom():
orig_wlist = NULL;
wlist = wl_cons(NULL, NULL);
C1 == false
D1 == false
C2,C3 dont care
orig_wlist = wl_cons(E1, wl_cons(E2, ... wl_cons(En, NULL)))
wlist = wl_cons(E1, wl_cons(E2, .... wl_cons(En, wl_cons(NULL, NULL))))
C1 == true
D1 == true
C2 === D2
C3 === D3 + 1
This commit is contained in:
parent
fec5b00a0d
commit
64d00a6b43
|
|
@ -94,11 +94,11 @@ cp_ccom(wordlist *wlist, char *buf, bool esc)
|
|||
|
||||
buf = cp_unquote(copy(buf));
|
||||
cp_wstrip(buf);
|
||||
if (wlist->wl_next) { /* Not the first word. */
|
||||
if (wlist) { /* Not the first word. */
|
||||
cc = getccom(wlist->wl_word);
|
||||
if (cc && cc->cc_invalid)
|
||||
cc = NULL;
|
||||
arg = wl_length(wlist) - 2;
|
||||
arg = wl_length(wlist) - 1;
|
||||
if (arg > 3)
|
||||
arg = 3;
|
||||
/* First filenames. */
|
||||
|
|
|
|||
|
|
@ -256,7 +256,6 @@ gotchar:
|
|||
goto done;
|
||||
}
|
||||
// cp_ccom doesn't mess wlist, read only access to wlist->wl_word
|
||||
append(NULL);
|
||||
cp_ccom(wlist, buf, FALSE);
|
||||
wl_free(wlist);
|
||||
(void) fputc('\r', cp_out);
|
||||
|
|
@ -291,7 +290,6 @@ gotchar:
|
|||
#else
|
||||
fputc(linebuf[j], cp_out); /* But you can't edit */
|
||||
#endif
|
||||
append(NULL);
|
||||
// cp_ccom doesn't mess wlist, read only access to wlist->wl_word
|
||||
cp_ccom(wlist, buf, TRUE);
|
||||
wl_free(wlist);
|
||||
|
|
|
|||
Loading…
Reference in New Issue