annotate 3rdparty/packages/uemacs/uedisplay3.c @ 3295:6b7a7b233925 default tip

makefile: Allow PORTS with level1/2 mix https://sourceforge.net/p/nitros9/feature-requests/10/
author Tormod Volden <debian.tormod@gmail.com>
date Tue, 19 Apr 2022 18:12:17 +0200
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 functions in this file handle redisplay. There are two halves, the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
3 * ones that update the virtual display screen, and the ones that make the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
4 * physical display screen the same as the virtual display screen. These
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
5 * functions use hints that are left in the windows by the commands.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
6 *
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
7 * REVISION HISTORY:
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
8 *
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
9 * ? Steve Wilhite, 1-Dec-85
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
10 * - massive cleanup on code.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
11 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
12
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
13 #include <stdio.h>
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
14 #include "ueed.h"
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
15 #include "uedisplay.h"
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
16
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
17 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
18 * Write a message into the message line. Keep track of the physical cursor
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
19 * position. A small class of printf like format items is handled.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
20 * This routine is probably one of the lease portable.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
21 * Assumes all arguments (with the possible exception of the first) are passed
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
22 * in the order expected on a downward growing stack without addtional
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
23 * padding; this assumption is made by the "++" in the
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
24 * argument scan loop. It works for the two or less argument case
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
25 * on OSK despite the fact the first two arguments are passed in registers.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
26 * Set the "message line" flag TRUE.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
27 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
28 mlwrite(fmt, arg)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
29 char *fmt;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
30 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
31 register int c;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
32 register char *ap;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
33
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
34 movecursor(term.t_nrow, 0);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
35 ap = (char *) &arg;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
36 while ((c = *fmt++) != 0) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
37 if (c != '%') {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
38 (*term.t_putchar)(c);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
39 ++ttcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
40 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
41 else
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
42 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
43 c = *fmt++;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
44 switch (c) {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
45 case 'd':
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
46 mlputi(*(int *)ap, 10);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
47 ap += sizeof(int);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
48 break;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
49
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
50 case 'o':
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
51 mlputi(*(int *)ap, 8);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
52 ap += sizeof(int);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
53 break;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
54
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
55 case 'x':
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
56 mlputi(*(int *)ap, 16);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
57 ap += sizeof(int);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
58 break;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
59
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
60 case 'D': /* this is %ld on many printf impleminations */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
61 mlputli(*(long *)ap, 10);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
62 ap += sizeof(long);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
63 break;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
64
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
65 case 's':
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
66 mlputs(*(char **)ap);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
67 ap += sizeof(char *);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
68 break;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
69
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
70 default:
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
71 (*term.t_putchar)(c);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
72 ++ttcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
73 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
74 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
75 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
76 (*term.t_eeol)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
77 (*term.t_flush)();
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
78 mpresf = 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 * Write out a string. Update the physical cursor position. This assumes that
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
83 * the characters in the string all have width "1"; if this is not the case
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
84 * things will get screwed up a little.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
85 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
86 mlputs(s)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
87 char *s;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
88 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
89 register int c;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
90
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
91 while ((c = *s++) != 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
92 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
93 (*term.t_putchar)(c);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
94 ++ttcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
95 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
96 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
97
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
98 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
99 * Write out an integer, in the specified radix. Update the physical cursor
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
100 * position. This will not handle any negative numbers; maybe it should.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
101 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
102 mlputi(i, r)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
103 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
104 register int q;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
105 static char hexdigits[] = "0123456789ABCDEF";
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
106
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
107 if (i < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
108 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
109 i = -i;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
110 (*term.t_putchar)('-');
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
111 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
112
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
113 q = i/r;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
114
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
115 if (q != 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
116 mlputi(q, r);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
117
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
118 (*term.t_putchar)(hexdigits[i%r]);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
119 ++ttcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
120 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
121
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
122 /*
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
123 * do the same except as a long integer.
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
124 */
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
125 mlputli(l, r)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
126 long l;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
127 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
128 register long q;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
129
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
130 if (l < 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
131 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
132 l = -l;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
133 (*term.t_putchar)('-');
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
134 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
135
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
136 q = l/r;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
137
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
138 if (q != 0)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
139 mlputli(q, r);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
140
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
141 (*term.t_putchar)((int)(l%r)+'0');
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
142 ++ttcol;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
143 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
144
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
145 #ifdef RAINBOW
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
146
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
147 putline(row, col, buf)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
148 int row, col;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
149 char buf[];
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
150 {
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
151 int n;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
152
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
153 n = strlen(buf);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
154 if (col + n - 1 > term.t_ncol)
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
155 n = term.t_ncol - col + 1;
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
156 Put_Data(row, col, n, buf);
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
157 }
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
158 #endif
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
159
48c646212b1c 'microEMACS' for OS-9.
roug
parents:
diff changeset
160