annotate 3rdparty/packages/uemacs/ueword.c @ 3054:22ddd48b4ec2

level1 krn: Fix scheduler bug that only affected 6309 The original 6809 binary was correct, but it was disassembled and interpreted wrongly, so that reassembly went wrong on 6309.
author Tormod Volden <debian.tormod@gmail.com>
date Sun, 25 Jan 2015 22:36:02 +0100
parents 48c646212b1c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
995
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
1 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
2 * The routines in this file implement commands that work word at a time.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
3 * There are all sorts of word mode commands. If I do any sentence and/or
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
4 * paragraph mode commands, they are likely to be put in this file.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
5 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
6
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
7 #include <stdio.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
8 #include "ueed.h"
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
9
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
10
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
11 /* Word wrap on n-spaces. Back-over whatever precedes the point on the current
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
12 * line and stop on the first word-break or the beginning of the line. If we
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
13 * reach the beginning of the line, jump back to the end of the word and start
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
14 * a new line. Otherwise, break the line at the word-break, eat it, and jump
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
15 * back to the end of the word.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
16 * NOTE: This function may leaving trailing blanks.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
17 * Returns TRUE on success, FALSE on errors.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
18 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
19 wrapword(n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
20 int n;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
21 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
22 register int cnt, oldp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
23 oldp = curwp->w_dotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
24 cnt = -1;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
25 do {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
26 cnt++;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
27 if (! backchar(NULL, 1))
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
28 return(FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
29 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
30 while (! inword());
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
31 if (! backword(NULL, 1))
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
32 return(FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
33 if (oldp == (int) (curwp->w_dotp && curwp->w_doto)) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
34 if (! backdel(NULL, 1))
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
35 return(FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
36 if (! newline(NULL, 1))
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
37 return(FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
38 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
39 return(forwword(NULL, 1) && forwchar(NULL, cnt));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
40 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
41
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
42 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
43 * Move the cursor backward by "n" words. All of the details of motion are
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
44 * performed by the "backchar" and "forwchar" routines. Error if you try to
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
45 * move beyond the buffers.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
46 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
47 backword(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
48 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
49 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
50 return (forwword(f, -n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
51 if (backchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
52 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
53 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
54 while (inword() == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
55 if (backchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
56 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
57 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
58 while (inword() != FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
59 if (backchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
60 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
61 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
62 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
63 return (forwchar(FALSE, 1));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
64 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
65
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
66 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
67 * Move the cursor forward by the specified number of words. All of the motion
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
68 * is done by "forwchar". Error if you try and move beyond the buffer's end.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
69 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
70 forwword(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
71 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
72 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
73 return (backword(f, -n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
74 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
75 while (inword() == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
76 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
77 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
78 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
79 while (inword() != FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
80 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
81 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
82 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
83 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
84 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
85 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
86
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
87 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
88 * Move the cursor forward by the specified number of words. As you move,
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
89 * convert any characters to upper case. Error if you try and move beyond the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
90 * end of the buffer. Bound to "M-U".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
91 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
92 upperword(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
93 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
94 register int c;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
95
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
96 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
97 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
98 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
99 while (inword() == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
100 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
101 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
102 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
103 while (inword() != FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
104 c = lgetc(curwp->w_dotp, curwp->w_doto);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
105 if (c>='a' && c<='z') {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
106 c -= 'a'-'A';
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
107 lputc(curwp->w_dotp, curwp->w_doto, c);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
108 lchange(WFHARD);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
109 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
110 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
111 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
112 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
113 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
114 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
115 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
116
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
117 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
118 * Move the cursor forward by the specified number of words. As you move
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
119 * convert characters to lower case. Error if you try and move over the end of
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
120 * the buffer. Bound to "M-L".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
121 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
122 lowerword(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
123 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
124 register int c;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
125
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
126 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
127 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
128 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
129 while (inword() == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
130 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
131 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
132 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
133 while (inword() != FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
134 c = lgetc(curwp->w_dotp, curwp->w_doto);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
135 if (c>='A' && c<='Z') {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
136 c += 'a'-'A';
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
137 lputc(curwp->w_dotp, curwp->w_doto, c);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
138 lchange(WFHARD);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
139 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
140 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
141 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
142 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
143 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
144 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
145 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
146
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
147 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
148 * Move the cursor forward by the specified number of words. As you move
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
149 * convert the first character of the word to upper case, and subsequent
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
150 * characters to lower case. Error if you try and move past the end of the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
151 * buffer. Bound to "M-C".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
152 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
153 capword(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
154 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
155 register int c;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
156
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
157 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
158 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
159 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
160 while (inword() == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
161 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
162 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
163 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
164 if (inword() != FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
165 c = lgetc(curwp->w_dotp, curwp->w_doto);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
166 if (c>='a' && c<='z') {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
167 c -= 'a'-'A';
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
168 lputc(curwp->w_dotp, curwp->w_doto, c);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
169 lchange(WFHARD);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
170 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
171 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
172 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
173 while (inword() != FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
174 c = lgetc(curwp->w_dotp, curwp->w_doto);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
175 if (c>='A' && c<='Z') {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
176 c += 'a'-'A';
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
177 lputc(curwp->w_dotp, curwp->w_doto, c);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
178 lchange(WFHARD);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
179 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
180 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
181 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
182 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
183 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
184 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
185 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
186 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
187
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
188 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
189 * Kill forward by "n" words. Remember the location of dot. Move forward by
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
190 * the right number of words. Put dot back where it was and issue the kill
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
191 * command for the right number of characters. Bound to "M-D".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
192 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
193 delfword(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
194 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
195 register int size;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
196 register LINE *dotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
197 register int doto;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
198
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
199 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
200 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
201 dotp = curwp->w_dotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
202 doto = curwp->w_doto;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
203 size = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
204 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
205 while (inword() == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
206 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
207 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
208 ++size;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
209 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
210 while (inword() != FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
211 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
212 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
213 ++size;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
214
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
215 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
216 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
217 curwp->w_dotp = dotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
218 curwp->w_doto = doto;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
219 return (ldelete(size, TRUE));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
220 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
221
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
222 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
223 * Kill backwards by "n" words. Move backwards by the desired number of words,
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
224 * counting the characters. When dot is finally moved to its resting place,
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
225 * fire off the kill command. Bound to "M-Rubout" and to "M-Backspace".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
226 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
227 delbword(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
228 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
229 register int size;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
230
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
231 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
232 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
233 if (backchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
234 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
235 size = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
236 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
237 while (inword() == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
238 if (backchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
239 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
240 ++size;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
241 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
242 while (inword() != FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
243 if (backchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
244 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
245 ++size;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
246 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
247 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
248 if (forwchar(FALSE, 1) == FALSE)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
249 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
250 return (ldelete(size, TRUE));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
251 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
252
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
253 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
254 * Return TRUE if the character at dot is a character that is considered to be
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
255 * part of a word. The word character list is hard coded. Should be setable.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
256 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
257 inword()
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
258 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
259 register int c;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
260
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
261 if (curwp->w_doto == llength(curwp->w_dotp))
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
262 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
263 c = lgetc(curwp->w_dotp, curwp->w_doto);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
264 if (c>='a' && c<='z')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
265 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
266 if (c>='A' && c<='Z')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
267 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
268 if (c>='0' && c<='9')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
269 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
270 if (c=='$' || c=='_') /* For identifiers */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
271 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
272 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
273 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
274