mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-22 18:31:44 +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
414 lines
12 KiB
C
414 lines
12 KiB
C
/* $Id: truecolor.c,v 1.2 1999/01/03 02:07:38 sybalsky Exp $ (C) Copyright Venue, All Rights
|
|
* Reserved */
|
|
static char *id = "$Id: truecolor.c,v 1.2 1999/01/03 02:07:38 sybalsky Exp $ Copyright (C) Venue";
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
|
/* Manufactured in the United States of America. */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
#include "version.h"
|
|
|
|
#include <stdio.h>
|
|
#include <sys/mman.h>
|
|
#include <pixrect/pixrect_hs.h>
|
|
|
|
#include "lispemul.h"
|
|
#include "lsptypes.h"
|
|
#include "lspglob.h"
|
|
#include "lispmap.h"
|
|
#include "adr68k.h"
|
|
#include "arith.h"
|
|
#include "devconf.h"
|
|
|
|
#include "picture.h"
|
|
|
|
#define FALSE 0
|
|
#define TRUE !FALSE
|
|
|
|
#define COLOR_INIT 0
|
|
#define COLOR_OVERLAYREGION 1
|
|
#define COLOR_VIDEOREGION 2
|
|
#define COLOR_VIDEOINIT 3
|
|
|
|
#define IntToFixp(C, Lisp) \
|
|
{ \
|
|
int *base; \
|
|
base = (int *)Addr68k_from_LADDR((unsigned int)Lisp); \
|
|
*base = C; \
|
|
}
|
|
|
|
extern int displaywidth, displayheight, DisplayRasterWidth;
|
|
extern int ScreenLocked;
|
|
extern DLword *EmCursorX68K, *EmCursorY68K;
|
|
extern Pixrect *TrueColorFb;
|
|
extern int FrameBufferFd;
|
|
extern int Inited_Video;
|
|
|
|
int Inited_TrueColor = NIL;
|
|
|
|
int TrueColor_Op(LispPTR *args)
|
|
{
|
|
int op, ret_value = NIL;
|
|
/*
|
|
N_GETNUMBER( args[0], op, bad_arg );
|
|
*/
|
|
op = (DLword)args[0];
|
|
|
|
switch (op) {
|
|
case COLOR_INIT: ret_value = TrueColor_Initialize(args[1]); break;
|
|
case COLOR_VIDEOINIT: ret_value = TrueColor_VideoInitialize(args[1]); break;
|
|
case COLOR_OVERLAYREGION: {
|
|
int left, top, bottom, width, height;
|
|
if (args[1] != NIL_PTR) {
|
|
LispPTR region, value;
|
|
int bottom;
|
|
/* get lisp region elements */
|
|
region = args[1];
|
|
value = car(region);
|
|
N_GETNUMBER(value, left, bad_arg);
|
|
region = cdr(region);
|
|
value = car(region);
|
|
N_GETNUMBER(value, bottom, bad_arg);
|
|
region = cdr(region);
|
|
value = car(region);
|
|
N_GETNUMBER(value, width, bad_arg);
|
|
region = cdr(region);
|
|
value = car(region);
|
|
N_GETNUMBER(value, height, bad_arg);
|
|
top = displayheight - (bottom + height);
|
|
if (args[2] == ATOM_T) {
|
|
Overlay_Region(left, top, width, height, TRUE);
|
|
} else {
|
|
Overlay_Region(left, top, width, height, FALSE);
|
|
} /* end if( args[2] ) */
|
|
ret_value = T;
|
|
} /* end if( arg[1] ) */
|
|
} /* end case */
|
|
break;
|
|
case COLOR_VIDEOREGION: {
|
|
int left, top, bottom, width, height;
|
|
if (args[1] != NIL_PTR) {
|
|
LispPTR region, value;
|
|
int bottom;
|
|
/* get lisp region elements */
|
|
region = args[1];
|
|
value = car(region);
|
|
N_GETNUMBER(value, left, bad_arg);
|
|
region = cdr(region);
|
|
value = car(region);
|
|
N_GETNUMBER(value, bottom, bad_arg);
|
|
region = cdr(region);
|
|
value = car(region);
|
|
N_GETNUMBER(value, width, bad_arg);
|
|
region = cdr(region);
|
|
value = car(region);
|
|
N_GETNUMBER(value, height, bad_arg);
|
|
top = displayheight - (bottom + height);
|
|
} else {
|
|
left = 0;
|
|
top = 0;
|
|
width = displaywidth;
|
|
height = displayheight;
|
|
} /* end if( arg[1] ) */
|
|
|
|
if (args[2] == NIL_PTR) { /* video region clear */
|
|
cgeight_video_region(left, top, width, height, FALSE);
|
|
} else { /* video region set */
|
|
cgeight_video_region(left, top, width, height, TRUE);
|
|
} /* end if( args[2] ) */
|
|
ret_value = T;
|
|
} /* end case */
|
|
break;
|
|
defaults:
|
|
break;
|
|
} /* end switch( op ) */
|
|
|
|
bad_arg:
|
|
return (ret_value);
|
|
|
|
} /* end TrueColor_Op */
|
|
|
|
extern int Inited_Color;
|
|
extern int DisplayType;
|
|
|
|
Pixrect *OverlayCursor, *OverlaySave;
|
|
DLword *OverlayRegion68k;
|
|
|
|
int TrueColor_Initialize(LispPTR overlay_bmbase)
|
|
{
|
|
unsigned int pict, *ret_value;
|
|
Pixrect *source;
|
|
int mmapstat, size;
|
|
|
|
if (Inited_Color) {
|
|
printf("cgeight_init_color_display: 8 bits color display has already initialized.\n");
|
|
} /* end if( Inited_Color ) */
|
|
|
|
if (Inited_TrueColor) {
|
|
printf("cgeight_init_color_display: 24 bits color display has already initialized.\n");
|
|
} /* end if( Inited_TrueColor ) */
|
|
|
|
if (DisplayType != SUNMEMCOLOR) {
|
|
error("cgeight_init_color_display: Unsupported FBreal_type %d\n", DisplayType);
|
|
} /* end if( DisplayType ) */
|
|
|
|
OverlayRegion68k = Addr68k_from_LADDR(overlay_bmbase);
|
|
size = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
|
|
|
|
ScreenLocked = T;
|
|
taking_mouse_down();
|
|
|
|
pict = (unsigned int)cgeight_init_color_display();
|
|
|
|
source = mem_point(displaywidth, displayheight, 1, OverlayRegion68k);
|
|
pr_set_plane_group(TrueColorFb, PIXPG_OVERLAY_ENABLE);
|
|
pr_rop(TrueColorFb, 0, 0, displaywidth, displayheight, PIX_SRC, source, 0, 0);
|
|
pr_set_plane_group(TrueColorFb, PIXPG_24BIT_COLOR);
|
|
|
|
mmapstat = (int)mmap(OverlayRegion68k, size, PROT_READ | PROT_WRITE,
|
|
#ifdef OS4
|
|
MAP_FIXED |
|
|
#endif
|
|
MAP_SHARED,
|
|
FrameBufferFd, 0x20000);
|
|
|
|
if (mmapstat == -1) {
|
|
perror("TrueColor_Initialize: ERROR at mmap system call\n");
|
|
exit(0);
|
|
} /* end if( mmapstat ) */
|
|
|
|
OverlayCursor = mem_create(16, 16, 32);
|
|
OverlaySave = mem_create(16, 16, 32);
|
|
|
|
Inited_TrueColor = TRUE;
|
|
|
|
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
|
|
overlay_mouse_up(*EmCursorX68K, *EmCursorY68K);
|
|
ScreenLocked = NIL;
|
|
|
|
ret_value = (unsigned int *)createcell68k(TYPE_FIXP);
|
|
*ret_value = pict;
|
|
return (LADDR_from_68k(ret_value));
|
|
|
|
} /* end TrueColor_Initialize */
|
|
|
|
DLword *VideoEnableRegion68k;
|
|
|
|
int TrueColor_VideoInitialize(LispPTR videoenable_bmbase)
|
|
{
|
|
Pixrect *source;
|
|
int mmapstat, size;
|
|
|
|
ScreenLocked = T;
|
|
|
|
clear_video_region();
|
|
Video_Initialize(FrameBufferFd);
|
|
|
|
VideoEnableRegion68k = Addr68k_from_LADDR(videoenable_bmbase);
|
|
size = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
|
|
|
|
source = mem_point(displaywidth, displayheight, 1, VideoEnableRegion68k);
|
|
pr_set_plane_group(TrueColorFb, PIXPG_VIDEO_ENABLE);
|
|
pr_rop(TrueColorFb, 0, 0, displaywidth, displayheight, PIX_SRC, source, 0, 0);
|
|
pr_set_plane_group(TrueColorFb, PIXPG_24BIT_COLOR);
|
|
|
|
mmapstat = (int)mmap(VideoEnableRegion68k, size, PROT_READ | PROT_WRITE,
|
|
#ifdef OS4
|
|
MAP_FIXED |
|
|
#endif
|
|
MAP_SHARED,
|
|
FrameBufferFd, 0x533000);
|
|
|
|
if (mmapstat == -1) {
|
|
perror("TrueColor_VideoInitialize: ERROR at mmap system call\n");
|
|
exit(0);
|
|
} /* end if( mmapstat ) */
|
|
|
|
ScreenLocked = NIL;
|
|
return (T);
|
|
|
|
} /* TrueColor_VideoInitialize */
|
|
|
|
int Overlay_Region(int left, int top, int width, int height, int flg)
|
|
{
|
|
ScreenLocked = T;
|
|
overlay_mouse_down();
|
|
|
|
cgeight_overlay_region(left, top, width, height, (flg ? FALSE : TRUE));
|
|
|
|
overlay_mouse_up(*EmCursorX68K, *EmCursorY68K);
|
|
ScreenLocked = NIL;
|
|
|
|
} /* end Overlay_Region */
|
|
|
|
#ifdef TRUECOLOR
|
|
#define TrackCursor(cx, cy) \
|
|
{ \
|
|
*CLastUserActionCell68k = MiscStats->secondstmp; \
|
|
overlay_mouse_down(); \
|
|
taking_mouse_down(); \
|
|
taking_mouse_up(cx, cy); \
|
|
overlay_mouse_up(cx, cy); \
|
|
*EmCursorX68K = cx; \
|
|
*EmCursorY68K = cy; \
|
|
}
|
|
#endif /* TRUECOLOR */
|
|
|
|
extern Pixrect *OverlaySave, *OverlayCursor;
|
|
|
|
void overlay_mouse_up(int newx, int newy)
|
|
{
|
|
pr_set_plane_group(TrueColorFb, PIXPG_OVERLAY_ENABLE);
|
|
pr_rop(TrueColorFb, newx, newy, 16, 16, PIX_SRC, OverlaySave, 0, 0);
|
|
pr_rop(TrueColorFb, 0, 0, 16, 16, PIX_SRC | PIX_DST, OverlayCursor, newx, newy);
|
|
pr_set_plane_group(TrueColorFb, PIXPG_24BIT_COLOR);
|
|
|
|
} /* end overlay_mouse_up */
|
|
|
|
extern int LastCursorX, LastCursorY;
|
|
|
|
void overlay_mouse_down() {
|
|
pr_set_plane_group(TrueColorFb, PIXPG_OVERLAY_ENABLE);
|
|
pr_rop(OverlaySave, 0, 0, 16, 16, PIX_SRC, TrueColorFb, LastCursorX, LastCursorY);
|
|
pr_set_plane_group(TrueColorFb, PIXPG_24BIT_COLOR);
|
|
|
|
} /* end overlay_mouse_down */
|
|
|
|
void truecolor_before_exit() {
|
|
if (Inited_TrueColor) {
|
|
{ /* fill region */
|
|
int h, w;
|
|
unsigned short *ptr;
|
|
ptr = (unsigned short *)OverlayRegion68k;
|
|
for (h = displayheight; (h--);) {
|
|
for (w = DisplayRasterWidth; (w--);) { *(ptr++) = ~0; } /* end for( w ) */
|
|
} /* end for( h ) */
|
|
}
|
|
|
|
pr_set_plane_group(TrueColorFb, PIXPG_24BIT_COLOR);
|
|
pr_rop(TrueColorFb, 0, 0, displaywidth, displayheight, PIX_SRC | PIX_COLOR(0xffffff), 0, 0, 0);
|
|
|
|
#ifdef VIDEO
|
|
if (Inited_Video) {
|
|
{ /* clear video enable region */
|
|
int h, w;
|
|
unsigned short *ptr;
|
|
ptr = (unsigned short *)VideoEnableRegion68k;
|
|
for (h = displayheight; (h--);) {
|
|
for (w = DisplayRasterWidth; (w--);) { *(ptr++) = 0xffff; } /* end for( w ) */
|
|
} /* end for( h ) */
|
|
}
|
|
|
|
Video_Close();
|
|
|
|
} /* end if( Inited_Video ) */
|
|
#endif /* VIDEO */
|
|
|
|
pr_close(TrueColorFb);
|
|
|
|
} /* end if( Inited_TrueColor ) */
|
|
|
|
} /* truecolor_before_exit */
|
|
|
|
char *valloc();
|
|
char *HideOverlayRegion;
|
|
#ifdef VIDEO
|
|
char *HideVideoEnableRegion;
|
|
extern int Video_OnOff_Flg;
|
|
static int video_onoff;
|
|
#endif /* VIDEO */
|
|
|
|
void truecolor_before_raid() {
|
|
int size;
|
|
|
|
if (Inited_TrueColor) {
|
|
size = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
|
|
|
|
if ((HideOverlayRegion = valloc(size)) == 0) {
|
|
printf("can't valloc hide space\n");
|
|
return (-1);
|
|
} /* end if( HideOverlayRegion ) */
|
|
|
|
copy_region(OverlayRegion68k, HideOverlayRegion, DisplayRasterWidth, displayheight);
|
|
|
|
{ /* fill region */
|
|
int h, w;
|
|
unsigned short *ptr;
|
|
ptr = (unsigned short *)OverlayRegion68k;
|
|
for (h = displayheight; (h--);) {
|
|
for (w = DisplayRasterWidth; (w--);) { *(ptr++) = 0xffff; } /* end for( w ) */
|
|
} /* end for( h ) */
|
|
}
|
|
} /* end if( Inited_TrueColor ) */
|
|
|
|
#ifdef VIDEO
|
|
if (Inited_Video) {
|
|
if ((video_onoff = Video_OnOff_Flg)) Video_OnOff(FALSE);
|
|
if ((HideVideoEnableRegion = valloc(size)) == 0) {
|
|
printf("can't valloc hide space\n");
|
|
return (-1);
|
|
} /* end if( HideVideoEnableRegion ) */
|
|
|
|
copy_region(VideoEnableRegion68k, HideVideoEnableRegion, DisplayRasterWidth, displayheight);
|
|
|
|
{ /* clear video enable region */
|
|
int h, w;
|
|
unsigned short *ptr;
|
|
ptr = (unsigned short *)VideoEnableRegion68k;
|
|
for (h = displayheight; (h--);) {
|
|
for (w = DisplayRasterWidth; (w--);) { *(ptr++) = 0xffff; } /* end for( w ) */
|
|
} /* end for( h ) */
|
|
}
|
|
} /* end if( Inited_Video ) */
|
|
#endif /* VIDEO */
|
|
|
|
} /* end truecolor_before_raid */
|
|
|
|
void truecolor_after_raid() {
|
|
int size, mmapstat;
|
|
|
|
if (Inited_TrueColor) {
|
|
size = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
|
|
|
|
mmapstat = (int)mmap(OverlayRegion68k, size, PROT_READ | PROT_WRITE,
|
|
#ifdef OS4
|
|
MAP_FIXED |
|
|
#endif
|
|
MAP_SHARED,
|
|
FrameBufferFd, 0x20000);
|
|
|
|
if (mmapstat == -1) {
|
|
perror("TrueColor_Initialize: ERROR at mmap system call\n");
|
|
exit(0);
|
|
} /* end if( mmapstat ) */
|
|
|
|
copy_region(HideOverlayRegion, OverlayRegion68k, DisplayRasterWidth, displayheight);
|
|
free(HideOverlayRegion);
|
|
} /* end if( Inited_TrueColor ) */
|
|
|
|
#ifdef VIDEO
|
|
if (Inited_Video) {
|
|
mmapstat = (int)mmap(VideoEnableRegion68k, size, PROT_READ | PROT_WRITE,
|
|
#ifdef OS4
|
|
MAP_FIXED |
|
|
#endif
|
|
MAP_SHARED,
|
|
FrameBufferFd, 0x533000);
|
|
|
|
if (mmapstat == -1) {
|
|
perror("TrueColor_VideoInitialize: ERROR at mmap system call\n");
|
|
exit(0);
|
|
} /* end if( mmapstat ) */
|
|
|
|
copy_region(HideVideoEnableRegion, VideoEnableRegion68k, DisplayRasterWidth, displayheight);
|
|
free(HideVideoEnableRegion);
|
|
if (video_onoff) Video_OnOff(TRUE);
|
|
|
|
} /* end if( Inited_Video ) */
|
|
#endif /* VIDEO */
|
|
|
|
} /* end truecolor_after_raid */
|