mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-18 00:52: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
304 lines
8.6 KiB
C
304 lines
8.6 KiB
C
/* $Id: llcolor.c,v 1.2 1999/01/03 02:07:15 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
|
|
*/
|
|
static char *id = "$Id: llcolor.c,v 1.2 1999/01/03 02:07:15 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>
|
|
|
|
#ifndef NOPIXRECT
|
|
#include <sunwindow/window_hs.h>
|
|
#include <sunwindow/cms.h>
|
|
#include <sunwindow/win_ioctl.h>
|
|
#include <pixrect/pixrect_hs.h>
|
|
#include <sun/fbio.h>
|
|
#include <pixrect/pr_planegroups.h>
|
|
#include <sys/mman.h>
|
|
#endif /* NOPIXRECT */
|
|
|
|
#include <sys/ioctl.h>
|
|
#include <sys/types.h>
|
|
#include <sys/file.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include "lispemul.h"
|
|
#include "lispmap.h"
|
|
#include "lsptypes.h"
|
|
#include "address.h"
|
|
#include "adr68k.h"
|
|
#include "lspglob.h"
|
|
#include "emlglob.h"
|
|
#include "display.h"
|
|
#include "devconf.h"
|
|
|
|
#include "bb.h"
|
|
#include "bitblt.h"
|
|
#include "pilotbbt.h"
|
|
#include "dbprint.h"
|
|
|
|
#include "llcolordefs.h"
|
|
|
|
int MonoOrColor = MONO_SCREEN;
|
|
DLword *ColorDisplayRegion68k;
|
|
int Dispcolorsize;
|
|
int Inited_Color = NIL;
|
|
extern struct pixrect *ColorDisplayPixrect;
|
|
extern int displaywidth, displayheight, FrameBufferFd;
|
|
|
|
/*******************************************************************/
|
|
/* Func name : cgfour_init_color_display(args)
|
|
Arg(s) : COLOR BITMAP ADDRESS(LISPPTR)
|
|
Desc : Assign to SUBR 0210
|
|
mmap LispPTR to Color Display FB.
|
|
By Takeshi
|
|
*/
|
|
/*******************************************************************/
|
|
#ifdef COLOR
|
|
LispPTR cgfour_init_color_display(LispPTR color_bitmapbase) /* SUBR 0210 */ /* COLOR BITMAP ADDRESS */
|
|
{
|
|
struct pixrect *ColorFb;
|
|
struct pixrect *color_source;
|
|
int mmapstat;
|
|
|
|
if (MonoOrColor == COLOR_SCREEN) {
|
|
printf("You can not initialize the color screen from inside color screen. \n");
|
|
}
|
|
|
|
ColorDisplayRegion68k = Addr68k_from_LADDR(color_bitmapbase);
|
|
|
|
Dispcolorsize =
|
|
((displaywidth * displayheight + (getpagesize() - 1)) & -getpagesize()); /* 8 bit depth */
|
|
#ifndef DISPLAYBUFFER
|
|
ColorFb = pr_open("/dev/fb");
|
|
#else
|
|
ColorFb = ColorDisplayPixrect;
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
#ifndef DISPLAYBUFFER
|
|
color_source = mem_point(displaywidth, displayheight, 8, ColorDisplayRegion68k);
|
|
|
|
pr_set_plane_group(ColorFb, PIXPG_8BIT_COLOR);
|
|
pr_rop(ColorFb, 0, 0, displaywidth, displayheight, PIX_SRC, color_source, 0, 0);
|
|
|
|
mmapstat = (int)mmap(ColorDisplayRegion68k, Dispcolorsize, PROT_READ | PROT_WRITE,
|
|
#ifdef OS4
|
|
MAP_FIXED |
|
|
#endif
|
|
MAP_SHARED,
|
|
FrameBufferFd, 0x40000);
|
|
if (mmapstat == -1) {
|
|
perror("cgfour_init_color_display: ERROR at mmap system call\n");
|
|
error(
|
|
"cgfour_init_color_display: ERROR at mmap system call\n You may be able to continue by "
|
|
"typing 'q'");
|
|
}
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
printf("COLOR-INIT OK BMBASE=0x%x\nNATIVE:= 0x%x)\n", color_bitmapbase, ColorDisplayRegion68k);
|
|
|
|
Inited_Color = T; /* Color display is active. */
|
|
|
|
return (color_bitmapbase);
|
|
} /* end cgfour_init_color_display */
|
|
|
|
#else /* COLOR */
|
|
|
|
LispPTR cgfour_init_color_display(LispPTR color_bitmapbase) /* SUBR 0210 */ /* COLOR BITMAP ADDRESS */
|
|
{
|
|
printf("Color is not supported.\n");
|
|
return (NIL);
|
|
}
|
|
#endif /* COLOR */
|
|
|
|
/*******************************************************************/
|
|
/* Func name : cgfour_change_screen_mode(which_screen)
|
|
Arg(s) : MONO_SCREEN OR COLOR_SCREEN
|
|
Desc : Assign to SUBR 0211
|
|
Change screen Mono to Color,vice versa.
|
|
By Takeshi
|
|
*/
|
|
/*******************************************************************/
|
|
#ifdef COLOR
|
|
LispPTR cgfour_change_screen_mode(LispPTR which_screen)
|
|
{ /* subr 0211 */
|
|
struct pixrect *ColorFb;
|
|
extern ScreenLocked;
|
|
extern DLword *EmCursorX68K, *EmCursorY68K;
|
|
|
|
int mmapstat;
|
|
|
|
#ifndef DISPLAYBUFFER
|
|
ColorFb = pr_open("/dev/fb");
|
|
#else
|
|
ColorFb = ColorDisplayPixrect;
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
ScreenLocked = T;
|
|
taking_mouse_down();
|
|
|
|
switch (which_screen & 0xf) {
|
|
case MONO_SCREEN: { /* resume mono screen */
|
|
#ifdef DISPLAYBUFFER
|
|
mmapstat = (int)munmap(ColorDisplayRegion68k, Dispcolorsize);
|
|
if (mmapstat == -1) {
|
|
perror("cg_four_change_screen: ERROR at munmap system call\n");
|
|
exit(0);
|
|
} /* end if(mmapstat) */
|
|
save_color_screen();
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
|
|
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_SET, 0, 0, 0);
|
|
pr_set_plane_group(ColorFb, PIXPG_OVERLAY);
|
|
#ifdef DISPLAYBUFFER
|
|
flush_display_buffer();
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
MonoOrColor = MONO_SCREEN;
|
|
break;
|
|
}
|
|
case COLOR_SCREEN: {
|
|
#ifndef DISPLAYBUFFER
|
|
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
|
|
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_CLR, 0, 0, 0);
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
pr_set_plane_group(ColorFb, PIXPG_8BIT_COLOR);
|
|
#ifdef DISPLAYBUFFER
|
|
restore_color_screen();
|
|
mmapstat = (int)mmap(ColorDisplayRegion68k, Dispcolorsize, PROT_READ | PROT_WRITE,
|
|
#ifdef OS4
|
|
MAP_FIXED |
|
|
#endif
|
|
MAP_SHARED,
|
|
FrameBufferFd, 0x40000);
|
|
if (mmapstat == -1) {
|
|
perror("cg_four_change_screen: ERROR at mmap system call\n");
|
|
exit(0);
|
|
}
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
MonoOrColor = COLOR_SCREEN;
|
|
break;
|
|
}
|
|
default: { error("cgfour_change_screen_mode:Unknown mode:"); }
|
|
};
|
|
|
|
#ifndef DISPLAYBUFFER
|
|
pr_close(ColorFb);
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
|
|
ScreenLocked = NIL;
|
|
return (which_screen);
|
|
}
|
|
#else /* COLOR */
|
|
|
|
LispPTR cgfour_change_screen_mode(LispPTR which_screen)
|
|
{
|
|
printf("Color is not supported.\n");
|
|
return (NIL);
|
|
}
|
|
#endif /* COLOR */
|
|
|
|
/*******************************************************************/
|
|
/* Func name : cgfour_set_colormap(args)
|
|
Arg(s) : Passed by args
|
|
index: colormap index(0~255)
|
|
red,green,blue:(0~255)
|
|
Desc : Assign to SUBR 0212
|
|
Set Colormap entry
|
|
By Takeshi
|
|
*/
|
|
/*******************************************************************/
|
|
unsigned char RED_colormap;
|
|
unsigned char GRN_colormap;
|
|
unsigned char BLU_colormap;
|
|
|
|
#ifdef COLOR
|
|
LispPTR cgfour_set_colormap(LispPTR args[])
|
|
{
|
|
int index;
|
|
struct pixrect *ColorFb;
|
|
|
|
index = args[0] & 0xff;
|
|
|
|
RED_colormap = (unsigned char)(args[1] & 0xff);
|
|
GRN_colormap = (unsigned char)(args[2] & 0xff);
|
|
BLU_colormap = (unsigned char)(args[3] & 0xff);
|
|
|
|
ColorFb = pr_open("/dev/fb");
|
|
|
|
if (pr_putcolormap(ColorFb, index, 1, &RED_colormap, &GRN_colormap, &BLU_colormap) == -1)
|
|
perror("putcolormap:");
|
|
pr_close(ColorFb);
|
|
return (T);
|
|
}
|
|
#else /* COLOR */
|
|
|
|
LispPTR cgfour_set_colormap(LispPTR args[])
|
|
{
|
|
printf("Color is not supported.\n");
|
|
return (NIL);
|
|
}
|
|
#endif /* COLOR */
|
|
|
|
#ifdef COLOR
|
|
#ifdef DISPLAYBUFFER
|
|
static struct pixrect *saved_screen;
|
|
static int Screen_Saved = T;
|
|
|
|
void save_color_screen() {
|
|
if (!Screen_Saved) {
|
|
saved_screen = mem_point(displaywidth, displayheight, 8, ColorDisplayRegion68k);
|
|
pr_rop(saved_screen, 0, 0, displaywidth, displayheight, PIX_SRC, ColorDisplayPixrect, 0, 0);
|
|
Screen_Saved = T;
|
|
} /* end if(!Screen_Saved) */
|
|
} /* end save_color_screen() */
|
|
|
|
void restore_color_screen() {
|
|
if (Screen_Saved) {
|
|
saved_screen = mem_point(displaywidth, displayheight, 8, ColorDisplayRegion68k);
|
|
pr_rop(ColorDisplayPixrect, 0, 0, displaywidth, displayheight, PIX_SRC, saved_screen, 0, 0);
|
|
Screen_Saved = NIL;
|
|
} /* end if(Screen_Saved) */
|
|
} /* end restore_color_screen() */
|
|
#endif /* DISPLAYBUFFER */
|
|
|
|
static unsigned char red_colormap[256], green_colormap[256], blue_colormap[256];
|
|
static int Saved_Colormap = NIL;
|
|
void save_colormap() {
|
|
struct pixrect *Color_Fb;
|
|
|
|
if (!Saved_Colormap) {
|
|
Color_Fb = pr_open("/dev/fb");
|
|
if ((pr_getcolormap(Color_Fb, 0, 256, red_colormap, green_colormap, blue_colormap)) == -1)
|
|
perror("save_color_map:");
|
|
else
|
|
Saved_Colormap = T;
|
|
|
|
pr_close(Color_Fb);
|
|
} /* end if( !Saved_Colormap ) */
|
|
} /* end save_colormap() */
|
|
|
|
void restore_colormap() {
|
|
struct pixrect *Color_Fb;
|
|
|
|
if (Saved_Colormap) {
|
|
Color_Fb = pr_open("/dev/fb");
|
|
if ((pr_putcolormap(Color_Fb, 0, 256, red_colormap, green_colormap, blue_colormap)) == -1)
|
|
perror("restore_color_map:");
|
|
pr_close(Color_Fb);
|
|
Saved_Colormap = NIL;
|
|
} /* end if( Saved_Colormap ) */
|
|
} /* end restore_colormap() */
|
|
#endif /* COLOR */
|