Lines Matching defs:edp
110 #define ARG(n) (edp->args[(n)])
112 #define COLS_LEFT (edp->ncols - edp->ccol - 1)
113 #define ROWS_LEFT (edp->nrows - edp->crow - 1)
119 struct wsemul_sun_emuldata *edp;
122 edp = &wsemul_sun_console_emuldata;
124 edp->emulops = type->textops;
125 edp->emulcookie = cookie;
126 edp->scrcapabilities = type->capabilities;
127 edp->nrows = type->nrows;
128 edp->ncols = type->ncols;
129 edp->crow = crow;
130 edp->ccol = ccol;
131 edp->curattr = edp->defattr = defattr;
147 res = (*edp->emulops->allocattr)(cookie,
150 &edp->kernattr);
152 res = (*edp->emulops->allocattr)(cookie, 0, 0,
154 &edp->kernattr);
159 edp->kernattr = defattr;
161 edp->cbcookie = NULL;
163 edp->state = SUN_EMUL_STATE_NORMAL;
164 edp->scrolldist = 1;
166 edp->console = 1;
168 return (edp);
175 struct wsemul_sun_emuldata *edp;
178 edp = &wsemul_sun_console_emuldata;
180 KASSERT(edp->console == 1);
183 edp = malloc(sizeof *edp, M_DEVBUF, M_WAITOK);
185 edp->emulops = type->textops;
186 edp->emulcookie = cookie;
187 edp->scrcapabilities = type->capabilities;
188 edp->nrows = type->nrows;
189 edp->ncols = type->ncols;
190 edp->crow = crow;
191 edp->ccol = ccol;
192 edp->defattr = defattr;
194 edp->state = SUN_EMUL_STATE_NORMAL;
195 edp->scrolldist = 1;
197 edp->console = 0;
201 edp->cbcookie = cbcookie;
203 if ((!(edp->scrcapabilities & WSSCREEN_REVERSE) ||
204 (*edp->emulops->allocattr)(edp->emulcookie, 0, 0,
206 &edp->bowattr)) &&
207 (!(edp->scrcapabilities & WSSCREEN_WSCOLORS) ||
208 (*edp->emulops->allocattr)(edp->emulcookie,
211 &edp->bowattr)))
212 edp->bowattr = edp->defattr;
214 edp->curattr = edp->defattr;
215 edp->rendflags = 0;
217 return (edp);
221 wsemul_sun_output_normal(struct wsemul_sun_emuldata *edp, u_char c, int kernel)
228 wsdisplay_emulbell(edp->cbcookie);
232 if (edp->ccol > 0)
233 edp->ccol--;
237 edp->ccol = 0;
241 n = uimin(8 - (edp->ccol & 7), COLS_LEFT);
242 (*edp->emulops->erasecols)(edp->emulcookie, edp->crow,
243 edp->ccol, n,
244 kernel ? edp->kernattr : edp->curattr);
245 edp->ccol += n;
249 (*edp->emulops->eraserows)(edp->emulcookie, 0, edp->nrows,
250 kernel ? edp->kernattr : edp->curattr);
252 edp->ccol = 0;
253 edp->crow = 0;
257 if (edp->crow > 0)
258 edp->crow--;
267 if (edp->state == SUN_EMUL_STATE_NORMAL) {
275 (*edp->emulops->putchar)(edp->emulcookie, edp->crow, edp->ccol,
276 c, kernel ? edp->kernattr : edp->curattr);
277 edp->ccol++;
280 if (edp->ccol < edp->ncols)
284 edp->ccol = 0;
290 if (edp->crow < edp->nrows - 1) {
291 edp->crow++;
299 if (edp->scrolldist == 0) {
300 edp->crow = 0;
301 (*edp->emulops->eraserows)(edp->emulcookie, 0, 1,
302 edp->curattr);
307 (*edp->emulops->copyrows)(edp->emulcookie, edp->scrolldist, 0,
308 edp->nrows - edp->scrolldist);
309 (*edp->emulops->eraserows)(edp->emulcookie,
310 edp->nrows - edp->scrolldist, edp->scrolldist,
311 edp->curattr);
312 edp->crow -= edp->scrolldist - 1;
320 wsemul_sun_output_haveesc(struct wsemul_sun_emuldata *edp, u_char c)
326 memset(edp->args, 0, sizeof (edp->args));
332 wsemul_sun_output_normal(edp, ASCII_ESC, 0); /* ??? */
333 newstate = wsemul_sun_output_normal(edp, c, 0);
341 wsemul_sun_control(struct wsemul_sun_emuldata *edp, u_char c)
348 src = edp->ccol;
349 dst = edp->ccol + n;
350 if (dst < edp->ncols) {
351 (*edp->emulops->copycols)(edp->emulcookie, edp->crow,
352 src, dst, edp->ncols - dst);
354 (*edp->emulops->erasecols)(edp->emulcookie, edp->crow,
355 src, dst - src, edp->curattr);
359 edp->crow -= uimin(NORMALIZE_ARG(0), edp->crow);
363 edp->ccol = 0;
366 edp->crow += uimin(NORMALIZE_ARG(0), ROWS_LEFT);
370 edp->ccol += uimin(NORMALIZE_ARG(0), COLS_LEFT);
374 edp->ccol -= uimin(NORMALIZE_ARG(0), edp->ccol);
379 edp->crow = uimin(NORMALIZE_ARG(1), edp->nrows) - 1;
380 edp->ccol = uimin(NORMALIZE_ARG(0), edp->ncols) - 1;
385 (*edp->emulops->eraserows)(edp->emulcookie,
386 edp->crow + 1, ROWS_LEFT, edp->curattr);
390 (*edp->emulops->erasecols)(edp->emulcookie, edp->crow,
391 edp->ccol, COLS_LEFT + 1, edp->curattr);
396 src = edp->crow;
397 dst = edp->crow + n;
398 if (dst < edp->nrows) {
399 (*edp->emulops->copyrows)(edp->emulcookie,
400 src, dst, edp->nrows - dst);
402 (*edp->emulops->eraserows)(edp->emulcookie,
403 src, dst - src, edp->curattr);
408 src = edp->crow + n;
409 dst = edp->crow;
410 if (src < edp->nrows) {
411 (*edp->emulops->copyrows)(edp->emulcookie,
412 src, dst, edp->nrows - src);
414 (*edp->emulops->eraserows)(edp->emulcookie,
415 dst + edp->nrows - src, src - dst, edp->curattr);
420 src = edp->ccol + n;
421 dst = edp->ccol;
422 if (src < edp->ncols) {
423 (*edp->emulops->copycols)(edp->emulcookie, edp->crow,
424 src, dst, edp->ncols - src);
426 (*edp->emulops->erasecols)(edp->emulcookie, edp->crow,
427 dst + edp->ncols - src, src - dst, edp->curattr);
432 edp->rendflags |= REND_SO;
434 edp->rendflags &= ~REND_SO;
438 edp->rendflags |= REND_BOW;
442 edp->rendflags &= ~REND_BOW;
446 edp->scrolldist = uimin(ARG(0), edp->nrows);
450 edp->scrolldist = 1;
451 edp->rendflags = 0;
453 if (((edp->rendflags & REND_BOW) != 0) ^
454 ((edp->rendflags & REND_SO) != 0))
455 edp->curattr = edp->bowattr;
457 edp->curattr = edp->defattr;
463 wsemul_sun_output_control(struct wsemul_sun_emuldata *edp, u_char c)
471 edp->args[0] = (edp->args[0] * 10) + (c - '0');
476 edp->args[i] = edp->args[i - 1];
477 edp->args[0] = 0;
481 wsemul_sun_control(edp, c);
491 struct wsemul_sun_emuldata *edp = cookie;
495 if (kernel && !edp->console)
500 (*edp->emulops->cursor)(edp->emulcookie, 0, edp->crow, edp->ccol);
503 wsemul_sun_output_normal(edp, *data, 1);
506 switch (edp->state) {
509 newstate = wsemul_sun_output_normal(edp, *data, 0);
512 newstate = wsemul_sun_output_haveesc(edp, *data);
515 newstate = wsemul_sun_output_control(edp, *data);
519 panic("wsemul_sun: invalid state %d", edp->state);
522 newstate = wsemul_sun_output_normal(edp, *data, 0);
525 edp->state = newstate;
528 (*edp->emulops->cursor)(edp->emulcookie, 1, edp->crow, edp->ccol);
619 struct wsemul_sun_emuldata *edp = cookie;
621 edp->crow;
622 *ccolp = edp->ccol;
623 if (edp != &wsemul_sun_console_emuldata)
624 free(edp, M_DEVBUF);
630 struct wsemul_sun_emuldata *edp = cookie;
634 edp->state = SUN_EMUL_STATE_NORMAL;
635 edp->scrolldist = 1;
636 edp->rendflags = 0;
637 edp->curattr = edp->defattr;
640 (*edp->emulops->eraserows)(edp->emulcookie, 0, edp->nrows,
641 edp->defattr);
642 edp->ccol = edp->crow = 0;
643 (*edp->emulops->cursor)(edp->emulcookie, 1, 0, 0);