mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-21 18:05:33 +00:00
This also involves removing unnecessary forward declarations, inserting
includes for all cross-file function references, making some definitions
static if they are not otherwise used, correcting errors that were exposed
by having correct prototypes.
new file: inc/allocmdsdefs.h
new file: inc/arith2defs.h
new file: inc/arith3defs.h
new file: inc/arith4defs.h
new file: inc/array2defs.h
new file: inc/array3defs.h
new file: inc/array4defs.h
new file: inc/array5defs.h
new file: inc/array6defs.h
new file: inc/arraydefs.h
new file: inc/bbtsubdefs.h
new file: inc/bindefs.h
new file: inc/bindsdefs.h
new file: inc/bitbltdefs.h
new file: inc/bltdefs.h
new file: inc/byteswapdefs.h
new file: inc/car-cdrdefs.h
new file: inc/chardevdefs.h
new file: inc/commondefs.h
new file: inc/conspagedefs.h
new file: inc/dbgtooldefs.h
new file: inc/dirdefs.h
new file: inc/drawdefs.h
new file: inc/dskdefs.h
new file: inc/dspifdefs.h
new file: inc/dspsubrsdefs.h
new file: inc/eqfdefs.h
new file: inc/etherdefs.h
new file: inc/findkeydefs.h
new file: inc/fpdefs.h
new file: inc/fvardefs.h
new file: inc/gc2defs.h
new file: inc/gcarraydefs.h
new file: inc/gccodedefs.h
new file: inc/gcdefs.h
new file: inc/gcfinaldefs.h
new file: inc/gchtfinddefs.h
new file: inc/gcmain3defs.h
new file: inc/gcoflowdefs.h
new file: inc/gcrcelldefs.h
new file: inc/gcrdefs.h
new file: inc/gcscandefs.h
new file: inc/gvar2defs.h
new file: inc/hacksdefs.h
new file: inc/hardrtndefs.h
new file: inc/inetdefs.h
new file: inc/initdspdefs.h
new file: inc/initkbddefs.h
new file: inc/initsoutdefs.h
modified: inc/inlineC.h
new file: inc/intcalldefs.h
new file: inc/kbdsubrsdefs.h
new file: inc/keyeventdefs.h
new file: inc/keylibdefs.h
new file: inc/kprintdefs.h
new file: inc/ldsoutdefs.h
new file: inc/lineblt8defs.h
new file: inc/lisp2cdefs.h
modified: inc/lispemul.h
new file: inc/llcolordefs.h
new file: inc/llstkdefs.h
modified: inc/lnk-inlineC.h
new file: inc/loopsopsdefs.h
new file: inc/lowlev1defs.h
new file: inc/lowlev2defs.h
new file: inc/lsthandldefs.h
new file: inc/maindefs.h
new file: inc/misc7defs.h
new file: inc/miscndefs.h
new file: inc/mkatomdefs.h
new file: inc/mkcelldefs.h
new file: inc/mvsdefs.h
new file: inc/osmsgdefs.h
new file: inc/perrnodefs.h
new file: inc/returndefs.h
new file: inc/rpcdefs.h
new file: inc/rplconsdefs.h
new file: inc/shiftdefs.h
new file: inc/storagedefs.h
new file: inc/subr0374defs.h
new file: inc/subrdefs.h
new file: inc/sxhashdefs.h
new file: inc/testtooldefs.h
new file: inc/timerdefs.h
new file: inc/typeofdefs.h
new file: inc/ubf1defs.h
new file: inc/ubf2defs.h
new file: inc/ubf3defs.h
new file: inc/ufsdefs.h
new file: inc/unixcommdefs.h
new file: inc/unwinddefs.h
new file: inc/uraiddefs.h
new file: inc/usrsubrdefs.h
new file: inc/uutilsdefs.h
new file: inc/vars3defs.h
new file: inc/vmemsavedefs.h
new file: inc/xbbtdefs.h
new file: inc/xcdefs.h
new file: inc/xcursordefs.h
new file: inc/xinitdefs.h
new file: inc/xlspwindefs.h
new file: inc/xmkicondefs.h
new file: inc/xrdoptdefs.h
new file: inc/xscrolldefs.h
new file: inc/xwinmandefs.h
new file: inc/z2defs.h
modified: src/allocmds.c
modified: src/arith2.c
modified: src/arith3.c
modified: src/arith4.c
modified: src/array.c
modified: src/array2.c
modified: src/array3.c
modified: src/array4.c
modified: src/array5.c
modified: src/array6.c
modified: src/bbtsub.c
modified: src/bin.c
modified: src/binds.c
modified: src/bitblt.c
modified: src/blt.c
modified: src/byteswap.c
modified: src/car-cdr.c
modified: src/chardev.c
modified: src/common.c
modified: src/conspage.c
modified: src/dbgtool.c
modified: src/dir.c
modified: src/draw.c
modified: src/dsk.c
modified: src/dspif.c
modified: src/dspsubrs.c
modified: src/eqf.c
modified: src/ether.c
modified: src/findkey.c
modified: src/foreign.c
modified: src/fp.c
modified: src/fvar.c
modified: src/gc.c
modified: src/gc2.c
modified: src/gcarray.c
modified: src/gccode.c
modified: src/gcfinal.c
modified: src/gchtfind.c
modified: src/gcmain3.c
modified: src/gcoflow.c
modified: src/gcr.c
modified: src/gcrcell.c
modified: src/gcscan.c
modified: src/gvar2.c
modified: src/hacks.c
modified: src/hardrtn.c
modified: src/inet.c
modified: src/initdsp.c
modified: src/initkbd.c
modified: src/initsout.c
modified: src/intcall.c
modified: src/kbdsubrs.c
modified: src/keyevent.c
modified: src/keylib.c
modified: src/kprint.c
modified: src/ldsout.c
modified: src/lineblt8.c
modified: src/lisp2c.c
modified: src/llcolor.c
modified: src/llstk.c
modified: src/loopsops.c
modified: src/lowlev1.c
modified: src/lowlev2.c
modified: src/lsthandl.c
modified: src/main.c
modified: src/misc7.c
modified: src/miscn.c
modified: src/mkatom.c
modified: src/mkcell.c
modified: src/mvs.c
modified: src/osmsg.c
modified: src/perrno.c
modified: src/return.c
modified: src/rpc.c
modified: src/rplcons.c
modified: src/setsout.c
modified: src/shift.c
modified: src/storage.c
modified: src/subr.c
modified: src/subr0374.c
modified: src/sxhash.c
modified: src/testtool.c
modified: src/timer.c
modified: src/truecolor.c
modified: src/tstsout.c
modified: src/typeof.c
modified: src/ubf1.c
modified: src/ubf2.c
modified: src/ubf3.c
modified: src/ufn.c
modified: src/ufs.c
modified: src/unixcomm.c
modified: src/unwind.c
modified: src/uraid.c
modified: src/usrsubr.c
modified: src/uutils.c
modified: src/vars3.c
modified: src/vmemsave.c
modified: src/xbbt.c
modified: src/xc.c
modified: src/xcursor.c
modified: src/xinit.c
modified: src/xlspwin.c
modified: src/xmkicon.c
modified: src/xrdopt.c
modified: src/xscroll.c
modified: src/xwinman.c
modified: src/z2.c
196 lines
10 KiB
C
196 lines
10 KiB
C
/* $Id: lineblt8.c,v 1.3 1999/05/31 23:35:37 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
|
|
*/
|
|
static char *id = "$Id: lineblt8.c,v 1.3 1999/05/31 23:35:37 sybalsky Exp $ Copyright (C) Venue";
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
|
/* Manufactured in the United States of America. */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
#include "version.h"
|
|
|
|
#include <sys/types.h>
|
|
#include "lispemul.h"
|
|
#include "lineblt8defs.h"
|
|
#include "commondefs.h"
|
|
|
|
#ifdef ISC
|
|
#include <sys/bsdtypes.h>
|
|
#endif /* ISC */
|
|
|
|
#define COLOR8ARRAYSIZE 16
|
|
#define BITSPERNIBBLE 4
|
|
#define BITSPERDLWORD 16
|
|
|
|
DLword BitMaskArray[] = {32768, 16384, 8192, 4096, 2048, 1024, 512, 256,
|
|
128, 64, 32, 16, 8, 4, 2, 1};
|
|
unsigned int ConvBM_tbl[] = {0, 0xff, 0xff00, 0xffff, 0xff0000, 0xff00ff,
|
|
0xffff00, 0xffffff, 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
|
|
0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff};
|
|
unsigned int BMask_tbl[] = {0xf, 7, 3, 1};
|
|
|
|
#define noop 1
|
|
|
|
/***************************************************************
|
|
Macro:WriteLongW
|
|
**************************************************************/
|
|
#define WriteLongW(srcpattern, destptr, op1, op2) \
|
|
{ \
|
|
register int cnt; \
|
|
register u_char *des, *src; \
|
|
for (cnt = 0, des = (u_char *)destptr, src = (u_char *)(&(srcpattern)); cnt < 4; \
|
|
cnt++, des++, src++) \
|
|
(*des) op1(*src); \
|
|
}
|
|
|
|
/***************************************************************
|
|
Macro:LineBLT8
|
|
srcWptr : DLword ptr
|
|
offset : Bits offset
|
|
width : Bits width to copy
|
|
dstLptr : Destination's LispPTR ptr
|
|
op1,op2 : operations in C(=,|=,^=,&=,^)
|
|
ERASE only uses op2
|
|
**************************************************************/
|
|
/* srcw points DLword which contains the nibble processed now */
|
|
/* offset indicates MSB in the nibble */
|
|
/* width:before copy,make sure the nibble is inside source bitmap */
|
|
/* width:after copy,decremented by BITSPERNIBBLE.
|
|
therefore,width indictes the rest bits in source bitmap */
|
|
|
|
#define LineBLT8(srcWptr, offset, width, dstLptr, op1, op2) \
|
|
{ \
|
|
register DLword *srcw; \
|
|
register u_int temp1; \
|
|
for (srcw = (srcWptr) + (offset) / BITSPERDLWORD; ((width)-BITSPERNIBBLE) >= 0; \
|
|
(width) -= BITSPERNIBBLE, (dstLptr) = (u_char *)((u_int *)(dstLptr) + 1), \
|
|
(offset) += BITSPERNIBBLE) { \
|
|
switch ((offset) % 16) { \
|
|
case 0: WriteLongW(color_array[(*srcw) >> 12], dstLptr, op1, op2); break; \
|
|
case 1: WriteLongW(color_array[(*srcw & 0x7800) >> 11], dstLptr, op1, op2); break; \
|
|
case 2: WriteLongW(color_array[(*srcw & 0x3c00) >> 10], dstLptr, op1, op2); break; \
|
|
case 3: WriteLongW(color_array[(*srcw & 0x1e00) >> 9], dstLptr, op1, op2); break; \
|
|
case 4: WriteLongW(color_array[(*srcw & 0x0f00) >> 8], dstLptr, op1, op2); break; \
|
|
case 5: WriteLongW(color_array[(*srcw & 0x0780) >> 7], dstLptr, op1, op2); break; \
|
|
case 6: WriteLongW(color_array[(*srcw & 0x03c0) >> 6], dstLptr, op1, op2); break; \
|
|
case 7: WriteLongW(color_array[(*srcw & 0x01e0) >> 5], dstLptr, op1, op2); break; \
|
|
case 8: WriteLongW(color_array[(*srcw & 0x00f0) >> 4], dstLptr, op1, op2); break; \
|
|
case 9: WriteLongW(color_array[(*srcw & 0x0078) >> 3], dstLptr, op1, op2); break; \
|
|
case 10: WriteLongW(color_array[(*srcw & 0x003c) >> 2], dstLptr, op1, op2); break; \
|
|
case 11: WriteLongW(color_array[(*srcw & 0x001e) >> 1], dstLptr, op1, op2); break; \
|
|
case 12: \
|
|
WriteLongW(color_array[*srcw & 0xf], dstLptr, op1, op2); \
|
|
srcw++; /* move srcw pointer */ \
|
|
break; \
|
|
case 13: \
|
|
temp1 = (*srcw & 7) << 1; \
|
|
temp1 |= ((*(++srcw)) & 0x8000) >> 15; /** Compiler's BUG?*/ \
|
|
WriteLongW(color_array[temp1], dstLptr, op1, op2); \
|
|
break; \
|
|
case 14: \
|
|
temp1 = ((*srcw & 3) << 2); \
|
|
temp1 |= ((*(++srcw) & 0xc000) >> 14); \
|
|
WriteLongW(color_array[temp1], dstLptr, op1, op2); \
|
|
break; \
|
|
case 15: \
|
|
temp1 = ((*srcw & 1) << 3); \
|
|
temp1 |= ((*(++srcw) & 0xe000) >> 13); \
|
|
WriteLongW(color_array[temp1], dstLptr, op1, op2); \
|
|
break; \
|
|
} /* switch end */ \
|
|
} /* for end */ \
|
|
/* process for the rest bits (0~3)*/ \
|
|
switch (width) { \
|
|
register u_char *destc; \
|
|
register int mod; \
|
|
case 0: /* already finished */ break; \
|
|
case 1: \
|
|
case 2: \
|
|
case 3: \
|
|
destc = (u_char *)dstLptr; \
|
|
while (width--) { \
|
|
if (BitMaskArray[mod = (offset % 16)] & *srcw) \
|
|
(*destc++) op1(color1); \
|
|
else \
|
|
(*destc++) op1(color0); \
|
|
if (mod == 15) srcw++; \
|
|
offset++; \
|
|
} /* WHILE END */ \
|
|
break; \
|
|
default:; /* error */ \
|
|
} /* switch end */ \
|
|
} /* MACRO END */
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* l i n e b l t 8 */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
/* destination is always ColorFontCache's line */
|
|
|
|
/* I don't care sourcetype & operation NOW */
|
|
|
|
void lineBlt8(DLword *srcbase, register int offset, register u_char *destl, register int width,
|
|
u_char color0, u_char color1, LispPTR sourcetype, LispPTR operation)
|
|
|
|
/* register u_int *destl;*/
|
|
/* for SPARC */
|
|
|
|
/* Background color */
|
|
/* foreground color */
|
|
|
|
/*operation type PAINT,REPLACE or INVERT */
|
|
|
|
{
|
|
static unsigned char beforecolor0 = 0;
|
|
static unsigned char beforecolor1 = 0;
|
|
static int color_array[COLOR8ARRAYSIZE];
|
|
|
|
extern DLword REPLACE_atom;
|
|
extern DLword INPUT_atom;
|
|
extern DLword INVERT_atom;
|
|
extern DLword PAINT_atom;
|
|
extern DLword ERASE_atom;
|
|
|
|
DLword *baseword; /* Assume dest word always quad aligned */
|
|
|
|
if (sourcetype == INVERT_atom) {
|
|
register int tempcol;
|
|
tempcol = color0;
|
|
color0 = color1;
|
|
color1 = tempcol;
|
|
}
|
|
if ((beforecolor0 != color0) || (beforecolor1 != color1)) {
|
|
/* making color-mapped array */
|
|
register int i;
|
|
register u_int longcol0, longcol1;
|
|
|
|
beforecolor0 = color0;
|
|
beforecolor1 = color1;
|
|
longcol0 = (color0 << 24) | (color0 << 16) | (color0 << 8) | color0;
|
|
longcol1 = (color1 << 24) | (color1 << 16) | (color1 << 8) | color1;
|
|
|
|
for (i = 0; i < COLOR8ARRAYSIZE; i++) {
|
|
color_array[i] = ConvBM_tbl[i] & longcol1;
|
|
color_array[i] |= (~(ConvBM_tbl[i])) & longcol0;
|
|
}
|
|
} /* otherwise previous colors are same as current one. use cached one */
|
|
|
|
if (operation == REPLACE_atom) {
|
|
LineBLT8(srcbase, offset, width, destl, =, noop);
|
|
} else if (operation == INVERT_atom) {
|
|
LineBLT8(srcbase, offset, width, destl, ^=, noop);
|
|
} else if (operation == PAINT_atom) {
|
|
LineBLT8(srcbase, offset, width, destl, |=, noop);
|
|
} else if (operation == ERASE_atom) { /*erase */
|
|
LineBLT8(srcbase, offset, width, destl, &= ~, noop);
|
|
} else
|
|
error("lineBlt8:Illegal operation specified");
|
|
}
|
|
/* lineBlt8 end */
|