teco

Check-in [d373d76bf4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update emacs for undo. Fix bug in recording delete. Refactor undo struct allocation. Move back to gcc (clang bugs).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:d373d76bf4e3b7a36381a03af8a18ff790be6ab0d6efebda6c06bdfffc9ed05a
User & Date: ajv-899-334-8894@vsta.org 2013-12-19 00:23:58
Context
2013-12-19
19:31
Fix up interface between emacs and undo check-in: 7d89c9e50c user: ajv-899-334-8894@vsta.org tags: master, trunk
00:23
Update emacs for undo. Fix bug in recording delete. Refactor undo struct allocation. Move back to gcc (clang bugs). check-in: d373d76bf4 user: ajv-899-334-8894@vsta.org tags: master, trunk
2013-12-18
23:40
Consume arguments when firing off undo/redo check-in: 4269842bbd user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CC=clang
# CC=gcc
OBJS=chario.o data.o exec0.o exec1.o \
	exec2.o main.o rdcmd.o srch.o subs.o \
	utils.o window.o undo.o
CFLAGS=-DDEBUG -O -g -Wall -Werror
LIBS=-ltermcap

te: $(OBJS)
	rm -f te
	$(CC) $(CFLAGS) -o te $(OBJS) $(LIBS)

clean:
	rm -f core *.o tags

clobber: clean
	rm -f te teco
|
|



|











1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# CC=clang
CC=gcc
OBJS=chario.o data.o exec0.o exec1.o \
	exec2.o main.o rdcmd.o srch.o subs.o \
	utils.o window.o undo.o
CFLAGS=-DDEBUG -g -Wall -Werror
LIBS=-ltermcap

te: $(OBJS)
	rm -f te
	$(CC) $(CFLAGS) -o te $(OBJS) $(LIBS)

clean:
	rm -f core *.o tags

clobber: clean
	rm -f te teco

Changes to exec1.c.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    }
}

void
exec_cmds1(void)
{
    char command;	/* command character */
    int cond;		/* conditional in progress */

    /* operators */
    switch (command = mapch_l[cmdc & 0xFF]) {

    case '+':
        esp->exp = (esp->flag1) ? esp->val1 : 0;
        esp->flag1 = 0;







|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    }
}

void
exec_cmds1(void)
{
    char command;	/* command character */
    int cond = 0;	/* conditional in progress */

    /* operators */
    switch (command = mapch_l[cmdc & 0xFF]) {

    case '+':
        esp->exp = (esp->flag1) ? esp->val1 : 0;
        esp->flag1 = 0;

Changes to lib/emacs.tec.

17
18
19
20
21
22
23



24
25
26
27
28
29
30
...
122
123
124
125
126
127
128






129
130
131
132
133
134
135
0ur

!* Dot !
.ud

!* endless loop for commands !
<




 !* Read key into Qa, update and sleep if none available !
 ^tua qa+1"e 1w et-32et ^tua et#40et'

 !* Bump command counter !
 %e

................................................................................
 qd-."g .,qd:xk .,qdk | qd,.:xk qd,.k'
 .ud f<

!CX!
 !* ^X-char; get next char to complete command !
 ^tua qa+1"e 1w et-32et ^tua et#40et'







 !* ^X-^X, swap point and mark !
 qa-24"e .ua qdj qaud f<'

 !* All others--ignore !
 f<

!CY!







>
>
>







 







>
>
>
>
>
>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
0ur

!* Dot !
.ud

!* endless loop for commands !
<

 !* advance undo versioning !
 :fu

 !* Read key into Qa, update and sleep if none available !
 ^tua qa+1"e 1w et-32et ^tua et#40et'

 !* Bump command counter !
 %e

................................................................................
 qd-."g .,qd:xk .,qdk | qd,.:xk qd,.k'
 .ud f<

!CX!
 !* ^X-char; get next char to complete command !
 ^tua qa+1"e 1w et-32et ^tua et#40et'

 !* ^X-u, undo !
 qa-^^u"e -1fu f<'

 !* ^X-r, redo !
 qa-^^r"e 1fu f<'

 !* ^X-^X, swap point and mark !
 qa-24"e .ua qdj qaud f<'

 !* All others--ignore !
 f<

!CY!

Changes to undo.c.

27
28
29
30
31
32
33
34
35
36
37
38
39
40


41
42
43
44
45
46
47
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
static unsigned int grpid;

/*
 * alloc_undo()
 *	Allocate a new "struct undo" entry
 */
static struct undo *
get_undo(int op)
{
    struct undo *u = (struct undo *)get_dcell();

    bzero(u, sizeof(struct undo));
    u->op = op;
    u->grpid = grpid;


    return(u);
}

/*
 * free_undo()
 *	Release undo header chain, along with any text storage
 */
................................................................................
 *	Add undo record for insertion of this much text
 */
void
undo_insert(int pos, int nchars)
{
    struct undo *u;

    u = get_undo(UNDO_INS);
    u->dot = pos;
    u->count = nchars;
    add_undo(u);
}

/*
 * undo_del()
 *	Add undo record for deletion of this text
 */
................................................................................
undo_del(int pos, int nchars)
{
    struct undo *u;
    struct buffcell *bc;
    struct qp src, dest;

    /* Our undo record */
    u = get_undo(UNDO_INS);
    u->dot = pos;
    u->count = nchars;

    /* Make a snapshot of the deleted chars */
    set_pointer(pos, &src);
    bc = dest.p = get_bcell();
    dest.c = 0;
    movenchars(&src, &dest, nchars);








|






>
>







 







|
<
<







 







|
<
<







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
...
157
158
159
160
161
162
163
164


165
166
167
168
169
170
171
...
173
174
175
176
177
178
179
180


181
182
183
184
185
186
187
static unsigned int grpid;

/*
 * alloc_undo()
 *	Allocate a new "struct undo" entry
 */
static struct undo *
get_undo(int op, int pos, int nchars)
{
    struct undo *u = (struct undo *)get_dcell();

    bzero(u, sizeof(struct undo));
    u->op = op;
    u->grpid = grpid;
    u->dot = pos;
    u->count = nchars;
    return(u);
}

/*
 * free_undo()
 *	Release undo header chain, along with any text storage
 */
................................................................................
 *	Add undo record for insertion of this much text
 */
void
undo_insert(int pos, int nchars)
{
    struct undo *u;

    u = get_undo(UNDO_INS, pos, nchars);


    add_undo(u);
}

/*
 * undo_del()
 *	Add undo record for deletion of this text
 */
................................................................................
undo_del(int pos, int nchars)
{
    struct undo *u;
    struct buffcell *bc;
    struct qp src, dest;

    /* Our undo record */
    u = get_undo(UNDO_DEL, pos, nchars);



    /* Make a snapshot of the deleted chars */
    set_pointer(pos, &src);
    bc = dest.p = get_bcell();
    dest.c = 0;
    movenchars(&src, &dest, nchars);