annotate 3rdparty/packages/uemacs/uebasic.c @ 1734:b992196e2ac9

Dragon updates by Phill
author boisy
date Sat, 27 Nov 2004 15:24:02 +0000
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 move the cursor around on the screen. They
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
3 * compute a new value for the cursor, then adjust ".". The display code
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
4 * always updates the cursor location, so only moves between lines, or
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
5 * functions that adjust the top line in the window and invalidate the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
6 * framing, are hard.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
7 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
8 #include <stdio.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
9 #include "ueed.h"
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
10
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
11 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
12 * Move the cursor to the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
13 * beginning of the current line.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
14 * Trivial.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
15 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
16 gotobol(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
17 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
18 curwp->w_doto = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
19 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
20 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
21
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
22 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
23 * Move the cursor backwards by "n" characters. If "n" is less than zero call
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
24 * "forwchar" to actually do the move. Otherwise compute the new cursor
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
25 * location. Error if you try and move out of the buffer. Set the flag if the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
26 * line pointer for dot changes.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
27 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
28 backchar(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
29 register int n;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
30 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
31 register LINE *lp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
32
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
33 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
34 return (forwchar(f, -n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
35 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
36 if (curwp->w_doto == 0) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
37 if ((lp=lback(curwp->w_dotp)) == curbp->b_linep)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
38 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
39 curwp->w_dotp = lp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
40 curwp->w_doto = llength(lp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
41 curwp->w_flag |= WFMOVE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
42 } else
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
43 curwp->w_doto--;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
44 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
45 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
46 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
47
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
48 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
49 * Move the cursor to the end of the current line. Trivial. No errors.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
50 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
51 gotoeol(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
52 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
53 curwp->w_doto = llength(curwp->w_dotp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
54 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
55 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
56
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
57 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
58 * Move the cursor forwwards by "n" characters. If "n" is less than zero call
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
59 * "backchar" to actually do the move. Otherwise compute the new cursor
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
60 * location, and move ".". Error if you try and move off the end of the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
61 * buffer. Set the flag if the line pointer for dot changes.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
62 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
63 forwchar(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
64 register int n;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
65 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
66 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
67 return (backchar(f, -n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
68 while (n--) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
69 if (curwp->w_doto == llength(curwp->w_dotp)) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
70 if (curwp->w_dotp == curbp->b_linep)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
71 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
72 curwp->w_dotp = lforw(curwp->w_dotp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
73 curwp->w_doto = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
74 curwp->w_flag |= WFMOVE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
75 } else
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
76 curwp->w_doto++;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
77 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
78 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
79 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
80
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
81 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
82 * Goto the beginning of the buffer. Massive adjustment of dot. This is
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
83 * considered to be hard motion; it really isn't if the original value of dot
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
84 * is the same as the new value of dot. Normally bound to "M-<".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
85 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
86 gotobob(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
87 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
88 curwp->w_dotp = lforw(curbp->b_linep);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
89 curwp->w_doto = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
90 curwp->w_flag |= WFHARD;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
91 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
92 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
93
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
94 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
95 * Move to the end of the buffer. Dot is always put at the end of the file
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
96 * (ZJ). The standard screen code does most of the hard parts of update.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
97 * Bound to "M->".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
98 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
99 gotoeob(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
100 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
101 curwp->w_dotp = curbp->b_linep;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
102 curwp->w_doto = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
103 curwp->w_flag |= WFHARD;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
104 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
105 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
106
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
107 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
108 * Move forward by full lines. If the number of lines to move is less than
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
109 * zero, call the backward line function to actually do it. The last command
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
110 * controls how the goal column is set. Bound to "C-N". No errors are
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
111 * possible.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
112 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
113 forwline(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
114 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
115 register LINE *dlp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
116
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
117 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
118 return (backline(f, -n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
119 if ((lastflag&CFCPCN) == 0) /* Reset goal if last */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
120 curgoal = curcol; /* not C-P or C-N */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
121 thisflag |= CFCPCN;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
122 dlp = curwp->w_dotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
123 while (n-- && dlp!=curbp->b_linep)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
124 dlp = lforw(dlp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
125 curwp->w_dotp = dlp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
126 curwp->w_doto = getgoal(dlp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
127 curwp->w_flag |= WFMOVE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
128 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
129 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
130
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
131 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
132 * This function is like "forwline", but goes backwards. The scheme is exactly
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
133 * the same. Check for arguments that are less than zero and call your
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
134 * alternate. Figure out the new line and call "movedot" to perform the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
135 * motion. No errors are possible. Bound to "C-P".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
136 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
137 backline(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
138 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
139 register LINE *dlp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
140
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
141 if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
142 return (forwline(f, -n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
143 if ((lastflag&CFCPCN) == 0) /* Reset goal if the */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
144 curgoal = curcol; /* last isn't C-P, C-N */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
145 thisflag |= CFCPCN;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
146 dlp = curwp->w_dotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
147 while (n-- && lback(dlp)!=curbp->b_linep)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
148 dlp = lback(dlp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
149 curwp->w_dotp = dlp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
150 curwp->w_doto = getgoal(dlp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
151 curwp->w_flag |= WFMOVE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
152 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
153 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
154
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
155 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
156 * This routine, given a pointer to a LINE, and the current cursor goal
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
157 * column, return the best choice for the offset. The offset is returned.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
158 * Used by "C-N" and "C-P".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
159 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
160 getgoal(dlp)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
161 register LINE *dlp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
162 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
163 register int c;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
164 register int col;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
165 register int newcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
166 register int dbo;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
167
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
168 col = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
169 dbo = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
170 while (dbo != llength(dlp)) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
171 c = lgetc(dlp, dbo);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
172 newcol = col;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
173 if (c == '\t')
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
174 newcol |= 0x07;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
175 else if (c<0x20 || c==0x7F)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
176 ++newcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
177 ++newcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
178 if (newcol > curgoal)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
179 break;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
180 col = newcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
181 ++dbo;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
182 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
183 return (dbo);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
184 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
185
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
186 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
187 * Scroll forward by a specified number of lines, or by a full page if no
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
188 * argument. Bound to "C-V". The "2" in the arithmetic on the window size is
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
189 * the overlap; this value is the default overlap value in ITS EMACS. Because
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
190 * this zaps the top line in the display window, we have to do a hard update.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
191 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
192 forwpage(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
193 register int n;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
194 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
195 register LINE *lp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
196
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
197 if (f == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
198 n = curwp->w_ntrows - 2; /* Default scroll. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
199 if (n <= 0) /* Forget the overlap */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
200 n = 1; /* if tiny window. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
201 } else if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
202 return (backpage(f, -n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
203 #ifdef CVMVAS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
204 else /* Convert from pages */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
205 n *= curwp->w_ntrows; /* to lines. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
206 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
207 lp = curwp->w_linep;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
208 while (n-- && lp!=curbp->b_linep)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
209 lp = lforw(lp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
210 curwp->w_linep = lp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
211 curwp->w_dotp = lp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
212 curwp->w_doto = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
213 curwp->w_flag |= WFHARD;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
214 return (TRUE);
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 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
218 * This command is like "forwpage", but it goes backwards. The "2", like
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
219 * above, is the overlap between the two windows. The value is from the ITS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
220 * EMACS manual. Bound to "M-V". We do a hard update for exactly the same
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
221 * reason.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
222 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
223 backpage(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
224 register int n;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
225 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
226 register LINE *lp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
227
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
228 if (f == FALSE) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
229 n = curwp->w_ntrows - 2; /* Default scroll. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
230 if (n <= 0) /* Don't blow up if the */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
231 n = 1; /* window is tiny. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
232 } else if (n < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
233 return (forwpage(f, -n));
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
234 #ifdef CVMVAS
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
235 else /* Convert from pages */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
236 n *= curwp->w_ntrows; /* to lines. */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
237 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
238 lp = curwp->w_linep;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
239 while (n-- && lback(lp)!=curbp->b_linep)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
240 lp = lback(lp);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
241 curwp->w_linep = lp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
242 curwp->w_dotp = lp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
243 curwp->w_doto = 0;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
244 curwp->w_flag |= WFHARD;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
245 return (TRUE);
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 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
249 * Set the mark in the current window to the value of "." in the window. No
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
250 * errors are possible. Bound to "M-.".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
251 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
252 setmark(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
253 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
254 curwp->w_markp = curwp->w_dotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
255 curwp->w_marko = curwp->w_doto;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
256 mlwrite("[Mark set]");
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
257 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
258 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
259
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
260 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
261 * Swap the values of "." and "mark" in the current window. This is pretty
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
262 * easy, bacause all of the hard work gets done by the standard routine
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
263 * that moves the mark about. The only possible error is "no mark". Bound to
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
264 * "C-X C-X".
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
265 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
266 swapmark(f, n)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
267 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
268 register LINE *odotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
269 register int odoto;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
270
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
271 if (curwp->w_markp == NULL) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
272 mlwrite("No mark in this window");
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
273 return (FALSE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
274 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
275 odotp = curwp->w_dotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
276 odoto = curwp->w_doto;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
277 curwp->w_dotp = curwp->w_markp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
278 curwp->w_doto = curwp->w_marko;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
279 curwp->w_markp = odotp;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
280 curwp->w_marko = odoto;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
281 curwp->w_flag |= WFMOVE;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
282 return (TRUE);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
283 }