1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-25 19:46:21 +00:00

Maiko sources matching state as of 020102 prior to initial patching for Mac OSX

This commit is contained in:
Nick Briggs
2015-04-20 18:53:52 -07:00
commit de170a64d9
427 changed files with 129342 additions and 0 deletions

64
inc/Check.h Executable file
View File

@@ -0,0 +1,64 @@
/* $Id: Check.h,v 1.2 1999/01/03 02:05:47 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* C h e c k . h */
/* */
/* */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define check_width 16
#define check_height 16
static char check_bits[] =
{ 0xAA, 0xAA
, 0x55, 0x55
, 0xAA, 0xAA
, 0x55, 0x55
, 0xAA, 0xAA
, 0x55, 0x55
, 0xAA, 0xAA
, 0x55, 0x55
, 0xAA, 0xAA
, 0x55, 0x55
, 0xAA, 0xAA
, 0x55, 0x55
, 0xAA, 0xAA
, 0x55, 0x55
, 0xAA, 0xAA
, 0x55, 0x55 };
static char plain_bits[] =
{ 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00 };

115
inc/MyWindow.h Executable file
View File

@@ -0,0 +1,115 @@
/* $Id: MyWindow.h,v 1.2 1999/01/03 02:05:47 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* M y W i n d o w . h */
/* */
/* */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#include "ldeXdefs.h"
#define VERTICAL 0
#define HORIZONTAL 1
#define PERCENT_OF_SCREEN 95
#define SCROLL_PITCH 30
typedef struct _MyEvent
{
int type; /* Event type */
int (*func)(); /* Pointer to Event Handler */
struct _MyEvent *next; /* Pointer to next event */
} MyEvent;
typedef struct _MyWindow
{
char *name; /* name of this window */
Window win; /* window id */
int x,y; /* x and y coordinates */
int width,height;/* window size */
int border; /* border width */
GC *gc; /* Current GC */
unsigned long event_mask;
Cursor *cursor; /* Current Cursor */
int (*before_create)(); /* Pointer to Initializer */
int (*after_create)();
int (*before_resize)(); /* Pointer to Configurator */
int (*after_resize)();
int (*event_func)(); /* Pointer to Event Handler */
MyEvent *event_head;
struct _MyWindow *parent; /* pointer to parent window */
struct _MyWindow *next; /* pointer of next window */
} MyWindow;
typedef struct
{
int left_x; /* x cordinate of upperleft corner */
int top_y; /* y cordinate of upperlert corner */
int right_x; /* x cordinate of lowerright corner */
int bottom_y;/* y cordinate of lowerright corner */
} DisplayArea;
#define CreateWindow(display, parent_win,child_win) { \
if( parent_win && child_win ) { \
if( (child_win)->before_create ) \
((child_win)->before_create)(parent_win,child_win); \
(child_win)->win = XCreateSimpleWindow( display \
, (parent_win)->win \
, (child_win)->x \
, (child_win)->y \
, (child_win)->width \
, (child_win)->height \
, (child_win)->border \
, Black_Pixel \
, White_Pixel ); \
XLOCK; \
XFlush( display ); \
XUNLOCK; \
(child_win)->parent = parent_win; \
if( (child_win)->after_create ) \
((child_win)->after_create)(parent_win,child_win);\
} \
}
#define ResizeWindow(display,window) { \
if( window ) { \
if( (window)->before_resize ) \
((window)->before_resize)( window ); \
XLOCK;\
XMoveResizeWindow( (display) \
, (window)->win \
, (window)->x \
, (window)->y \
, (window)->width \
, (window)->height ); \
XFlush( display ); \
XUNLOCK; \
if( (window)->after_resize ) \
((window)->after_resize)( window ); \
} \
}
#define DefineCursor(display, window,mycursor) { \
XLOCK; \
XDefineCursor( display, (window)->win, *(mycursor) ); \
XFlush( display ); \
XUNLOCK; \
(window)->cursor = mycursor; \
}

46
inc/Stipple.h Executable file
View File

@@ -0,0 +1,46 @@
/* $Id: Stipple.h,v 1.2 1999/01/03 02:05:47 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
* Author: Mitsunori Matsuda
* Date : August 26, 1988
*/
/************************************************************************/
/* */
/* */
/* */
/* */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define check_width 16
#define check_height 16
static char check_bits[] = { 0x88, 0x88
, 0x00, 0x00
, 0x22, 0x22
, 0x00, 0x00
, 0x88, 0x88
, 0x00, 0x00
, 0x22, 0x22
, 0x00, 0x00
, 0x88, 0x88
, 0x00, 0x00
, 0x22, 0x22
, 0x00, 0x00
, 0x88, 0x88
, 0x00, 0x00
, 0x22, 0x22
, 0x00, 0x00 };

260
inc/XCursors.h Executable file
View File

@@ -0,0 +1,260 @@
/* $Id: XCursors.h,v 1.2 1999/01/03 02:05:48 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
* Author: Mitsunori Matsuda
* Date : August 29, 1988
*/
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
char horizscrollcursor_bitmap[]={
0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x08, 0x20
, 0x18, 0x30
, 0x38, 0x38
, 0x78, 0x3C
, 0xFF, 0xFE
, 0xFF, 0xFE
, 0x78, 0x3C
, 0x38, 0x38
, 0x18, 0x30
, 0x08, 0x20
};
LISP_CURSOR horizscroll_cursor = {
1
, horizscrollcursor_bitmap
, horizscrollcursor_bitmap
, 7
, 5
, NULL
};
char horizthumbcursor_bitmap[]={
0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x02, 0x00
, 0x02, 0x00
, 0x0A, 0x80
, 0x0A, 0x80
, 0x0A, 0x80
, 0x2A, 0xA0
, 0x2A, 0xA0
, 0x2A, 0xA0
, 0xAA, 0xA8
, 0xAA, 0xA8
, 0xAA, 0xA8
, 0xAA, 0xA8
, 0xAA, 0xA8
};
LISP_CURSOR horizthumb_cursor = {
1
, horizthumbcursor_bitmap
, horizthumbcursor_bitmap
, 6
, 8
, NULL
};
char scrolldowncursor_bitmap[]={
0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x1F, 0xF0
, 0x1F, 0xF0
, 0x0F, 0xE0
, 0x0F, 0xE0
, 0x07, 0xC0
, 0x07, 0xC0
, 0x03, 0x80
, 0x03, 0x80
, 0x01, 0x00
};
LISP_CURSOR scrolldown_cursor = {
1
, scrolldowncursor_bitmap
, scrolldowncursor_bitmap
, 7
, 15
, NULL
};
char scrollleftcursor_bitmap[]={
0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x80
, 0x03, 0x80
, 0x0F, 0x80
, 0x3F, 0x80
, 0xFF, 0xFF
, 0xFF, 0xFF
, 0x3F, 0x80
, 0x0F, 0x80
, 0x03, 0x80
, 0x00, 0x80
};
LISP_CURSOR scrollleft_cursor = {
1
, scrollleftcursor_bitmap
, scrollleftcursor_bitmap
, 8
, 5
, NULL
};
char scrollrightcursor_bitmap[]={
0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x00, 0x00
, 0x01, 0x00
, 0x01, 0xC0
, 0x01, 0xF0
, 0x01, 0xFC
, 0xFF, 0xFF
, 0xFF, 0xFF
, 0x01, 0xFC
, 0x01, 0xF0
, 0x01, 0xC0
, 0x01, 0x00
};
LISP_CURSOR scrollright_cursor = {
1
, scrollrightcursor_bitmap
, scrollrightcursor_bitmap
, 7
, 5
, NULL
};
char scrollupcursor_bitmap[]={
0x01, 0x00
, 0x03, 0x80
, 0x03, 0x80
, 0x07, 0xC0
, 0x07, 0xC0
, 0x0F, 0xE0
, 0x0F, 0xE0
, 0x1F, 0xF0
, 0x1F, 0xF0
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
};
LISP_CURSOR scrollup_cursor = {
1
, scrollupcursor_bitmap
, scrollupcursor_bitmap
, 7
, 15
, NULL
};
char vertscrollcursor_bitmap[]={
0x01, 0x00
, 0x03, 0x80
, 0x03, 0x80
, 0x07, 0xC0
, 0x07, 0xC0
, 0x0F, 0xE0
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x03, 0x80
, 0x0F, 0xE0
, 0x07, 0xC0
, 0x07, 0xC0
, 0x03, 0x80
, 0x03, 0x80
, 0x01, 0x00
};
LISP_CURSOR vertscroll_cursor = {
1
, vertscrollcursor_bitmap
, vertscrollcursor_bitmap
, 7
, 15
, NULL
};
char vertthumbcursor_bitmap[]={
0x00,0x00
,0x00,0x1f
,0x00,0x00
,0x00,0xff
,0x00,0x00
,0x07,0xff
,0x00,0x00
,0x1f,0xff
,0x00,0x00
,0x07,0xff
,0x00,0x00
,0x00,0xff
,0x00,0x00
,0x00,0x1f
,0x00,0x00
,0x00,0x00
};
LISP_CURSOR vertthumb_cursor = {
1
, vertthumbcursor_bitmap
, vertthumbcursor_bitmap
, 8
, 8
, NULL
};

264
inc/XKeymap.h Executable file
View File

@@ -0,0 +1,264 @@
/* $Id: XKeymap.h,v 1.2 1999/01/03 02:05:48 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* Generic X-keyboard map for Medley. This table is used at */
/* start-up time to create the table that maps X keycodes to */
/* Medley key numbers. */
/* */
/* This is done by asking X for the keycodes that correspond */
/* to given KEYSYMs (X's machine-independent coding scheme), */
/* and building the table. This has one problem: The mapping */
/* for non-ASCII characters isn't standard among keyboards. To */
/* get as reasonable a map as possible, the table below contains */
/* possibly several mappings for each Medley key number. Since */
/* not every keyboard has every key (e.g., Alt vs Meta), there */
/* may also be several mappings for a single KEYSYM. */
/* */
/* Here's how it works: Each entry is tried in turn. If the */
/* Medley key number we'd be assigning is already assigned a */
/* mapping, skip this entry. If not, assign this mapping, and */
/* set the "this-KEYSYM-used" flag. If this is a new KEYSYM, */
/* reset the flag before trying anything. If the "used" flag */
/* is set, skip until we find a new KEYSYM. */
/* */
/* Constraints: */
/* Put the better key-number assignment earlier. */
/* Put the better KEYSYM assignment earlier. */
/* All entries for a single KEYSYM -must- be adjacent */
/* Final entry in the map has key number -1. */
/* */
/************************************************************************/
/* */
/* C H A N G E H I S T O R Y */
/* */
/* 23 SEP 91 JDS: Rearrange CUT, BS, and DEL keys to assure that */
/* we get a BS key first, then a CUT key, then, */
/* if there's a key left, a DEL (BW) key. */
/* */
/* 26 MAY 92 JDS: Rearrange keys for PC kbd layout. */
/* */
/* */
/* */
/* */
/* */
/* */
/************************************************************************/
#ifdef XWINDOW
int generic_X_keymap[] =
{
0, 107, 0x1000ff10, /* Un-named KEYSYM used on Sun kbd for F11 */
0, 108, 0x1000ff11, /* Un-named KEYSYM used on Sun kbd for F12 */
0, 107, XK_F11,
0, 61, XK_F11, /* STOP, usual sun type-4 kbd key */
0, 61, XK_Pause, /* STOP, Pause/break key on PC */
0, 108, XK_F12,
0, 91, XK_F12,
0, 61, XK_L1,
0, 91, XK_L2,
0, 97, XK_Help,
0, 99, XK_F2,
0, 106, XK_F10,
0, 100, XK_F3,
0, 67, XK_F4,
0, 68, XK_F5,
0, 101, XK_F6,
0, 66, XK_F7,
0, 104, XK_F8,
0, 80, XK_F9,
0, 31, XK_Meta_L, /* Meta, standard meta key */
0, 86, XK_Meta_L, /* (sun left-diamond key) */
0, 31, XK_Alt_L, /* Meta, Sun-4 usual key */
0, 86, XK_Alt_L, /* (sun left-diamond key) */
0, 75, XK_F21,
0, 110, XK_F22,
0, 74, XK_F23,
0, 109, XK_F13,
0, 14, XK_F15, /* SAME key on Sun type-4 kbd */
#ifdef XK_Scroll_Lock
0, 14, XK_Scroll_Lock, /* SAME key on PC kbd */
#endif /* .. scroll .. */
0, 33, XK_Escape,
0, 32, XK_1,
0, 32, XK_exclam,
0, 17, XK_2,
0, 17, XK_at,
0, 16, XK_3,
0, 16, XK_numbersign,
0, 1, XK_4,
0, 1, XK_dollar,
0, 0, XK_5,
0, 0, XK_percent,
0, 2, XK_6,
0, 2, XK_asciicircum,
0, 4, XK_7,
0, 4, XK_ampersand,
0, 53, XK_8,
0, 53, XK_asterisk,
0, 22, XK_9,
0, 22, XK_parenleft,
0, 8, XK_0,
0, 8, XK_parenright,
0, 10, XK_minus,
0, 10, XK_underscore,
0, 59, XK_equal,
0, 59, XK_plus,
0, 45, XK_quoteleft,
0, 45, XK_asciitilde,
0, 89, XK_F16, /* Copy, Sun-4 kbd L6 */
0, 34, XK_Tab,
0, 19, XK_Q,
0, 18, XK_W,
0, 3, XK_E,
0, 48, XK_R,
0, 49, XK_T,
0, 51, XK_Y,
0, 6, XK_U,
0, 23, XK_I,
0, 25, XK_O,
0, 11, XK_P,
0, 58, XK_bracketleft,
0, 58, XK_braceleft,
0, 29, XK_bracketright,
0, 29, XK_braceright,
0, 13, XK_Delete,
0, 111, XK_F17,
0, 36, XK_Control_L,
0, 21, XK_A,
0, 20, XK_S,
0, 5, XK_D,
0, 35, XK_F,
0, 50, XK_G,
0, 52, XK_H,
0, 38, XK_J,
0, 9, XK_K,
0, 26, XK_L,
0, 43, XK_semicolon,
0, 28, XK_quoteright,
0, 105, XK_backslash,
0, 105, XK_bar,
0, 105, XK_brokenbar,
0, 44, XK_Return,
/* 46, XK_F20, See DELETE, CUT, BS below */
0, 41, XK_Shift_L,
0, 40, XK_Z,
0, 24, XK_X,
0, 37, XK_C,
0, 7, XK_V,
0, 39, XK_B,
0, 54, XK_N,
0, 55, XK_M,
0, 27, XK_comma,
0, 42, XK_period,
0, 12, XK_slash,
0, 60, XK_Shift_R,
0, 71, XK_Linefeed,
0, 92, XK_Help,
0, 92, XK_Print, /* PC Kbd Print key, works as HELP */
0, 56, XK_Caps_Lock,
0, 86, XK_Meta_L,
0, 57, XK_space,
0, 88, XK_Meta_R,
/* DELETE, CUT, and BACKSPACE keys. It's important that there */
/* be a BS key, so we'll take over DEL for that purpose */
/* if nothing better offers. We also need a CUT key, so we'll */
/* grab it for THAT if there's a BS key. */
0, 15, XK_BackSpace, /* best BS key */
0, 46, XK_F20, /* CUT key on Sun kbd */
0, 13, XK_KP_Decimal, /* Keypad DEL/. key if all else fails */
0, 15, XK_Delete, /* Use DEL for BS if needed */
0, 46, XK_Delete, /* or for CUT if needed */
1, 13, XK_Delete, /* Or leave it as BackWord */
/* The keypad (right side, numeric entry pad) */
/* But keypad-decimal is assigned up with DEL & BS */
0, 98, XK_KP_0, /* Keypad 0 */
0, 89, XK_Insert, /* Copy, generic INS key */
0, 98, XK_Insert, /* INS key = Keypad 0 otherwise */
0, 94, XK_KP_1, /* Keypad 1 */
0, 94, XK_R13,
0, 69, XK_KP_2,
0, 70, XK_KP_3,
0, 70, XK_F35,
0, 84, XK_KP_4,
0, 85, XK_KP_5,
0, 85, XK_F31,
0, 87, XK_KP_6,
0, 81, XK_KP_7,
0, 81, XK_F27,
0, 82, XK_KP_8,
0, 83, XK_F29,
0, 83, XK_KP_9,
0, 96, XK_KP_Subtract,
0, 76, XK_KP_Enter,
0, 102, XK_KP_Add,
0, 73, XK_Num_Lock,
0, 64, XK_KP_Equal,
0, 64, XK_F24,
0, 65, XK_KP_Divide,
0, 65, XK_F25,
0, 95, XK_KP_Multiply,
0, 95, XK_F26,
/* Arrow keys. If not already assigned by the */
/* keypad digit assignments above, try assigning */
/* the new arrow-key key#s assigned for RS/6000 */
/* Failing that, try assigning the keypad #s. */
0, 129, XK_Left,
0, 84, XK_Left,
0, 130, XK_Up,
0, 82, XK_Up,
0, 131, XK_Down,
0, 69, XK_Down,
0, 132, XK_Right,
0, 87, XK_Right,
0, 93, XK_Multi_key, /* Expand, suyn type-4 */
0, 93, XK_Alt_R, /* Expand, RH Alt key */
0, 93, XK_Mode_switch, /* Expand, RH Alt key on PC kbd */
/* No key defs may come here! */
0, 47, XK_Mode_switch, /* Next, Sun-4 Alt-graph key */
1, 47, XK_Control_R, /* Next, PC's right-hand Ctrl key */
0, 47, XK_Next, /* Next, Next or PgDn key ? */
0, 91, XK_Next, /* Again, Next or PgDn key */
0, 63, XK_F14, /* Undo, Sun-4 kbd L4 */
0, 63, XK_Prior, /* Undo, generic Prev or PgUp key */
0, 90, XK_F19, /* Find, Sun-4 L9 key */
0, 90, XK_Find, /* Find, generic Find key */
0, 90, XK_End, /* End key on PC kbd */
0, 62, XK_F18, /* Move key on Sun4 kbd */
0, 62, XK_Home, /* Home key on PC 101-key kbd */
-1, -1, -1 };
#endif /* XWINDOW */

60
inc/XVersion.h Executable file
View File

@@ -0,0 +1,60 @@
/* $Id: XVersion.h,v 1.2 1999/01/03 02:05:48 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifdef XWINDOW
#ifdef XV11R4
#undef XV11R1
#undef XV11R2
#undef XV11R3
#endif /* XV11R4 */
#ifdef XV11R3
#undef XV11R1
#undef XV11R2
#undef XV11R4
#endif /* XV11R3 */
#ifdef XV11R2
#undef XV11R1
#undef XV11R3
#undef XV11R4
#endif /* XV11R2 */
#ifdef XV11R1
#undef XV11R2
#undef XV11R3
#undef XV11R4
#endif /* XV11R1 */
#if ( !(defined( XV11R1 )) \
&& !(defined( XV11R2 )) \
&& !(defined( XV11R3 )) \
&& !(defined( XV11R4 )) )
#define XV11R4 /* newest version */
#endif
#endif /* XWINDOW */

38
inc/XWaitCur.h Executable file
View File

@@ -0,0 +1,38 @@
/* $Id: XWaitCur.h,v 1.2 1999/01/03 02:05:49 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
*
* Copyright (C) 1988 by Fuji Xerox co.,Ltd. All rights reserved.
*
* Author: Mitsunori Matsuda
* Date : August 30, 1988
*/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
char waitcursor_bitmap[]=
{
0xFF, 0xFE, 0xC0, 0x06, 0x60, 0x1C, 0x3D, 0x78
, 0x1F, 0xF0, 0x0F, 0xE0, 0x06, 0xC0, 0x03, 0x80
, 0x02, 0x80, 0x03, 0xC0, 0x0D, 0x60, 0x19, 0x30
, 0x37, 0xD8, 0x67, 0xEC, 0xFF, 0xFE, 0xFF, 0xFE
};
LISP_CURSOR wait_cursor =
{
1
, waitcursor_bitmap
, waitcursor_bitmap
, 7
, 8
, NULL
};

71
inc/Xbitblt.h Executable file
View File

@@ -0,0 +1,71 @@
/* $Id: Xbitblt.h,v 1.2 1999/01/03 02:05:49 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
*
* Copyright (C) 1988 by Fuji Xerox co.,Ltd. All rights reserved.
*
* Author: Mitsunori Matsuda
* Date : August 11, 1988
*
*/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
#define Xbitblt( display, x,y,w,h) { \
XPutImage( display, Display_Window.win \
, *(Display_Window.gc) \
, &XScreenBitmap \
, x \
, y \
, x - ScreenRegion.left_x \
, y - ScreenRegion.top_y \
, w \
, h ); \
/* XFlush( display ); */ \
}
#define clipping_Xbitblt(x,y,w,h) { \
int temp_x \
, temp_y; \
temp_x = x + w - 1; \
temp_y = y + h - 1; \
if( ( temp_x < ScreenRegion.left_x ) \
|| ( x > ScreenRegion.right_x ) \
|| ( temp_y < ScreenRegion.top_y ) \
|| ( y > ScreenRegion.bottom_y ) ) { \
return; \
} \
if( ( x >= ScreenRegion.left_x ) \
&& ( temp_x <= ScreenRegion.right_x ) \
&& ( y >= ScreenRegion.top_y ) \
&& ( temp_y <= ScreenRegion.bottom_y ) ) { \
Xbitblt( x, y, w, h ); \
return; \
} \
if( x < ScreenRegion.left_x ) { \
w -= ScreenRegion.left_x - x; \
x = ScreenRegion.left_x; \
} \
if( temp_x > ScreenRegion.right_x ) { \
w -= temp_x - ScreenRegion.right_x; \
} \
if( y < ScreenRegion.top_y ) { \
h -= ScreenRegion.top_y - y; \
y = ScreenRegion.top_y; \
} \
if( temp_y > ScreenRegion.bottom_y ) { \
h -= temp_y - ScreenRegion.bottom_y; \
} \
if( ( w>0 ) && ( h>0 ) ) { \
Xbitblt( x, y, w, h ); \
} \
}

38
inc/Xcursdef.h Executable file
View File

@@ -0,0 +1,38 @@
/* $Id: Xcursdef.h,v 1.2 1999/01/03 02:05:49 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
*
* Copyright (C) 1988 by Fuji Xerox co.,Ltd. All rights reserved.
*
* Author: Mitsunori Matsuda
* Date : August 29, 1988
*/
/************************************************************************/
/* */
/* Structure used to describe cursors in the X version of Medley. */
/* */
/* */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
typedef struct {
short cubitsprepixel; /* bits per pixel in the cursor, mostly 1 */
char *cuimage; /* the image bitmap */
char *cumask; /* the mask bitmap */
short cuhotspotx; /* hot-spot X coordinate */
short cuhotspoty; /* hot-spot Y coordinate */
short cudata; /* ?? */
} LISP_CURSOR;

39
inc/Xdefcur.h Executable file
View File

@@ -0,0 +1,39 @@
/* $Id: Xdefcur.h,v 1.2 1999/01/03 02:05:50 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
*
* Copyright (C) 1988 by Fuji Xerox co.,Ltd. All rights reserved.
*
* Author: Mitsunori Matsuda
* Date : August 30, 1988
*/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
char defaultcursor_bitmap[]=
{
0x80, 0, 0xc0, 0, 0xe0, 0, 0xf0, 0
, 0xf8, 0, 0xfc, 0, 0xfe, 0, 0xf0, 0
, 0xd8, 0, 0x98, 0, 0x0c, 0, 0x0c, 0
, 0x06, 0, 0x06, 0, 0x03, 0, 0x03, 0
};
LISP_CURSOR default_cursor =
{
1
, defaultcursor_bitmap
, defaultcursor_bitmap
, 0
, 15
, NULL
};

35
inc/Xdeflt.h Executable file
View File

@@ -0,0 +1,35 @@
/* $Id: Xdeflt.h,v 1.2 1999/01/03 02:05:50 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
* Define the X window Medley runs in.
*
*/
/************************************************************************/
/* */
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define DEF_WIN_X 20
#define DEF_WIN_Y 20
#define DEF_WIN_WIDTH 565
#define DEF_WIN_HEIGHT 430
#define WIN_MIN_WIDTH 150
#define WIN_MIN_HEIGHT 100
#define DEF_BDRWIDE 2
#define SCROLL_WIDTH 18
#define WINDOW_NAME "Medley (C) Copyright 1980-94 Venue"
#define ICON_NAME "Medley"

50
inc/Xdisplay.h Executable file
View File

@@ -0,0 +1,50 @@
/* $Id: Xdisplay.h,v 1.2 1999/01/03 02:05:51 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
*
* Copyright (C) 1988 by Fuji Xerox co.,Ltd. All rights reserved.
*
* Author: Mitsunori Matsuda
* Date : July 26,1988
*/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
typedef struct
{
char *name; /* name of this window */
Window win; /* window id */
int x,y; /* x and y cordinates */
int width,height; /* window size */
int border; /* border width */
GC *gc;
unsigned logn event_mask;
Cursor *cursor; /* current cursor */
int (*func)(); /* Event Function */
} MyWindow;
typedef struct
{
int type; /* Event type */
int (*func)();/* Event function */
} MyEvent;
typedef struct
{
int left_x; /* x coordinate of upper-left corner */
int top_y; /* y coordinate of upper-lert corner */
int right_x; /* x coordinate of lower-right corner */
int bottom_y;/* y coordinate of lower-right corner */
} DisplayArea;

81
inc/Xicon.h Executable file
View File

@@ -0,0 +1,81 @@
/* $Id: Xicon.h,v 1.2 1999/01/03 02:05:51 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1991 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
int Lisp_icon_width = 88;
int Lisp_icon_height = 58;
char Lisp_icon[] =
{
0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08,
0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x3f, 0xe2,
0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x10, 0x20,
0xbf, 0xff, 0xff, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x97, 0xa8,
0x3f, 0xff, 0xff, 0xa0, 0x82, 0x08, 0x20, 0x82, 0x08, 0x30, 0x22,
0x20, 0x00, 0x00, 0x88, 0x20, 0x82, 0x08, 0x20, 0x83, 0xf0, 0x20,
0xa0, 0x00, 0x00, 0x82, 0x08, 0x20, 0x82, 0x08, 0x21, 0x10, 0x28,
0x24, 0x01, 0x00, 0xa0, 0x87, 0xff, 0xff, 0xc2, 0x09, 0x1f, 0xe2,
0x29, 0xb2, 0x00, 0x88, 0x24, 0x00, 0x00, 0x60, 0x83, 0x04, 0x20,
0xa9, 0xb2, 0x50, 0x82, 0x0c, 0x00, 0x00, 0x48, 0x21, 0x06, 0x08,
0x29, 0xb2, 0x00, 0xa0, 0x87, 0xff, 0xff, 0xc2, 0x09, 0xfc, 0x82,
0x24, 0x01, 0x00, 0xbf, 0xff, 0xff, 0xff, 0xe0, 0x82, 0x08, 0x20,
0xa0, 0x00, 0x00, 0xbf, 0xff, 0xe0, 0x08, 0x48, 0x21, 0xfe, 0x08,
0x20, 0x01, 0x20, 0xe0, 0x00, 0x20, 0x0f, 0x42, 0x0a, 0x02, 0x82,
0x20, 0x00, 0x90, 0xe0, 0x00, 0x3f, 0xf8, 0x60, 0x83, 0xfe, 0x20,
0xa5, 0x48, 0x90, 0xbf, 0xff, 0xff, 0xff, 0x48, 0x20, 0x82, 0x08,
0x20, 0x00, 0x90, 0xbf, 0xff, 0xe0, 0x08, 0x42, 0x08, 0x20, 0x82,
0x20, 0x01, 0x20, 0xa0, 0x00, 0x35, 0x4f, 0x7f, 0xff, 0xff, 0xe0,
0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x20, 0x08, 0x5f, 0xff, 0xff, 0xe8,
0x20, 0x00, 0x00, 0xa0, 0x00, 0x35, 0x4f, 0x50, 0x00, 0x00, 0x22,
0x3f, 0xff, 0xff, 0xab, 0x56, 0x20, 0x08, 0x70, 0x07, 0xc0, 0x20,
0x82, 0x00, 0x00, 0x20, 0x00, 0x35, 0x0f, 0xd0, 0x0c, 0x47, 0xa8,
0x22, 0x00, 0x00, 0x2d, 0x5a, 0xa0, 0x08, 0x90, 0x0f, 0xcc, 0xa2,
0x0a, 0x00, 0x00, 0x20, 0x00, 0x34, 0x08, 0x30, 0x10, 0x17, 0xa0,
0x82, 0x00, 0x00, 0x20, 0x00, 0x20, 0x0a, 0x10, 0x17, 0xd0, 0x28,
0x22, 0x00, 0x00, 0x20, 0x00, 0x35, 0x08, 0x90, 0x2c, 0x67, 0xa2,
0x0a, 0x00, 0x00, 0x20, 0x00, 0x20, 0x08, 0x30, 0x37, 0xdc, 0xa0,
0x82, 0x00, 0x00, 0x20, 0x00, 0x35, 0x4a, 0x17, 0xe0, 0x07, 0xa8,
0x22, 0x00, 0x00, 0x20, 0x00, 0x20, 0x08, 0x94, 0x57, 0xc0, 0x22,
0x0a, 0x00, 0x00, 0x20, 0x00, 0x20, 0x08, 0x37, 0xec, 0x40, 0x20,
0x83, 0xff, 0xff, 0xe0, 0x00, 0x20, 0x0a, 0x10, 0x27, 0xc0, 0x28,
0x20, 0x82, 0x08, 0x20, 0x00, 0x20, 0x08, 0x90, 0x10, 0x00, 0x22,
0x08, 0x20, 0x82, 0x20, 0x00, 0x3f, 0xf8, 0x30, 0x1f, 0xc0, 0x20,
0x82, 0x08, 0x20, 0xa0, 0x00, 0x20, 0x82, 0x10, 0x0c, 0x40, 0x28,
0x20, 0x82, 0x08, 0x3f, 0xff, 0xe8, 0x20, 0x90, 0x07, 0xc0, 0x22,
0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x30, 0x00, 0x00, 0x20,
0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x10, 0x00, 0x00, 0x28,
0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x9f, 0xff, 0xff, 0xe2,
0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20,
0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08,
0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82,
0x42, 0x13, 0x18, 0xc7, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x99, 0x34, 0xa5, 0x24, 0x29, 0x26, 0x38, 0xc5, 0x04, 0x00, 0x00,
0xa1, 0x14, 0x99, 0x27, 0x35, 0x29, 0x40, 0x26, 0x9c, 0x00, 0x00,
0xa1, 0x13, 0xa4, 0xe4, 0x25, 0x29, 0x30, 0xe4, 0xa4, 0x00, 0x00,
0xa1, 0x10, 0xa4, 0x24, 0x24, 0xc9, 0x09, 0x24, 0xa4, 0x00, 0x00,
0x5a, 0x13, 0x18, 0xc7, 0xa4, 0xc6, 0x70, 0xd4, 0x9c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0xc0, 0x50, 0x84, 0x00, 0x00, 0x01, 0xc0, 0x02, 0x10, 0x20,
0x02, 0x12, 0x00, 0x48, 0xcb, 0x32, 0x22, 0x0c, 0x02, 0x38, 0x20,
0x03, 0x92, 0x50, 0x31, 0x2c, 0x49, 0x42, 0x12, 0x02, 0x10, 0xe0,
0x02, 0x12, 0x50, 0x31, 0xe8, 0x48, 0x82, 0x12, 0x02, 0x11, 0x20,
0x02, 0x16, 0x50, 0x49, 0x08, 0x49, 0x42, 0x12, 0x02, 0x15, 0x20,
0x02, 0x0a, 0x50, 0x84, 0xc8, 0x32, 0x21, 0xcc, 0x93, 0xc8, 0xe0,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

59
inc/address.h Executable file
View File

@@ -0,0 +1,59 @@
/* $Id: address.h,v 1.2 1999/01/03 02:05:51 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/**********************************************************************/
/*
File Name : address.h
Address Manipulate Macros(for LISP pointer)
Date : December 8, 1986
Edited by : Takeshi Shimizu
Changed : Dec.22.86 (take)
Changed : Jan.14.87(take)
Changed : Apr.20.87(mitani)
Sep.02.87 take
(add parenthesises)
*/
/**********************************************************************/
/* NOTE: Thease MACRO shuld be used for the pointers in LISP SYSOUT */
#define LLSH(datum , n) ((datum )<< n)
#define LRSH(datum , n) ((datum) >> n)
#define HILOC(ptr) (LRSH(((unsigned int)(ptr) & SEGMASK),16))
#define LOLOC(ptr) ((unsigned int)(ptr) & 0x0ffff)
#define VAG2(hi,lo) (LLSH((hi),16) | (lo))
/* NOTE: argument off must be WORD offset */
#define ADDBASE(ptr,off) ((UNSIGNED)(ptr) + (off))
#define GETBASE(ptr,off) (GETWORD(((DLword *)(ptr)) + (off)))
/* Following MACRO defs. is related with POINTER which is defined as ACCESSFNS in Interlisp(LLNEW) */
#ifdef BIGVM
#define POINTER_PAGE(datum) (((unsigned int)(datum) & 0x0fffff00) >> 8 )
#define POINTER_SEGMENT(datum) HILOC(datum)
#define POINTER_PAGEBASE(datum) ((datum) & 0x0fffff00)
#else
#define POINTER_PAGE(datum) (((unsigned int)(datum) & 0x0ffff00) >> 8 )
#define POINTER_SEGMENT(datum) HILOC(datum)
#define POINTER_PAGEBASE(datum) ((datum) & 0x0ffff00)
#endif /* BIGVM */

69
inc/adr68k.h Executable file
View File

@@ -0,0 +1,69 @@
/* $Id: adr68k.h,v 1.2 1999/01/03 02:05:52 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
* Copyright (C) 1987 by Fuji Xerox Co., Ltd. All rights reserved.
*
* Author : Takeshi Shimizu
* Hiroshi Hayata
*/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/**********************************************************************/
/*
Func name : adr68k.h
Translate 68k address to Lisp or Lisp to 68k
Date : January 16, 1987
Create : Takeshi Shimizu
*/
/**********************************************************************/
/* translate 68k ptr to Lisp DLword address */
#define LADDR_from_68k(ptr68k) ((LispPTR)(((UNSIGNED)(ptr68k) - (UNSIGNED)Lisp_world) >>1))
/* translate 68k ptr to Lisp Page number */
#define LPAGE_from_68k(ptr68k) (LADDR_from_68k(ptr68k) >> 8)
/* Translate Lisp_address to 68K address */
/* Lisp_addr: word offset */
#ifndef I386
#define Addr68k_from_LADDR(Lisp_addr) (Lisp_world + (Lisp_addr))
#else
#define Addr68k_from_LADDR(Lisp_addr) ((Lisp_addr) + Lisp_world)
#endif
/* translate LispPage to 68k address */
#define Addr68k_from_LPAGE(Lisp_page) (Addr68k_from_LADDR((Lisp_page << 8) ))
/* Stack Offset Macros */
#define StkOffset_from_68K(ptr68k)\
((LispPTR)(((UNSIGNED)(ptr68k) - (UNSIGNED)Stackspace) >>1))
#ifndef I386
#define Addr68k_from_StkOffset(stkoffset)\
(Stackspace + (stkoffset))
#else
#define Addr68k_from_StkOffset(stkoffset)\
( (stkoffset) + Stackspace)
#endif

275
inc/arith.h Executable file
View File

@@ -0,0 +1,275 @@
/* $Id: arith.h,v 1.2 1999/01/03 02:05:52 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define MAX_SMALL 65535 /* == 0x0000FFFF */
#define MIN_SMALL -65536 /* == 0xFFFF0000 */
#define MAX_FIXP 2147483647 /* == 0x7FFFFFFF */
#define MIN_FIXP -2147483648 /* == 0x80000000 */
#define GetSmalldata(x) (((SEGMASK & x)==S_POSITIVE) ? (0xFFFF & x) : (((SEGMASK & x)==S_NEGATIVE) ? (0xFFFF0000 | x) : error("Not smallp address")))
#define GetSmallp(x) ((0xFFFF0000 & x) ? (((0xFFFF0000 & x)==0xFFFF0000) ? (S_NEGATIVE | (0xFFFF & x)) : error("Not Smallp data") ) : (S_POSITIVE | (0xFFFF & x)))
/* arg sour is Lisp address, arg dest is a box to store the number */
#define GetNumber(sour, dest){ \
switch(SEGMASK & sour){\
case S_POSITIVE: \
dest = 0xFFFF & sour; \
break; \
case S_NEGATIVE: \
dest = 0xFFFF0000 | sour; \
break; \
default: \
if(GetTypeNumber( sour ) != TYPE_FIXP){ \
ufn(0xFF & (*PC)); \
return; \
} \
dest = *((int *)Addr68k_from_LADDR(sour)); \
} \
}
#define FIXP_VALUE(dest) *((int *)Addr68k_from_LADDR(dest))
#define FLOATP_VALUE(dest) *((float *)Addr68k_from_LADDR(dest))
#define N_GETNUMBER(sour, dest, label) \
{ dest = sour; /* access memory once */ \
switch(SEGMASK & dest){ \
case S_POSITIVE: \
dest = 0xFFFF & (dest); \
break; \
case S_NEGATIVE: \
dest = 0xFFFF0000 | (dest); \
break; \
default: \
if (GetTypeNumber( dest ) != TYPE_FIXP) \
{ goto label; } \
dest = FIXP_VALUE(dest); \
} \
}
#ifdef I386
#define N_IGETNUMBER(sour, dest, label) \
{ dest = sour; /* access memory once */ \
switch(SEGMASK & dest){ \
case S_POSITIVE: \
dest = 0xFFFF & dest; \
break; \
case S_NEGATIVE: \
dest = 0xFFFF0000 | dest; \
break; \
default: \
switch (GetTypeNumber( dest )) { \
case TYPE_FIXP: \
dest = FIXP_VALUE(dest); \
break; \
case TYPE_FLOATP: \
{register float temp; \
temp = FLOATP_VALUE(dest) ; \
if ( (temp > ((float) 0x7fffffff)) || \
(temp < ((float) 0x80000000)) ) \
goto label; \
dest = (int) temp; \
} \
break; \
default: goto label; \
} \
break; \
} \
}
#else
#define N_IGETNUMBER(sour, dest, label) \
{ dest = sour; /* access memory once */ \
switch(SEGMASK & dest){ \
case S_POSITIVE: \
dest = 0xFFFF & dest; \
break; \
case S_NEGATIVE: \
dest = 0xFFFF0000 | dest; \
break; \
default: \
switch (GetTypeNumber( dest )) { \
case TYPE_FIXP: \
dest = FIXP_VALUE(dest); \
break; \
case TYPE_FLOATP: \
{register float temp; \
temp = FLOATP_VALUE(dest) ; \
if ( (temp > ((float) 0x7fffffff)) || \
(temp < ((float) 0x80000000)) ) \
goto label; \
dest = (int) temp; \
} \
break; \
default: goto label; \
} \
break; \
} \
}
#endif /* I386 */
#define ARITH_SWITCH(arg, result) \
switch((int) arg & 0xFFFF0000){ \
case 0: \
result = (S_POSITIVE | (int) arg); \
break; \
case 0xFFFF0000: \
result = (S_NEGATIVE | (0xFFFF & (int) arg)); \
break; \
default:{register LispPTR *wordp; \
/* arg is FIXP, call createcell */ \
wordp = (LispPTR *) createcell68k(TYPE_FIXP); \
*((int *)wordp) = (int) arg; \
result = (LADDR_from_68k(wordp)); \
break; \
} \
}
/* *******
NEED to See if this is faster than the N_ARITH_SWITCH macro
if( (MIN_FIXP <= result) && (result <= MAX_FIXP) ){
if(0 <= result){
if(result <= MAX_SMALL)
return(S_POSITIVE | result);
else{
wordp = createcell68k(TYPE_FIXP);
*((unsigned int *)wordp) = result;
return(LADDR_from_68k(wordp));
}
}else{
if(MIN_SMALL <= result)
return(S_NEGATIVE | (0xFFFF & result));
else{
wordp = createcell68k(TYPE_FIXP);
*((unsigned int *)wordp) = result;
return(LADDR_from_68k(wordp));
}
}/
}
****** */
#define N_ARITH_SWITCH(arg) \
switch(arg & 0xFFFF0000){ \
case 0: \
return(S_POSITIVE | arg); \
case 0xFFFF0000: \
return(S_NEGATIVE | (0xFFFF & arg)); \
default:{register LispPTR *wordp; \
/* arg is FIXP, call createcell */ \
wordp = (LispPTR *) createcell68k(TYPE_FIXP); \
*((int *)wordp) = arg; \
return(LADDR_from_68k(wordp)); \
} \
}
/* Used in ISC asm inlines in arithmetic, to defeat optimizer.
with INLINE_ERROR_EXIT, we use asm jumps to avoid having
one or the other eliminated as dead code. */
#ifdef ISC
#define INLINE_ARITH_SWITCH(arg,retlbl) \
switch(arg & 0xFFFF0000){ \
case 0: \
result=(S_POSITIVE | arg); \
break; \
case 0xFFFF0000: \
result=(S_NEGATIVE | (0xFFFF & arg)); \
break; \
default:{register LispPTR *wordp; \
/* arg is FIXP, call createcell */ \
wordp = (LispPTR *) createcell68k(TYPE_FIXP); \
*((int *)wordp) = arg; \
result=(LADDR_from_68k(wordp)); \
} \
} \
asm("jmp " retlbl)
#endif /* ISC */
#define N_IARITH_BODY_2(a, tos, op) \
{ \
register int arg1,arg2; \
\
N_IGETNUMBER( a, arg1, do_ufn); \
N_IGETNUMBER( tos, arg2, do_ufn); \
\
arg1 = arg1 op arg2; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: ERROR_EXIT(tos); \
}
#define N_ARITH_BODY_1(a, n, op) \
{ \
register int arg1; \
\
N_GETNUMBER( a, arg1, do_ufn); \
\
arg1 = arg1 op n; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: ERROR_EXIT(a); \
}
#define N_ARITH_BODY_1_UNSIGNED(a, n, op) \
{ \
register unsigned int arg1; \
\
N_GETNUMBER( a, arg1, do_ufn); \
\
arg1 = arg1 op n; \
\
N_ARITH_SWITCH(arg1); \
\
do_ufn: ERROR_EXIT(a); \
}
#ifdef I386
/*********************************************************/
/* */
/* Macros for airthmetic operations, to let inline work */
/* */
/*********************************************************/
#define iplus32(a,b) Xiplus32()
#define plus32(a,b) Xplus32()
#define iplus32n(a,b) Xiplus32n()
#define sub32(a,b) Xsub32()
#define isub32(a,b) Xisub32()
#define sub32n(a,b) Xisub32n()
#endif

142
inc/arith2.h Executable file
View File

@@ -0,0 +1,142 @@
/* $Id: arith2.h,v 1.2 1999/01/03 02:05:52 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* Take care of results for inlined arithmetic cases. */
/* xxx_RESULT does overflow checking and boxing. */
/* */
/* */
/************************************************************************/
#ifdef ARITHINLINE
#ifdef GCC386
/* Inline defines for arith on GCC386 machines */
extern inline const int plus32 (int arg1, int arg2)
{
asm(" addl %2,%0 \n\
jo plus_err": "=r" (arg2): "0" (arg2), "r" (arg1));
return arg2;
}
#define PLUS_RESULT \
INLINE_ARITH_SWITCH(result,"plus_ret"); \
asm("plus_err:"); \
INLINE_ERROR_EXIT(tos,"plus_ret")
extern inline const int iplus32 (int arg1, int arg2)
{
asm(" addl %2,%0 \n\
jo iplus_err": "=r" (arg2): "0" (arg2), "r" (arg1));
return arg2;
}
#define IPLUS_RESULT \
INLINE_ARITH_SWITCH(result,"iplus_ret"); \
asm("iplus_err:"); \
INLINE_ERROR_EXIT(tos,"iplus_ret")
extern inline const int sub32 (int arg1, int arg2)
{
asm("subl %2,%0 \n\
jo diff_err": "=r" (arg1): "0" (arg1), "r" (arg2));
return arg1;
}
#define DIFF_RESULT \
INLINE_ARITH_SWITCH(result,"diff_ret"); \
asm("diff_err:"); \
INLINE_ERROR_EXIT(tos,"diff_ret")
extern inline const int isub32 (int arg1, int arg2)
{
asm(" subl %2,%0 \n\
jo idiff_err": "=r" (arg1): "0" (arg1), "r" (arg2));
return arg1;
}
#define IDIFF_RESULT \
INLINE_ARITH_SWITCH(result,"idiff_ret"); \
asm("idiff_err:"); \
INLINE_ERROR_EXIT(tos,"idiff_ret")
extern inline const int iplus32n(int arg1, int arg2)
{
asm("addl %2,%0 \n\
jo iplusn_err": "=r" (arg2): "0" (arg2), "r" (arg1));
return arg2;
}
#define IPLUSN_RESULT \
INLINE_ARITH_SWITCH(result,"iplusn_ret"); \
asm("iplusn_err:"); \
INLINE_ERROR_EXIT(tos,"iplusn_ret")
extern inline const int sub32n (int arg1, int arg2)
{
asm(" subl %2,%0 \n\
jo idiffn_err": "=r" (arg1): "0" (arg1), "r" (arg2));
return arg1;
}
#define IDIFFN_RESULT \
INLINE_ARITH_SWITCH(result,"idiffn_ret"); \
asm("idiffn_err:"); \
INLINE_ERROR_EXIT(tos,"idiffn_ret")
#else /* Any other ARITHINLINE case */
#define PLUS_RESULT \
N_ARITH_SWITCH(result); \
doufn2: plus_err_label(); \
ERROR_EXIT(tos);
#define IPLUS_RESULT \
N_ARITH_SWITCH(result); \
dummy: iplus_err_label();
#define DIFF_RESULT \
N_ARITH_SWITCH(result); \
doufn2: diff_err_label(); \
ERROR_EXIT(tos);
#define IDIFF_RESULT \
N_ARITH_SWITCH(result); \
dummy: idiff_err_label();
#define IPLUSN_RESULT \
N_ARITH_SWITCH(result); \
dummy: iplusn_err_label();
#define IDIFFN_RESULT \
N_ARITH_SWITCH(result); \
dummy: idiffn_err_label();
#endif /* GCC386 */
#endif /* ARITHINLINE */

234
inc/array.h Executable file
View File

@@ -0,0 +1,234 @@
/* $Id: array.h,v 1.2 1999/01/03 02:05:53 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef BYTESWAP
/********************************/
/* Normal byte-order version */
/********************************/
#ifdef BIGVM
typedef struct sequencedescriptor {
unsigned orig :1;
unsigned nil :1;
unsigned readonly :1;
unsigned nil2 :1;
unsigned base :28;
unsigned typ :4;
unsigned length: 28;
LispPTR offst;
} Arrayp;
struct arrayheader {
unsigned nil :4;
unsigned base :28;
unsigned readonlyp :1;
unsigned indirectp :1;
unsigned bitp :1;
unsigned stringp :1;
unsigned adjustablep :1;
unsigned displacedp :1;
unsigned fillpointerp :1;
unsigned extendablep :1;
unsigned typenumber :8;
DLword offset;
LispPTR fillpointer;
LispPTR totalsize;
};
#else
typedef struct sequencedescriptor {
unsigned orig :1;
unsigned nil :1;
unsigned readonly :1;
unsigned nil2 :1;
unsigned typ :4;
unsigned base :24;
DLword length;
DLword offst;
} Arrayp;
struct arrayheader {
unsigned nil :8;
unsigned base :24;
unsigned readonlyp :1;
unsigned indirectp :1;
unsigned bitp :1;
unsigned stringp :1;
unsigned adjustablep :1;
unsigned displacedp :1;
unsigned fillpointerp :1;
unsigned extendablep :1;
unsigned typenumber :8;
DLword offset;
DLword fillpointer;
DLword totalsize;
};
#endif /* BIGVM */
struct arrayblock {
unsigned password :13;
unsigned gctype :2;
unsigned inuse :1;
DLword arlen;
LispPTR fwd;
LispPTR bkwd;
};
struct abdum {
DLword abflags;
};
#else
/********************************/
/* Byte-swapped version, for */
/* e.g., 80386's */
/********************************/
#ifdef BIGVM
typedef struct sequencedescriptor {
unsigned base :28;
unsigned nil2 :1;
unsigned readonly :1;
unsigned nil :1;
unsigned orig :1;
unsigned length: 28;
unsigned typ :4;
LispPTR offst;
} Arrayp;
struct arrayheader {
unsigned base :28;
unsigned nil :4;
DLword offset;
unsigned typenumber :8;
unsigned extendablep :1;
unsigned fillpointerp :1;
unsigned displacedp :1;
unsigned adjustablep :1;
unsigned stringp :1;
unsigned bitp :1;
unsigned indirectp :1;
unsigned readonlyp :1;
LispPTR totalsize;
LispPTR fillpointer;
};
#else
typedef struct sequencedescriptor {
unsigned base :24;
unsigned typ :4;
unsigned nil2 :1;
unsigned readonly :1;
unsigned nil :1;
unsigned orig :1;
DLword offst;
DLword length;
} Arrayp;
struct arrayheader {
unsigned base :24;
unsigned nil :8;
DLword offset;
unsigned typenumber :8;
unsigned extendablep :1;
unsigned fillpointerp :1;
unsigned displacedp :1;
unsigned adjustablep :1;
unsigned stringp :1;
unsigned bitp :1;
unsigned indirectp :1;
unsigned readonlyp :1;
DLword totalsize;
DLword fillpointer;
};
#endif /* BIGVM */
struct arrayblock {
DLword arlen;
unsigned inuse :1;
unsigned gctype :2;
unsigned password :13;
LispPTR fwd;
LispPTR bkwd;
};
struct abdum
{
DLword abflags;
};
#endif /* BYTESWAP */
/****************************************************************************/
/* */
/* The following data are the constant values for array itself. */
/* */
/****************************************************************************/
/* #define ST_BYTE 0 in lsptypes.h */
/* #define ST_POS16 1 in lsptypes.h */
#define ST_INT32 2
/*#define ST_CODE 4 in load.h */
#define ST_PTR 6
#define ST_FLOAT 7
#define ST_BIT 8
#define ST_PTR2 11
/****************************************************************************/
/* */
/* The following data are the constant values for array reclaimer. */
/* */
/****************************************************************************/
#define MAXARRAYBLOCKSIZE 65535
#define MAXARRAYLEN 65535
#define ARRAYBLOCKHEADERCELLS 1
#define ARRAYBLOCKTRAILERCELLS 1
#define ARRAYBLOCKOVERHEADCELLS (ARRAYBLOCKHEADERCELLS+ARRAYBLOCKTRAILERCELLS)
#define MAXARRAYNCELLS (MAXARRAYBLOCKSIZE-ARRAYBLOCKOVERHEADCELLS)
#define ARRAYBLOCKHEADERWORDS 2
#define ARRAYBLOCKTRAILERWORDS 2
#define ARRAYBLOCKOVERHEADWORDS (ARRAYBLOCKHEADERWORDS+ARRAYBLOCKTRAILERWORDS)
#define ARRAYBLOCKLINKINGCELLS 2
#define MINARRAYBLOCKSIZE (ARRAYBLOCKOVERHEADCELLS+ARRAYBLOCKLINKINGCELLS)
#define MAXBUCKETINDEX 30
#define UNBOXEDBLOCK_GCT 0
#define PTRBLOCK_GCT 1
#define CODEBLOCK_GCT 2
#define ABPASSWORDSHIFT 3
#define ARRAYBLOCKPASSWORD (43690 >> ABPASSWORDSHIFT)
/* = 1010101010101010 >> 3 = 5461 */
#define FREEARRAYFLAGWORD ((ARRAYBLOCKPASSWORD << ABPASSWORDSHIFT) | (UNBOXEDBLOCK_GCT << 1))
/* = 43688 */
#define USEDARRAYFLAGWORD ((ARRAYBLOCKPASSWORD << ABPASSWORDSHIFT) | 1)
#define CODEARRAYFLAGWORD ((ARRAYBLOCKPASSWORD << ABPASSWORDSHIFT) | ((CODEBLOCK_GCT << 1) | 1))
#define FIRSTARRAYSEGMENT 19
#define MAXCELLSPERHUNK 64
/****************** The following are for codereclaimer *********************/
#define BITSPERBITE 8
/********************* End of codereclaimer *********************************/
/****************************************************************************/
/* */
/* End of Definitions */
/* */
/****************************************************************************/

837
inc/bb.h Executable file
View File

@@ -0,0 +1,837 @@
/* $Id: bb.h,v 1.2 1999/01/03 02:05:53 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* bb.h
written by don charnley
*/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1991 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/*
COMMENTS:
This code tries to make very few assumptions about the
underlying hardware, and some are required. The following
assumptions are made:
memory addresses are "byte addresses"
data is effectively 32 bits
the memory is most efficient at 32-bit words
(always 32-bit aligned)
Left and right shift amounts are always less than 32 bits.
(there is one exception, B_postloop_mask, which may have its
shift count = 32, in which case it is not used)
Right shifted data is masked if necessary to compensate for
possible arithemetic shifts. Arithmetic shifts are assumed as
the default.
The backwards bit of the control block is followed blindly,
except that gray is always executed forwards. Gray bricks
are always 16 bits wide, and 1 to 16 bits high. These
assumptions are identical to those made in the D-machine
microcode.
*/
/* INDEX
CONSTANTS
op_repl_src
op_fn_and
op_fn_or
op_fn_xor
CONDITIONS
aligned_loop -- it's all 32-bit-word aligned.
F_single_dst_word -- All the dest bits lie in 1 word
F_postloop_dst_word
F_two_preloop_src
F_src_preloop_normal
F_src_word_in_postloop
B_two_preloop_src
B_src_preloop_normal
B_single_dst_word -- All the dest bits lie in 1 word
B_postloop_dst_word
B_src_word_in_postloop
VARIABLES
F_num_loop
F_preloop_mask
F_postloop_mask
B_num_loop
B_preloop_mask
B_postloop_mask
OTHER
TRANSFER LOOP THINGS
ForInner
DestGetsF
DestGetsB
GetSrcF
GetSrcB
INIT
some_init
do_gray_init
F_do_init
B_do_init
F_dst_init
gray_src_init
F_src_init
B_dst_init
B_src_init
SETUPS
do_src_gray_setup
F_do_src_setup
B_do_src_setup
TRANSFERS
do_gray_transfer
F_do_transfer
B_do_transfer
do_partial_transfer
POSTLOOP
F_do_postloop_src_prep
B_do_postloop_src_prep
ADVANCES
do_gray_advance
F_do_advance
B_do_advance
do_src_gray_advance
F_do_dst_advance
F_do_src_advance
B_do_src_advance
B_do_dst_advance
NAMED VARIABLES
variables
*/
/* CONSTANTS */
#define op_repl_src 0
#define op_fn_and 1
#define op_fn_or 2
#define op_fn_xor 3
/* CONDITIONS */
#define aligned_loop src32lbit == dst32lbit
#define F_single_dst_word (dst32lbit + w) <= 32
#define F_postloop_dst_word dst32rbit != 31
#define F_two_preloop_src (src32lbit > dst32lbit) && ((src32lbit + w) > 32)
#define F_src_preloop_normal src32lbit <= dst32lbit
#define F_src_word_in_postloop src32rbit <= dst32rbit
#define B_single_dst_word (dst32lbit + w) <= 32
#define B_two_preloop_src (src32rbit < dst32rbit) && ((src32lbit + w) > (dst32lbit + 1))
#define B_src_preloop_normal src32rbit >= dst32rbit
#define B_postloop_dst_word dst32lbit != 0
#define B_src_word_in_postloop src32lbit >= dst32lbit
/* VARIABLES */
#define F_num_loop ((dst32lbit + w) >> 5) - 1
#define B_num_loop ((w - dst32rbit - 1) > 0) ? ((w - dst32rbit - 1) >> 5) : 0
#define F_preloop_mask ((dst32lbit) ? (~(0xFFFFFFFF << (32 - dst32lbit))) : 0xFFFFFFFF)
#define F_postloop_mask 0xFFFFFFFF << (31 - dst32rbit)
#define B_preloop_mask 0xFFFFFFFF << (31 - dst32rbit)
#define B_postloop_mask ((dst32lbit) ? (~(0xFFFFFFFF << (32 - dst32lbit))) : 0xFFFFFFFF)
/* OTHER */
/************************************************************************/
/* */
/* */
/* */
/* */
/* */
/************************************************************************/
/* TRANSFER LOOP THINGS (assume cnt's value is not used!) */
#define ForInner for (cnt = dstnumL; --cnt >= 0; )
#define DestGetsF(FN) *(dst32addr++) FN shS;
#define DestGetsB(FN) *(dst32addr--) FN shS;
#define GetSrcF newS = *(src32addr++); \
shS = savedS | ((newS >> srcRshift)/* & srcRmask*/); \
savedS = newS << srcLshift;
#define GetSrcCF newS = *(src32addr++); \
shS = ~(savedS | ((newS >> srcRshift) /* & srcRmask */)); \
savedS = newS << srcLshift;
#define GetSrcB newS = *(src32addr--); \
shS = savedS | (newS << srcLshift); \
savedS = (newS >> srcRshift) /* & srcRmask*/;
#define GetSrcCB newS = *(src32addr--); \
shS = ~(savedS | (newS << srcLshift)); \
savedS = (newS >> srcRshift)/* & srcRmask*/;
/************************************************************************/
/* */
/* I N I T I A L I Z A T I O N S */
/* */
/* */
/* */
/************************************************************************/
#define some_init \
num_lines_remaining = h; \
fwd = !backwardflg; \
bb_fast = !(31 & (srcbpl | dstbpl)); \
if (gray) {do_gray_init} \
else if (fwd) {F_do_init} \
else {B_do_init}
#define do_gray_init \
F_dst_init \
gray_src_init
#define F_do_init \
F_dst_init \
F_src_init
#define B_do_init \
B_dst_init \
B_src_init
#define F_dst_init \
if (dx < 0) \
{ \
x32byta = (UNSIGNED)dstbase - ((7 - dx) >> 3); \
} \
else \
{ \
x32byta = (UNSIGNED)dstbase + (dx >> 3); \
} \
x32nbyt = x32byta & 3; \
x32ia = x32byta - x32nbyt; \
dst32addr = (unsigned int *)x32ia; \
dst32lbit = (x32nbyt << 3) + (dx & 7); \
dst32rbit = 31 & (dst32lbit + w - 1); \
OrigDstAddr = dst32addr; \
preloop_mask = F_preloop_mask; \
postloop_mask = F_postloop_mask; \
sdw_mask = preloop_mask & postloop_mask; \
dstnumL = F_num_loop;
#define gray_src_init \
bb_fast = !(dstbpl & 31); \
src32lbit = 15 & sx;
#define F_src_init \
if (sx < 0) \
{ \
x32byta = (UNSIGNED)srcbase - ((7 - sx) >> 3); \
} \
else \
{ \
x32byta = (UNSIGNED)srcbase + (sx >> 3); \
} \
x32nbyt = x32byta & 3; \
x32ia = x32byta - x32nbyt; \
src32addr = (unsigned int *)x32ia; \
src32lbit = (x32nbyt << 3) + (sx & 7); \
src32rbit = 31 & (src32lbit + w - 1); \
srcRshift = 31 & (dst32lbit - src32lbit); \
srcLshift = 31 & (src32lbit - dst32lbit); \
srcRmask = ((srcLshift) ? ~(0xFFFFFFFF << srcLshift) : 0xFFFFFFFF); \
OrigSrcAddr = src32addr;
#define B_dst_init \
abc = dx + w - 1; \
if (abc < 0) \
{ \
x32byta = (UNSIGNED)dstbase - ((7 - abc) >> 3); \
} \
else \
{ \
x32byta = (UNSIGNED)dstbase + (abc >> 3); \
} \
x32nbyt = x32byta & 3; \
x32ia = x32byta - x32nbyt; \
dst32addr = (unsigned int *)x32ia; \
dst32rbit = (x32nbyt << 3) + (abc & 7); \
dst32lbit = 31 & (dst32rbit - w + 1); \
OrigDstAddr = dst32addr; \
preloop_mask = B_preloop_mask; \
postloop_mask = B_postloop_mask; \
sdw_mask = preloop_mask & postloop_mask; \
dstnumL = B_num_loop;
#define B_src_init \
abc = sx + w - 1; \
if (abc < 0) \
{ \
x32byta = (UNSIGNED)srcbase - ((7 - abc) >> 3); \
} \
else \
{ \
x32byta = (UNSIGNED)srcbase + (abc >> 3); \
} \
x32nbyt = x32byta & 3; \
x32ia = x32byta - x32nbyt; \
src32addr = (unsigned int *)x32ia; \
src32rbit = (x32nbyt << 3) + (abc & 7); \
src32lbit = 31 & (src32rbit - w + 1); \
srcRshift = 31 & (dst32lbit - src32lbit); \
srcLshift = 31 & (src32lbit - dst32lbit); \
srcRmask = ((srcLshift) ? ~(0xFFFFFFFF << srcLshift) : 0); \
OrigSrcAddr = src32addr;
/************************************************************************/
/* */
/* S O U R C E & D E S T I N A T I O N S E T - U P S */
/* */
/* */
/* */
/************************************************************************/
/* SETUPS */
#define do_src_gray_setup \
srcLshift = 15 & (src32lbit - dst32lbit); \
shS = *srcbase; \
shS |= (shS << 16); /* replicate the word */ \
shS <<= srcLshift; /* rotate left */ \
shS |= (0xFFFF & (shS >> 16)); /* " " */ \
if (src_comp) shS = ~shS;
#define F_do_src_setup \
if (F_two_preloop_src) \
{ \
newS = *(src32addr++); \
savedS = newS << srcLshift; \
newS = *(src32addr++); \
shS = savedS | ((newS >> srcRshift) & srcRmask); \
savedS = (newS << srcLshift) & ~srcRmask; \
} \
else if (F_src_preloop_normal) \
{ \
newS = *(src32addr++); \
shS = ((newS >> srcRshift) & srcRmask); \
savedS = (newS << srcLshift) & ~srcRmask; \
} \
else \
{ \
newS = *(src32addr++); \
shS = newS << srcLshift; \
} \
if (src_comp) shS = ~shS;
#define B_do_src_setup \
if (B_two_preloop_src) \
{ \
newS = *(src32addr--); \
savedS = (newS >> srcRshift) & srcRmask; \
newS = *(src32addr--); \
shS = savedS | (newS << srcLshift); \
savedS = (newS >> srcRshift) & srcRmask; \
} \
else if (B_src_preloop_normal) \
{ \
newS = *(src32addr--); \
shS = newS << srcLshift; \
savedS = (newS >> srcRshift) & srcRmask; \
} \
else \
{ \
newS = *(src32addr--); \
shS = (newS >> srcRshift) & srcRmask; \
} \
if (src_comp) shS = ~shS;
/************************************************************************/
/* */
/* T R A N S F E R L O O P S */
/* */
/* */
/* */
/************************************************************************/
#define do_gray_transfer \
if (F_single_dst_word) \
{ \
mask = sdw_mask; \
goto do_fpt; \
} \
mask = preloop_mask; \
do_partial_transfer \
dst32addr++; \
switch (op) \
{ register int cnt; \
case op_repl_src: ForInner { DestGetsF(=) } break; \
case op_fn_and: ForInner { DestGetsF(&=) } break; \
case op_fn_or: ForInner { DestGetsF(|=) } break; \
case op_fn_xor: ForInner { DestGetsF(^=) } break; \
} \
if (F_postloop_dst_word) \
{ \
mask = postloop_mask; \
goto do_fpt; \
} \
goto next_line;
#define F_do_transfer \
if (F_single_dst_word) \
{ \
mask = sdw_mask; \
goto do_fpt; \
} \
mask = preloop_mask; \
do_partial_transfer \
dst32addr++; \
if (aligned_loop) \
{ \
if (src_comp) switch (op) \
{ register int cnt; \
case op_repl_src: ForInner {*dst32addr++ = ~*src32addr++;} break; \
case op_fn_and: ForInner {*dst32addr++ &= ~*src32addr++;} break; \
case op_fn_or: ForInner {*dst32addr++ |= ~*src32addr++;} break; \
case op_fn_xor: ForInner {*dst32addr++ ^= ~*src32addr++;} break; \
} \
else switch (op) \
{ register int cnt; \
case op_repl_src: ForInner {*dst32addr++ = *src32addr++;} break; \
case op_fn_and: ForInner {*dst32addr++ &= *src32addr++;} break; \
case op_fn_or: ForInner {*dst32addr++ |= *src32addr++;} break; \
case op_fn_xor: ForInner {*dst32addr++ ^= *src32addr++;} break; \
} \
} \
else \
{ \
if (src_comp) switch (op) \
{ register int cnt; \
case op_repl_src: ForInner {GetSrcCF DestGetsF(=) } break; \
case op_fn_and: ForInner {GetSrcCF DestGetsF(&=) } break; \
case op_fn_or: ForInner {GetSrcCF DestGetsF(|=) } break; \
case op_fn_xor: ForInner {GetSrcCF DestGetsF(^=) } break; \
} \
else switch (op) \
{ register int cnt; \
case op_repl_src: ForInner {GetSrcF DestGetsF(=) } break; \
case op_fn_and: ForInner {GetSrcF DestGetsF(&=) } break; \
case op_fn_or: ForInner {GetSrcF DestGetsF(|=) } break; \
case op_fn_xor: ForInner {GetSrcF DestGetsF(^=) } break; \
} \
} \
if (F_postloop_dst_word) \
{ \
F_do_postloop_src_prep \
mask = postloop_mask; \
goto do_fpt; \
} \
goto next_line;
#define B_do_transfer \
if (B_single_dst_word) \
{ \
mask = sdw_mask; \
goto do_fpt; \
} \
mask = preloop_mask; \
do_partial_transfer \
dst32addr--; \
if (aligned_loop) \
{ \
if (src_comp) switch (op) \
{ register int cnt; \
case op_repl_src: ForInner {*dst32addr-- = ~*src32addr--;} break; \
case op_fn_and: ForInner {*dst32addr-- &= ~*src32addr--;} break; \
case op_fn_or: ForInner {*dst32addr-- |= ~*src32addr--;} break; \
case op_fn_xor: ForInner {*dst32addr-- ^= ~*src32addr--;} break; \
} \
else switch (op) \
{ register int cnt; \
case op_repl_src: ForInner {*dst32addr-- = *src32addr--;} break; \
case op_fn_and: ForInner {*dst32addr-- &= *src32addr--;} break; \
case op_fn_or: ForInner {*dst32addr-- |= *src32addr--;} break; \
case op_fn_xor: ForInner {*dst32addr-- ^= *src32addr--;} break; \
} \
} \
else \
{ \
if (src_comp) switch (op) \
{ register int cnt; \
case op_repl_src: ForInner {GetSrcCB DestGetsB(=) } break; \
case op_fn_and: ForInner {GetSrcCB DestGetsB(&=) } break; \
case op_fn_or: ForInner {GetSrcCB DestGetsB(|=) } break; \
case op_fn_xor: ForInner {GetSrcCB DestGetsB(^=) } break; \
} \
else switch (op) \
{ register int cnt; \
case op_repl_src: ForInner {GetSrcB DestGetsB(=) } break; \
case op_fn_and: ForInner {GetSrcB DestGetsB(&=) } break; \
case op_fn_or: ForInner {GetSrcB DestGetsB(|=) } break; \
case op_fn_xor: ForInner {GetSrcB DestGetsB(^=) } break; \
} \
} \
if (B_postloop_dst_word) \
{ \
B_do_postloop_src_prep \
mask = postloop_mask; \
goto do_fpt; \
} \
goto next_line;
#define do_partial_transfer \
dstdata = *dst32addr; \
dstold = dstdata & ~mask; \
switch (op) \
{ \
case op_repl_src: dstdata = shS; break; \
case op_fn_and: dstdata &= shS; break; \
case op_fn_or: dstdata |= shS; break; \
case op_fn_xor: dstdata ^= shS; break; \
} \
dstdata &= mask; \
dstdata |= dstold; \
*dst32addr = dstdata;
/************************************************************************/
/* */
/* P O S T - L O O P C O D E */
/* */
/* */
/* */
/************************************************************************/
#define F_do_postloop_src_prep \
if (F_src_word_in_postloop) \
{ \
newS = *src32addr; \
shS = savedS | ((newS >> srcRshift) & srcRmask); \
} \
else \
{ \
shS = savedS; \
} \
if (src_comp) shS = ~shS;
#define B_do_postloop_src_prep \
if (B_src_word_in_postloop) \
{ \
newS = *src32addr; \
shS = savedS | (newS << srcLshift); \
} \
else \
{ \
shS = savedS; \
} \
if (src_comp) shS = ~shS;
/************************************************************************/
/* */
/* L O O P - C O U N T E R A D V A N C E C O D E */
/* */
/* */
/* */
/************************************************************************/
#define do_gray_advance \
F_do_dst_advance \
do_src_gray_advance
#define F_do_advance \
F_do_dst_advance \
F_do_src_advance
#define B_do_advance \
B_do_dst_advance \
B_do_src_advance
#define F_do_dst_advance \
if (bb_fast) \
{ \
OrigDstAddr += dstbpl >> 5; \
dst32addr = OrigDstAddr; \
} \
else \
{ \
dst32addr = OrigDstAddr; \
dst32lbit += dstbpl; \
dst32addr += dst32lbit >> 5; \
dst32lbit &= 31; \
dst32rbit = 31 & (dst32lbit + w - 1); \
OrigDstAddr = dst32addr; \
preloop_mask = F_preloop_mask; \
postloop_mask = F_postloop_mask; \
sdw_mask = preloop_mask & postloop_mask; \
dstnumL = F_num_loop; \
}
#define do_src_gray_advance \
if (++curr_gray_line >= num_gray) \
{ \
curr_gray_line = 0; \
srcbase = srcbase - (num_gray - 1); \
} \
else ++srcbase;
#define F_do_src_advance \
if (bb_fast) \
{ \
OrigSrcAddr += srcbpl >> 5; \
src32addr = OrigSrcAddr; \
} \
else \
{ \
src32addr = OrigSrcAddr; \
src32lbit += srcbpl; \
src32addr += src32lbit >> 5; \
src32lbit &= 31; \
src32rbit = 31 & (src32lbit + w - 1); \
OrigSrcAddr = src32addr; \
srcRshift = 31 & (dst32lbit - src32lbit); \
srcLshift = 31 & (src32lbit - dst32lbit); \
srcRmask = ((srcLshift) ? ~(0xFFFFFFFF << srcLshift) : 0xFFFFFFFF); \
}
#define B_do_src_advance \
if (bb_fast) \
{ \
OrigSrcAddr += srcbpl >> 5; \
src32addr = OrigSrcAddr; \
} \
else \
{ \
src32addr = OrigSrcAddr; \
src32rbit += srcbpl; \
if (src32rbit < 0) \
{ \
src32addr -= (31 - src32rbit) >> 5; \
} \
else \
{ \
src32addr += src32rbit >> 5; \
} \
src32rbit &= 31; \
src32lbit = 31 & (src32rbit - w + 1); \
srcRshift = 31 & (dst32lbit - src32lbit); \
srcLshift = 31 & (src32lbit - dst32lbit); \
srcRmask = ((srcLshift) ? ~(0xFFFFFFFF << srcLshift) : 0); \
OrigSrcAddr = src32addr; \
}
#define B_do_dst_advance \
if (bb_fast) \
{ \
OrigDstAddr += dstbpl >> 5; \
dst32addr = OrigDstAddr; \
} \
else \
{ \
dst32addr = OrigDstAddr; \
dst32rbit += dstbpl; \
if (dst32rbit < 0) \
{ \
dst32addr -= (31 - dst32rbit) >> 5; \
} \
else \
{ \
dst32addr += dst32lbit >> 5; \
} \
dst32rbit &= 31; \
dst32lbit = 31 & (dst32rbit - w + 1); \
OrigDstAddr = dst32addr; \
preloop_mask = B_preloop_mask; \
postloop_mask = B_postloop_mask; \
sdw_mask = preloop_mask & postloop_mask; \
dstnumL = B_num_loop; \
}
/************************************************************************/
/* */
/* V A R I A B L E D E C L A R A T I O N S */
/* */
/* This sets up the strictly-internal variables for bitblt. */
/* */
/* However, YOU must set up the control variables that are used */
/* as "arguments" to the bitblt code: */
/* */
/* register DLword *srcbase, *dstbase; */
/* int sx, dx, w, h, srcbpl, dstbpl, backwardflg; */
/* int src_comp, op, gray, num_gray, curr_gray_line; */
/* */
/************************************************************************/
#define variables \
int num_lines_remaining, temp; \
int dstnumL, src32lbit, srcLshift, dst32lbit; \
unsigned int srcRmask, dstold, dstdata, mask; \
UNSIGNED x32byta, x32nbyt, x32ia; \
int abc, dst32rbit, src32rbit, fwd; \
unsigned int *OrigSrcAddr, *OrigDstAddr; \
int bb_fast; \
unsigned int preloop_mask, postloop_mask, sdw_mask; \
register unsigned int *dst32addr, *src32addr; \
register unsigned int shS, savedS, newS; \
register int srcRshift;
/************************************************************************/
/* */
/* n e w _ b i t b l t _ c o d e */
/* */
/* Generic bitblt-code macro; generates bitblt code for the */
/* general cases. Requires a number of symbols be defined */
/* by the calling code, in lieu of arguments: */
/* */
/* srcbase */
/* dstbase */
/* srcbpl */
/* dstbpl */
/* backwardflg */
/* sx, dx */
/* w, h */
/* */
/************************************************************************/
#define new_bitblt_code \
{ \
variables \
some_init \
while (num_lines_remaining-- > 0) \
{ /* begin line loop */ \
if (gray) \
{ \
do_src_gray_setup \
do_gray_transfer \
} \
if (fwd) \
{ \
F_do_src_setup \
F_do_transfer \
} \
{ \
B_do_src_setup \
B_do_transfer \
} \
do_fpt: \
{ \
do_partial_transfer \
goto next_line; \
} \
next_line: \
if (gray) \
{ \
do_gray_advance \
continue; \
} \
if (fwd) \
{ \
F_do_advance \
continue; \
} \
{ \
B_do_advance \
continue; \
} \
} /* end line loop */ \
}
/************************************************************************/
/* */
/* n e w _ g r a y _ b i t b l t _ c o d e */
/* */
/* Handles texture case of bitblt, for BLTSHADE functions. */
/* */
/************************************************************************/
#define new_gray_bitblt_code \
{ \
variables \
some_init \
while (num_lines_remaining-- > 0) \
{ /* begin line loop */ \
do_src_gray_setup \
do_gray_transfer \
do_fpt: \
do_partial_transfer \
next_line: \
do_gray_advance \
} /* end line loop */ \
}
/************************************************************************/
/* */
/* n e w _ c h a r _ b i t b l t _ c o d e */
/* */
/* Optimized slightly for bltchar. */
/* */
/************************************************************************/
#define new_char_bitblt_code \
{ \
variables \
some_init \
while (num_lines_remaining-- > 0) \
{ /* begin line loop */ \
F_do_src_setup \
F_do_transfer \
do_fpt: \
do_partial_transfer \
next_line: \
F_do_advance \
} /* end line loop */ \
}

1
inc/bbt386i.h Executable file
View File

@@ -0,0 +1 @@
/* $Id: bbt386i.h,v 1.2 1999/01/03 02:05:54 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */

95
inc/bitblt.h Executable file
View File

@@ -0,0 +1,95 @@
/* $Id: bitblt.h,v 1.2 1999/01/03 02:05:54 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
* Copyright (C) 1988 by Fuji Xerox Co., Ltd. All rights reserved.
*
* File : bitblt.h
*
* Author : Osamu Nakamura
*
*/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
#define REPLACE 0
#define PAINT 2
#define ERASE 1
#define INVERT 3
#define ERROR PIX_SRC
#define PixOperation( SRCTYPE, OPERATION ) \
( SRCTYPE == ERASE ? \
(OPERATION == REPLACE ? PIX_NOT(PIX_SRC) : \
(OPERATION == PAINT ? PIX_NOT(PIX_SRC) | PIX_DST : \
(OPERATION == ERASE ? PIX_NOT(PIX_SRC) & PIX_DST : \
(OPERATION == INVERT ? PIX_NOT(PIX_SRC) ^ PIX_DST : ERROR)))) : \
/* SRCTYPE == INPUT */ \
(OPERATION == REPLACE ? PIX_SRC : \
(OPERATION == PAINT ? PIX_SRC | PIX_DST : \
(OPERATION == ERASE ? PIX_SRC & PIX_DST : \
(OPERATION == INVERT ? PIX_SRC ^ PIX_DST : ERROR)))))
extern DLword *EmMouseX68K, *EmMouseY68K;
extern int DisplayRasterWidth;
#define XDELTA 50
#define YDELTA 50
#define MOUSEXL ((int)*EmMouseX68K - XDELTA)
#define MOUSEXR ((int)*EmMouseX68K + XDELTA)
#define MOUSEYL ((int)*EmMouseY68K - YDELTA)
#define MOUSEYH ((int)*EmMouseY68K + YDELTA)
#ifdef DOS
#define HideCursor { (currentdsp->mouse_invissible)(currentdsp, IOPage68K); }
#define ShowCursor { (currentdsp->mouse_vissible)(IOPage68K->dlmousex, \
IOPage68K->dlmousey); }
#elif OLD_CURSOR
extern struct winlock DisplayLockArea;
#define HideCursor \
ioctl( LispWindowFd, WINLOCKSCREEN, &DisplayLockArea)
#define ShowCursor \
ioctl( LispWindowFd, WINUNLOCKSCREEN, &DisplayLockArea)
#else
extern DLword *EmCursorX68K,*EmCursorY68K;
#define HideCursor { taking_mouse_down();}
#define ShowCursor { taking_mouse_up(*EmCursorX68K,*EmCursorY68K);}
#endif
#define refresh_CG6 \
HideCursor; \
pr_rop(ColorDisplayPixrect, 0, 0, displaywidth, displayheight, \
PIX_SRC,DisplayRegionPixrect, 0, 0); \
ShowCursor;
#define clear_CG6 \
HideCursor; \
pr_rop(ColorDisplayPixrect, 0, 0, displaywidth, displayheight, \
PIX_CLR, ColorDisplayPixrect, 0, 0); \
ShowCursor;
/* Macro for locking and unlocking screen to prevent multiple updates */
#ifdef DOS
#define LOCKSCREEN currentdsp->device.locked++;
#define UNLOCKSCREEN currentdsp->device.locked--;
#else
#define LOCKSCREEN ScreenLocked = T;
#define UNLOCKSCREEN ScreenLocked = NIL;
#endif /* DOS */

144
inc/cdrom.h Executable file
View File

@@ -0,0 +1,144 @@
/* $Id: cdrom.h,v 1.2 1999/01/03 02:05:54 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/***********************************
file: cdrom_audio.h
***********************************/
/* function number for CD audio functions */
#define CD_OPEN 1
#define CD_CLOSE 2
#define CD_READ 3
#define CD_DISK_INFO 4
#define CD_TRACK_INFO 5
#define CD_START 6
#define CD_STOP 7
#define CD_PLAY 8
#define CD_Q_READ 9
#define CD_PAUSE 10
#define CD_RESUME 11
#define CD_VOLUME 12
#define CD_EJECT 13
/* function numbers for CD-ROM */
#define CDROM_INIT_DRV 1
#define CDROM_KEN_INT 2
#define CDROM_CHOSAKU 3
#define CDROM_MIKANA 4
#define CDROM_MIKANAT 5
#define CDROM_HYOKI 6
#define CDROM_HYOKIT 7
#define CDROM_EIJI 8
#define CDROM_EIJIT 9
#define CDROM_SUJI 10
#define CDROM_SUJIT 11
#define CDROM_ZENKANA 12
#define CDROM_ZENKANAT 13
#define CDROM_ZENKANJ 14
#define CDROM_ZENKANJT 15
#define CDROM_ZENEIJI 16
#define CDROM_ZENEIJIIT 17
#define CDROM_KOHKANA 18
#define CDROM_KOHKANAT 19
#define CDROM_KOHKANJ 20
#define CDROM_KOHKANJT 21
#define CDROM_KOHEIJI 22
#define CDROM_KOHEIJIT 23
#define CDROM_ZUHAN 24
#define CDROM_JYOKEN 25
#define CDROM_JYOKENT 26
#define CDROM_MENU 27
#define CDROM_AUDIOST 28
#define CDROM_AUDIOED 29
#define CDROM_AUDIOQ_GET 30
#define CDROM_GAIJI 31
#define CDROM_ZENGO 32
#define CDROM_KEIZOKU 33
#define CDROM_SYURYO 34
typedef unsigned char BYTE;
typedef unsigned long DWORD;
/*
extern DWORD CDred_lbn();
extern void CDlbn_red();
extern int CDopen();
extern int CDclose();
extern int CDread();
extern int CDdisk_info();
extern int CDtrack_info();
extern int CDstart();
extern int CDstop();
extern int CDplay();
extern int CDqread();
extern int CDpause();
extern int CDresume();
extern int CDvolume();
extern int CDeject();
*/
#define LispStringToCString(Lisp, C, MaxLen) \
{ \
OneDArray *arrayp; \
char *base, *dp; \
short *sbase; \
int i, length; \
arrayp = (OneDArray *)(Addr68k_from_LADDR(Lisp)); \
length = min(MaxLen, arrayp->totalsize); \
switch(arrayp->typenumber) \
{ \
case THIN_CHAR_TYPENUMBER: \
base = ((char *)(Addr68k_from_LADDR(arrayp->base))) \
+ ((int)(arrayp->offset)); \
strncpy(C, base, length); \
C[length] = '\0'; \
break; \
\
case FAT_CHAR_TYPENUMBER: \
sbase = ((short *)(Addr68k_from_LADDR(arrayp->base))) \
+ ((int)(arrayp->offset)); \
for(i=0,dp=C;i<(length);i++) \
*dp++ = (char)(*sbase++); \
*dp = '\0'; \
break; \
default: \
error("LispStringToCString can not handle\n"); \
} \
}
#define LispStringToCString2(Lisp, C, MaxLen) \
{ \
OneDArray *arrayp; \
char *base, *dp; \
short *sbase; \
int i, length; \
arrayp = (OneDArray *)(Addr68k_from_LADDR(Lisp)); \
length = min(MaxLen, arrayp->totalsize); \
switch(arrayp->typenumber) \
{ \
case THIN_CHAR_TYPENUMBER: \
base = ((char *)(Addr68k_from_LADDR(arrayp->base))) \
+ ((int)(arrayp->offset)); \
strncpy(C, base, length); \
C[length] = '\0'; \
break; \
\
case FAT_CHAR_TYPENUMBER: \
sbase = ((short *)(Addr68k_from_LADDR(arrayp->base))) \
+ ((int)(arrayp->offset)); \
for(i=0,dp=C;i<(length);i++) { \
*dp++ = (char)(*sbase / 256 ); \
*dp++ = (char)(*sbase % 256 ); \
sbase++; \
} \
*dp = '\0'; \
break; \
default: \
error("LispStringToCString can not handle\n"); \
} \
}
#define min(a, b) ((a <= b)?a:b)

493
inc/cell.h Executable file
View File

@@ -0,0 +1,493 @@
/* $Id: cell.h,v 1.2 1999/01/03 02:05:55 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/**********************************************************************/
/*
File Name : cell.h
Cell Manipulate Macros
Date : December 16, 1986
Edited by : Takeshi Shimizu
*/
/**********************************************************************/
/* CONS CELL (LISTP) definitions moved to lispemulater.h */
/* This Macro may produce a pointer that points CAR cell */
/* On 68010,68000 This Macro does not effect */
#ifdef NEWCDRCODING
#define CARFIELD(x) ((int)x & 0x0fffffff)
/* CDR-Codes defs */
#define CDR_ONPAGE 8
#define CDR_NIL 8
#define CDR_INDIRECT 0
#define CDR_MAXINDIRECT 7
#define CONSPAGE_LAST 0xffffffff /* dummy "last cons page" */
#else
#define CARFIELD(x) ((int)x & 0x00ffffff)
/* CDR-Codes defs */
#define CDR_ONPAGE 128
#define CDR_NIL 128
#define CDR_INDIRECT 0
#define CDR_MAXINDIRECT 127
#define CONSPAGE_LAST 0xffff
#endif /* NEWCDRCODING */
/************************************************************************/
/* */
/* CONSPAGE describes the free-space management fields at the */
/* beginning of a cons page -- # of free cells on the page, etc. */
/* */
/************************************************************************/
#ifndef BYTESWAP
#ifdef NEWCDRCODING
struct
conspage
{
/* used to be ifdef NEWNEW */
LispPTR cell6; /* cell 6 in shifted world */
LispPTR cell4; /* cell 4 in shifted world */
/* used to endif NEWNEW here */
unsigned count: 8; /* free cells on this page */
unsigned next_cell: 8; /* next free cell in chain */
unsigned nil:16;
LispPTR next_page; /* next cons page, or 0 if none */
};
#else
struct
conspage
{
unsigned count : 8 ;
unsigned next_cell :8 ;
DLword next_page ;
};
#endif /* NEWCDRCODING */
#else
/* byte-swapped version */
#ifdef NEWCDRCODING
struct
conspage
{
LispPTR cell6; /* cell 6 in shifted world */
LispPTR cell4; /* cell 4 in shifted world */
unsigned nil: 16;
unsigned next_cell: 8;
unsigned count: 8;
LispPTR next_page;
};
#else
struct
conspage
{
DLword next_page ;
unsigned next_cell :8 ;
unsigned count : 8 ;
};
#endif /* NEWCDRCODING */
#endif /* BYTESWAP */
/* Following MACROs for Conspage */
/* lisp_ptr is LISP pointer, returns 68k ptr points struct conspage obj */
#define Get_ConsPageBase(lisp_ptr) \
(struct conspage *)Addr68k_from_LPAGE(POINTER_PAGEBASE(lisp_ptr))
#define GetNewCell_68k(conspage68k) \
(ConsCell *)(((DLword *)(conspage68k)) \
+ (unsigned)((conspage68k)->next_cell) )
/* page : LISP page */
#define GetCONSCount(page) \
(((struct conspage *)Addr68k_from_LPAGE(page))->count)
#ifndef BYTESWAP
/* For chaining together free cons cells on a page */
typedef struct freec
{
unsigned next_free: 8; /* next free cell on this page */
unsigned nil: 24;
} freecons;
#else
typedef struct freec
{
unsigned nil: 24;
unsigned next_free: 8;
} freecons;
#endif /* BYTESWAP */
#define FREECONS(page,offset) ((freecons *) ((DLword *)page + offset))
/************************************************************************/
/* */
/* S Y M B O L D E F S */
/* */
/* */
/* */
/************************************************************************/
#ifndef BYTESWAP
/************************************************/
/* Definitions for normal byte-order machines */
/************************************************/
#ifdef BIGVM
/* Definition of a new-atom, where all the cells are in one object */
typedef
struct new_atom
{
unsigned dfccodep: 1 ; /* DEFCELL FLAGS */
unsigned dffastp: 1 ;
unsigned dfargtype: 2 ;
unsigned pncell: 28; /* pointer to the pname itself */
unsigned nil2: 4; /* top 4 bits of value cell */
unsigned valcell: 28; /* pointer to the top-level value */
unsigned nil3: 4; /* top 4 bits of definition cell */
unsigned defcell: 28; /* pointer to function definition */
unsigned nil4: 4; /* */
unsigned plcell: 28; /* pointer to property list */
unsigned pnpkg: 8; /* package */
unsigned dfnil1: 4 ; /* DEFCELL FLAGS */
unsigned dfpseudo: 1 ;
unsigned dfswapped: 1 ; /* T for native-order fn opcodes */
unsigned dfnil: 2 ;
unsigned plunused: 1; /* PROPLIST FLAGS */
unsigned plgensymp: 1;
unsigned plfatpnamep: 1;
unsigned plnil: 5;
unsigned nil5: 8; /* Fill out last byte of final cell */
} NewAtom;
/* DEFs for DEFINITIONCELL */
typedef
struct definition_cell
{
unsigned ccodep : 1 ;
unsigned fastp : 1 ;
unsigned argtype : 2 ;
unsigned defpointer : 28;
LispPTR nil_PL; /* skip the proplist cell */
unsigned nilpkg:8; /* skip pkg byte */
unsigned nil2 : 4 ;
unsigned pseudocodep : 1 ;
unsigned byteswapped : 1 ; /* T for native-order fn opcodes */
unsigned nil_last: 18;
} DefCell ;
typedef
struct pname_cell
{
unsigned nil : 4 ;
unsigned pnamebase : 28 ;
LispPTR nil_val;
LispPTR nil_def;
LispPTR nil_plist;
unsigned pkg_index : 8 ;
unsigned nil2: 24;
} PNCell ;
typedef
struct proplist_cell
{
unsigned nil: 4;
unsigned propbase: 28;
unsigned nilpkg: 8;
unsigned nildef: 8;
unsigned unused: 1;
unsigned gensymp: 1;
unsigned fatpnamep: 1;
unsigned nil2: 5;
unsigned nil3: 8;
} PLCell;
struct xpointer{
unsigned flags:4;
unsigned addr:28;
};
#else /* not BIGVM */
/* DEFs for DEFINITIONCELL */
typedef
struct definition_cell
{
unsigned ccodep : 1 ;
unsigned fastp : 1 ;
unsigned argtype : 2 ;
unsigned pseudocodep : 1 ;
unsigned byteswapped : 1 ; /* T for native-order fn opcodes */
unsigned nil : 2 ;
unsigned defpointer : 24;
} DefCell ;
typedef
struct pname_cell
{
unsigned pkg_index : 8 ;
unsigned pnamebase : 24 ;
} PNCell ;
typedef
struct proplist_cell
{
unsigned unused: 1;
unsigned gensymp: 1;
unsigned fatpnamep: 1;
unsigned nil: 5;
unsigned propbase: 24;
} PLCell;
struct xpointer{
unsigned flags:8;
unsigned addr:24;
};
#endif /* BIGVM */
#else
/************************************************/
/* Definitions for byte-swapped machines */
/************************************************/
#ifdef BIGVM
/* Definition of a new-atom, where all the cells are in one object */
typedef
struct new_atom
{
unsigned pncell: 28; /* pointer to the pname itself */
unsigned dfargtype: 2 ;
unsigned dffastp: 1 ;
unsigned dfccodep: 1 ; /* DEFCELL FLAGS */
unsigned valcell: 28; /* pointer to the top-level value */
unsigned nil2: 4; /* top 4 bits of value cell */
unsigned defcell: 28; /* pointer to function definition */
unsigned nil3: 4; /* top 4 bits of definition cell */
unsigned plcell: 28; /* pointer to property list */
unsigned nil4: 4; /* */
unsigned nil5: 8; /* Fill out last byte of final cell */
unsigned plnil: 5;
unsigned plfatpnamep: 1;
unsigned plgensymp: 1;
unsigned plunused: 1; /* PROPLIST FLAGS */
unsigned dfnil: 2 ;
unsigned dfswapped: 1 ; /* T for native-order fn opcodes */
unsigned dfpseudo: 1 ;
unsigned dfnil1: 4 ; /* DEFCELL FLAGS */
unsigned pnpkg: 8; /* package */
} NewAtom;
/* DEFs for DEFINITIONCELL */
typedef
struct definition_cell
{
unsigned defpointer : 28;
unsigned argtype : 2 ;
unsigned fastp : 1 ;
unsigned ccodep : 1 ;
LispPTR nil_PL; /* skip the proplist cell */
unsigned nil_last: 18;
unsigned byteswapped : 1 ; /* T for native-order fn opcodes */
unsigned pseudocodep : 1 ;
unsigned nil2 : 4 ;
unsigned nilpkg:8; /* skip pkg byte */
} DefCell ;
typedef
struct pname_cell
{
unsigned pnamebase : 28 ;
unsigned nil : 4 ;
LispPTR nil_val;
LispPTR nil_def;
LispPTR nil_plist;
unsigned nil2: 24;
unsigned pkg_index : 8 ;
} PNCell ;
typedef
struct proplist_cell
{
unsigned propbase: 28;
unsigned nil: 4;
unsigned nil3: 8;
unsigned nil2: 5;
unsigned fatpnamep: 1;
unsigned gensymp: 1;
unsigned unused: 1;
unsigned nildef: 8;
unsigned nilpkg: 8;
} PLCell;
struct xpointer{
unsigned addr:28;
unsigned flags:4;
};
#else /* BIGVM */
/* DEFs for DEFINITIONCELL */
typedef
struct definition_cell
{
unsigned defpointer : 24;
unsigned nil : 2 ;
unsigned byteswapped : 1 ; /* T if opcodes are native-order */
unsigned pseudocodep : 1 ;
unsigned argtype : 2 ;
unsigned fastp : 1 ;
unsigned ccodep : 1 ;
} DefCell ;
typedef
struct pname_cell
{
unsigned pnamebase : 24 ;
unsigned pkg_index : 8 ;
} PNCell ;
typedef
struct proplist_cell
{
unsigned propbase: 24;
unsigned nil: 5;
unsigned fatpnamep: 1;
unsigned gensymp: 1;
unsigned unused: 1;
} PLCell;
struct xpointer
{
unsigned addr:24;
unsigned flags:8;
};
#endif /* BIGVM */
#endif /* BYTESWAP */
struct
cadr_cell
{
LispPTR car_cell; /* Lisp address (word addressing) */
LispPTR cdr_cell; /* Lisp address (word addressing) */
};
/************************************************************************/
/* */
/* Access to the parts of a SYMBOL: Pname, Definition, Value, */
/* and property list. */
/* */
/* */
/* */
/* */
/************************************************************************/
#ifndef BIGATOMS
#define GetDEFCELL68k(index) ((LispPTR *)Defspace + (index) )
#define GetVALCELL68k(index) ((LispPTR *)Valspace + (index))
#define GetPnameCell(index) ((LispPTR *)Pnamespace + (index))
#define GetPropCell(index) ((LispPTR *)Plistspace + (index))
/* Good only for old-style LITATOMS */
#define GetDEFCELLlitatom(index) ((LispPTR *)Defspace + (index) )
#define GetVALCELLlitatom(index) ((LispPTR *)Valspace + (index))
#define GetPnameCelllitatom(index) ((LispPTR *)Pnamespace + (index))
#define GetPropCelllitatom(index) ((LispPTR *)Plistspace + (index))
#else
/* Good for old LITATOMS and new NEW-ATOMs */
#define GetDEFCELL68k(index) (((index & SEGMASK) != 0) ? \
(LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_DEFN_OFFSET) \
: GetDEFCELLlitatom(index) )
#define GetVALCELL68k(index) (((index & SEGMASK) != 0) ? \
(LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_VALUE_OFFSET) \
: GetVALCELLlitatom(index))
#define GetPnameCell(index) (((index & SEGMASK) != 0) ? \
(LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_PNAME_OFFSET) \
: GetPnameCelllitatom(index))
#define GetPropCell(index) (((index & SEGMASK) != 0) ? \
(LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_PLIST_OFFSET) \
: GetPropCelllitatom(index))
/* Good only for old-style LITATOMS */
#ifdef BIGVM
#define GetDEFCELLlitatom(index)\
((LispPTR *)AtomSpace + (5*(index))+NEWATOM_DEFN_PTROFF)
#define GetVALCELLlitatom(index) \
((LispPTR *)AtomSpace + (5*(index))+NEWATOM_VALUE_PTROFF)
#define GetPnameCelllitatom(index) \
((LispPTR *)AtomSpace + (5*(index))+NEWATOM_PNAME_PTROFF)
#define GetPropCelllitatom(index) \
((LispPTR *)AtomSpace + (5*(index))+NEWATOM_PLIST_PTROFF)
#else /* BIGVM not set, so use old name-space format */
#define GetDEFCELLlitatom(index) ((LispPTR *)Defspace + (index) )
#define GetVALCELLlitatom(index) ((LispPTR *)Valspace + (index))
#define GetPnameCelllitatom(index) ((LispPTR *)Pnamespace + (index))
#define GetPropCelllitatom(index) ((LispPTR *)Plistspace + (index))
#endif
/* Good only for new-style NEW-ATOMs */
#define GetDEFCELLnew(index) (LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_DEFN_OFFSET)
#define GetVALCELLnew(index) (LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_VALUE_OFFSET)
#define GetPnameCellnew(index) (LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_PNAME_OFFSET)
#define GetPropCellnew(index) (LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_PLIST_OFFSET)
#endif /* BIGATOMS */
/* When cadr() function is called, type check should be done. */
#define S_N_CHECKANDCADR(sour, dest, tos) \
{register LispPTR parm = sour; \
if(GetTypeNumber(parm) != TYPE_LISTP){ \
ERROR_EXIT(tos); \
}else \
dest = cadr(parm); \
}

467
inc/cell.h% Executable file
View File

@@ -0,0 +1,467 @@
/* %Z% %M% Version %I% (%G%). copyright Venue */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/**********************************************************************/
/*
File Name : cell.h
Cell Manipulate Macros
Date : December 16, 1986
Edited by : Takeshi Shimizu
*/
/**********************************************************************/
/* CONS CELL (LISTP) definitions moved to lispemulater.h */
/* This Macro may produce the CDR code */
#define CDRCODE(x) LRSH (((int)x & 0x0ff000000) , 24)
/* This Macro may produce a pointer that points CAR cell */
/* On 68010,68000 This Macro does not effect *
#define CARFIELD(x) ((int)x & 0x00ffffff)
/* CDR-Codes defs */
#define CDR_ONPAGE 128
#define CDR_NIL 128
#define CDR_INDIRECT 0
#define CDR_MAXINDIRECT 127
/* short CarCdrError ; */
/************************************************************************/
/* */
/* CONSPAGE describes the free-space management fields at the */
/* beginning of a cons page -- # of free cells on the page, etc. */
/* */
/************************************************************************/
#ifndef BYTESWAP
#ifdef NEWCDRCODE
struct
conspage
{
unsigned count: 8; /* free cells on this page */
unsigned next_cell: 8; /* next free cell in chain */
unsigned nil:16;
LispPTR next_page; /* next cons page, or 0 if none */
};
#else
struct
conspage
{
unsigned count : 8 ;
unsigned next_cell :8 ;
DLword next_page ;
};
#endif /* NEWCDRCODE */
#else
/* byte-swapped version */
#ifdef NEWCDRCODE
struct
conspage
{
unsigned nil: 16;
unsigned next_cell: 8;
unsigned count: 8;
LispPTR next_page;
};
#else
struct
conspage
{
DLword next_page ;
unsigned next_cell :8 ;
unsigned count : 8 ;
};
#endif /* NEWCDRCODE */
#endif /* BYTESWAP */
/* Following MACROs for Conspage */
/* lisp_ptr is LISP pointer, returns 68k ptr points struct conspage obj */
#define Get_ConsPageBase(lisp_ptr) \
(struct conspage *)Addr68k_from_LPAGE(POINTER_PAGEBASE(lisp_ptr))
#define GetNewCell_68k(conspage68k) \
(ConsCell *)(((DLword *)(conspage68k)) \
+ (unsigned)((conspage68k)->next_cell) )
/* page : LISP page */
#define GetCONSCount(page) \
(((struct conspage *)Addr68k_from_LPAGE(page))->count)
#ifndef BYTESWAP
/* For chaining together free cons cells on a page */
struct freecons
{
unsigned next_free: 8; /* next free cell on this page */
unsigned nil: 24;
}
#else
struct freecons
{
unsigned next_free: 8;
unsigned nil: 24;
}
#endif /* BYTESWAP */
#ifndef BYTESWAP
/************************************************/
/* Definitions for normal byte-order machines */
/************************************************/
#ifdef BIGVM2
/* Definition of a new-atom, where all the cells are in one object */
typedef
struct new_atom
{
unsigned dfccodep: 1 ; /* DEFCELL FLAGS */
unsigned dffastp: 1 ;
unsigned dfargtype: 2 ;
unsigned pncell: 28; /* pointer to the pname itself */
unsigned nil2: 4; /* top 4 bits of value cell */
unsigned valcell: 28; /* pointer to the top-level value */
unsigned nil3: 4; /* top 4 bits of definition cell */
unsigned defcell: 28; /* pointer to function definition */
unsigned nil4: 4; /* */
unsigned plcell: 28; /* pointer to property list */
unsigned pnpkg: 8; /* package */
unsigned dfnil1: 4 ; /* DEFCELL FLAGS */
unsigned dfpseudo: 1 ;
unsigned dfswapped: 1 ; /* T for native-order fn opcodes */
unsigned dfnil: 2 ;
unsigned plunused: 1; /* PROPLIST FLAGS */
unsigned plgensymp: 1;
unsigned plfatpnamep: 1;
unsigned plnil: 5;
unsigned nil5: 8; /* Fill out last byte of final cell */
} NewAtom;
/* DEFs for DEFINITIONCELL */
typedef
struct definition_cell
{
unsigned ccodep : 1 ;
unsigned fastp : 1 ;
unsigned argtype : 2 ;
unsigned defpointer : 28;
LispPTR nil_PL; /* skip the proplist cell */
unsigned nilpkg:8; /* skip pkg byte */
unsigned nil2 : 4 ;
unsigned pseudocodep : 1 ;
unsigned byteswapped : 1 ; /* T for native-order fn opcodes */
unsigned nil_last: 18;
} DefCell ;
typedef
struct pname_cell
{
unsigned nil : 4 ;
unsigned pnamebase : 28 ;
LispPTR nil_val;
LispPTR nil_def;
LispPTR nil_plist;
unsigned pkg_index : 8 ;
unsigned nil2: 24;
} PNCell ;
typedef
struct proplist_cell
{
unsigned nil: 4;
unsigned propbase: 28;
unsigned nilpkg: 8;
unsigned nildef: 8;
unsigned unused: 1;
unsigned gensymp: 1;
unsigned fatpnamep: 1;
unsigned nil2: 5;
unsigned nil3: 8;
} PLCell;
struct xpointer{
unsigned flags:4;
unsigned addr:28;
};
#elif BIGVM
/* Definition of a new-atom, where all the cells are in one object */
typedef
struct new_atom
{
unsigned dfccodep: 1 ; /* DEFCELL FLAGS */
unsigned dffastp: 1 ;
unsigned dfargtype: 2 ;
unsigned nil1:4;
unsigned pncell: 24; /* pointer to the pname itself */
unsigned nil2: 8; /* top 4 bits of value cell */
unsigned valcell: 24; /* pointer to the top-level value */
unsigned nil3: 8; /* top 4 bits of definition cell */
unsigned defcell: 24; /* pointer to function definition */
unsigned nil4: 8; /* */
unsigned plcell: 24; /* pointer to property list */
unsigned pnpkg: 8; /* package */
unsigned dfnil1: 4 ; /* DEFCELL FLAGS */
unsigned dfpseudo: 1 ;
unsigned dfswapped: 1 ; /* T for native-order fn opcodes */
unsigned dfnil: 2 ;
unsigned plunused: 1; /* PROPLIST FLAGS */
unsigned plgensymp: 1;
unsigned plfatpnamep: 1;
unsigned plnil: 5;
unsigned nil5: 8; /* Fill out last byte of final cell */
} NewAtom;
/* DEFs for DEFINITIONCELL */
typedef
struct definition_cell
{
unsigned ccodep : 1 ;
unsigned fastp : 1 ;
unsigned argtype : 2 ;
unsigned nil1:4;
unsigned defpointer : 24;
LispPTR nil_PL; /* skip the proplist cell */
unsigned nilpkg:8; /* skip pkg byte */
unsigned nil2 : 4 ;
unsigned pseudocodep : 1 ;
unsigned byteswapped : 1 ; /* T for native-order fn opcodes */
unsigned nil_last: 18;
} DefCell ;
typedef
struct pname_cell
{
unsigned nil : 8 ;
unsigned pnamebase : 24 ;
LispPTR nil_val;
LispPTR nil_def;
LispPTR nil_plist;
unsigned pkg_index : 8 ;
unsigned nil2: 24;
} PNCell ;
typedef
struct proplist_cell
{
unsigned nil: 8;
unsigned propbase: 24;
unsigned nilpkg: 8;
unsigned nildef: 8;
unsigned unused: 1;
unsigned gensymp: 1;
unsigned fatpnamep: 1;
unsigned nil2: 5;
unsigned nil3: 8;
} PLCell;
struct xpointer{
unsigned flags:8;
unsigned addr:24;
};
#else /* not BIGVM */
/* DEFs for DEFINITIONCELL */
typedef
struct definition_cell
{
unsigned ccodep : 1 ;
unsigned fastp : 1 ;
unsigned argtype : 2 ;
unsigned pseudocodep : 1 ;
unsigned byteswapped : 1 ; /* T for native-order fn opcodes */
unsigned nil : 2 ;
unsigned defpointer : 24;
} DefCell ;
typedef
struct pname_cell
{
unsigned pkg_index : 8 ;
unsigned pnamebase : 24 ;
} PNCell ;
typedef
struct proplist_cell
{
unsigned unused: 1;
unsigned gensymp: 1;
unsigned fatpnamep: 1;
unsigned nil: 5;
unsigned propbase: 24;
} PLCell;
struct xpointer{
unsigned flags:8;
unsigned addr:24;
};
#endif /* BIGVM */
#else
/************************************************/
/* Definitions for byte-swapped machines */
/************************************************/
/* DEFs for DEFINITIONCELL */
typedef
struct definition_cell
{
unsigned defpointer : 24;
unsigned nil : 2 ;
unsigned byteswapped : 1 ; /* T if opcodes are native-order */
unsigned pseudocodep : 1 ;
unsigned argtype : 2 ;
unsigned fastp : 1 ;
unsigned ccodep : 1 ;
} DefCell ;
typedef
struct pname_cell
{
unsigned pnamebase : 24 ;
unsigned pkg_index : 8 ;
} PNCell ;
typedef
struct proplist_cell
{
unsigned propbase: 24;
unsigned nil: 5;
unsigned fatpnamep: 1;
unsigned gensymp: 1;
unsigned unused: 1;
} PLCell;
struct xpointer
{
unsigned addr:24;
unsigned flags:8;
};
#endif /* BYTESWAP */
struct
cadr_cell
{
LispPTR car_cell; /* Lisp address (word addressing) */
LispPTR cdr_cell; /* Lisp address (word addressing) */
};
/************************************************************************/
/* */
/* Access to the parts of a SYMBOL: Pname, Definition, Value, */
/* and property list. */
/* */
/* */
/* */
/* */
/************************************************************************/
#ifndef BIGATOMS
#define GetDEFCELL68k(index) ((LispPTR *)Defspace + (index) )
#define GetVALCELL68k(index) ((LispPTR *)Valspace + (index))
#define GetPnameCell(index) ((LispPTR *)Pnamespace + (index))
#define GetPropCell(index) ((LispPTR *)Plistspace + (index))
/* Good only for old-style LITATOMS */
#define GetDEFCELLlitatom(index) ((LispPTR *)Defspace + (index) )
#define GetVALCELLlitatom(index) ((LispPTR *)Valspace + (index))
#define GetPnameCelllitatom(index) ((LispPTR *)Pnamespace + (index))
#define GetPropCelllitatom(index) ((LispPTR *)Plistspace + (index))
#else
/* Good for old LITATOMS and new NEW-ATOMs */
#define GetDEFCELL68k(index) (((index & 0xFF0000) != 0) ? \
(LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_DEFN_OFFSET) \
: GetDEFCELLlitatom(index) )
#define GetVALCELL68k(index) (((index & 0xFF0000) != 0) ? \
(LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_VALUE_OFFSET) \
: GetVALCELLlitatom(index))
#define GetPnameCell(index) (((index & 0xFF0000) != 0) ? \
(LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_PNAME_OFFSET) \
: GetPnameCelllitatom(index))
#define GetPropCell(index) (((index & 0xFF0000) != 0) ? \
(LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_PLIST_OFFSET) \
: GetPropCelllitatom(index))
/* Good only for old-style LITATOMS */
#ifdef BIGVM
#define GetDEFCELLlitatom(index)\
((LispPTR *)Pnamespace + (5*(index))+NEWATOM_DEFN_PTROFF)
#define GetVALCELLlitatom(index) \
((LispPTR *)Pnamespace + (5*(index))+NEWATOM_VALUE_PTROFF)
#define GetPnameCelllitatom(index) \
((LispPTR *)Pnamespace + (5*(index))+NEWATOM_PNAME_PTROFF)
#define GetPropCelllitatom(index) \
((LispPTR *)Pnamespace + (5*(index))+NEWATOM_PLIST_PTROFF)
#else /* BIGVM not set, so use old name-space format */
#define GetDEFCELLlitatom(index) ((LispPTR *)Defspace + (index) )
#define GetVALCELLlitatom(index) ((LispPTR *)Valspace + (index))
#define GetPnameCelllitatom(index) ((LispPTR *)Pnamespace + (index))
#define GetPropCelllitatom(index) ((LispPTR *)Plistspace + (index))
#endif
/* Good only for new-style NEW-ATOMs */
#define GetDEFCELLnew(index) (LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_DEFN_OFFSET)
#define GetVALCELLnew(index) (LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_VALUE_OFFSET)
#define GetPnameCellnew(index) (LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_PNAME_OFFSET)
#define GetPropCellnew(index) (LispPTR *)(Addr68k_from_LADDR(index)+NEWATOM_PLIST_OFFSET)
#endif /* BIGATOMS */
/* When cadr() function is called, type check should be done. */
#define S_N_CHECKANDCADR(sour, dest, tos) \
{register LispPTR parm = sour; \
if(GetTypeNumber(parm) != TYPE_LISTP){ \
ERROR_EXIT(tos); \
}else \
dest = cadr(parm); \
}

13
inc/copyright Executable file
View File

@@ -0,0 +1,13 @@
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/

13
inc/cr Executable file
View File

@@ -0,0 +1,13 @@
/************************************************************************/
/* */
/* (C) Copyright 1989-1999 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/

94
inc/dbprint.h Executable file
View File

@@ -0,0 +1,94 @@
/* $Id: dbprint.h,v 1.2 1999/01/03 02:05:55 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#include <stdio.h>
/* ================================================================ */
/* Debugprint usage: DBPRINT( paren'ed arglist )
e.g. DBPRINT ( ("value of foo is %d\n", foo) );
the double parens are needed because of cpp's limited macro
capability (can only handle variable number of args if they
are paren'ed. The motivation for this macro is, its easier to
read:
DBPRINT ( ("value of foo is %d\n", foo) );
than:
#ifdef DEBUG
printf("value of foo is %d\n", foo);
#endif
e.g. TRACER(expr);
executes the expression if TRACE is on.
/* ================================================================ */
/* For debugging print statements */
#ifdef DEBUG
#define DBPRINT(X) printf X; fflush(stdout)
#define DEBUGGER(X) X;
#else
#define DBPRINT(X)
#define DEBUGGER(X)
#endif
/* For trace print statements */
#ifdef TRACE
#define TPRINT(X) printf X; fflush(stdout);
#define TRACER(X) X;
#else /* TRACE */
#define TPRINT(X)
#define TRACER(X)
#endif /* TRACE */
/* For tracing individual opcode executions */
#ifdef OPTRACE
#define OPTPRINT(X) printf X; fflush(stdout);
#define OPTRACER(X) X;
#else
#define OPTPRINT(X)
#define OPTRACER(X)
#endif
/* For tracing function calls */
#ifdef FNTRACE
#define FNTPRINT(X) printf X; fflush(stdout);
#define FNTRACER(X) X;
#else
#define FNTPRINT(X)
#define FNTRACER(X)
#endif
/* For function-call & return stack checking */
#ifdef FNSTKCHECK
#define FNCHKPRINT(X) printf X; fflush(stdout);
#define FNCHECKER(X) X;
#else
#define FNCHKPRINT(X)
#define FNCHECKER(X)
#endif

443
inc/debug.h Executable file
View File

@@ -0,0 +1,443 @@
/* $Id: debug.h,v 1.2 1999/01/03 02:05:56 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef BYTESWAP
/************************************************/
/* Normal byte-order version of definitions */
/************************************************/
typedef struct{
DLword W0;
DLword W1;
DLword W2;
DLword W3;
DLword WU;
DLword W4;
DLword W5;
int TIME;
unsigned MOUSESTATE : 3;
unsigned SHIFT1 : 1;
unsigned SHIFT2 : 1;
unsigned keLOCK : 1;
unsigned keCTRL : 1;
unsigned keMETA : 1;
unsigned keFONT : 1;
unsigned USERMODE1 : 1;
unsigned USERMODE2 : 1;
unsigned USERMODE3 : 1;
unsigned NIL1 : 4;
DLword MOUSEX;
DLword MOUSEY;
} KEYBOARDEVENT;
typedef struct{
DLword READ;
DLword WRITE;
} RING;
typedef struct{
LispPTR FLAGS;
LispPTR CODES;
LispPTR SHIFTCODES;
LispPTR ARMED;
LispPTR INTERRUPTLIST;
} KEYACTION;
typedef struct{
unsigned int EVENTWAKEUPPENDING : 1;
unsigned int nil1 : 7;
unsigned int EVENTQUEUETAIL : 24;
LispPTR EVENTNAME;
} EVENT;
typedef struct{
unsigned int nil1 : 1;
unsigned int MLOCKPERPROCESS : 1;
unsigned int nil2 : 6;
unsigned int MLOCKQUEUETAIL : 24;
LispPTR MLOCKOWNER;
LispPTR MLOCKNAME;
LispPTR MLOCKLINK;
} MONITORLOCK;
typedef struct{
DLword PROCFX0;
DLword PROCFX;
unsigned int PROCSTATUS : 8;
unsigned int PROCNAME : 24;
unsigned int PROCPRIORITY : 8;
unsigned int PROCQUEUE : 24;
unsigned int nil1 : 8;
unsigned int NEXTPROCHANDLE : 24;
unsigned int PROCTIMERSET : 1;
unsigned int PROCBEINGDELETED : 1;
unsigned int PROCDELETED : 1;
unsigned int PROCSYSTEMP : 1;
unsigned int PROCNEVERSTARTED : 1;
unsigned int nil2 : 3;
unsigned int PROCWAKEUPTIMER : 24;
LispPTR PROCTIMERLINK;
LispPTR PROCTIMERBOX;
LispPTR WAKEREASON;
LispPTR PROCEVENTORLOCK;
LispPTR PROCFORM;
LispPTR RESTARTABLE;
LispPTR PROCWINDOW;
LispPTR PROCFINISHED;
LispPTR PROCRESULT;
LispPTR PROCFINISHEVENT;
LispPTR PROCMAILBOX;
LispPTR PROCDRIBBLEOUTPUT;
LispPTR PROCINFOHOOK;
LispPTR PROCTYPEAHEAD;
LispPTR PROCREMOTEINFO;
LispPTR PROCUSERDATA;
LispPTR PROCEVENTLINK;
LispPTR PROCAFTEREXIT;
LispPTR PROCBEFOREEXIT;
LispPTR PROCOWNEDLOCKS;
LispPTR PROCEVAPPLYRESULT;
LispPTR PROCTTYENTRYFN;
LispPTR PROCEXITFN;
LispPTR PROCHARDRESETINFO;
LispPTR PROCRESTARTFORM;
LispPTR PROCOLDTTYPROC;
LispPTR nil3;
} PROCESS;
typedef struct{
unsigned int PQPRIORITY : 8;
unsigned int PQHIGHER : 24;
LispPTR PQLOWER;
LispPTR PQNEXT;
LispPTR PQLAST;
} PROCESSQUEUE;
typedef struct fdev{
unsigned RESETABLE : 1;
unsigned RANDOMACCESSP : 1;
unsigned NODIRECTORIES : 1;
unsigned PAGEMAPPED : 1;
unsigned FDBINABLE : 1;
unsigned FDBOUTABLE : 1;
unsigned FDEXTENDABLE : 1;
unsigned BUFFERED : 1;
unsigned DEVICENAME : 24;
unsigned REMOTEP : 1;
unsigned SUBDIRECTORIES : 1;
unsigned INPUT_INDIRECTED : 1;
unsigned OUTPUT_INDIRECTED : 1;
unsigned NIL1 : 4;
unsigned DEVICEINFO : 24;
LispPTR OPENFILELST ;
LispPTR HOSTNAMEP ;
LispPTR EVENTFN ;
LispPTR DIRECTORYNAMEP ;
LispPTR OPENFILE ;
LispPTR CLOSEFILE ;
LispPTR REOPENFILE ;
LispPTR GETFILENAME ;
LispPTR DELETEFILE ;
LispPTR GENERATEFILES ;
LispPTR RENAMEFILE ;
LispPTR OPENP ;
LispPTR REGISTERFILE ;
LispPTR UNREGISTERFILE ;
LispPTR FREEPAGECOUNT ;
LispPTR MAKEDIRECTORY ;
LispPTR CHECKFILENAME ;
LispPTR HOSTALIVEP ;
LispPTR BREAKCONNECTION ;
LispPTR BIN ;
LispPTR BOUT ;
LispPTR PEEKBIN ;
LispPTR READCHAR ;
LispPTR WRITECHAR ;
LispPTR PEEKCHAR ;
LispPTR UNREADCHAR ;
LispPTR READP ;
LispPTR EOFP ;
LispPTR BLOCKIN ;
LispPTR BLOCKOUT ;
LispPTR FORCEOUTPUT ;
LispPTR GETFILEINFO ;
LispPTR SETFILEINFO ;
LispPTR CHARSETFN ;
LispPTR INPUTSTREAM ;
LispPTR OUTPUTSTREAM ;
LispPTR GETFILEPTR ;
LispPTR GETEOFPTR ;
LispPTR SETFILEPTR ;
LispPTR BACKFILEPTR ;
LispPTR SETEOFPTR ;
LispPTR LASTC ;
LispPTR GETNEXTBUFFER ;
LispPTR RELEASEBUFFER ;
LispPTR READPAGES ;
LispPTR WRITEPAGES ;
LispPTR TRUNCATEFILE ;
LispPTR WINDOWOPS ;
LispPTR WINDOWDATA ;
}FDEV;
typedef struct package{
LispPTR INDEX ;
LispPTR TABLES ;
LispPTR NAME ;
LispPTR NAMESYMBOL ;
LispPTR NICKNAMES ;
LispPTR USE_LIST ;
LispPTR USED_BY_LIST ;
LispPTR EXTERNAL_ONLY ;
LispPTR INTERNAL_SYMBOLS ;
LispPTR EXTERNAL_SYMBOLS ;
LispPTR SHADOWING_SYMBOLS ;
} PACKAGE;
#ifdef NEVER
typedef struct {
unsigned nil1 : 8 ;
unsigned BASE : 24 ;
unsigned READ_ONLY_P : 1 ;
unsigned nil2 : 1 ;
unsigned BIT_P : 1 ;
unsigned STRING_P : 1 ;
unsigned nil3 : 1 ;
unsigned DISPLACED_P : 1 ;
unsigned FILL_POINTER_P : 1 ;
unsigned EXTENDABLE_P : 1 ;
unsigned TYPE_NUMBER : 8 ;
DLword OFFSET;
DLword FILL_POINTER;
DLword TOTAL_SIZE;
} ONED_ARRAY;
#endif /* NEVER */
#else
/****************************************************************/
/* Byte-swapped, word-swapped definitions, for e.g. 80386's */
/****************************************************************/
typedef struct{
DLword W1;
DLword W0;
DLword W3;
DLword W2;
DLword W4;
DLword WU;
/* only swapped down to here, and MOUSEX & Y -- there */
/* looks like a missing word in the block at this point. */
DLword W5;
int TIME;
unsigned MOUSESTATE : 3;
unsigned SHIFT1 : 1;
unsigned SHIFT2 : 1;
unsigned LOCK : 1;
unsigned CTRL : 1;
unsigned META : 1;
unsigned FONT : 1;
unsigned USERMODE1 : 1;
unsigned USERMODE2 : 1;
unsigned USERMODE3 : 1;
unsigned NIL1 : 4;
DLword MOUSEY;
DLword MOUSEX;
} KEYBOARDEVENT;
typedef struct{
DLword WRITE;
DLword READ;
} RING;
typedef struct{
LispPTR FLAGS;
LispPTR CODES;
LispPTR SHIFTCODES;
LispPTR ARMED;
LispPTR INTERRUPTLIST;
} KEYACTION;
typedef struct{
unsigned int EVENTQUEUETAIL : 24;
unsigned int nil1 : 7;
unsigned int EVENTWAKEUPPENDING : 1;
LispPTR EVENTNAME;
} EVENT;
typedef struct{
unsigned int MLOCKQUEUETAIL : 24;
unsigned int nil2 : 6;
unsigned int MLOCKPERPROCESS : 1;
unsigned int nil1 : 1;
LispPTR MLOCKOWNER;
LispPTR MLOCKNAME;
LispPTR MLOCKLINK;
} MONITORLOCK;
typedef struct{
DLword PROCFX;
DLword PROCFX0;
unsigned int PROCNAME : 24;
unsigned int PROCSTATUS : 8;
unsigned int PROCQUEUE : 24;
unsigned int PROCPRIORITY : 8;
unsigned int NEXTPROCHANDLE : 24;
unsigned int nil1 : 8;
unsigned int PROCWAKEUPTIMER : 24;
unsigned int nil2 : 3;
unsigned int PROCNEVERSTARTED : 1;
unsigned int PROCSYSTEMP : 1;
unsigned int PROCDELETED : 1;
unsigned int PROCBEINGDELETED : 1;
unsigned int PROCTIMERSET : 1;
LispPTR PROCTIMERLINK;
LispPTR PROCTIMERBOX;
LispPTR WAKEREASON;
LispPTR PROCEVENTORLOCK;
LispPTR PROCFORM;
LispPTR RESTARTABLE;
LispPTR PROCWINDOW;
LispPTR PROCFINISHED;
LispPTR PROCRESULT;
LispPTR PROCFINISHEVENT;
LispPTR PROCMAILBOX;
LispPTR PROCDRIBBLEOUTPUT;
LispPTR PROCINFOHOOK;
LispPTR PROCTYPEAHEAD;
LispPTR PROCREMOTEINFO;
LispPTR PROCUSERDATA;
LispPTR PROCEVENTLINK;
LispPTR PROCAFTEREXIT;
LispPTR PROCBEFOREEXIT;
LispPTR PROCOWNEDLOCKS;
LispPTR PROCEVAPPLYRESULT;
LispPTR PROCTTYENTRYFN;
LispPTR PROCEXITFN;
LispPTR PROCHARDRESETINFO;
LispPTR PROCRESTARTFORM;
LispPTR PROCOLDTTYPROC;
LispPTR nil3;
} PROCESS;
typedef struct{
unsigned int PQHIGHER : 24;
unsigned int PQPRIORITY : 8;
LispPTR PQLOWER;
LispPTR PQNEXT;
LispPTR PQLAST;
} PROCESSQUEUE;
typedef struct fdev{
unsigned DEVICENAME : 24;
unsigned BUFFERED : 1;
unsigned FDEXTENDABLE : 1;
unsigned FDBOUTABLE : 1;
unsigned FDBINABLE : 1;
unsigned PAGEMAPPED : 1;
unsigned NODIRECTORIES : 1;
unsigned RANDOMACCESSP : 1;
unsigned RESETABLE : 1;
unsigned DEVICEINFO : 24;
unsigned NIL1 : 4;
unsigned OUTPUT_INDIRECTED : 1;
unsigned INPUT_INDIRECTED : 1;
unsigned SUBDIRECTORIES : 1;
unsigned REMOTEP : 1;
LispPTR OPENFILELST ;
LispPTR HOSTNAMEP ;
LispPTR EVENTFN ;
LispPTR DIRECTORYNAMEP ;
LispPTR OPENFILE ;
LispPTR CLOSEFILE ;
LispPTR REOPENFILE ;
LispPTR GETFILENAME ;
LispPTR DELETEFILE ;
LispPTR GENERATEFILES ;
LispPTR RENAMEFILE ;
LispPTR OPENP ;
LispPTR REGISTERFILE ;
LispPTR UNREGISTERFILE ;
LispPTR FREEPAGECOUNT ;
LispPTR MAKEDIRECTORY ;
LispPTR CHECKFILENAME ;
LispPTR HOSTALIVEP ;
LispPTR BREAKCONNECTION ;
LispPTR BIN ;
LispPTR BOUT ;
LispPTR PEEKBIN ;
LispPTR READCHAR ;
LispPTR WRITECHAR ;
LispPTR PEEKCHAR ;
LispPTR UNREADCHAR ;
LispPTR READP ;
LispPTR EOFP ;
LispPTR BLOCKIN ;
LispPTR BLOCKOUT ;
LispPTR FORCEOUTPUT ;
LispPTR GETFILEINFO ;
LispPTR SETFILEINFO ;
LispPTR CHARSETFN ;
LispPTR INPUTSTREAM ;
LispPTR OUTPUTSTREAM ;
LispPTR GETFILEPTR ;
LispPTR GETEOFPTR ;
LispPTR SETFILEPTR ;
LispPTR BACKFILEPTR ;
LispPTR SETEOFPTR ;
LispPTR LASTC ;
LispPTR GETNEXTBUFFER ;
LispPTR RELEASEBUFFER ;
LispPTR READPAGES ;
LispPTR WRITEPAGES ;
LispPTR TRUNCATEFILE ;
LispPTR WINDOWOPS ;
LispPTR WINDOWDATA ;
}FDEV;
typedef struct package{
LispPTR INDEX ;
LispPTR TABLES ;
LispPTR NAME ;
LispPTR NAMESYMBOL ;
LispPTR NICKNAMES ;
LispPTR USE_LIST ;
LispPTR USED_BY_LIST ;
LispPTR EXTERNAL_ONLY ;
LispPTR INTERNAL_SYMBOLS ;
LispPTR EXTERNAL_SYMBOLS ;
LispPTR SHADOWING_SYMBOLS ;
} PACKAGE;
#ifdef NEVER
typedef struct {
unsigned BASE : 24 ;
unsigned nil1 : 8 ;
DLword OFFSET;
unsigned TYPE_NUMBER : 8 ;
unsigned EXTENDABLE_P : 1 ;
unsigned FILL_POINTER_P : 1 ;
unsigned DISPLACED_P : 1 ;
unsigned nil3 : 1 ;
unsigned STRING_P : 1 ;
unsigned BIT_P : 1 ;
unsigned nil2 : 1 ;
unsigned READ_ONLY_P : 1 ;
DLword TOTAL_SIZE;
DLword FILL_POINTER;
} ONED_ARRAY;
#endif /* NEVER */
#endif /* BYTESWAP */

51
inc/devconf.h Executable file
View File

@@ -0,0 +1,51 @@
/* $Id: devconf.h,v 1.2 1999/01/03 02:05:56 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/**********************************************************/
/*
devconf.h
Device Configurations assignments
for IFPAGE->devconfig
LSB(0)~3 -> KBD
4~7 -> DISPLAY,
8~10 -> CPU
[CPU] [DSP] [KB]
!!!!!! !!! !!!! !!! LSB>
By Takeshi
*/
/**********************************************************/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/* MAIKO(sun3,sun4)*/
/* KBD */
#define SUN_KEYTYPE_MASK 7
#define SUN_TYPE3_KBD 0x0
#define SUN_TYPE4_KBD 0x1
/* DISPALY */
#define SUN_DISPTYPE_MASK 0x78
#define SUN2BW (2<<3)
#define SUN2COLOR (3<<3)
#define SUN4COLOR (8<<3)
#define SUNMEMCOLOR (7<<3)
/* CPUTYPE NOT IMPLEMENTED */
/* useful macros */
#define SUN_GETKEYTYPE (InterfacePage->devconfig & SUN_KEYTYPE_MASK)
#define SUN_GETDISPTYPE (InterfacePage->devconfig & SUN_DISPTYPE_MASK)

309
inc/devif.h Executable file
View File

@@ -0,0 +1,309 @@
/* $Id: devif.h,v 1.2 1999/01/03 02:05:57 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef __DEVIF__
#define __DEVIF__ 1
typedef void (*PFV)(); /* Pointer to Function returning Void */
typedef int (*PFI)(); /* Pointer to Function returning Int */
typedef char (*PFC)(); /* Pointer to Function returning Char */
typedef float (*PFF)(); /* Pointer to Function returning Float */
typedef int (*PFP)(); /* Pointer to Function returning a Pointer */
typedef unsigned long (*PFUL)(); /* Pointer to Function returning an unsigned long */
#ifdef XWINDOW
#include <X11/Xlib.h>
#endif /* XWINDOW */
typedef struct
{
short type; /* Type of event */
short next; /* Index to next event */
} IRQEvent;
/**************************************************************/
/* P o s i t i o n */
/* */
/* Support structure for the geometry calculations. */
/**************************************************************/
typedef struct
{
int x;
int y;
} Mposition;
/**************************************************************/
/* R e g i o n */
/* */
/* Support structure for the geometry calculations. */
/**************************************************************/
typedef struct
{
int x;
int y;
int width;
int height;
} MRegion;
/**************************************************************/
/* D e v R e c */
/* */
/* Definition common to all devices. Used for mouse, kbd and */
/* display. */
/**************************************************************/
typedef struct
{
int active; /* ACTIVE, a flag.
TRUE if this device is activated. Use this
to prevent multiple consecutive initializations. */
int locked; /* LOCK, a semaphore: 0 if dev is free.
Test and increment to use this device. */
void (* enter)(); /* ENTER, a function
args: self
Called to set up the device. Has to be called before
anything else is done to the device. */
void (* exit)(); /* EXIT, a function
args: self
Called to deactivate the device and restore the
device to its previous state */
void (* before_raid)(); /* BEFORE_RAID, a function.
args: self
Prepare this device for uraid. */
void (* after_raid)(); /* BEFORE_RAID, a function.
args: self
Cleanup and restart device after uraid. */
void (* sync_device)(); /* SYNC_DEVICE, a function.
args: self
Make reality and emualtor coinside with eachother */
} DevRec;
/**************************************************************/
/* M o u s e I n t e r f a c e */
/* */
/* Definition of the mouse. Note that the mouse is also */
/* dependent on the IOPage68K */
/**************************************************************/
typedef struct
{
unsigned TwoButtonP: 1;
/* Interface towards Lisp */
unsigned Left: 1; /* Left button state. */
unsigned Middle: 1; /* Middle button state. */
unsigned Right: 1; /* Right button state. */
/* Mouse chording machinery */
unsigned StateLeft: 1;
unsigned StateMiddle: 1; /* real middle state */
unsigned StateRight: 1;
unsigned FakeMiddle: 1;
unsigned nil: 8;
short tick; /* Clock for timeout. */
long StartTime; /* The maximum timeout */
long RunTimer; /* Chording timer activate flag. */
PFV NextHandler; /* Pointer to the next timer (used with 2button) */
} Button;
typedef struct {
MRegion Last; /* Last position the mouse was in. */
Mposition New; /* The place to move the mouse when we have time */
Mposition Hotspot; /* The current hotspot for the mousecursor */
long Moved; /* Did the mouse move? */
DLword Savebitmap[16]; /* The bitmap under the mouse. Taking down the
mouse involves blitting this bitmap to the screen.
When bringing the mouse back up to the screen you
first have to save the contents of the screen under
the mouse here.*/
} MCursor;
typedef struct
{
DevRec device;
void (* Handler)(); /* Event handler for the mouse. */
MCursor Cursor;
Button Button;
LispPTR *timestamp;
unsigned int keyeventsize; /* The sizeof() one kbd event */
unsigned int maxkeyevent; /* Offset to the end of the ringbuffer. */
int eurokbd; /* Keep tabs of the euro-ness of the kbd */
} MouseInterfaceRec, *MouseInterface;
/**************************************************************/
/* K b d I n t e r f a c e */
/* */
/* Definition of the keyboard. Note that the keyboard is also */
/* dependent on the IOPage68K */
/**************************************************************/
typedef struct
{
DevRec device;
PFV device_event; /* Event handler for the keyboard. */
#ifdef DOS
u_char KeyMap[0x80]; /* The key translation table. Use the keycode you
get from the keyboard as an index. The value
gives the lispkeycode.*/
unsigned char lastbyte; /* Last byte that we got from the keyboard. */
unsigned int keyeventsize; /* The sizeof() one kbd event */
unsigned int maxkeyevent; /* Offset to the end of the ringbuffer. */
int eurokbd; /* Keep tabs of the euro-ness of the kbd */
PFV prev_handler; /* The previous keyboard handler.
Keep this around
to restore when we exit Medley */
int URaid; /* Put this in a better place later.. /jarl */
#endif /* DOS */
} KbdInterfaceRec, *KbdInterface;
/**************************************************************/
/* D s p I n t e r f a c e */
/* */
/* Definition of the display. This structure collects all the */
/* special knowlege needed to manipulate the screen. */
/**************************************************************/
typedef struct
{
DevRec device;
void (* drawline)(); /* DRAWLINE
args: dont know yet. Not yet implemented.*/
void (* cleardisplay)(); /* CLEARDISPLAY, a function
args: self
clears the screen.*/
unsigned long (* get_color_map_entry)();
unsigned long (* set_color_map_entry)();
unsigned long (* available_colors)(); /* How many colors do I have on my palette */
unsigned long (* possible_colors)(); /* How many colors is it possible to select from */
#ifdef NOTYET
unsigned long (* get_color_map)(); /* get a pointer to a colormap */
unsigned long (* set_color_map)(); /* set the current colormap */
unsigned long (* make_color_map)(); /* return a brand new colormap */
#endif /* NOTYET */
unsigned long (* medley_to_native_bm)(); /* 1 bit/pix to native bit/pix */
unsigned long (* native_to_medley_bm)(); /* native bit/pix to 1 bit/pix */
unsigned long (* bitblt_to_screen)(); /* BITBLT_TO_SCREEN, a function
args: self, buffer left top width height.
biblt's buffer to the screen. */
unsigned long (* bitblt_from_screen)();
unsigned long (* scroll_region)(); /* ie. bbt from screen to screen */
void (* mouse_invissible)(); /* MOUSE_INVISSIBLE
args: self (a dsp), iop (an IOPAGE preferably the one and only)
This method makes the mouse invissible on the screen. Note that
the dsp supplys the method and the iop supplys the data. */
void (* mouse_vissible)(); /* MOUSE_VISSIBLE
args: self (a dsp), iop (an IOPAGE preferably the one and only)
This method makes the mouse vissible on the screen. Note that
the dsp supplys the method and the iop supplys the data. */
MRegion Display; /* Dimensions of the physical display. */
unsigned short bitsperpixel;
unsigned long colors; /* cash for the available_colors */
unsigned long oldstate; /* Keep the old state around */
unsigned long graphicsmode; /* Magic cookie used to set the state. */
unsigned long numberofbanks;
#ifdef DOS
unsigned long BytesPerLine;
unsigned long DisplayStartAddr;
unsigned long DisplaySegSize;
unsigned long DisplaySegMagnitude;
unsigned long LinesPerBank;
unsigned short LastLineLen[32]; /* length of last line fragment per bank */
unsigned short LinesInBank[32]; /* True # of full lines in this bank */
/* # of lines we can do with the full-line dumpline */
/* for sure. */
unsigned short LinesBeforeBank[32]; /* Scan lines before start of this bank. */
void (* SwitchBank)(); /* Method to switch the bank (see vesa standard) */
#elif XWINDOW
char *identifier;
int BitGravity;
Display *display_id;
Window LispWindow;
Window DisplayWindow;
Window HorScrollBar;
Window VerScrollBar;
Window HorScrollButton;
Window VerScrollButton;
Window NEGrav;
Window SEGrav;
Window SWGrav;
Window NWGrav;
GC Copy_GC;
MRegion Vissible;
unsigned int InternalBorderWidth;
unsigned int ScrollBarWidth;
Pixmap ScrollBarPixmap;
Pixmap GravityOnPixmap;
Pixmap GravityOffPixmap;
XImage ScreenBitmap;
Mask DisableEventMask;
Mask EnableEventMask;
#endif /* XWINDOW */
} DspInterfaceRec, *DspInterface;
#ifdef XWINDOW
#define DefineCursor(display, window, mycursor) { \
XLOCK;\
XDefineCursor( display, window, *(mycursor) );\
XUNLOCK;\
}
#endif /* XWINDOW */
#define OUTER_SB_WIDTH(dsp) (dsp->ScrollBarWidth + 2*(dsp->InternalBorderWidth))
#ifndef min
#define min( a, b ) (((a)<(b))?(a):(b))
#endif /* min */
#ifndef max
#define max( a, b ) (((a)>(b))?(a):(b))
#endif /* max */
#ifndef mid
#define mid(a, b, c) max( min( b, max( a, c ), min( a, max( b, c ))))
#endif /* mid */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */
#ifndef TRUE
#define TRUE !FALSE
#endif /* TRUE */
#define MINKEYEVENT 2 /* leave 2 words for read,write offsets */
#define NUMBEROFKEYEVENTS 383
#endif /* __DEVIF__ */

81
inc/display.h Executable file
View File

@@ -0,0 +1,81 @@
/* $Id: display.h,v 1.2 1999/01/03 02:05:57 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define BCPLDISPLAY stdout
#define CURSORWIDTH 16
#define CURSORHEIGHT 16
/* Max address for HI-RES DISPLAY */
/* Osamu '90/02/08
* Change into variable for efficiency
#define DISP_MAX_Address (DisplayRegion68k + 1600*1280/8)
*/
extern DLword *DISP_MAX_Address;
/* Is the bitmap in the display region? */
#define IN_DISPLAY_BANK(hiaddr) (((hiaddr)==DISPLAY_HI)|((hiaddr)==(DISPLAY_HI+1)))
#define DLWORD_PERLINE (displaywidth/16)
#define HARD_CURSORWIDTH 16
#define HARD_CURSORHEIGHT 16
#define COLOR_BITSPER_PIXEL 8
#define MONO_SCREEN 0
#define COLOR_SCREEN 1
#define COLOR_MAX_Address (ColorDisplayRegion68k + 1152 * 900)
/* Replicate a 4-bit pattern to fill a word */
#define Expand4Bit(BITS) \
((BITS) | ((BITS) << 4) | ((BITS) << 8) | ((BITS) << 12))
#ifdef XWINDOW
#define DISPLAYBUFFER
#endif /* XWINDOW */
#ifdef DOS
#define DISPLAYBUFFER
#endif /* DOS */
#ifdef DISPLAYBUFFER
/************************************************************************/
/* */
/* i n _ d i s p l a y _ s e g m e n t */
/* */
/* Returns T if the base address for this bitblt is in the */
/* display segment. */
/* */
/************************************************************************/
/* Osamu '90/02/08
* This definition is moved from initdsp.c
* Change into macro for efficiency.
* And also DISP_MAX_Address is changed as variable
* to avoid same calicuration every time it uses.
*********************************************************************/
extern DLword *DisplayRegion68k;
#define in_display_segment(baseaddr) \
(((DisplayRegion68k <= baseaddr) && \
(baseaddr <=DISP_MAX_Address)) ? T :NIL )
#endif
#ifdef XWINDOW
#undef DISPLAYBUFFER
#endif /* XWINDOW */

64
inc/dld.h Executable file
View File

@@ -0,0 +1,64 @@
/* $Id: dld.h,v 1.2 1999/01/03 02:05:57 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* Error codes */
#define DLD_ENOFILE 1 /* cannot open file */
#define DLD_EBADMAGIC 2 /* bad magic number */
#define DLD_EBADHEADER 3 /* failure reading header */
#define DLD_ENOTEXT 4 /* premature eof in text section */
#define DLD_ENOSYMBOLS 5 /* premature end of file in symbols */
#define DLD_ENOSTRINGS 6 /* bad string table */
#define DLD_ENOTXTRELOC 7 /* premature eof in text relocation */
#define DLD_ENODATA 8 /* premature eof in data section */
#define DLD_ENODATRELOC 9 /* premature eof in data relocation */
#define DLD_EMULTDEFS 10 /* multiple definitions of symbol */
#define DLD_EBADLIBRARY 11 /* malformed library archive */
#define DLD_EBADCOMMON 12 /* common block not supported */
#define DLD_EBADOBJECT 13 /* malformed input file (not rel or
archive) */
#define DLD_EBADRELOC 14 /* bad relocation info */
#define DLD_ENOMEMORY 15 /* virtual memory exhausted */
#define DLD_EUNDEFSYM 16 /* undefined symbol */
extern int dld_errno; /* error code returned by dld */
extern int dld_undefined_sym_count; /* # of undefined global symbols */
extern int dld_init (); /* initialize the dld routines */
extern int dld_link (); /* dynamically link and load an object
file */
extern unsigned long
dld_get_symbol (); /* return the address of the named
identifier */
extern unsigned long
dld_get_func (); /* return the address of the named
function */
extern unsigned long
dld_get_bare_symbol (); /* same as dld_get_symbol except that
no underscore (_) is prepended. Use
to locate symbols defined by
assembly routines. */
extern int dld_unlink_by_file (); /* unlink a file */
extern int dld_unlink_by_symbol (); /* unlink the module that define the
given symbol */
extern int
dld_function_executable_p (); /* return true if the named C function
is executable */
extern char **
dld_list_undefined_sym (); /* return an array of undefined symbols */
extern char *
dld_find_executable (); /* return the full path name of the
given executable file. */
extern int
dld_create_reference (); /* explicitly create a reference to the
given symbol. */
extern int dld_define_sym (); /* explicitly define the value for the
given symbol. */
extern void
dld_remove_defined_symbol (); /* remove a explicitly defined symbol */
extern void dld_perror (); /* print error messages. */

131
inc/dspdata.h Executable file
View File

@@ -0,0 +1,131 @@
/* $Id: dspdata.h,v 1.2 1999/01/03 02:05:58 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef BYTESWAP
/******************************************************/
/* Normal-byte-order declarations, for, e.g., 68020's */
/******************************************************/
typedef struct displaydata{
LispPTR ddxposition ;
LispPTR ddyposition;
LispPTR ddxoffset;
LispPTR ddyoffset;
LispPTR dddestination;
LispPTR ddclippingregion;
LispPTR ddfont;
LispPTR ddslowprintingcase;
LispPTR ddwidthscache;
LispPTR ddoffsetscache;
LispPTR ddcolor;
LispPTR ddlinefeed;
LispPTR ddrightmargin;
LispPTR ddleftmargin;
LispPTR ddscroll;
LispPTR ddoperation;
unsigned ddheldflg : 1;
#ifdef BIGVM
unsigned nil1 : 3;
unsigned ddsourcetype : 28;
#else
unsigned nil1 : 7;
unsigned ddsourcetype : 24;
#endif /* BIGVM */
DLword ddclippingleft;
DLword ddclippingright;
DLword ddclippingbottom;
DLword ddclippingtop;
DLword nil2;
DLword ddcharsetascent;
LispPTR xwindowhint ; /* xpointer */
LispPTR ddpilotbbt;
LispPTR ddxscale;
LispPTR ddyscale;
LispPTR ddcharimagewidths;/* Lisp POINTER to DLword array (49,50)*/
LispPTR ddeolfn;
LispPTR ddpagefullfn;
LispPTR ddtexture;
LispPTR ddmicaxpos;
LispPTR ddmicaypos;
LispPTR ddmicarightmargin;
LispPTR ddcharset;
DLword ddcharsetdescent;
DLword ddspacewidth; /* ??*/
LispPTR ddcharheightdelta; /* NUM PTR */
}DISPLAYDATA;
#else
/*************************************************/
/* Byte-swapped declarations, for, e.g., 80386's */
/*************************************************/
typedef struct displaydata{
LispPTR ddxposition ;
LispPTR ddyposition;
LispPTR ddxoffset;
LispPTR ddyoffset;
LispPTR dddestination;
LispPTR ddclippingregion;
LispPTR ddfont;
LispPTR ddslowprintingcase;
LispPTR ddwidthscache;
LispPTR ddoffsetscache;
LispPTR ddcolor;
LispPTR ddlinefeed;
LispPTR ddrightmargin;
LispPTR ddleftmargin;
LispPTR ddscroll;
LispPTR ddoperation;
#ifdef BIGVM
unsigned ddsourcetype : 28;
unsigned nil1 : 3;
#else
unsigned ddsourcetype : 24;
unsigned nil1 : 7;
#endif /* BIGVM */
unsigned ddheldflg : 1;
DLword ddclippingright;
DLword ddclippingleft;
DLword ddclippingtop;
DLword ddclippingbottom;
DLword ddcharsetascent;
DLword nil2;
LispPTR xwindowhint ; /* xpointer */
LispPTR ddpilotbbt;
LispPTR ddxscale;
LispPTR ddyscale;
LispPTR ddcharimagewidths;/* Lisp POINTER to DLword array (49,50)*/
LispPTR ddeolfn;
LispPTR ddpagefullfn;
LispPTR ddtexture;
LispPTR ddmicaxpos;
LispPTR ddmicaypos;
LispPTR ddmicarightmargin;
LispPTR ddcharset;
DLword ddspacewidth; /* ??*/
DLword ddcharsetdescent;
LispPTR ddcharheightdelta; /* NUM PTR */
}DISPLAYDATA;
#endif /* BYTESWAP */

36
inc/emlglob.h Executable file
View File

@@ -0,0 +1,36 @@
/* $Id: emlglob.h,v 1.2 1999/01/03 02:05:58 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
* Copyright (C) 1987 by Fuji Xerox Co., Ltd. All rights reserved.
*
* Author : Takeshi Shimizu
* Hiroshi Hayata
*/
/**********************************************************************/
/*
File Name : emlglob.h
Gloval variables for LispEmulator(external declared)
Date : December 10, 1986
Edited by : Takeshi Shimizu
Changed by : H. Hayata (11-Feb-87)
Changed : 5-Mar-87(take)
24-Apr-87 take
02-Jul-87 take
*/
/**********************************************************************/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/

126
inc/ether.h Executable file
View File

@@ -0,0 +1,126 @@
/* $Id: ether.h,v 1.2 1999/01/03 02:05:59 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef BYTESWAP
typedef struct {
DLword DLLOCALHOST0;
DLword DLLOCALHOST1;
DLword DLLOCALHOST2;
DLword DLFIRSTICB;
DLword DLINPUTMASK;
DLword DLFIRSTOCB;
DLword DLOUTPUTMASK;
DLword DLMISSEDPACKETS;
DLword DLLASTICB;
DLword DLLASTOCB;
} DLETHERCSB;
typedef struct{
DLword DLIOCBLENGTH;
DLword DLIOCBBUFFERLO;
DLword DLIOCBBUFFERHI;
DLword DLRETRANSMISSIONMASK;
DLword DLIOCBBYTESUSED;
DLword DLIOCBSTATUS;
DLword DLNEXTIOCB;
DLword DLFOROUTPUTUSE;
} DLETHERIOCB;
typedef struct {
unsigned int NETTYPE : 8;
unsigned int NDBNEXT : 24;
unsigned int NDBPUPNET : 8;
unsigned int NDBNSNET : 24;
unsigned int NDBTASK : 8;
unsigned int NDBBROADCASTP : 24;
unsigned int NDBPUPHOST : 8;
unsigned int NDBTRANSMITTER : 24;
unsigned int nil1: 8;
unsigned int NDBENCAPSULATOR : 24;
unsigned int NDBIQLENGTH : 8; /* DATATYPE */
unsigned int NDBCSB : 24; /* DATATYPE */
LispPTR NDBIQ;
LispPTR NDBTQ;
LispPTR NDBTRANSLATIONS;
LispPTR NDBETHERFLUSHER;
LispPTR NDBWATCHER;
LispPTR NDBCANHEARSELF;
LispPTR NDBIPNET;
LispPTR NDBIPHOST;
DLword NDBPUPTYPE;
DLword nil2;
LispPTR nil3;
} NDB;
#else
/***********************************************/
/* Byte-swapped definitions, for e.g., 80386's */
/***********************************************/
typedef struct {
DLword DLLOCALHOST1;
DLword DLLOCALHOST0;
DLword DLFIRSTICB;
DLword DLLOCALHOST2;
DLword DLFIRSTOCB;
DLword DLINPUTMASK;
DLword DLMISSEDPACKETS;
DLword DLOUTPUTMASK;
DLword DLLASTOCB;
DLword DLLASTICB;
} DLETHERCSB;
typedef struct{
DLword DLIOCBBUFFERLO;
DLword DLIOCBLENGTH;
DLword DLRETRANSMISSIONMASK;
DLword DLIOCBBUFFERHI;
DLword DLIOCBSTATUS;
DLword DLIOCBBYTESUSED;
DLword DLFOROUTPUTUSE;
DLword DLNEXTIOCB;
} DLETHERIOCB;
typedef struct {
unsigned int NDBNEXT : 24;
unsigned int NETTYPE : 8;
unsigned int NDBNSNET : 24;
unsigned int NDBPUPNET : 8;
unsigned int NDBBROADCASTP : 24;
unsigned int NDBTASK : 8;
unsigned int NDBTRANSMITTER : 24;
unsigned int NDBPUPHOST : 8;
unsigned int NDBENCAPSULATOR : 24;
unsigned int nil1: 8;
unsigned int NDBCSB : 24; /* DATATYPE */
unsigned int NDBIQLENGTH : 8; /* DATATYPE */
LispPTR NDBIQ;
LispPTR NDBTQ;
LispPTR NDBTRANSLATIONS;
LispPTR NDBETHERFLUSHER;
LispPTR NDBWATCHER;
LispPTR NDBCANHEARSELF;
LispPTR NDBIPNET;
LispPTR NDBIPHOST;
DLword nil2;
DLword NDBPUPTYPE;
LispPTR nil3;
} NDB;
#endif /* BYTESWAP */

187
inc/externs.h Executable file
View File

@@ -0,0 +1,187 @@
/* $Id: externs.h,v 1.2 1999/01/03 02:05:59 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
* externs.h - external definitons for nfswatch.
*
* David A. Curry Jeffrey C. Mogul
* Purdue University Digital Equipment Corporation
* Engineering Computer Network Western Research Laboratory
* 1285 Electrical Engineering Building 250 University Avenue
* West Lafayette, IN 47907-1285 Palo Alto, CA 94301
* davy@ecn.purdue.edu mogul@decwrl.dec.com
*
* $Log: externs.h,v $
* Revision 1.2 1999/01/03 02:05:59 sybalsky
* Add ID comments / static to files for CVS use
*
* Revision 1.1.1.1 1998/12/17 05:03:16 sybalsky
* Import of Medley 3.5 emulator
*
* Revision 4.2 93/10/04 11:00:24 mogul
* Added fhdebugf flag
*
* Revision 4.1 93/09/28 21:23:40 mogul
* explicit IP address data type.
*
* Revision 4.0 93/03/01 19:59:00 davy
* NFSWATCH Version 4.0.
*
* Revision 3.7 1993/02/24 17:44:45 davy
* Added -auth mode, changes to -proc mode, -map option, -server option.
*
* Revision 3.6 1993/01/20 14:52:30 davy
* Added -T maxtime option.
*
* Revision 3.5 1993/01/16 19:08:59 davy
* Corrected Jeff's address.
*
* Revision 3.4 1993/01/15 19:33:39 davy
* Miscellaneous cleanups.
*
* Revision 3.3 1993/01/13 15:12:05 davy
* Added background mode.
*
* Revision 3.2 1993/01/13 13:00:04 davy
* Fixed a bug in finish() routine, closing too many file descriptors.
*
* Revision 3.1 1992/07/24 18:47:57 mogul
* Added FDDI support
*
* Revision 3.0 1991/01/23 08:23:02 davy
* NFSWATCH Version 3.0.
*
* Revision 1.3 91/01/04 15:52:07 davy
* New features from Jeff Mogul.
*
* Revision 1.2 90/08/17 15:46:43 davy
* NFSWATCH Version 2.0.
*
* Revision 1.1 88/11/29 11:20:27 davy
* NFSWATCH Release 1.0
*
*/
extern char *pname;
extern FILE *logfp;
extern Counter pkt_total;
extern Counter pkt_drops;
extern Counter int_pkt_total;
extern Counter int_pkt_drops;
extern Counter dst_pkt_total;
extern Counter int_dst_pkt_total;
extern int errno;
extern int bgflag;
extern int if_fd[];
extern int allintf;
extern int fhdebugf;
extern int dstflag;
extern int srcflag;
extern int allflag;
extern int logging;
extern int learnfs;
extern int if_dlt[];
extern int do_update;
extern int cycletime;
extern int totaltime;
extern int showwhich;
extern int serverflag;
extern int truncation;
extern int ninterfaces;
extern int sortbyusage;
extern int nnfscounters;
extern int nfilecounters;
extern int nauthcounters;
extern int screen_inited;
extern int nclientcounters;
extern ipaddrt thisdst;
extern ipaddrt srcaddrs[];
extern ipaddrt dstaddrs[];
extern ipaddrt serveraddrs[];
extern struct timeval starttime;
extern char myhost[];
extern char srchost[];
extern char dsthost[];
extern char serverhost[];
extern char *prompt;
extern char *logfile;
extern char *mapfile;
extern char *filelist;
extern char *snapshotfile;
extern NFSCounter nfs_counters[];
extern FileCounter fil_counters[];
extern PacketCounter pkt_counters[];
extern ProcCounter prc_counters[];
extern int prc_countmap[];
extern ClientCounter clnt_counters[];
extern AuthCounter auth_counters[];
extern NFSCall nfs_calls[NFSCALLHASHSIZE];
char *dlt_name();
char *prtime();
char *savestr();
int auth_comp();
int clnt_comp();
int dlpi_devtype();
int fil_comp();
int is_exported();
int nfs_comp();
int nit_devtype();
int pfilt_devtype();
int prc_comp();
int setup_nit_dev();
int setup_dlpi_dev();
int setup_pfilt_dev();
int setup_snoop_dev();
int snoop_devtype();
int udprpc_recv();
int want_packet();
void clear_vars();
void command();
void error();
void finish();
void flush_nit();
void flush_dlpi();
void flush_pfilt();
void flush_snoop();
void get_net_addrs();
void icmp_filter();
void ip_filter();
void label_screen();
void nd_filter();
void nfs_count();
void nfs_filter();
void nfs_hash_call();
void nfs_hash_reply();
void nfswatch();
void pkt_filter_ether();
void pkt_filter_fddi();
void rpc_callfilter();
void rpc_filter();
void rpc_replyfilter();
void setup_auth_counters();
void setup_fil_counters();
void setup_map_file();
void setup_nfs_counters();
void setup_pkt_counters();
void setup_screen();
void setup_rpcxdr();
void snapshot();
void sort_auth_counters();
void sort_nfs_counters();
void tcp_filter();
void udp_filter();
void update_logfile();
void update_screen();
void usage();
void wakeup();

258
inc/fast_dsp.h Executable file
View File

@@ -0,0 +1,258 @@
/* $Id: fast_dsp.h,v 1.2 1999/01/03 02:05:59 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* These are the Macros Used to generate fast dispatch inline code.
*/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1991 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* F A S T O P C O D E D I S P A T C H M A C R O S */
/* */
/* These macros generate better opcode-dispatch code than the */
/* native compiler will. The difference may be only one or */
/* two instructions, but in the inner loop, that's a LOT. */
/* */
/* To add a new architecture, you must define 5 macros: */
/* */
/* nextop0 - for single-byte opcodes */
/* nextop1 - skip a byte and grab an opcode */
/* nextop2 - skip 2 bytes and grab an opcode */
/* nextop3 - skip 3 bytes and grab an opcode */
/* nextop4 - skip 4 bytes and grab an opcode */
/* */
/* (These macros are already defined naively, so undef them.) */
/* */
/* For existing implementations, these often expand out to */
/* calls to inline functions. */
/* */
/* */
/* */
/************************************************************************/
#ifdef OPDISP /* Only do any of this if OPDISP is set. */
/* Sun 3 */
#ifdef mc68020
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
/* JRB - fast case is now nextop1 */
#define nextop0 { fast0_dispatcher(); goto nextopcode; }
#define nextop1 { fast1_dispatcher(); goto nextopcode; }
#define nextop2 { fast1_dispatcher2(); }
#define nextop3 { PCMACL += 2; nextop1; }
#define nextop4 { PCMACL += 3; nextop1; }
#endif
/* Sun 386i */
#ifdef I386
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
/* JRB - fast case is now nextop1 */
#define nextop0 { fast0_dispatcher(); goto nextopcode; }
#define nextop1 { fast1_dispatcher(); goto nextopcode; }
#define nextop2 { fast2_dispatcher(); }
#define nextop3 { PCMACL += 2; nextop1; }
#define nextop4 { PCMACL += 3; nextop1; }
#endif
/* ISC 386 using gcc */
#ifdef ISC
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
#define nextop0 { fast0_dispatcher(); goto nextopcode; }
#define nextop1 { fast1_dispatcher(); goto nextopcode; }
#define nextop2 { fast2_dispatcher(); goto nextopcode;}
#define nextop3 { fast3_dispatcher(); goto nextopcode;}
#define nextop4 { fast4_dispatcher(); goto nextopcode;}
#define fast0_dispatcher() \
asm volatile(" \n\
// leal -1(%0),%%eax \n\
/ xorb $3,%%al \n\
/ movzbl (%%eax),%%eax \n\
movzbl -1(%0),%%eax \n\
jmp *optable(,%%eax,4)" : : "r" (pccache): "ax");
#define fast1_dispatcher() \
asm volatile(" \n\
/ movl %0,%%eax \n\
/ xorb $3,%%al \n\
movzbl (%0),%%eax \n\
incl %0 \n\
/ movzbl (%%eax),%%eax \n\
jmp *optable(,%%eax,4)" : "=r" (pccache) : "0" (pccache): "ax");
#define fast2_dispatcher() \
asm volatile(" \n\
/ leal 1(%0),%%eax \n\
movzbl 1(%0),%%eax \n\
addl $2,%0 \n\
/ xorb $3,%%al \n\
/ movzbl (%%eax),%%eax \n\
jmp *optable(,%%eax,4)" :"=r" (pccache) : "0" (pccache): "ax");
#define fast3_dispatcher() \
asm volatile(" \n\
/ leal 2(%0),%%eax \n\
movzbl 2(%0),%%eax \n\
addl $3,%0 \n\
/ xorb $3,%%al \n\
/ movzbl (%%eax),%%eax \n\
jmp *optable(,%%eax,4)" :"=r" (pccache) : "0" (pccache): "ax");
#define fast4_dispatcher() \
asm volatile(" \n\
/ leal 3(%0),%%eax \n\
movzbl 3(%0),%%eax \n\
addl $4,%0 \n\
/ xorb $3,%%al \n\
/ movzbl (%%eax),%%eax \n\
jmp *optable(,%%eax,4)" :"=r" (pccache) : "0" (pccache): "ax");
#endif
#endif /* OPDISP */
/* ISC 386 using gcc with turbo assembler (DOS version) */
#ifdef DOS
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
#define nextop0 { fast0_dispatcher(); goto nextopcode; }
#define nextop1 { fast1_dispatcher(); goto nextopcode; }
#define nextop2 { fast2_dispatcher(); goto nextopcode;}
#define nextop3 { fast3_dispatcher(); goto nextopcode;}
#define nextop4 { fast4_dispatcher(); goto nextopcode;}
#define fast0_dispatcher() \
asm volatile(" \n\
lea eax,-1[%0] \n\
xor al,3 \n\
movzx eax, BYTE PTR [eax] \n\
; mov dword ptr save_opcode, eax \n\
; mov dword ptr save_pc, esi \n\
; mov dword ptr save_tos, ebx \n\
; mov dword ptr save_tsptr, edi \n\
; mov dword ptr save_esp, esp \n\
; mov dword ptr save_ebp, ebp \n\
jmp OFFSET CODE32:optable[eax*4]" : "=r" (pccache) : "0" (pccache): "ax");
#define fast1_dispatcher() \
asm volatile(" \n\
mov eax,%0 \n\
xor al,3 \n\
inc %0 \n\
movzx eax, BYTE PTR [eax] \n\
; mov dword ptr save_opcode, eax \n\
; mov dword ptr save_pc, esi \n\
; mov dword ptr save_tos, ebx \n\
; mov dword ptr save_tsptr, edi \n\
; mov dword ptr save_esp, esp \n\
; mov dword ptr save_ebp, ebp \n\
jmp OFFSET CODE32:optable[eax*4]" : "=r" (pccache) : "0" (pccache): "ax");
#define fast2_dispatcher() \
asm volatile(" \n\
lea eax,1[%0] \n\
add %0,2 \n\
xor al,3 \n\
movzx eax, BYTE PTR [eax] \n\
; mov dword ptr save_opcode, eax \n\
; mov dword ptr save_pc, esi \n\
; mov dword ptr save_tos, ebx \n\
; mov dword ptr save_tsptr, edi \n\
; mov dword ptr save_esp, esp \n\
; mov dword ptr save_ebp, ebp \n\
jmp OFFSET CODE32:optable[eax*4]" : "=r" (pccache) : "0" (pccache): "ax");
#define fast3_dispatcher() \
asm volatile(" \n\
lea eax,2[%0] \n\
add %0,3 \n\
xor al,3 \n\
movzx eax, BYTE PTR [eax] \n\
; mov dword ptr save_opcode, eax \n\
; mov dword ptr save_pc, esi \n\
; mov dword ptr save_tos, ebx \n\
; mov dword ptr save_tsptr, edi \n\
; mov dword ptr save_esp, esp \n\
; mov dword ptr save_ebp, ebp \n\
jmp OFFSET CODE32:optable[eax*4]" : "=r" (pccache) : "0" (pccache): "ax");
#define fast4_dispatcher() \
asm volatile(" \n\
lea eax,3[%0] \n\
add %0,4 \n\
xor al,3 \n\
movzx eax, BYTE PTR [eax] \n\
; mov dword ptr save_opcode, eax \n\
; mov dword ptr save_pc, esi \n\
; mov dword ptr save_tos, ebx \n\
; mov dword ptr save_tsptr, edi \n\
; mov dword ptr save_esp, esp \n\
; mov dword ptr save_ebp, ebp \n\
jmp OFFSET CODE32:optable[eax*4]" : "=r" (pccache) : "0" (pccache): "ax");
#endif /* DOS */
#ifdef SPARCDISP
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
#define nextop0 { fast_dispatcher(table, Get_BYTE(PCMAC)); goto nextopcode; }
#define nextop_n(n) { \
PCMACL += n; \
nextop0; \
}
#define nextop1 { nextop_n(1); }
#define nextop2 { nextop_n(2); }
#define nextop3 { nextop_n(3); }
#define nextop4 { nextop_n(4); }
#endif /* SPARCDISP */

119
inc/fp.h Executable file
View File

@@ -0,0 +1,119 @@
/* $Id: fp.h,v 1.2 1999/01/03 02:06:00 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* */
/* */
/* */
/* */
/************************************************************************/
#ifdef DOS
#include <i32.h>
#endif /* DOS */
#ifdef ULTRIX
#include <ieeefp.h>
#endif /* ULTRIX */
#ifdef RISCOS
/*#include <ieeefp.h> */
/*#define isnan isnand */
#define isnan(x) 0
#endif /* RISCOS */
/* --------------------------------------------------
FPCLEAR - clear status as necessary
FPTEST(result) - check result or status
Sun 4 compiler w. -O2 moves too much code around
to use FLTINT.
-------------------------------------------------- */
#ifdef FLTINT
extern int FP_error;
/* Note that a compiler may very likely move code around the arithmetic
operation, causing this test (set by an interrupt handler) to be
incorrect. For example, the Sun SPARC compiler with -O2 makes
this test incorrect.
*/
#define FPCLEAR FP_error = 0;
#define FPTEST(result) FP_error
#else
/* fpstatus_ is a FORTRAN library routine (in libc) which
can be called to determine floating point status results.
Documented in the Sun manual, "Floating Point Programmer's Guide",
(Rev. A 19-Sep-86), pg. 34, it does *not* exist in libc for the
SPARC.
For sparc, should also check for isnan? Don't know what isnormal
& issubnormal do (these are sunos4.0 only)
*/
#ifdef OS5
#define FPCLEAR
#define FPTEST(result) (!finite(result))
#elif (defined(sparc) || defined(I386) || defined(HPUX))
#define FPCLEAR
#define FPTEST(result) (isinf(result) || isnan(result))
#elif APOLLO
/**********************************************************/
/* Need values.h & nan.h, so we all parts of IsNANorINF */
/* are defined. IsNANorINF uses structure aliasing to */
/* get at pieces of the float to test it, so the item */
/* being tested can't be a register variable. Sigh. */
/**********************************************************/
#include </sys5/usr/include/values.h>
#include </sys5/usr/include/nan.h>
#define FPCLEAR
#define FPTEST(result) (IsNANorINF(result))
#undef REGISTER
#define REGISTER
#elif INDIGO
#include <nan.h>
#define FPCLEAR
#define FPTEST(result) (IsNANorINF(result))
#else
#ifdef AIX
#define FPCLEAR
#define FPTEST(result) ((!finite(result)) || isnan(result))
#elif DOS
#define FPCLEAR
#define FPTEST(result) (_getrealerror() & ( I87_ZERO_DIVIDE | I87_OVERFLOW | I87_UNDERFLOW))
#else
static int constant0 = 0;
unsigned int fpstatus_();
#define FPCLEAR fpstatus_(&constant0);
#define FPTEST(result) (fpstatus_(&constant0) & 0xF0)
#endif /* AIX */
#endif /* sparc | I386 */
#endif /* FLTINT */

270
inc/gc.h Executable file
View File

@@ -0,0 +1,270 @@
/* $Id: gc.h,v 1.3 2001/12/24 01:08:57 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/**********************************************************************/
/*
File Name : gc.h
Define for garbage collector
*/
/**********************************************************************/
#define ADDREF 0 /* for gclookup routine. */
#define DELREF 1 /* for gclookup routine. */
#define STKREF 2 /* for gclookup routine. */
#define UNSTKREF 3 /* for htfind function. (T.T.) */
#ifdef BIGVM
/* 32-bit HTmain, HTcoll, etc. entries */
#define GETGC(x) *((LispPTR *) (x))
#define GCENTRY LispPTR
#define GCPTR
#define MAX_GCCOUNT 0x7FFF /* = 32767 */
#else
/* Old, 16-bit entries */
#define GETGC GETWORD
#define GCENTRY DLword
#define GCPTR(x) WORDPTR(x)
#define MAX_GCCOUNT 0x3F /* = 63 */
#endif /* BIGVM */
/* IncAllocCnt(n) decrements reclaim countdown by N
and signals interrupt if GC should happen soon */
/* IncAllocCnt is called only when *Reclaim_cnt_word != NIL */
#define IncAllocCnt(n) {\
if ((*Reclaim_cnt_word -= n) <= S_POSITIVE) {\
/* time for GC */\
Irq_Stk_Check = Irq_Stk_End = 0;\
*Reclaim_cnt_word = S_POSITIVE;\
};\
}
/* DecAllocCnt only called when *Reclaim_cnt_word != NIL */
#define DecAllocCnt(n) { *Reclaim_cnt_word += n; }
#define FreeLink(link) {\
GETGC(link) = 0;\
GETGC(link+1) = GETGC(HTcoll);\
GETGC(HTcoll) = (link - HTcoll);\
}
/* Given the contents of an HTMAIN or HTCOLL entry,
get the link pointer (i.e., turn off the low bit) */
#define GetLinkptr(entry) (entry & 0x0fffffffe)
#define DelLink(link, prev, entry) { \
if (prev != (GCENTRY *)0) \
{ \
GETGC((GCENTRY *)prev + 1) = GETGC((GCENTRY *)link + 1); \
} \
else \
{ \
GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link + 1) | 1; \
} \
FreeLink((GCENTRY *)link); \
link = (GCENTRY *)(HTcoll + GetLinkptr(GETGC((GCENTRY *)entry))); \
if (GETGC((GCENTRY *)link + 1) == 0) \
{ \
GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link); \
FreeLink((GCENTRY *)link); \
} \
}
#define RefCntP(ptr) (!(GetTypeEntry((ptr)) & TT_NOREF) && \
(*GcDisabled_word != ATOM_T))
#define GCLOOKUP(ptr, case) { \
if (RefCntP(ptr)) { \
if (*Reclaim_cnt_word != NIL) \
htfind(ptr, case); \
else \
rec_htfind(ptr, case); \
} \
}
#define GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) { \
if (*Reclaim_cnt_word != NIL) \
val = htfind(ptr, case); \
else \
val = rec_htfind(ptr, case); \
} else val = NIL; \
}
#define REC_GCLOOKUP(ptr, case) { if (RefCntP(ptr)) rec_htfind(ptr, case); }
#define REC_GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) \
val = rec_htfind(ptr, case); \
else \
val = NIL; \
}
#define FRPLPTR(old , new) { \
GCLOOKUP(new, ADDREF); \
GCLOOKUP(old, DELREF); \
(old) = (new) ; }
#ifndef BYTESWAP
/********************************************************/
/* Normal byte-order definitions, for e.g., 68020s */
/********************************************************/
#ifdef BIGVM
struct hashentry
{ /* GC hastable entry */
unsigned short count :15;
unsigned short stackref :1;
unsigned short segnum :15;
unsigned short collision :1;
};
struct htlinkptr
{ /* overlay access method */
LispPTR contents;
};
struct htcoll
{ /* GC collision table entry */
LispPTR free_ptr ;
LispPTR next_free ;
};
struct gc_ovfl
{
LispPTR ovfl_ptr ;
unsigned int ovfl_cnt ;
};
struct htoverflow
{ /* July-23-1987 by TT */
unsigned pcase :4;
unsigned ptr :28;
};
#else
struct hashentry
{ /* GC hastable entry */
USHORT count :6;
USHORT stackref :1;
USHORT segnum :8;
USHORT collision :1;
};
struct htlinkptr
{ /* overlay access method */
DLword contents;
};
struct htcoll
{ /* GC collision table entry */
DLword free_ptr ;
DLword next_free ;
};
struct gc_ovfl
{
LispPTR ovfl_ptr ;
unsigned int ovfl_cnt ;
};
struct htoverflow
{ /* July-23-1987 by TT */
unsigned pcase :8;
unsigned ptr :24;
};
#endif /* BIGVM */
#else
/********************************************************/
/* Byte-swapped definitions, for e.g., 80386s */
/********************************************************/
#ifdef BIGVM
struct hashentry
{ /* GC hashtable entry */
USHORT collision :1;
USHORT segnum :15;
USHORT stackref :1;
USHORT count :15;
};
struct htlinkptr
{ /* overlay access method */
LispPTR contents;
};
struct htcoll
{ /* GC collision table entry */
LispPTR free_ptr ;
LispPTR next_free ;
};
struct gc_ovfl
{
LispPTR ovfl_ptr ;
unsigned int ovfl_cnt ;
};
struct htoverflow
{ /* July-23-1987 by TT */
unsigned ptr :28;
unsigned pcase :4;
};
#else
struct hashentry
{ /* GC hashtable entry */
USHORT collision :1;
USHORT segnum :8;
USHORT stackref :1;
USHORT count :6;
};
struct htlinkptr
{ /* overlay access method */
DLword contents;
};
struct htcoll
{ /* GC collision table entry */
DLword next_free ;
DLword free_ptr ;
};
struct gc_ovfl
{
LispPTR ovfl_ptr ;
unsigned int ovfl_cnt ;
};
struct htoverflow
{ /* July-23-1987 by TT */
unsigned ptr :24;
unsigned pcase :8;
};
#endif /* BIGVM */
#endif /* BYTESWAP */
extern LispPTR htfind(LispPTR ptr, int casep);
extern LispPTR rec_htfind(LispPTR ptr, int casep);

270
inc/gc.h.save Executable file
View File

@@ -0,0 +1,270 @@
/* $Id: gc.h,v 1.2 1999/01/03 02:06:00 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/**********************************************************************/
/*
File Name : gc.h
Define for garbage collector
*/
/**********************************************************************/
#define ADDREF 0 /* for gclookup routine. */
#define DELREF 1 /* for gclookup routine. */
#define STKREF 2 /* for gclookup routine. */
#define UNSTKREF 3 /* for htfind function. (T.T.) */
#ifdef BIGVM
/* 32-bit HTmain, HTcoll, etc. entries */
#define GETGC(x) *((LispPTR *) (x))
#define GCENTRY LispPTR
#define GCPTR
#define MAX_GCCOUNT 0x7FFF /* = 32767 */
#else
/* Old, 16-bit entries */
#define GETGC GETWORD
#define GCENTRY DLword
#define GCPTR(x) WORDPTR(x)
#define MAX_GCCOUNT 0x3F /* = 63 */
#endif /* BIGVM */
/* IncAllocCnt(n) decrements reclaim countdown by N
and signals interrupt if GC should happen soon */
/* IncAllocCnt is called only when *Reclaim_cnt_word != NIL */
#define IncAllocCnt(n) {\
if ((*Reclaim_cnt_word -= n) <= S_POSITIVE) {\
/* time for GC */\
Irq_Stk_Check = Irq_Stk_End = 0;\
*Reclaim_cnt_word = S_POSITIVE;\
};\
}
/* DecAllocCnt only called when *Reclaim_cnt_word != NIL */
#define DecAllocCnt(n) { *Reclaim_cnt_word += n; }
#define FreeLink(link) {\
GETGC(link) = 0;\
GETGC(link+1) = GETGC(HTcoll);\
GETGC(HTcoll) = (link - HTcoll);\
}
/* Given the contents of an HTMAIN or HTCOLL entry,
get the link pointer (i.e., turn off the low bit) */
#define GetLinkptr(entry) (entry & 0x0fffffffe)
#define DelLink(link, prev, entry) { \
if (prev != (GCENTRY *)0) \
{ \
GETGC((GCENTRY *)prev + 1) = GETGC((GCENTRY *)link + 1); \
} \
else \
{ \
GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link + 1) | 1; \
} \
FreeLink((GCENTRY *)link); \
link = (GCENTRY *)(HTcoll + GetLinkptr(GETGC((GCENTRY *)entry))); \
if (GETGC((GCENTRY *)link + 1) == 0) \
{ \
GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link); \
FreeLink((GCENTRY *)link); \
} \
}
#define RefCntP(ptr) (!(GetTypeEntry((ptr)) & TT_NOREF) && \
(*GcDisabled_word != ATOM_T))
#define GCLOOKUP(ptr, case) { \
if (RefCntP(ptr)) { \
if (*Reclaim_cnt_word != NIL) \
htfind(ptr, case); \
else \
rec_htfind(ptr, case); \
} \
}
#define GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) { \
if (*Reclaim_cnt_word != NIL) \
val = htfind(ptr, case); \
else \
val = rec_htfind(ptr, case); \
} else val = NIL; \
}
#define REC_GCLOOKUP(ptr, case) { if (RefCntP(ptr)) rec_htfind(ptr, case); }
#define REC_GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) \
val = rec_htfind(ptr, case); \
else \
val = NIL; \
}
#define FRPLPTR(old , new) { \
GCLOOKUP(new, ADDREF); \
GCLOOKUP(old, DELREF); \
(old) = (new) ; }
#ifndef BYTESWAP
/********************************************************/
/* Normal byte-order definitions, for e.g., 68020s */
/********************************************************/
#ifdef BIGVM
struct hashentry
{ /* GC hastable entry */
unsigned short count :15;
unsigned short stackref :1;
unsigned short segnum :15;
unsigned short collision :1;
};
struct htlinkptr
{ /* overlay access method */
LispPTR contents;
};
struct htcoll
{ /* GC collision table entry */
LispPTR free_ptr ;
LispPTR next_free ;
};
struct gc_ovfl
{
LispPTR ovfl_ptr ;
unsigned int ovfl_cnt ;
};
struct htoverflow
{ /* July-23-1987 by TT */
unsigned pcase :4;
unsigned ptr :28;
};
#else
struct hashentry
{ /* GC hastable entry */
USHORT count :6;
USHORT stackref :1;
USHORT segnum :8;
USHORT collision :1;
};
struct htlinkptr
{ /* overlay access method */
DLword contents;
};
struct htcoll
{ /* GC collision table entry */
DLword free_ptr ;
DLword next_free ;
};
struct gc_ovfl
{
LispPTR ovfl_ptr ;
unsigned int ovfl_cnt ;
};
struct htoverflow
{ /* July-23-1987 by TT */
unsigned pcase :8;
unsigned ptr :24;
};
#endif /* BIGVM */
#else
/********************************************************/
/* Byte-swapped definitions, for e.g., 80386s */
/********************************************************/
#ifdef BIGVM
struct hashentry
{ /* GC hashtable entry */
USHORT collision :1;
USHORT segnum :15;
USHORT stackref :1;
USHORT count :15;
};
struct htlinkptr
{ /* overlay access method */
LispPTR contents;
};
struct htcoll
{ /* GC collision table entry */
LispPTR free_ptr ;
LispPTR next_free ;
};
struct gc_ovfl
{
LispPTR ovfl_ptr ;
unsigned int ovfl_cnt ;
};
struct htoverflow
{ /* July-23-1987 by TT */
unsigned ptr :28;
unsigned pcase :4;
};
#else
struct hashentry
{ /* GC hashtable entry */
USHORT collision :1;
USHORT segnum :8;
USHORT stackref :1;
USHORT count :6;
};
struct htlinkptr
{ /* overlay access method */
DLword contents;
};
struct htcoll
{ /* GC collision table entry */
DLword next_free ;
DLword free_ptr ;
};
struct gc_ovfl
{
LispPTR ovfl_ptr ;
unsigned int ovfl_cnt ;
};
struct htoverflow
{ /* July-23-1987 by TT */
unsigned ptr :24;
unsigned pcase :8;
};
#endif /* BIGVM */
#endif /* BYTESWAP */
extern LispPTR htfind();
extern LispPTR rec_htfind();

52
inc/gcscan.h Executable file
View File

@@ -0,0 +1,52 @@
/* $Id: gcscan.h,v 1.2 1999/01/03 02:06:01 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define HTSTKBIT 0x200 /* = 512 */
#define HTENDS ((struct hashentry *) htlptr)
#define GetStkCnt(entry1) (entry1 >> 9)
/* extern DLword *HTmain; -- this is real method */
const inline extern DLword gcscan1 (probe)
register int probe; /* probe is offset */
{ register struct htlinkptr *htlptr; /* overlay access method */
register int contents;
while (--probe >= 0) /* End of HTmain Table ? */
{
/* Start addr. of scanning */
htlptr = (struct htlinkptr *)(HTmain+probe);
contents = ((struct htlinkptr *)WORDPTR(htlptr))->contents;
if (contents && (((struct hashentry *)WORDPTR(HTENDS))->collision || (GetStkCnt(contents) == 0)))
return(probe);
}
return(NIL);
}
const inline extern DLword gcscan2 (probe)
register int probe; /* probe is offset */
{register struct htlinkptr *htlptr; /* overlay access method */
while (--probe >= 0) /* End of HTmain Table ? */
{ htlptr = (struct htlinkptr *)(HTmain+probe);
/* Start addr. of scanning */
if (((HTSTKBIT | 1) & ((struct htlinkptr *)WORDPTR(htlptr))->contents) != 0)
return(probe); /* stackref or collision ON */
}
return(NIL);
}

41
inc/hdw_conf.h Executable file
View File

@@ -0,0 +1,41 @@
/* $Id: hdw_conf.h,v 1.2 1999/01/03 02:06:01 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/**************************************************************/
/*
File name : machineconfig.h
Created : Aug-19-87 take
Desc. : Define for Machine dependent param
*/
/**************************************************************/
/* Machine Type */
#define KATANA 3
/* Lastvmempage(32Mbyte) */
#ifdef BIGVM
#define LASTVMEMPAGE 0x1FFFF
#else
#define LASTVMEMPAGE (65535)
#endif

362
inc/ifpage.h Executable file
View File

@@ -0,0 +1,362 @@
/* $Id: ifpage.h,v 1.2 1999/01/03 02:06:01 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef IFPAGE_DEFINED
#define IFPAGE_DEFINED (1)
#define IFPAGE_KEYVAL 0x15e3
#ifndef BYTESWAP
#ifdef BIGVM
/* Normal definition, for big-indian BIGVM machines */
typedef struct ifpage {
DLword currentfxp;
DLword resetfxp;
DLword subovfxp;
DLword kbdfxp;
DLword hardreturnfxp;
DLword gcfxp;
DLword faultfxp;
DLword endofstack;
DLword lversion;
DLword minrversion;
DLword minbversion;
DLword rversion;
DLword bversion;
DLword machinetype;
DLword miscfxp;
DLword key;
DLword serialnumber;
DLword emulatorspace;
DLword screenwidth;
DLword nxtpmaddr;
DLword ex_nactivepages;
DLword ex_ndirtypages;
DLword filepnpmp0;
DLword filepnpmt0;
DLword teleraidfxp;
DLword filler1;
DLword filler2;
DLword filler3;
DLword usernameaddr;
DLword userpswdaddr;
DLword stackbase;
DLword faulthi;
DLword faultlo;
DLword devconfig;/*wasrealpagetable;*/
DLword rptsize;
DLword rpoffset;
DLword wasrptlast;
DLword embufvp;
DLword nshost0;
DLword nshost1;
DLword nshost2;
DLword mdszone;
DLword mdszonelength;
DLword emubuffers;
DLword emubuflength;
#ifdef NEW_STORAGE
DLword ex_process_size; /* was lastnumchars */
DLword storagefullstate; /* was sysdisk */
#else
DLword lastnumchars;
DLword sysdisk;
#endif /* NEW_STORAGE */
DLword isfmap;
/* these are for \miscapply
* -- note that they are not ref counted, so don't pass the only pointer
* to something this way */
LispPTR miscstackfn;
LispPTR miscstackarg1;
LispPTR miscstackarg2;
LispPTR miscstackresult;
DLword nrealpages;
DLword lastlockedfilepage;
DLword lastdominofilepage;
DLword fptovpstart;
DLword fakemousebits;
DLword dl24bitaddressable;
LispPTR realpagetableptr;
DLword ex_dllastvmempage;
DLword fullspaceused;
DLword fakekbdad4;
DLword fakekbdad5;
DLword d1nil1;
DLword dlnil2;
DLword dlnil3;
DLword dlnil4;
DLword dlnil5;
DLword dlnil6;
LispPTR dlnilp1;
LispPTR dlnilp2;
LispPTR dlnilp3;
int dllastvmempage;
int nactivepages;
int ndirtypages;
int process_size; /* was lastnumchars */
} IFPAGE;
#else
/* Normal definition, for big-indian machines */
typedef struct ifpage {
DLword currentfxp;
DLword resetfxp;
DLword subovfxp;
DLword kbdfxp;
DLword hardreturnfxp;
DLword gcfxp;
DLword faultfxp;
DLword endofstack;
DLword lversion;
DLword minrversion;
DLword minbversion;
DLword rversion;
DLword bversion;
DLword machinetype;
DLword miscfxp;
DLword key;
DLword serialnumber;
DLword emulatorspace;
DLword screenwidth;
DLword nxtpmaddr;
DLword nactivepages;
DLword ndirtypages;
DLword filepnpmp0;
DLword filepnpmt0;
DLword teleraidfxp;
DLword filler1;
DLword filler2;
DLword filler3;
DLword usernameaddr;
DLword userpswdaddr;
DLword stackbase;
DLword faulthi;
DLword faultlo;
DLword devconfig;/*wasrealpagetable;*/
DLword rptsize;
DLword rpoffset;
DLword wasrptlast;
DLword embufvp;
DLword nshost0;
DLword nshost1;
DLword nshost2;
DLword mdszone;
DLword mdszonelength;
DLword emubuffers;
DLword emubuflength;
#ifdef NEW_STORAGE
DLword process_size; /* was lastnumchars */
DLword storagefullstate; /* was sysdisk */
#else
DLword lastnumchars;
DLword sysdisk;
#endif /* NEW_STORAGE */
DLword isfmap;
/* these are for \miscapply
* -- note that they are not ref counted, so don't pass the only pointer
* to something this way */
LispPTR miscstackfn;
LispPTR miscstackarg1;
LispPTR miscstackarg2;
LispPTR miscstackresult;
DLword nrealpages;
DLword lastlockedfilepage;
DLword lastdominofilepage;
DLword fptovpstart;
DLword fakemousebits;
DLword dl24bitaddressable;
LispPTR realpagetableptr;
DLword dllastvmempage;
DLword fullspaceused;
DLword fakekbdad4;
DLword fakekbdad5;
} IFPAGE;
#endif /* BIGVM */
#else
#ifdef BIGVM
/***********************************************************/
/* Byte-swapped/word-swapped BIGVM version */
/***********************************************************/
typedef struct ifpage {
DLword resetfxp;
DLword currentfxp; /* hi word */
DLword kbdfxp;
DLword subovfxp; /* hi word */
DLword gcfxp;
DLword hardreturnfxp; /* hi word */
DLword endofstack;
DLword faultfxp; /* hi word */
DLword minrversion;
DLword lversion; /* hi word */
DLword rversion;
DLword minbversion; /* hi word */
DLword machinetype;
DLword bversion; /* hi word */
DLword key;
DLword miscfxp; /* hi word */
DLword emulatorspace;
DLword serialnumber; /* hi word */
DLword nxtpmaddr;
DLword screenwidth; /* hi word */
DLword ex_ndirtypages;
DLword ex_nactivepages; /* hi word */
DLword filepnpmt0;
DLword filepnpmp0; /* hi word */
DLword filler1;
DLword teleraidfxp; /* hi word */
DLword filler3;
DLword filler2; /* hi word */
DLword userpswdaddr;
DLword usernameaddr; /* hi word */
DLword faulthi;
DLword stackbase; /* hi word */
DLword devconfig;/*wasrealpagetable;*/
DLword faultlo; /* hi word */
DLword rpoffset;
DLword rptsize; /* hi word */
DLword embufvp;
DLword wasrptlast; /* hi word */
DLword nshost1;
DLword nshost0; /* hi word */
DLword mdszone;
DLword nshost2; /* hi word */
DLword emubuffers;
DLword mdszonelength; /* hi word */
#ifdef NEW_STORAGE
DLword ex_process_size;
DLword emubuflength; /* hi word */
DLword isfmap;
DLword storagefullstate; /* hi word */
#else
DLword lastnumchars;
DLword emubuflength; /* hi word */
DLword isfmap;
DLword sys_disk; /* hi word */
#endif /* NEW_STORAGE */
/* these are for \miscapply
* -- note that they are not ref counted, so don't pass the only pointer
* to something this way */
LispPTR miscstackfn;
LispPTR miscstackarg1;
LispPTR miscstackarg2;
LispPTR miscstackresult;
DLword lastlockedfilepage;
DLword nrealpages; /* hi word */
DLword fptovpstart;
DLword lastdominofilepage; /* hi word */
DLword dl24bitaddressable;
DLword fakemousebits; /* hi word */
LispPTR realpagetableptr;
DLword fullspaceused;
DLword ex_dllastvmempage; /* hi word */
DLword fakekbdad5;
DLword fakekbdad4; /* hi word */
DLword d1nil1;
DLword dlnil2;
DLword dlnil3;
DLword dlnil4;
DLword dlnil5;
DLword dlnil6;
LispPTR dlnilp1;
LispPTR dlnilp2;
LispPTR dlnilp3;
int dllastvmempage;
int nactivepages;
int ndirtypages;
int process_size; /* was lastnumchars */
} IFPAGE;
#else
/***********************************************************/
/* Byte-swapped/word-swapped version, for 386i */
/***********************************************************/
typedef struct ifpage {
DLword resetfxp;
DLword currentfxp; /* hi word */
DLword kbdfxp;
DLword subovfxp; /* hi word */
DLword gcfxp;
DLword hardreturnfxp; /* hi word */
DLword endofstack;
DLword faultfxp; /* hi word */
DLword minrversion;
DLword lversion; /* hi word */
DLword rversion;
DLword minbversion; /* hi word */
DLword machinetype;
DLword bversion; /* hi word */
DLword key;
DLword miscfxp; /* hi word */
DLword emulatorspace;
DLword serialnumber; /* hi word */
DLword nxtpmaddr;
DLword screenwidth; /* hi word */
DLword ndirtypages;
DLword nactivepages; /* hi word */
DLword filepnpmt0;
DLword filepnpmp0; /* hi word */
DLword filler1;
DLword teleraidfxp; /* hi word */
DLword filler3;
DLword filler2; /* hi word */
DLword userpswdaddr;
DLword usernameaddr; /* hi word */
DLword faulthi;
DLword stackbase; /* hi word */
DLword devconfig;/*wasrealpagetable;*/
DLword faultlo; /* hi word */
DLword rpoffset;
DLword rptsize; /* hi word */
DLword embufvp;
DLword wasrptlast; /* hi word */
DLword nshost1;
DLword nshost0; /* hi word */
DLword mdszone;
DLword nshost2; /* hi word */
DLword emubuffers;
DLword mdszonelength; /* hi word */
#ifdef NEW_STORAGE
DLword process_size;
DLword emubuflength; /* hi word */
DLword isfmap;
DLword storagefullstate; /* hi word */
#else
DLword lastnumchars;
DLword emubuflength; /* hi word */
DLword isfmap;
DLword sys_disk; /* hi word */
#endif /* NEW_STORAGE */
/* these are for \miscapply
* -- note that they are not ref counted, so don't pass the only pointer
* to something this way */
LispPTR miscstackfn;
LispPTR miscstackarg1;
LispPTR miscstackarg2;
LispPTR miscstackresult;
DLword lastlockedfilepage;
DLword nrealpages; /* hi word */
DLword fptovpstart;
DLword lastdominofilepage; /* hi word */
DLword dl24bitaddressable;
DLword fakemousebits; /* hi word */
LispPTR realpagetableptr;
DLword fullspaceused;
DLword dllastvmempage; /* hi word */
DLword fakekbdad5;
DLword fakekbdad4; /* hi word */
} IFPAGE;
#endif /* BIGVM */
#endif /* BYTESWAP */
#endif

44
inc/initatms.h Executable file
View File

@@ -0,0 +1,44 @@
/* $Id: initatms.h,v 1.2 1999/01/03 02:06:02 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/*
*
* Author : Takeshi Shimizu
* Hiroshi Hayata
*/
/*********************************************************/
/*
File : initatms.h
System ATOMs
last changed : 5-Mar-87 (take)
12-Aug-87 take
** MERGED AT AIS
*/
/*********************************************************/
#define ATOM_EVALFORM 248
#define ATOM_GCHANDLEOVERFLOW 249
#define ATOM_INTERPRETER 256
#define ATOM_SMALLP 257
#define ATOM_FIXP 258
#define ATOM_FLOATP 259
#define ATOM_LITATOM 260
#define ATOM_LISTP 261
#define ATOM_ARRAYP 262
#define ATOM_STRINGP 263
#define ATOM_STACKP 264
#define ATOM_CHARACTER 265
#define ATOM_VMEMPAGEP 266

1075
inc/inlineC.h Executable file

File diff suppressed because it is too large Load Diff

261
inc/inln386i.h Executable file
View File

@@ -0,0 +1,261 @@
/* $Id: inln386i.h,v 1.2 1999/01/03 02:06:02 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* inlinedefs386i.c */
/* */
/* Dispatch-loop macro devinitions specific to the Sun386i */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/* use the swapx [inline] function to swap words in a dword */
#undef SWAP_WORDS
#define SWAP_WORDS(x) swapx(x)
/* undefine these macros so we use the 386i inline code */
#undef Get_BYTE_PCMAC0
#undef Get_BYTE_PCMAC1
#undef Get_BYTE_PCMAC2
#undef Get_BYTE_PCMAC3
#undef Get_DLword_PCMAC0
#undef Get_DLword_PCMAC1
#undef Get_DLword_PCMAC2
#undef Get_DLword_PCMAC3
#define Get_BYTE_PCMAC0 Get_BYTE_PCMAC0fn()
#define Get_BYTE_PCMAC1 Get_BYTE_PCMAC1fn()
#define Get_BYTE_PCMAC2 Get_BYTE_PCMAC2fn()
#define Get_BYTE_PCMAC3 Get_BYTE_PCMAC3fn()
#define Get_DLword_PCMAC0 Get_DLword_PCMAC0fn()
#define Get_DLword_PCMAC1 Get_DLword_PCMAC1fn()
#define Get_DLword_PCMAC2 Get_DLword_PCMAC2fn()
#define Get_DLword_PCMAC3 Get_DLword_PCMAC3fn()
#undef DIFFERENCE
#undef PLUS2
#undef IDIFFERENCE
#undef IPLUS2
#define DIFFERENCE { \
fast_op_difference(POP_TOS_1); \
nextop1; \
diff_err: \
asm("diff_err:"); \
asm("addw $7,%bx"); \
asm("rorl $15,%ebx"); \
asm("popl %ecx"); \
N_OP_POPPED_CALL_2(N_OP_difference, GET_POPPED); \
}
#define IDIFFERENCE { \
fast_op_idifference(POP_TOS_1); \
nextop1; \
idiff_err: \
asm("idiff_err:"); \
asm("addw $7,%bx"); \
asm("rorl $15,%ebx"); \
asm("popl %ecx"); \
N_OP_POPPED_CALL_2(N_OP_idifference, GET_POPPED); \
}
#define IDIFFERENCE_N(n) { \
fast_op_idifferencen(n); \
nextop2; \
idiffn_err: \
asm("idiffn_err:"); \
asm("addw $7,%bx"); \
asm("rorl $15,%ebx"); \
asm("popl %ecx"); \
N_OP_CALL_1d(N_OP_idifferencen, n); \
}
#define PLUS2 { \
fast_op_plus(POP_TOS_1); \
nextop1; \
plus_err: \
asm("plus_err:"); \
asm("addw $7,%bx"); \
asm("rorl $15,%ebx"); \
asm("popl %ecx"); \
N_OP_POPPED_CALL_2(N_OP_plus2, GET_POPPED); \
}
#define IPLUS2 { \
fast_op_iplus(POP_TOS_1); \
nextop1; \
iplus_err: \
asm("iplus_err:"); \
asm("addw $7,%bx"); \
asm("rorl $15,%ebx"); \
asm("popl %ecx"); \
N_OP_POPPED_CALL_2(N_OP_iplus2, GET_POPPED); \
}
#define IPLUS_N(n) { \
fast_op_iplusn(n); \
nextop2; \
iplusn_err: \
asm("iplusn_err:"); \
asm("addw $7,%bx"); \
asm("rorl $15,%ebx"); \
asm("popl %ecx"); \
N_OP_CALL_1d(N_OP_iplusn, n); \
}
#undef GREATERP
#define GREATERP { \
fast_op_greaterp(POP_TOS_1); \
nextop1; \
greaterp_err: \
asm("greaterp_err: popl %ecx"); \
N_OP_POPPED_CALL_2(N_OP_greaterp, GET_POPPED); \
}
#undef IGREATERP
#define IGREATERP { \
fast_op_igreaterp(POP_TOS_1); \
nextop1; \
igreaterp_err: \
asm("igreaterp_err: popl %ecx"); \
N_OP_POPPED_CALL_2(N_OP_igreaterp, GET_POPPED); \
}
#undef LRSH8
#define LRSH8 { \
fast_op_lrsh8(); \
nextop1; \
lrsh8_err: \
asm("lrsh8_err: "); \
N_OP_CALL_1(N_OP_lrsh8); \
}
#undef LRSH1
#define LRSH1 { \
fast_op_lrsh1(); \
nextop1; \
lrsh1_err: \
asm("lrsh1_err: "); \
N_OP_CALL_1(N_OP_lrsh1); \
}
#undef LLSH8
#define LLSH8 { \
fast_op_llsh8(); \
nextop1; \
llsh8_err: \
asm("llsh8_err: "); \
N_OP_CALL_1(N_OP_llsh8); \
}
#undef LLSH1
#define LLSH1 { \
fast_op_llsh1(); \
nextop1; \
llsh1_err: \
asm("llsh1_err: "); \
N_OP_CALL_1(N_OP_llsh1); \
}
#undef LOGOR
#define LOGOR { \
fast_op_logor(POP_TOS_1); \
nextop1; \
logor_err: \
asm("logor_err: popl %ecx"); \
asm("rorl $15,%ebx"); \
N_OP_POPPED_CALL_2(N_OP_logor, GET_POPPED); \
}
#undef LOGAND
#define LOGAND { \
fast_op_logand(POP_TOS_1); \
nextop1; \
logand_err: \
asm("logand_err: popl %ecx"); \
asm("rorl $15,%ebx"); \
N_OP_POPPED_CALL_2(N_OP_logand, GET_POPPED); \
}
#undef LOGXOR
#define LOGXOR { \
fast_op_logxor(POP_TOS_1); \
nextop1; \
logxor_err: \
asm("logxor_err: popl %ecx"); \
asm("rorl $15,%ebx"); \
N_OP_POPPED_CALL_2(N_OP_logxor, GET_POPPED); \
}
#undef N_OP_ADDBASE
#define N_OP_ADDBASE { \
fast_op_addbase(POP_TOS_1); \
nextop1; \
addbase_err: \
asm("addbase_err: popl %ecx"); \
asm("addw $7,%bx"); \
asm("rorl $15,%ebx"); \
N_OP_POPPED_CALL_2(N_OP_addbase, GET_POPPED); \
}
#undef N_OP_LOLOC
#define N_OP_LOLOC { fast_op_loloc(); nextop1; }
#undef N_OP_HILOC
#define N_OP_HILOC { fast_op_hiloc(); nextop1; }
#undef N_OP_VAG2
#define N_OP_VAG2 \
{ \
asm(" subl $4,%esi"); \
asm(" movl (%esi),%eax"); \
asm(" roll $16,%ebx"); \
asm(" movw %ax,%bx"); \
asm(" rorl $16,%ebx"); \
nextop1; }
/***********/
/* Fast function call */
#undef FN0
#define FN0 fast_FN0()
#undef FN1
#define FN1 fast_FN1()
#undef FN2
#define FN2 fast_FN2()
#undef FN3
#define FN3 fast_FN3()
#undef FN4
#define FN4 fast_FN4()
#undef FN5
#define FN5 fast_FN5()
#undef FN6
#define FN6 fast_FN6()
#undef FN7
#define FN7 fast_FN7()
#undef FN8
#define FN8 fast_FN8()
#undef FN9
#define FN9 fast_FN9()

200
inc/inln68k+.h Executable file
View File

@@ -0,0 +1,200 @@
/* $Id: inln68k+.h,v 1.2 1999/01/03 02:06:03 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/* These are the Macros Used to generate inline 68K assembly code.
The call inline code which really CHEATS!
BEWARE the inline code makes many register assumptions!
Such as:
D7 = TOPOFSTACK
D5 = 15
A3 = CSTKPTR
*/
#undef DIFFERENCE
#define DIFFERENCE { \
fast_op_difference(POP_TOS_1); \
nextop1; \
diff_err: \
asm("diff_err:"); \
asm("addqb #7,d7"); \
asm("rorl d5,d7"); \
N_OP_POPPED_CALL_2(N_OP_difference, GET_POPPED); \
}
#undef IDIFFERENCE
#define IDIFFERENCE { \
fast_op_idifference(POP_TOS_1); \
nextop1; \
idiff_err: \
asm("idiff_err:"); \
asm("addqb #7,d7"); \
asm("rorl d5,d7"); \
N_OP_POPPED_CALL_2(N_OP_idifference, GET_POPPED); \
}
#undef IDIFFERENCE_N
#define IDIFFERENCE_N(n) { \
fast_op_idifferencen(n); \
nextop2; \
idiffn_err: \
asm("idiffn_err:"); \
asm("addqb #7,d7"); \
asm("rorl d5,d7"); \
N_OP_CALL_1d(N_OP_idifferencen, n); \
}
#undef PLUS2
#define PLUS2 { \
fast_op_plus(POP_TOS_1); \
nextop1; \
plus_err: \
asm("plus_err:"); \
asm("addqb #7,d7"); \
asm("rorl d5,d7"); \
N_OP_POPPED_CALL_2(N_OP_plus2, GET_POPPED); \
}
#undef IPLUS2
#define IPLUS2 { \
fast_op_iplus(POP_TOS_1); \
nextop1; \
iplus_err: \
asm("iplus_err:"); \
asm("addqb #7,d7"); \
asm("rorl d5,d7"); \
N_OP_POPPED_CALL_2(N_OP_iplus2, GET_POPPED); \
}
#undef IPLUS_N
#define IPLUS_N(n) { \
fast_op_iplusn(n); \
nextop2; \
iplusn_err: \
asm("iplusn_err:"); \
asm("addqb #7,d7"); \
asm("rorl d5,d7"); \
N_OP_CALL_1d(N_OP_iplusn, n); \
}
#undef GREATERP
#define GREATERP { \
fast_op_greaterp(POP_TOS_1); \
nextop1; \
greaterp_err: \
asm("greaterp_err:"); \
N_OP_POPPED_CALL_2(N_OP_greaterp, GET_POPPED); \
}
#undef IGREATERP
#define IGREATERP { \
fast_op_igreaterp(POP_TOS_1); \
nextop1; \
igreaterp_err: \
asm("igreaterp_err:"); \
N_OP_POPPED_CALL_2(N_OP_igreaterp, GET_POPPED); \
}
#undef LRSH8
#define LRSH8 { \
fast_op_lrsh8(); \
nextop1; \
lrsh8_err: \
asm("lrsh8_err:"); \
N_OP_CALL_1(N_OP_lrsh8); \
}
#undef LRSH1
#define LRSH1 { \
fast_op_lrsh1(); \
nextop1; \
lrsh1_err: \
asm("lrsh1_err:"); \
N_OP_CALL_1(N_OP_lrsh1); \
}
#undef LLSH8
#define LLSH8 { \
fast_op_llsh8(); \
nextop1; \
llsh8_err: \
asm("llsh8_err:"); \
N_OP_CALL_1(N_OP_llsh8); \
}
#undef LLSH1
#define LLSH1 { \
fast_op_llsh1(); \
nextop1; \
llsh1_err: \
asm("llsh1_err:"); \
N_OP_CALL_1(N_OP_llsh1); \
}
#undef LOGOR
#define LOGOR { \
fast_op_logor(POP_TOS_1); \
nextop1; \
logor_err: \
asm("logor_err:"); \
asm("rorl d5,d7"); \
N_OP_POPPED_CALL_2(N_OP_logor, GET_POPPED); \
}
#undef LOGAND
#define LOGAND { \
fast_op_logand(POP_TOS_1); \
nextop1; \
logand_err: \
asm("logand_err:"); \
asm("rorl d5,d7"); \
N_OP_POPPED_CALL_2(N_OP_logand, GET_POPPED); \
}
#undef LOGXOR
#define LOGXOR { \
fast_op_logxor(POP_TOS_1); \
nextop1; \
logxor_err: \
asm("logxor_err:"); \
asm("rorl d5,d7"); \
N_OP_POPPED_CALL_2(N_OP_logxor, GET_POPPED); \
}
#undef N_OP_ADDBASE
#define N_OP_ADDBASE { \
fast_op_addbase(POP_TOS_1); \
nextop1; \
addbase_err: \
asm("addbase_err:"); \
asm("addqb #7,d7"); \
asm("rorl d5,d7"); \
N_OP_POPPED_CALL_2(N_OP_addbase, GET_POPPED); \
}
#undef N_OP_LOLOC
#define N_OP_LOLOC { fast_op_loloc(); nextop1; }
#undef N_OP_HILOC
#define N_OP_HILOC { fast_op_hiloc(); nextop1; }
#undef N_OP_VAG2
#define N_OP_VAG2 { fast_op_vag2(POP_TOS_1); nextop1; }

162
inc/inln68k.h Executable file
View File

@@ -0,0 +1,162 @@
/* $Id: inln68k.h,v 1.2 1999/01/03 02:06:03 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/* inlinedefs68K.h */
/* Bob Krivacic 2/23/88 */
/* These are the Macros used to generate inline 68K assembly code
to implement the opcodes. Used by both dispatch
loop and native code.
*/
#undef DIFFERENCE
#undef PLUS2
#undef GREATERP
#undef IDIFFERENCE
#undef IPLUS2
#undef IGREATERP
#undef LOGOR
#undef LOGAND
#undef LOGXOR
#undef LRSH8
#undef LRSH1
#undef LLSH8
#undef LLSH1
#undef N_OP_ADDBASE
#undef N_OP_LOLOC
#undef N_OP_HILOC
#undef N_OP_VAG2
#undef LISTP
#undef NTYPEX
#undef TYPEP
#undef SWAP_WORDS
/*
#undef FN3
#undef RETURN
*/
#define SWAP_WORDS(x) swapx(x)
#define DIFFERENCE { \
TOPOFSTACK = op_difference(POP_TOS_1, TOPOFSTACK); \
nextop1; \
diff_err: \
asm("diff_err:"); \
N_OP_POPPED_CALL_2(N_OP_difference, GET_POPPED); \
}
#define PLUS2 { \
TOPOFSTACK = op_plus(POP_TOS_1, TOPOFSTACK); \
nextop1; \
plus_err: \
asm("plus_err:"); \
N_OP_POPPED_CALL_2(N_OP_plus2, GET_POPPED); \
}
#define GREATERP { \
TOPOFSTACK = op_greaterp(POP_TOS_1, TOPOFSTACK); \
nextop1; \
greaterp_err: \
asm("greaterp_err:"); \
N_OP_POPPED_CALL_2(N_OP_greaterp, GET_POPPED); \
}
#define IDIFFERENCE { \
TOPOFSTACK = op_difference(POP_TOS_1, TOPOFSTACK); \
}
#define IPLUS2 { \
TOPOFSTACK = op_plus(POP_TOS_1, TOPOFSTACK); \
nextop1; \
}
#define IGREATERP { \
TOPOFSTACK = op_greaterp(POP_TOS_1, TOPOFSTACK); \
nextop1; \
}
#define LOGOR { \
TOPOFSTACK = op_logor(POP_TOS_1, TOPOFSTACK); \
nextop1; \
logor_err: \
asm("logor_err:"); \
N_OP_POPPED_CALL_2(N_OP_logor, GET_POPPED); \
}
#define LOGAND { \
TOPOFSTACK = op_logand(POP_TOS_1, TOPOFSTACK); \
nextop1; \
logand_err: \
asm("logand_err:"); \
N_OP_POPPED_CALL_2(N_OP_logand, GET_POPPED); \
}
#define LOGXOR { \
TOPOFSTACK = op_logxor(POP_TOS_1, TOPOFSTACK); \
nextop1; \
logxor_err: \
asm("logxor_err:"); \
N_OP_POPPED_CALL_2(N_OP_logxor, GET_POPPED); \
}
#define LRSH8 { \
TOPOFSTACK = op_lrsh8(TOPOFSTACK); \
nextop1; \
lrsh8_err: \
asm("lrsh8_err:"); \
N_OP_CALL_1(N_OP_lrsh8); \
}
#define LRSH1 { \
TOPOFSTACK = op_lrsh1(TOPOFSTACK); \
nextop1; \
lrsh1_err: \
asm("lrsh1_err:"); \
N_OP_CALL_1(N_OP_lrsh1); \
}
#define LLSH8 { \
TOPOFSTACK = op_llsh8(TOPOFSTACK); \
nextop1; \
llsh8_err: \
asm("llsh8_err:"); \
N_OP_CALL_1(N_OP_llsh8); \
}
#define LLSH1 { \
TOPOFSTACK = op_llsh1(TOPOFSTACK); \
nextop1; \
llsh1_err: \
asm("llsh1_err:"); \
N_OP_CALL_1(N_OP_llsh1); \
}
#define N_OP_ADDBASE { \
TOPOFSTACK = addbase(POP_TOS_1, TOPOFSTACK); \
nextop1; \
}
#define N_OP_LOLOC { TOPOFSTACK = loloc(TOPOFSTACK); nextop1; }
#define N_OP_HILOC { TOPOFSTACK = hiloc(TOPOFSTACK); nextop1; }
#define N_OP_VAG2 { TOPOFSTACK = vag2(POP_TOS_1, TOPOFSTACK); nextop1; }
#define LISTP { TOPOFSTACK = listp(TOPOFSTACK); nextop1;}
#define NTYPEX { TOPOFSTACK = ntypex(TOPOFSTACK); nextop1; }
#define TYPEP(n) { TOPOFSTACK = typep(TOPOFSTACK, Get_BYTE(PCMAC+1)); nextop2; }

95
inc/inlnMIPS.h Executable file
View File

@@ -0,0 +1,95 @@
/* $Id: inlnMIPS.h,v 1.2 1999/01/03 02:06:04 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* I N L I N E F U N C T I O N S F O R M I P S */
/* */
/* These are GCC-style inline asm functions for use when */
/* compiling Medley for MIPS RISCstations. */
/* */
/* JDS 28 Aug 91 Created; no valid defns yet. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1991 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* R E G I S T E R C O N V E N T I O N S */
/* */
/* */
/************************************************************************/
/* Copyright Venue 1991 All rights reserved. */
/* inline defs for MIPS */
extern inline const unsigned int swapx (unsigned int word)
{
asm("roll $16,%0" : "=g" (word) : "0" (word));
return(word);
}
extern inline const unsigned int word_swap_longword (unsigned int word)
{
asm("roll $16,%0" : "=g" (word) : "0" (word));
return(word);
}
extern inline const unsigned short byte_swap_word (unsigned short word)
{
asm("rolw $8,%0" : "=g" (word) : "0" (word));
return(word);
}
extern inline const void word_swap_page(unsigned short * page, int count)
{
asm("\
pushl %ebp \n\
movl %esp,%ebp \n\
subl $4,%esp \n\
pushl %edi \n\
pushl %esi \n\
pushl %ebx \n\
cld \n\
movl 8(%ebp),%esi // word pointer. \n\
movl %esi,%edi \n\
movl 12(%ebp),%ecx // count \n\
\n\
$0: lodsl \n\
rolw $8,%ax \n\
roll $16,%eax \n\
rolw $8,%ax \n\
stosl \n\
loop $0 \n\
\n\
// epilogue. \n\
leal -16(%ebp),%esp \n\
popl %ebx \n\
popl %esi \n\
popl %edi \n\
leave \n\
ret");
}

1112
inc/inlnPS2.h Executable file

File diff suppressed because it is too large Load Diff

177
inc/inlnSPARC.h Executable file
View File

@@ -0,0 +1,177 @@
/* $Id: inlnSPARC.h,v 1.2 1999/01/03 02:06:04 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/* inlinedefsSPARC.h */
/* Bob Krivacic, Steve Purcell */
/* These are the Macros Used to generate inline SPARC assembly code
to implement the opcodes. Used by both dispatch
loop and native code.
*/
/* this is *very* carefully written to generate optimal sun4 assembly code. Be very careful modifying it if you must do so. scp*/
/*
Get_BYTE(PCMAC+1); \
xc.c: #define PCMAC pccache
xc.c: register InstPtr pccache;
xc.c: typedef ByteCode *InstPtr; CHANGED TO
xc.c: typedef BYTECODE *InstPtr;
lispemul.h: typedef char ByteCode;
lispemul.h: #define Get_BYTE(byteptr) (((BYTECODE *)(byteptr))->code)
lispemul.h: typedef struct {unsigned code : 8;} BYTECODE;
*/
/* shuffle loads to go faster */
#undef IVARMACRO
#define IVARMACRO(x) { \
register LispPTR *var = (LispPTR *)IVar; \
\
HARD_PUSH(TOPOFSTACK); \
{register unsigned char opcode; \
opcode = *(unsigned char *)(PCMAC+1); \
TOPOFSTACK = *(var + x); \
PCMACL += 1; \
fast_dispatcher(table, opcode);} \
goto nextopcode; }
#undef PVARMACRO
#define PVARMACRO(x) { \
register LispPTR *var = (LispPTR *)PVar; \
\
HARD_PUSH(TOPOFSTACK); \
{register unsigned char opcode; \
opcode = *(unsigned char *)(PCMAC+1); \
TOPOFSTACK = *(var + x); \
PCMACL += 1; \
fast_dispatcher(table, opcode);} \
goto nextopcode; }
#define NSMALLP(x) (((x) >> 17) ^ 7)
#define NSMALLP_RANGE(x) (((x << 15) >>15) ^ x)
#define UNBOX_SMALLP(sour) ( ((int)sour << 15) >> 15 )
#define HARD_CASE(fn) {SV; TOPOFSTACK = fn(POP_TOS_1, TOPOFSTACK, ufn_2); nextop1;}
#define UNBOX_ELSE(sour, dest, otherwise){ \
if (NSMALLP(sour)) \
if (GetTypeNumber(sour) != TYPE_FIXP) otherwise; \
else dest = FIXP_VALUE(sour); \
else dest = UNBOX_SMALLP(sour);}
#define UNBOX_ELSE_UFN(sour, dest) UNBOX_ELSE(sour, dest, goto op_ufn);
#define BOX_INTO(result, dest){ \
if (NSMALLP_RANGE(result))/* dest = box_fixp(result);*/ \
{register LispPTR *wordp; \
wordp = (LispPTR *) createcell68k(TYPE_FIXP); \
*((int *)wordp) = result; \
dest = (LADDR_from_68k(wordp)); } \
else dest = (( (unsigned)result <<15) >>15) | S_POSITIVE;}
#define ARITH_OP(op, exceptions, handler) \
{register int arg1, arg2, result; \
arg1 = GET_TOS_1; /* w/o side effect */ \
if(!NSMALLP(TOPOFSTACK) && !NSMALLP(arg1)) { \
arg2 = UNBOX_SMALLP(TOPOFSTACK); \
arg1 = UNBOX_SMALLP(arg1); \
result = arg1 op arg2; \
BOX_INTO(result, TOPOFSTACK); \
POP_TOS_1; \
nextop1;} \
N_OP_CALL_2(handler); }
#define BINARY_OP(exp, exceptions) { \
register int arg1, arg2, result; \
arg1 = GET_TOS_1; /* w/o side effect */ \
UNBOX_ELSE_UFN(TOPOFSTACK, arg2); \
UNBOX_ELSE_UFN(arg1, arg1); \
result = exp; \
if (exceptions) goto op_ufn; \
BOX_INTO(result, TOPOFSTACK); \
POP_TOS_1; nextop1;}
#undef GREATERP
#undef IGREATERP
#define GREATERP { \
register int arg1, arg2, result; \
arg1 = GET_TOS_1; /* w/o side effect */ \
UNBOX_ELSE_UFN(TOPOFSTACK, arg2); \
UNBOX_ELSE_UFN(arg1, arg1); \
TOPOFSTACK = (arg1>arg2? ATOM_T : NIL_PTR); \
POP_TOS_1; nextop1;}
#define IGREATERP { \
register int arg1, arg2, result; \
arg1 = GET_TOS_1; /* w/o side effect */ \
UNBOX_ELSE_UFN(TOPOFSTACK, arg2); \
UNBOX_ELSE_UFN(arg1, arg1); \
TOPOFSTACK = (arg1>arg2? ATOM_T : NIL_PTR); \
POP_TOS_1; nextop1;}
#define OVERFLOW(a,b,r) ( (int)((r^a) & (a^~b)) < 0)
#define SOVERFLOW(a,b,r) ( (int)((r^a) & (a^b)) < 0)
/* overflow is ((arg1>0) == (arg2>0)) && ((result>0) != (arg1>0)) */
#undef IPLUS2
#undef PLUS2
#define IPLUS2 ARITH_OP(+, OVERFLOW(arg1,arg2,result), N_OP_iplus2)
#define PLUS2 ARITH_OP(+, OVERFLOW(arg1,arg2,result), N_OP_plus2)
#undef IDIFFERENCE
#undef DIFFERENCE
#define IDIFFERENCE ARITH_OP(-, SOVERFLOW(arg1,arg2,result), N_OP_idifference)
#define DIFFERENCE ARITH_OP(-, SOVERFLOW(arg1,arg2,result), N_OP_difference)
#undef LOGOR
#undef LOGAND
#undef LOGXOR
#define LOGOR BINARY_OP(arg1 | arg2, 0)
#define LOGAND BINARY_OP(arg1 & arg2, 0)
#define LOGXOR BINARY_OP(arg1 ^ arg2, 0)
#define UNARY_OP(exp, exceptions) { \
register int arg, result; \
UNBOX_ELSE_UFN(TOPOFSTACK, arg); \
result = exp; \
if (exceptions) goto op_ufn; \
BOX_INTO(result, TOPOFSTACK); \
nextop1;}
#undef LRSH8
#undef LRSH1
#define LRSH8 UNARY_OP((unsigned)arg >> 8, 0)
#define LRSH1 UNARY_OP((unsigned)arg >> 1, 0)
#undef LLSH8
#undef LLSH1
#define LLSH8 UNARY_OP(arg << 8, ((arg >> 24)!=0))
#define LLSH1 UNARY_OP(arg << 1, (arg < 0))
#undef ADDBASE
#define ADDBASE { \
register int arg1, arg2; \
UNBOX_ELSE_UFN(TOPOFSTACK, arg2); \
TOPOFSTACK = POP_TOS_1 + arg2; \
nextop1;}
#undef SWAP_WORDS
#define SWAP_WORDS(x) swapx(x)

1125
inc/inlndos.h Executable file

File diff suppressed because it is too large Load Diff

175
inc/inlsparc.h Executable file
View File

@@ -0,0 +1,175 @@
/* $Id: inlsparc.h,v 1.2 1999/01/03 02:06:05 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/* inlinedefsSPARC.h */
/* Bob Krivacic, Steve Purcell */
/* These are the Macros Used to generate inline SPARC assembly code
to implement the opcodes. Used by both dispatch
loop and native code.
*/
/* this is *very* carefully written to generate optimal sun4 assembly code. Be very careful modifying it if you must do so. scp*/
/*
Get_BYTE(PCMAC+1); \
xc.c: #define PCMAC pccache
xc.c: register InstPtr pccache;
xc.c: typedef ByteCode *InstPtr; CHANGED TO
xc.c: typedef BYTECODE *InstPtr;
lispemul.h: typedef char ByteCode;
lispemul.h: #define Get_BYTE(byteptr) (((BYTECODE *)(byteptr))->code)
lispemul.h: typedef struct {unsigned code : 8;} BYTECODE;
*/
/* shuffle loads to go faster */
#undef IVARMACRO
#define IVARMACRO(x) { \
register LispPTR *var = (LispPTR *)IVar; \
\
HARD_PUSH(TOPOFSTACK); \
{register unsigned char opcode; \
opcode = *(unsigned char *)(PCMAC+1); \
TOPOFSTACK = *(var + x); \
PCMACL += 1; \
fast_dispatcher(table, opcode);} \
goto nextopcode; }
#undef PVARMACRO
#define PVARMACRO(x) { \
register LispPTR *var = (LispPTR *)PVar; \
\
HARD_PUSH(TOPOFSTACK); \
{register unsigned char opcode; \
opcode = *(unsigned char *)(PCMAC+1); \
TOPOFSTACK = *(var + x); \
PCMACL += 1; \
fast_dispatcher(table, opcode);} \
goto nextopcode; }
#define NSMALLP(x) (((x) >> 17) ^ 7)
#define NSMALLP_RANGE(x) (((x << 15) >>15) ^ x)
#define UNBOX_SMALLP(sour) ( ((int)sour << 15) >> 15 )
#define HARD_CASE(fn) {SV; TOPOFSTACK = fn(POP_TOS_1, TOPOFSTACK, ufn_2); nextop1;}
#define UNBOX_ELSE(sour, dest, otherwise){ \
if (NSMALLP(sour)) \
if (GetTypeNumber(sour) != TYPE_FIXP) otherwise; \
else dest = FIXP_VALUE(sour); \
else dest = UNBOX_SMALLP(sour);}
#define UNBOX_ELSE_UFN(sour, dest) UNBOX_ELSE(sour, dest, goto op_ufn);
#define BOX_INTO(result, dest){ \
if (NSMALLP_RANGE(result))/* dest = box_fixp(result);*/ \
{register LispPTR *wordp; \
wordp = (LispPTR *) createcell68k(TYPE_FIXP); \
*((int *)wordp) = result; \
dest = (LADDR_from_68k(wordp)); } \
else dest = (( (unsigned)result <<15) >>15) | S_POSITIVE;}
#define ARITH_OP(op, exceptions, handler) \
{register int arg1, arg2, result; \
arg1 = GET_TOS_1; /* w/o side effect */ \
if(!NSMALLP(TOPOFSTACK) && !NSMALLP(arg1)) { \
arg2 = UNBOX_SMALLP(TOPOFSTACK); \
arg1 = UNBOX_SMALLP(arg1); \
result = arg1 op arg2; \
BOX_INTO(result, TOPOFSTACK); \
POP_TOS_1; \
nextop1;} \
N_OP_CALL_2(handler); }
#define BINARY_OP(exp, exceptions) { \
register int arg1, arg2, result; \
arg1 = GET_TOS_1; /* w/o side effect */ \
UNBOX_ELSE_UFN(TOPOFSTACK, arg2); \
UNBOX_ELSE_UFN(arg1, arg1); \
result = exp; \
if (exceptions) goto op_ufn; \
BOX_INTO(result, TOPOFSTACK); \
POP_TOS_1; nextop1;}
#undef GREATERP
#undef IGREATERP
#define GREATERP { \
register int arg1, arg2, result; \
arg1 = GET_TOS_1; /* w/o side effect */ \
UNBOX_ELSE_UFN(TOPOFSTACK, arg2); \
UNBOX_ELSE_UFN(arg1, arg1); \
TOPOFSTACK = (arg1>arg2? ATOM_T : NIL_PTR); \
POP_TOS_1; nextop1;}
#define IGREATERP { \
register int arg1, arg2, result; \
arg1 = GET_TOS_1; /* w/o side effect */ \
UNBOX_ELSE_UFN(TOPOFSTACK, arg2); \
UNBOX_ELSE_UFN(arg1, arg1); \
TOPOFSTACK = (arg1>arg2? ATOM_T : NIL_PTR); \
POP_TOS_1; nextop1;}
#define OVERFLOW(a,b,r) ( (int)((r^a) & (a^~b)) < 0)
#define SOVERFLOW(a,b,r) ( (int)((r^a) & (a^b)) < 0)
/* overflow is ((arg1>0) == (arg2>0)) && ((result>0) != (arg1>0)) */
#undef IPLUS2
#undef PLUS2
#define IPLUS2 ARITH_OP(+, OVERFLOW(arg1,arg2,result), N_OP_iplus2)
#define PLUS2 ARITH_OP(+, OVERFLOW(arg1,arg2,result), N_OP_plus2)
#undef IDIFFERENCE
#undef DIFFERENCE
#define IDIFFERENCE ARITH_OP(-, SOVERFLOW(arg1,arg2,result), N_OP_idifference)
#define DIFFERENCE ARITH_OP(-, SOVERFLOW(arg1,arg2,result), N_OP_difference)
#undef LOGOR
#undef LOGAND
#undef LOGXOR
#define LOGOR BINARY_OP(arg1 | arg2, 0)
#define LOGAND BINARY_OP(arg1 & arg2, 0)
#define LOGXOR BINARY_OP(arg1 ^ arg2, 0)
#define UNARY_OP(exp, exceptions) { \
register int arg, result; \
UNBOX_ELSE_UFN(TOPOFSTACK, arg); \
result = exp; \
if (exceptions) goto op_ufn; \
BOX_INTO(result, TOPOFSTACK); \
nextop1;}
#undef LRSH8
#undef LRSH1
#define LRSH8 UNARY_OP((unsigned)arg >> 8, 0)
#define LRSH1 UNARY_OP((unsigned)arg >> 1, 0)
#undef LLSH8
#undef LLSH1
#define LLSH8 UNARY_OP(arg << 8, ((arg >> 24)!=0))
#define LLSH1 UNARY_OP(arg << 1, (arg < 0))
#undef ADDBASE
#define ADDBASE { \
register int arg1, arg2; \
UNBOX_ELSE_UFN(TOPOFSTACK, arg2); \
TOPOFSTACK = POP_TOS_1 + arg2; \
nextop1;}
#undef SWAP_WORDS
#define SWAP_WORDS(x) swapx(x)

156
inc/iopage.h Executable file
View File

@@ -0,0 +1,156 @@
/* $Id: iopage.h,v 1.2 1999/01/03 02:06:06 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef IOPAGE_DEFINED
#define IOPAGE_DEFINED (1)
#ifndef BYTESWAP
/* Normal definition, for big-indian machines */
typedef struct iopage {
DLword dummy0[022];
DLword dlmaintpanel;
DLword dlfloppycmd;
DLword dlttyportcmd;
DLword dlprocessorcmd;
DLword newmousestate;
DLword dlbeepcmd;
DLword dlrs232cmisccommand;
DLword dlrs232cputflag;
DLword dlrs232cgetflag;
DLword dummy1[6];
DLword dlfloppy;
DLword dlttyout;
DLword dummy2;
DLword dlttyin;
DLword dummy3;
DLword dlprocessor2;
DLword dlprocessor1;
DLword dlprocessor0;
DLword newmousex;
DLword newmousey;
DLword dlbeepfreq;
DLword dlrs232cparametercsblo;
DLword dlrs232cparametercsbhi;
DLword dlrs232csetrs366status[3];
DLword dlrs232cputcsblo;
DLword dlrs232cputcsbhi;
DLword dlrs232cgetcsblo;
DLword dlrs232cgetcsbhi;
DLword dlrs232cdevicestatus;
DLword dlrs232cparameteroutcome;
DLword dltodvalid;
DLword dltodlo;
DLword dltodhi;
DLword dltodlo2;
DLword dlmousex;
DLword dlmousey;
DLword dlutilin;
DLword dlkbdad0;
DLword dlkbdad1;
DLword dlkbdad2;
DLword dlkbdad3;
DLword dlkbdad4;
DLword dlkbdad5;
DLword dllsepimagecsb[040];
DLword dliophardwareconfig;
DLword dummy4[013];
DLword dlrs232cparametercsblo_11;
DLword dlrs232cparametercsbhi_11;
DLword dlrs232csetrs366status_11[016] ;
DLword dummy5[074];
DLword dlmagtape[4];
DLword dlethernet[014];
DLword dummy6[037];
DLword dldispinterrupt;
DLword dldispcontrol;
DLword dldispborder;
DLword dlcursorx;
DLword dlcursory;
DLword dlcursorbitmap[020];
} IOPAGE;
#else
/***********************************************************/
/* Byte-swapped/word-swapped version, for 386i */
/***********************************************************/
typedef struct iopage {
DLword dummy0[022];
DLword dlfloppycmd;
DLword dlmaintpanel; /* hi */
DLword dlprocessorcmd;
DLword dlttyportcmd; /* hi */
DLword dlbeepcmd;
DLword newmousestate; /* hi */
DLword dlrs232cputflag;
DLword dlrs232cmisccommand; /* hi */
DLword dummy1b;
DLword dlrs232cgetflag; /* hi */
DLword dummy1[4];
DLword dlfloppy;
DLword dummy1a; /* hi */
DLword dummy2;
DLword dlttyout; /* hi */
DLword dummy3;
DLword dlttyin; /* hi */
DLword dlprocessor1;
DLword dlprocessor2; /* hi */
DLword newmousex;
DLword dlprocessor0; /* hi */
DLword dlbeepfreq;
DLword newmousey; /* hi */
DLword dlrs232cparametercsbhi;
DLword dlrs232cparametercsblo; /* hi */
DLword dlrs232csetrs366status[2];
DLword dlrs232cputcsblo;
DLword dlrs232csetrs366statusa; /* hi */
DLword dlrs232cgetcsblo;
DLword dlrs232cputcsbhi; /* hi */
DLword dlrs232cdevicestatus;
DLword dlrs232cgetcsbhi; /* hi */
DLword dltodvalid;
DLword dlrs232cparameteroutcome; /* hi */
DLword dltodhi;
DLword dltodlo; /* hi */
DLword dlmousex;
DLword dltodlo2; /* hi */
DLword dlutilin;
DLword dlmousey; /* hi */
DLword dlkbdad1;
DLword dlkbdad0; /* hi */
DLword dlkbdad3;
DLword dlkbdad2; /* hi */
DLword dlkbdad5;
DLword dlkbdad4; /* hi */
DLword dllsepimagecsb[040];
DLword dummy4a;
DLword dliophardwareconfig; /* hi */
DLword dummy4[012];
DLword dlrs232cparametercsbhi_11;
DLword dlrs232cparametercsblo_11; /* hi */
DLword dlrs232csetrs366status_11[016] ;
DLword dummy5[074];
DLword dlmagtape[4];
DLword dlethernet[014];
DLword dummy6[036];
DLword dldispinterrupt;
DLword dummy6a;
DLword dldispborder;
DLword dldispcontrol; /* hi */
DLword dlcursory;
DLword dlcursorx; /* hi */
DLword dlcursorbitmap[020];
} IOPAGE;
#endif /* BYTESWAP */
#endif

46
inc/kbdif.h Executable file
View File

@@ -0,0 +1,46 @@
/* $Id: kbdif.h,v 1.2 1999/01/03 02:06:06 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/* The Keyboard structure. */
typedef struct {
u_char KeyMap[0x80];
#ifdef DOS
u_char lastbyte;
void (*prev_handler)();
#endif /* DOS */
void (* sync_device)(); /* Make reality and emualtor coinside with eachother */
void (* enter_device)();
void (* exit_device)();
void (* device_event)();
void (* before_raid)();
void (* after_raid)();
int lispkeycode;
#ifdef DOS
int device_active;
int device_locked;
#endif /* DOS */
} KbdInterfaceRec, *KbdInterface;
#ifndef TRUE
#define FALSE 0
#define TRUE !FALSE
#endif /* TRUE */

196
inc/keyboard.h Executable file
View File

@@ -0,0 +1,196 @@
/* $Id: keyboard.h,v 1.2 1999/01/03 02:06:06 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/** Header File for K/B MOUSE */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define MOUSE_LEFT 13
#define MOUSE_MIDDLE 15
#define MOUSE_RIGHT 14
#define CAPSKEY 16
#define DLMOUSEUP 0
#define DLMOUSEWAITING 1
#define DLMOUSENORMAL 2
#define MOUSE_ALLBITS 7
#define KB_ALLUP 0xffff
#define HARDCURSORHEIGHT 16
#ifndef BYTESWAP
typedef struct
{
DLword read;
DLword write;
} RING;
#else
typedef struct
{
DLword write;
DLword read;
} RING;
#endif /* BYTESWAP */
/* macros for getting to the next-read and next-write ring buf ptrs */
#define RING_READ(head68k) (((RING*)(head68k))->read)
#define RING_WRITE(head68k) (((RING*)(head68k))->write)
/* for feature use */
#ifndef BYTESWAP
typedef struct
{
DLword mousex;
DLword mousey;
DLword utilin;
DLword kbdad0;
DLword kbdad1;
DLword kbdad2;
DLword kbdad3;
DLword kbdad4;
DLword kbdad5;
DLword nil;
} IOState;
/* Corresponds to the Lisp KEYBOARDEVENT structure */
typedef struct
{
DLword W0;
DLword W1;
DLword W2;
DLword W3;
DLword WU;
DLword W4;
DLword W5;
/* int time; */
short timehi;
short timelo;
unsigned mousestate : 3;
unsigned shift1 : 1;
unsigned shift2 : 1;
unsigned lock : 1;
unsigned ctrl : 1;
unsigned meta : 1;
unsigned font : 1;
unsigned usermode1 : 1;
unsigned usermode2 : 1;
unsigned usermode3 : 1;
unsigned altgr : 1;
unsigned deadkey : 1;
unsigned nil : 2;
DLword mousex;
DLword mousey;
/* DLword nil2; */
LispPTR deadkeyalist;
} KBEVENT;
#define RCLK(place) { struct timeval time;\
gettimeofday(&time,NULL);\
(place)=(time.tv_sec * 1000000)+time.tv_usec;}
#else
typedef struct
{
DLword mousey;
DLword mousex;
DLword kbdad0;
DLword utilin;
DLword kbdad2;
DLword kbdad1;
DLword kbdad4;
DLword kbdad3;
DLword nil;
DLword kbdad5;
} IOState;
/* Corresponds to the Lisp KEYBOARDEVENT structure */
typedef struct
{
DLword W1;
DLword W0;
DLword W3;
DLword W2;
DLword W4;
DLword WU;
DLword timehi;
DLword W5;
short timelo;
DLword mousex;
unsigned nil : 4;
unsigned usermode3 : 1;
unsigned usermode2 : 1;
unsigned usermode1 : 1;
unsigned font : 1;
unsigned meta : 1;
unsigned ctrl : 1;
unsigned lock : 1;
unsigned shift2 : 1;
unsigned shift1 : 1;
unsigned mousestate : 3;
/* DLword nil2; */
DLword mousey;
LispPTR deadkeyalist;
} KBEVENT; /* CHANGED-BY-TAKE ***/
/*** OBSLOETE
**#define RCLK(hi,lo) \
{ \
struct timeval time;\
int timetemp; \
gettimeofday(&time,NULL);\
timetemp = (time.tv_sec * 1000000)+time.tv_usec; \
(hi)=(DLword)(timetemp>>16); \
(lo) = (DLword)(timetemp & 0xFFFF); \
}
******/
#define RCLK(place) { struct timeval time;\
gettimeofday(&time,NULL);\
(place)=(time.tv_sec * 1000000)+time.tv_usec;}
#endif /* BYTESWAP */
/* Size of a KEYBOARDEVENT structure, and */
/* the size of the kbd-event ring buffer */
#define MINKEYEVENT 2 /* leave 2 words for read,write offsets */
#ifdef NOEUROKBD /* set to disable new european kbd support */
#define KEYEVENTSIZE 12
#else
#define KEYEVENTSIZE ((sizeof(KBEVENT)+1)>>1)
#endif
/* Offset of the end of the ring buffer */
#define MAXKEYEVENT (MINKEYEVENT + (383*KEYEVENTSIZE))
#define NOEUROKEYEVENTSIZE 12
#define EUROKEYEVENTSIZE ((sizeof(KBEVENT) + 1) >> 1)
#define NUMBEROFKEYEVENTS 383
typedef union
{
struct
{
RING vectorindex; /* Index for the vector of DLwords in this structure */
KBEVENT event[NUMBEROFKEYEVENTS + 1];
} ring;
/* The array of KBEVENTS (indexed by DLword) for euro */
DLword euro[MINKEYEVENT + (NUMBEROFKEYEVENTS * EUROKEYEVENTSIZE)];
/* The array of KBEVENTS (indexed by DLword) for noeuro */
DLword noeuro[MINKEYEVENT + (NUMBEROFKEYEVENTS * NOEUROKEYEVENTSIZE)];
} keybuffer;

195
inc/keyboard.h% Executable file
View File

@@ -0,0 +1,195 @@
/* %Z% %M% Version %I% (%G%). copyright venue */
/** Header File for K/B MOUSE */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define MOUSE_LEFT 13
#define MOUSE_MIDDLE 15
#define MOUSE_RIGHT 14
#define CAPSKEY 16
#define DLMOUSEUP 0
#define DLMOUSEWAITING 1
#define DLMOUSENORMAL 2
#define MOUSE_ALLBITS 7
#define KB_ALLUP 0xffff
#define HARDCURSORHEIGHT 16
#ifndef BYTESWAP
typedef struct
{
DLword read;
DLword write;
} RING;
#else
typedef struct
{
DLword write;
DLword read;
} RING;
#endif /* BYTESWAP */
/* macros for getting to the next-read and next-write ring buf ptrs */
#define RING_READ(head68k) (((RING*)(head68k))->read)
#define RING_WRITE(head68k) (((RING*)(head68k))->write)
/* for feature use */
#ifndef BYTESWAP
typedef struct
{
DLword mousex;
DLword mousey;
DLword utilin;
DLword kbdad0;
DLword kbdad1;
DLword kbdad2;
DLword kbdad3;
DLword kbdad4;
DLword kbdad5;
DLword nil;
} IOState;
/* Corresponds to the Lisp KEYBOARDEVENT structure */
typedef struct
{
DLword W0;
DLword W1;
DLword W2;
DLword W3;
DLword WU;
DLword W4;
DLword W5;
/* int time; */
short timehi;
short timelo;
unsigned mousestate : 3;
unsigned shift1 : 1;
unsigned shift2 : 1;
unsigned lock : 1;
unsigned ctrl : 1;
unsigned meta : 1;
unsigned font : 1;
unsigned usermode1 : 1;
unsigned usermode2 : 1;
unsigned usermode3 : 1;
unsigned altgr : 1;
unsigned deadkey : 1;
unsigned nil : 2;
DLword mousex;
DLword mousey;
/* DLword nil2; */
LispPTR deadkeyalist;
} KBEVENT;
#define RCLK(place) { struct timeval time;\
gettimeofday(&time,NULL);\
(place)=(time.tv_sec * 1000000)+time.tv_usec;}
#else
typedef struct
{
DLword mousey;
DLword mousex;
DLword kbdad0;
DLword utilin;
DLword kbdad2;
DLword kbdad1;
DLword kbdad4;
DLword kbdad3;
DLword nil;
DLword kbdad5;
} IOState;
/* Corresponds to the Lisp KEYBOARDEVENT structure */
typedef struct
{
DLword W1;
DLword W0;
DLword W3;
DLword W2;
DLword W4;
DLword WU;
DLword timehi;
DLword W5;
short timelo;
DLword mousex;
unsigned nil : 4;
unsigned usermode3 : 1;
unsigned usermode2 : 1;
unsigned usermode1 : 1;
unsigned font : 1;
unsigned meta : 1;
unsigned ctrl : 1;
unsigned lock : 1;
unsigned shift2 : 1;
unsigned shift1 : 1;
unsigned mousestate : 3;
/* DLword nil2; */
DLword mousey;
LispPTR deadkeyalist;
} KBEVENT; /* CHANGED-BY-TAKE ***/
/*** OBSLOETE
**#define RCLK(hi,lo) \
{ \
struct timeval time;\
int timetemp; \
gettimeofday(&time,NULL);\
timetemp = (time.tv_sec * 1000000)+time.tv_usec; \
(hi)=(DLword)(timetemp>>16); \
(lo) = (DLword)(timetemp & 0xFFFF); \
}
******/
#define RCLK(place) { struct timeval time;\
gettimeofday(&time,NULL);\
(place)=(time.tv_sec * 1000000)+time.tv_usec;}
#endif /* BYTESWAP */
/* Size of a KEYBOARDEVENT structure, and */
/* the size of the kbd-event ring buffer */
#define MINKEYEVENT 2 /* leave 2 words for read,write offsets */
#ifdef NOEUROKBD /* set to disable new european kbd support */
#define KEYEVENTSIZE 12
#else
#define KEYEVENTSIZE ((sizeof(KBEVENT)+1)>>1)
#endif
/* Offset of the end of the ring buffer */
#define MAXKEYEVENT (MINKEYEVENT + (383*KEYEVENTSIZE))
#define NOEUROKEYEVENTSIZE 12
#define EUROKEYEVENTSIZE ((sizeof(KBEVENT) + 1) >> 1)
typedef union
{
struct
{
RING vectorindex; /* Index for the vector of DLwords in this structure */
KBEVENT event[NUMBEROFKEYEVENTS + 1];
} ring;
/* The array of KBEVENTS (indexed by DLword) for euro */
DLword euro[MINKEYEVENT + (NUMBEROFKEYEVENTS * EUROKEYEVENTSIZE)];
/* The array of KBEVENTS (indexed by DLword) for noeuro */
DLword noeuro[MINKEYEVENT + (NUMBEROFKEYEVENTS * NOEUROKEYEVENTSIZE)];
} keybuffer;

133
inc/keysym.h Executable file
View File

@@ -0,0 +1,133 @@
/* $Id: keysym.h,v 1.2 1999/01/03 02:06:07 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/* * * * D O S K E Y B O A R D M A P P I N G S * * * */
#define KEY_5 0
#define KEY_4 1
#define KEY_6 2
#define KEY_E 3
#define KEY_7 4
#define KEY_D 5
#define KEY_U 6
#define KEY_V 7
#define KEY_0 8
#define KEY_K 9
#define KEY_MINUS 10
#define KEY_P 11
#define KEY_SLASH 12
#define KEY_BACKSPACE 13
#define KEY_SAME 14
#define KEY_DEL 15
#define KEY_3 16
#define KEY_2 17
#define KEY_W 18
#define KEY_Q 19
#define KEY_S 20
#define KEY_A 21
#define KEY_9 22
#define KEY_I 23
#define KEY_X 24
#define KEY_O 25
#define KEY_L 26
#define KEY_COMMA 27
#define KEY_QUOTE 28
#define KEY_CLOSEBRACK 29
/* KEY_NOT_USED 30 */
#define KEY_LEFTMETA 31
#define KEY_1 32
#define KEY_ESC 33
#define KEY_TAB 34
#define KEY_F 35
#define KEY_CTRL 36
#define KEY_C 37
#define KEY_J 38
#define KEY_B 39
#define KEY_Z 40
#define KEY_LEFTSHIFT 41
#define KEY_PERIOD 42
#define KEY_SEMICOLON 43
#define KEY_RETURN 44
#define KEY_BACKQUOTE 45
/* #define KEY_DEL 46 */
#define KEY_NEXT 47
#define KEY_R 48
#define KEY_T 49
#define KEY_G 50
#define KEY_Y 51
#define KEY_H 52
#define KEY_8 53
#define KEY_N 54
#define KEY_M 55
/* #define KEY_CAPSLOCK 56 */
#define KEY_SPACE 57
#define KEY_OPENBRACK 58
#define KEY_EQUAL 59
#define KEY_RIGHTSHIFT 60
#define KEY_STOP 61
#define KEY_MOVE 62
#define KEY_UNDO 63
#define KEY_PK_EQUAL 64
#define KEY_KP_SLASH 65
#define KEY_SUPERSCRIPT 66
#define KEY_CASE 67
#define KEY_STRIKEOUT 68
#define KEY_KP_2 69
#define KEY_KP_3 70
#define KEY_LINEFEED 71
#define KEY_CAPSLOCK 72
#define KEY_NUMLOCK 73
#define KEY_SCROLLOCK 74
#define KEY_BREAK 75
#define KEY_DOIT 76
/* KEY_NOT_USED 77 */
/* KEY_NOT_USED 78 */
/* KEY_NOT_USED 79 */
#define KEY_MARGIN 80
#define KEY_KP_HOME 81
#define KEY_KP_8 82
#define KEY_KP_9 83
#define KEY_KP_4 84
#define KEY_KP_5 85
#define KEEY_LEFT_SPC 86
#define KEY_KP_6 87
#define KEY_RIGHT_SPC 88
#define KEY_COPY 89
#define KEY_FIND 90
#define KEY_AGAIN 91
#define KEY_HELP 92
#define KEY_EXPAND 93
#define KEY_KP_END 94
#define KEY_KP_TIMES 95
#define KEY_KP_MINUS 96
#define KEY_CENTER 97
#define KEY_KP_INS 98
#define KEY_BOLD 99
#define KEY_ITALIC 100
#define KEY_UNDERLINE 101
#define KEY_KP_PLUS 102
/* KEY_NOT_USED 103 */
#define KEY_LARGER 104
#define KEY_BACKSLASH 105
#define KEY_LOOKS 106
#define KEY_F11 107
#define KEY_F12 108
#define KEY_PROPS 109
#define KEY_PRSC 110
#define KEY_OPEN 111

43
inc/ldeXdefs.h Executable file
View File

@@ -0,0 +1,43 @@
/* $Id: ldeXdefs.h,v 1.2 1999/01/03 02:06:07 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* * * * * X defs for all files in Medley * * * * */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef __LDEXDEF__
#define __LDEXDEF__ 1
#include <signal.h>
#ifdef LOCK_X_UPDATES
#define XLOCK { XLocked++; /* printf("L"); fflush(stdout);*/}
#define XUNLOCK \
{ XLocked--;/* printf("U"); fflush(stdout);*/ \
if (XNeedSignal) \
{ \
XNeedSignal = 0; \
kill(getpid(), SIGPOLL); \
}; \
}
#else
#define XLOCK
#define XUNLOCK
#endif /* LOCK_X_UPDATES */
extern int XLocked;
extern int XNeedSignal;
/* this is !0 if we're locked; it should be 0 or larger always */
#endif

640
inc/lispemul.h Executable file
View File

@@ -0,0 +1,640 @@
/* $Id: lispemul.h,v 1.4 2001/12/24 01:08:57 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-1995 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef BYTESWAP
/*** Normal byte-order type decls */
typedef struct {unsigned char code;} BYTECODE;
typedef char ByteCode;
typedef unsigned short DLword;
typedef char DLbyte;
typedef unsigned int LispPTR;
/* 32 bit Cell Chang. 14 Jan 87 take */
typedef DLword mds_page; /* Top word of the MDS */
typedef (*CFuncPTR)();
#ifdef BIGVM
typedef struct consstr
{
unsigned cdr_code : 4;
unsigned car_field : 28;
} ConsCell;
typedef struct ufn_entry
{
DLword atom_name; /* UFN's atomindex */
unsigned byte_num : 8; /* num of byte code */
unsigned arg_num : 8; /* num of argments */
} UFN;
typedef struct closure_type
{
unsigned nil1 : 4;
unsigned def_ptr : 28; /* LispPTR to definition cell */
unsigned nil2 : 4;
unsigned env_ptr : 28; /* LispPTR to environment */
} Closure;
#else /* not BIGVM */
typedef struct consstr
{
unsigned cdr_code : 8;
unsigned car_field : 24;
} ConsCell;
typedef struct ufn_entry
{
DLword atom_name; /* UFN's atomindex */
unsigned byte_num : 8; /* num of byte code */
unsigned arg_num : 8; /* num of argments */
} UFN;
typedef struct closure_type
{
unsigned nil1 : 8;
unsigned def_ptr : 24; /* LispPTR to definition cell */
unsigned nil2 : 8;
unsigned env_ptr : 24; /* LispPTR to environment */
} Closure;
#endif /* BIGVM */
typedef struct interrupt_state
{ /* Interrupt-request mask to communicate with INTERRUPTED */
unsigned LogFileIO :1; /* console msg arrived to print */
unsigned ETHERInterrupt :1; /* 10MB activity happened */
unsigned IOInterrupt :1; /* I/O happened (not used yet) */
unsigned gcdisabled :1;
unsigned vmemfull :1;
unsigned stackoverflow :1;
unsigned storagefull :1;
unsigned waitinginterrupt :1;
unsigned nil :8; /* mask of ints being processes */
DLword intcharcode;
} INTSTAT;
typedef struct interrupt_state_2
{ /* alternate view of the interrupt state */
unsigned pendingmask :8;
unsigned handledmask :8;
DLword nil;
} INTSTAT2;
struct state
{
DLword *ivar; /* + 0 */
DLword *pvar; /* + 4 */
DLword *csp; /* + 8 */
LispPTR tosvalue; /* + 12 */
ByteCode *currentpc; /* + 16 */
struct fnhead *currentfunc; /* + 20*/
DLword *endofstack; /* + 24*/
UNSIGNED irqcheck; /* + 28 */
UNSIGNED irqend; /* + 32 */
LispPTR scratch_cstk; /* + 34 */
int errorexit; /* + 38 */
};
/***** Get_DLword(ptr) ptr is char* ***/
#ifndef UNALIGNED_FETCH_OK
#define Get_DLword(ptr) ((Get_BYTE(ptr) <<8) | Get_BYTE(ptr+1))
#else
#define Get_DLword(ptr) *(((DLword *)WORDPTR(ptr)))
#endif
#ifdef BIGVM
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 24) | \
(Get_BYTE(ptr+1) << 16) | \
(Get_BYTE(ptr+2) << 8) | Get_BYTE(ptr+3))
#else
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 16) | \
(Get_BYTE(ptr+1) << 8) | \
Get_BYTE(ptr+2))
#endif /* BIGVM */
#define Get_code_BYTE Get_BYTE
#define Get_code_DLword Get_DLword
#define Get_code_AtomNo Get_AtomNo
#define Get_code_Pointer Get_Pointer
#ifdef BIGATOMS
#define Get_AtomNo(ptr) Get_Pointer(ptr)
#else
#define Get_AtomNo(ptr) Get_DLword(ptr)
#endif /* BIGATOMS */
/* For bit test */
typedef struct wbits
{
unsigned xMSB :1;
unsigned B1 :1;
unsigned B2 :1;
unsigned B3 :1;
unsigned B4 :1;
unsigned B5 :1;
unsigned B6 :1;
unsigned B7 :1;
unsigned B8 :1;
unsigned B9 :1;
unsigned B10 :1;
unsigned B11 :1;
unsigned B12 :1;
unsigned B13 :1;
unsigned B14 :1;
unsigned LSB :1;
}WBITS;
typedef struct lbits
{
unsigned xMSB :1;
unsigned MIDDLE :30;
unsigned LSB :1;
}LBITS;
#define PUTBASEBIT68K(base68k, offset, bitvalue ) { \
if( bitvalue) \
*((DLword*)(base68k) + (((u_short)(offset))>>4 )) \
|= 1 << (15 - ((u_short)(offset))%BITSPER_DLWORD); \
else \
*((DLword*)(base68k) + (((u_short)(offset))>>4 )) \
&= ~( 1 << (15 - ((u_short)(offset)) %BITSPER_DLWORD)); \
}
#else
/*** Byte-swapped structure declarations, for 80386 ***/
typedef struct {unsigned char code;} BYTECODE;
typedef char ByteCode;
typedef unsigned short DLword;
typedef char DLbyte;
typedef unsigned int LispPTR;
/* 32 bit Cell Chang. 14 Jan 87 take */
typedef DLword mds_page; /* Top word of the MDS */
typedef (*CFuncPTR)();
#ifdef BIGVM
typedef struct consstr
{
unsigned car_field : 28;
unsigned cdr_code : 4;
} ConsCell;
typedef struct ufn_entry
{
unsigned arg_num : 8; /* num of argments */
unsigned byte_num : 8; /* num of byte code */
DLword atom_name; /* UFN's atomindex */
} UFN;
typedef struct closure_type
{
unsigned def_ptr : 28; /* LispPTR to definition cell */
unsigned nil1 : 4;
unsigned env_ptr : 28; /* LispPTR to environment */
unsigned nil2 : 4;
} Closure;
#else /* BIGVM */
typedef struct consstr
{
unsigned car_field : 24;
unsigned cdr_code : 8;
} ConsCell;
typedef struct ufn_entry
{
unsigned arg_num : 8; /* num of argments */
unsigned byte_num : 8; /* num of byte code */
DLword atom_name; /* UFN's atomindex */
} UFN;
typedef struct closure_type
{
unsigned def_ptr : 24; /* LispPTR to definition cell */
unsigned nil1 : 8;
unsigned env_ptr : 24; /* LispPTR to environment */
unsigned nil2 : 8;
} Closure;
#endif /* BIGVM */
typedef struct interrupt_state
{ /* Interrupt-request mask to communicate with INTERRUPTED */
DLword intcharcode;
unsigned nil :8;
unsigned waitinginterrupt :1;
unsigned storagefull :1;
unsigned stackoverflow :1;
unsigned vmemfull :1;
unsigned gcdisabled :1;
unsigned IOInterrupt :1; /* I/O happened (not used yet) */
unsigned ETHERInterrupt :1; /* 10MB activity happened */
unsigned LogFileIO :1; /* console msg arrived to print */
} INTSTAT;
typedef struct interrupt_state_2
{ /* alternate view of the interrupt state */
DLword nil;
unsigned handledmask :8;
unsigned pendingmask :8;
} INTSTAT2;
struct state
{
DLword *ivar; /* + 0 */
DLword *pvar; /* + 4 */
DLword *csp; /* + 8 */
LispPTR tosvalue; /* + 12 */
ByteCode *currentpc; /* + 16 */
struct fnhead *currentfunc; /* + 20*/
DLword *endofstack; /* + 24*/
UNSIGNED irqcheck; /* + 28 */
UNSIGNED irqend; /* + 32 */
LispPTR scratch_cstk; /* + 34 */
int errorexit; /* + 38 */
};
/* Fetching 2 bytes to make a word -- always do it the hard way */
/* if we're byte-swapped: You can't rely on byte ordering!! */
#define Get_DLword(ptr) ((Get_BYTE(ptr) <<8) | Get_BYTE(ptr+1))
#ifdef BIGVM
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 24) | \
(Get_BYTE(ptr+1) << 16) | \
(Get_BYTE(ptr+2) << 8) | Get_BYTE(ptr+3))
#else
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 16) | \
(Get_BYTE(ptr+1) << 8) | \
Get_BYTE(ptr+2))
#endif /* BIGVM */
#ifndef RESWAPPEDCODESTREAM
#define Get_code_BYTE(ptr) Get_BYTE(ptr)
#define Get_code_AtomNo Get_AtomNo
#define Get_code_DLword Get_DLword
#else
#define Get_code_BYTE(ptr) (((BYTECODE *)(ptr))->code)
#define Get_code_Pointer(ptr) ((Get_code_BYTE(ptr) << 16) | \
(Get_code_BYTE(ptr+1) << 8) | \
Get_code_BYTE(ptr+2))
#define Get_code_DLword(ptr) ((Get_code_BYTE(ptr) << 8) | Get_code_BYTE(ptr+1))
#define Get_code_AtomNo Get_code_Pointer
#endif /* RESWAPPEDCODESTREAM */
#ifdef BIGATOMS
#define Get_AtomNo(ptr) Get_Pointer(ptr)
#else
#define Get_AtomNo(ptr) Get_DLword(ptr)
#endif /* BIGATOMS */
/* For bit test */
typedef struct wbits
{
USHORT LSB :1;
USHORT B14 :1;
USHORT B13 :1;
USHORT B12 :1;
USHORT B11 :1;
USHORT B10 :1;
USHORT B9 :1;
USHORT B8 :1;
USHORT B7 :1;
USHORT B6 :1;
USHORT B5 :1;
USHORT B4 :1;
USHORT B3 :1;
USHORT B2 :1;
USHORT B1 :1;
USHORT xMSB :1;
} WBITS;
typedef struct lbits
{
unsigned LSB :1;
unsigned MIDDLE :30;
unsigned xMSB :1; /* xMSB b/c HPUX defined MSB in a header */
} LBITS;
#define PUTBASEBIT68K(base68k, offset, bitvalue ) { \
UNSIGNED real68kbase; \
real68kbase = 2 ^ ((UNSIGNED)(base68k)); \
if( bitvalue) \
(* (DLword *) (2^(UNSIGNED)((DLword*)(real68kbase) + (((u_short)(offset))>>4 )))) \
|= 1 << (15 - ((u_short)(offset))%BITSPER_DLWORD); \
else \
(* (DLword *) (2^(UNSIGNED)((DLword*)(real68kbase) + (((u_short)(offset))>>4 )))) \
&= ~( 1 << (15 - ((u_short)(offset)) %BITSPER_DLWORD)); \
}
#endif /* BYTESWAP */
/* Because a WBITS is only 1 word long, need byte-swapped */
/* access to it. Use WBITSPTR(x) instead of ((WBITS *) x) */
#define WBITSPTR(ptr) ((WBITS *) WORDPTR(ptr))
extern struct state MachineState;
#define MState (&MachineState)
#define CURRENTFX ((struct frameex1 *)(((DLword *) PVar) - FRAMESIZE))
#define IVar (MState->ivar)
#define PVar (MState->pvar)
#define CurrentStackPTR (MState->csp)
#define TopOfStack (MState->tosvalue)
#define PC (MState->currentpc)
#define FuncObj (MState->currentfunc)
#define EndSTKP (MState->endofstack)
#define Irq_Stk_Check (MState->irqcheck)
#define Irq_Stk_End (MState->irqend)
#define Scratch_CSTK (MState->scratch_cstk)
#define Error_Exit (MState->errorexit)
/* Typedef for IFPAGE */
#include "ifpage.h"
/* Typedef for IOPAGE */
#include "iopage.h"
/* Typedef for MISCSTAT */
#include "miscstat.h"
/****************************************************
MakeAddr:
base: DLword*
offset: word offset from base
return: DLword*
****************************************************/
#define MakeAddr(base, offset) ((DLword *)(base + (int)offset))
/****************************************************
GetHiWord:
*****************************************************/
#define GetHiWord(x) ((DLword)((x)>>16))
/****************************************************
GetLoWord:
*****************************************************/
#define GetLoWord(x) ((DLword)(x))
/****************************************************
GetLongWord:
address: DLword*
retrun: int
*****************************************************/
#define GetLongWord(address) (*((LispPTR *) (address)))
/****************************************************
PopCStack:
#define PopCStack {TopOfStack = *((LispPTR *)(--CurrentStackPTR)); --CurrentStackPTR;}
*****************************************************/
#define PopCStack {TopOfStack = *((LispPTR *)(CurrentStackPTR)); CurrentStackPTR -= 2;}
/****************************************************
PopStackTo: CSTK -> Place
#define PopStackTo(Place) {Place= *((LispPTR *)(--CurrentStackPTR)); CurrentStackPTR--; }
*****************************************************/
#define PopStackTo(Place) {Place= *((LispPTR *)(CurrentStackPTR)); CurrentStackPTR -= 2; }
/****************************************************
PushCStack:
#define PushCStack {*((int *)(++CurrentStackPTR)) = TopOfStack; ++CurrentStackPTR;}
*****************************************************/
#define PushCStack {CurrentStackPTR += 2;*((LispPTR *)(CurrentStackPTR)) = TopOfStack; }
/****************************************************
PushStack:
#define PushStack(x) {*((LispPTR *)(++CurrentStackPTR))=x;CurrentStackPTR++;}
*****************************************************/
#define PushStack(x) {CurrentStackPTR += 2;*((LispPTR *)(CurrentStackPTR))=x;}
/****************************************************
SmashStack:
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR-1))=x)
*****************************************************/
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR))=x)
/*********************************************************
Get_BYTE(byteptr) byteptr: pointer to 8 bit data
**********************************************************/
/***** OLD definition ************* 13 Nov 1987 takeshi ***
#define Get_BYTE(byteptr) (((unsigned)(*(byteptr))) & 0xff)
**********************************************/
#define Get_BYTE(byteptr) (((BYTECODE *)BYTEPTR(byteptr))->code)
/**********************************************************
DOSTACKOVERFLOW(argnum,bytenum) if it needs hardreturn-cleanup
then upnt to contextsw and immediately return
**********************************************************/
#define DOSTACKOVERFLOW(argnum,bytenum) { \
if(do_stackoverflow(T)) \
{ PushStack(S_POSITIVE | argnum); \
contextsw(SubovFXP,bytenum,1); \
return;\
} \
}
/************************************************************************/
/* */
/* E X T E R N A L F U N C T I O N S */
/* */
/* Declare all functions that will default incorrectly under */
/* normal C inference rules. These functions are the ones */
/* that return pointers, because on DEC Alpha, a pointer is 8 */
/* bytes--but the default fn decl is int, a 4-byte return. */
/* */
/************************************************************************/
extern DLword *createcell68k(unsigned int type);
extern LispPTR *alloc_mdspage(register short int type);
extern UNSIGNED N_OP_unwind(register LispPTR *cstkptr, register LispPTR tos, int n, int keep);
extern char *getenv(const char *);
#include <stdlib.h>
/************************************************************************/
/* */
/* E R R O R & T I M E R P U N T C A S E S */
/* */
/* Set up the top-of-stack so we can continue gracefully after */
/* handling the timer interrupt (e.g., FMEMB, which walks down */
/* the list being searched, pushes its current state on TOS */
/* so that it picks up where it left off after the interrupt. */
/* */
/* Call Interface where neg number indicates an error return */
/* */
/************************************************************************/
#define ERROR_EXIT(tos) {TopOfStack=tos; Error_Exit = 1; return(-1);}
#ifdef ISC
#define INLINE_ERROR_EXIT(tos,retlbl) {TopOfStack=tos; Error_Exit=1 asm("movl $-1,%0\n" retlbl ":" : "=g" (result) : "0" (result)); return(result); }
#endif
#define TIMER_EXIT(tos) {TopOfStack=tos; Error_Exit = 1; return(-2);}
#define WARN(message,operation) {warn(message);operation;return;}
#define NO_WOP {}
#define NIL 0 /* added 29-jan */
#define T 1
#define ATOM_T 0114 /* T's AtomIndex Number 114Q */
#define NIL_PTR 0 /* from cell.h 24-mar-87 take */
#define NOBIND_PTR 1
#define STKLIM 0x1FFFF
#define FRAMESIZE 10 /* size of frameex1: 10 words */
#define FNHEADSIZE 8 /* size of fnhead: 8 words */
#define BFSIZE 2 /* size of basci frame pointer: 2 words */
#define BITSPER_DLWORD 16
#define BITSPER_CELL 32
#define BYTESPER_DLWORD 2
#define BYTESPER_CELL 4
#define BYTESPER_QUAD 8
#define BYTESPER_PAGE 512
#define CELLSPER_QUAD 2
#define CELLSPER_PAGE 128
#define CELLSPER_SEGMENT 32768
#define DLWORDSPER_CELL 2
#define DLWORDSPER_QUAD 4
#define DLWORDSPER_PAGE 256
#define DLWORDSPER_SEGMENT 65536
#define PAGESPER_SEGMENT 256
#define PAGESPER_MDSUNIT 2
#define MDSINCREMENT 512
#define GUARDSTORAGEFULL 128
#define GUARD1STORAGEFULL 64
#define SFS_NOTSWITCHABLE 1
#define SFS_SWITCHABLE 2
#define SFS_ARRAYSWITCHED 3
#define SFS_FULLYSWITCHED 4
#define AtomHTSIZE 256 * DLWORDSPER_PAGE
#define MAXPNCHARS 255 /* Maximam length of PnChars */
#define GET_NATIVE_ADDR(fnobject) \
*((int *) ((UNSIGNED)fnobject + fnobject->startpc - 4))
#define FALSE 0
#define TRUE !FALSE
typedef unsigned int boolean;
/************************************************************************/
/* Define sizes of FN and FNX opcodes; depends on atom size */
/************************************************************************/
#ifdef BIGVM
#define FN_OPCODE_SIZE 5
#define FNX_OPCODE_SIZE 6
#elif defined(BIGATOMS)
#define FN_OPCODE_SIZE 4
#define FNX_OPCODE_SIZE 5
#else
#define FN_OPCODE_SIZE 3
#define FNX_OPCODE_SIZE 4
#endif /* BIGATOMS */
/************************************************************************/
/* */
/* Definitions for "NEW" Symbols */
/* */
/* Offsets within the "New symbols that go with 3-byte atoms. */
/* */
/************************************************************************/
#ifdef BIGATOMS
typedef struct newatom
{
LispPTR na_pname; /* Pointer to the print name */
LispPTR na_value; /* The value cell */
LispPTR na_defn; /* The definition cell */
LispPTR na_plist; /* The property list */
LispPTR na_flags; /* flags from other cells, to make BIGVM work ok */
} NEWATOM;
/* Offsets, in WORDS, from the start of the NEWATOM structure */
#define NEWATOM_PNAME_OFFSET 0
#define NEWATOM_VALUE_OFFSET 2
#define NEWATOM_DEFN_OFFSET 4
#define NEWATOM_PLIST_OFFSET 6
/* Offsets, in cells from start of the NEWATOM structure */
#define NEWATOM_PNAME_PTROFF 0
#define NEWATOM_VALUE_PTROFF 1
#define NEWATOM_DEFN_PTROFF 2
#define NEWATOM_PLIST_PTROFF 3
#endif
/************************************************************************/
/* */
/* Mask to mask off relevant bits in a pointer. */
/* */
/************************************************************************/
#ifdef BIGVM
#define POINTERMASK 0xfffffff
#define SEGMASK 0xfff0000
#define mPAGEMASK 0xfffff00
#else
#define POINTERMASK 0xffffff
#define SEGMASK 0xff0000
#define mPAGEMASK 0xffff00
#endif /* BIGVM */
/************************************************************************/
/* */
/* F P t o V P M a n i p u l a t i o n */
/* */
/* */
/* */
/************************************************************************/
#ifdef BIGVM
#define GETFPTOVP(b,o) b[o]
#define GETPAGEOK(b,o) (b[o]>>16)
#else
#define GETFPTOVP GETWORDBASEWORD
#define GETPAGEOK GETWORDBASEWORD
#endif

640
inc/lispemul.h.save Executable file
View File

@@ -0,0 +1,640 @@
/* $Id: lispemul.h,v 1.3 1999/01/03 02:06:08 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-1995 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef BYTESWAP
/*** Normal byte-order type decls */
typedef struct {unsigned char code;} BYTECODE;
typedef char ByteCode;
typedef unsigned short DLword;
typedef char DLbyte;
typedef unsigned int LispPTR;
/* 32 bit Cell Chang. 14 Jan 87 take */
typedef DLword mds_page; /* Top word of the MDS */
typedef (*CFuncPTR)();
#ifdef BIGVM
typedef struct consstr
{
unsigned cdr_code : 4;
unsigned car_field : 28;
} ConsCell;
typedef struct ufn_entry
{
DLword atom_name; /* UFN's atomindex */
unsigned byte_num : 8; /* num of byte code */
unsigned arg_num : 8; /* num of argments */
} UFN;
typedef struct closure_type
{
unsigned nil1 : 4;
unsigned def_ptr : 28; /* LispPTR to definition cell */
unsigned nil2 : 4;
unsigned env_ptr : 28; /* LispPTR to environment */
} Closure;
#else /* not BIGVM */
typedef struct consstr
{
unsigned cdr_code : 8;
unsigned car_field : 24;
} ConsCell;
typedef struct ufn_entry
{
DLword atom_name; /* UFN's atomindex */
unsigned byte_num : 8; /* num of byte code */
unsigned arg_num : 8; /* num of argments */
} UFN;
typedef struct closure_type
{
unsigned nil1 : 8;
unsigned def_ptr : 24; /* LispPTR to definition cell */
unsigned nil2 : 8;
unsigned env_ptr : 24; /* LispPTR to environment */
} Closure;
#endif /* BIGVM */
typedef struct interrupt_state
{ /* Interrupt-request mask to communicate with INTERRUPTED */
unsigned LogFileIO :1; /* console msg arrived to print */
unsigned ETHERInterrupt :1; /* 10MB activity happened */
unsigned IOInterrupt :1; /* I/O happened (not used yet) */
unsigned gcdisabled :1;
unsigned vmemfull :1;
unsigned stackoverflow :1;
unsigned storagefull :1;
unsigned waitinginterrupt :1;
unsigned nil :8; /* mask of ints being processes */
DLword intcharcode;
} INTSTAT;
typedef struct interrupt_state_2
{ /* alternate view of the interrupt state */
unsigned pendingmask :8;
unsigned handledmask :8;
DLword nil;
} INTSTAT2;
struct state
{
DLword *ivar; /* + 0 */
DLword *pvar; /* + 4 */
DLword *csp; /* + 8 */
LispPTR tosvalue; /* + 12 */
ByteCode *currentpc; /* + 16 */
struct fnhead *currentfunc; /* + 20*/
DLword *endofstack; /* + 24*/
UNSIGNED irqcheck; /* + 28 */
UNSIGNED irqend; /* + 32 */
LispPTR scratch_cstk; /* + 34 */
int errorexit; /* + 38 */
};
/***** Get_DLword(ptr) ptr is char* ***/
#ifndef UNALIGNED_FETCH_OK
#define Get_DLword(ptr) ((Get_BYTE(ptr) <<8) | Get_BYTE(ptr+1))
#else
#define Get_DLword(ptr) *(((DLword *)WORDPTR(ptr)))
#endif
#ifdef BIGVM
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 24) | \
(Get_BYTE(ptr+1) << 16) | \
(Get_BYTE(ptr+2) << 8) | Get_BYTE(ptr+3))
#else
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 16) | \
(Get_BYTE(ptr+1) << 8) | \
Get_BYTE(ptr+2))
#endif /* BIGVM */
#define Get_code_BYTE Get_BYTE
#define Get_code_DLword Get_DLword
#define Get_code_AtomNo Get_AtomNo
#define Get_code_Pointer Get_Pointer
#ifdef BIGATOMS
#define Get_AtomNo(ptr) Get_Pointer(ptr)
#else
#define Get_AtomNo(ptr) Get_DLword(ptr)
#endif /* BIGATOMS */
/* For bit test */
typedef struct wbits
{
unsigned xMSB :1;
unsigned B1 :1;
unsigned B2 :1;
unsigned B3 :1;
unsigned B4 :1;
unsigned B5 :1;
unsigned B6 :1;
unsigned B7 :1;
unsigned B8 :1;
unsigned B9 :1;
unsigned B10 :1;
unsigned B11 :1;
unsigned B12 :1;
unsigned B13 :1;
unsigned B14 :1;
unsigned LSB :1;
}WBITS;
typedef struct lbits
{
unsigned xMSB :1;
unsigned MIDDLE :30;
unsigned LSB :1;
}LBITS;
#define PUTBASEBIT68K(base68k, offset, bitvalue ) { \
if( bitvalue) \
*((DLword*)(base68k) + (((u_short)(offset))>>4 )) \
|= 1 << (15 - ((u_short)(offset))%BITSPER_DLWORD); \
else \
*((DLword*)(base68k) + (((u_short)(offset))>>4 )) \
&= ~( 1 << (15 - ((u_short)(offset)) %BITSPER_DLWORD)); \
}
#else
/*** Byte-swapped structure declarations, for 80386 ***/
typedef struct {unsigned char code;} BYTECODE;
typedef char ByteCode;
typedef unsigned short DLword;
typedef char DLbyte;
typedef unsigned int LispPTR;
/* 32 bit Cell Chang. 14 Jan 87 take */
typedef DLword mds_page; /* Top word of the MDS */
typedef (*CFuncPTR)();
#ifdef BIGVM
typedef struct consstr
{
unsigned car_field : 28;
unsigned cdr_code : 4;
} ConsCell;
typedef struct ufn_entry
{
unsigned arg_num : 8; /* num of argments */
unsigned byte_num : 8; /* num of byte code */
DLword atom_name; /* UFN's atomindex */
} UFN;
typedef struct closure_type
{
unsigned def_ptr : 28; /* LispPTR to definition cell */
unsigned nil1 : 4;
unsigned env_ptr : 28; /* LispPTR to environment */
unsigned nil2 : 4;
} Closure;
#else /* BIGVM */
typedef struct consstr
{
unsigned car_field : 24;
unsigned cdr_code : 8;
} ConsCell;
typedef struct ufn_entry
{
unsigned arg_num : 8; /* num of argments */
unsigned byte_num : 8; /* num of byte code */
DLword atom_name; /* UFN's atomindex */
} UFN;
typedef struct closure_type
{
unsigned def_ptr : 24; /* LispPTR to definition cell */
unsigned nil1 : 8;
unsigned env_ptr : 24; /* LispPTR to environment */
unsigned nil2 : 8;
} Closure;
#endif /* BIGVM */
typedef struct interrupt_state
{ /* Interrupt-request mask to communicate with INTERRUPTED */
DLword intcharcode;
unsigned nil :8;
unsigned waitinginterrupt :1;
unsigned storagefull :1;
unsigned stackoverflow :1;
unsigned vmemfull :1;
unsigned gcdisabled :1;
unsigned IOInterrupt :1; /* I/O happened (not used yet) */
unsigned ETHERInterrupt :1; /* 10MB activity happened */
unsigned LogFileIO :1; /* console msg arrived to print */
} INTSTAT;
typedef struct interrupt_state_2
{ /* alternate view of the interrupt state */
DLword nil;
unsigned handledmask :8;
unsigned pendingmask :8;
} INTSTAT2;
struct state
{
DLword *ivar; /* + 0 */
DLword *pvar; /* + 4 */
DLword *csp; /* + 8 */
LispPTR tosvalue; /* + 12 */
ByteCode *currentpc; /* + 16 */
struct fnhead *currentfunc; /* + 20*/
DLword *endofstack; /* + 24*/
UNSIGNED irqcheck; /* + 28 */
UNSIGNED irqend; /* + 32 */
LispPTR scratch_cstk; /* + 34 */
int errorexit; /* + 38 */
};
/* Fetching 2 bytes to make a word -- always do it the hard way */
/* if we're byte-swapped: You can't rely on byte ordering!! */
#define Get_DLword(ptr) ((Get_BYTE(ptr) <<8) | Get_BYTE(ptr+1))
#ifdef BIGVM
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 24) | \
(Get_BYTE(ptr+1) << 16) | \
(Get_BYTE(ptr+2) << 8) | Get_BYTE(ptr+3))
#else
#define Get_Pointer(ptr) ((Get_BYTE(ptr) << 16) | \
(Get_BYTE(ptr+1) << 8) | \
Get_BYTE(ptr+2))
#endif /* BIGVM */
#ifndef RESWAPPEDCODESTREAM
#define Get_code_BYTE(ptr) Get_BYTE(ptr)
#define Get_code_AtomNo Get_AtomNo
#define Get_code_DLword Get_DLword
#else
#define Get_code_BYTE(ptr) (((BYTECODE *)(ptr))->code)
#define Get_code_Pointer(ptr) ((Get_code_BYTE(ptr) << 16) | \
(Get_code_BYTE(ptr+1) << 8) | \
Get_code_BYTE(ptr+2))
#define Get_code_DLword(ptr) ((Get_code_BYTE(ptr) << 8) | Get_code_BYTE(ptr+1))
#define Get_code_AtomNo Get_code_Pointer
#endif /* RESWAPPEDCODESTREAM */
#ifdef BIGATOMS
#define Get_AtomNo(ptr) Get_Pointer(ptr)
#else
#define Get_AtomNo(ptr) Get_DLword(ptr)
#endif /* BIGATOMS */
/* For bit test */
typedef struct wbits
{
USHORT LSB :1;
USHORT B14 :1;
USHORT B13 :1;
USHORT B12 :1;
USHORT B11 :1;
USHORT B10 :1;
USHORT B9 :1;
USHORT B8 :1;
USHORT B7 :1;
USHORT B6 :1;
USHORT B5 :1;
USHORT B4 :1;
USHORT B3 :1;
USHORT B2 :1;
USHORT B1 :1;
USHORT xMSB :1;
} WBITS;
typedef struct lbits
{
unsigned LSB :1;
unsigned MIDDLE :30;
unsigned xMSB :1; /* xMSB b/c HPUX defined MSB in a header */
} LBITS;
#define PUTBASEBIT68K(base68k, offset, bitvalue ) { \
UNSIGNED real68kbase; \
real68kbase = 2 ^ ((UNSIGNED)(base68k)); \
if( bitvalue) \
(* (DLword *) (2^(UNSIGNED)((DLword*)(real68kbase) + (((u_short)(offset))>>4 )))) \
|= 1 << (15 - ((u_short)(offset))%BITSPER_DLWORD); \
else \
(* (DLword *) (2^(UNSIGNED)((DLword*)(real68kbase) + (((u_short)(offset))>>4 )))) \
&= ~( 1 << (15 - ((u_short)(offset)) %BITSPER_DLWORD)); \
}
#endif /* BYTESWAP */
/* Because a WBITS is only 1 word long, need byte-swapped */
/* access to it. Use WBITSPTR(x) instead of ((WBITS *) x) */
#define WBITSPTR(ptr) ((WBITS *) WORDPTR(ptr))
extern struct state MachineState;
#define MState (&MachineState)
#define CURRENTFX ((struct frameex1 *)(((DLword *) PVar) - FRAMESIZE))
#define IVar (MState->ivar)
#define PVar (MState->pvar)
#define CurrentStackPTR (MState->csp)
#define TopOfStack (MState->tosvalue)
#define PC (MState->currentpc)
#define FuncObj (MState->currentfunc)
#define EndSTKP (MState->endofstack)
#define Irq_Stk_Check (MState->irqcheck)
#define Irq_Stk_End (MState->irqend)
#define Scratch_CSTK (MState->scratch_cstk)
#define Error_Exit (MState->errorexit)
/* Typedef for IFPAGE */
#include "ifpage.h"
/* Typedef for IOPAGE */
#include "iopage.h"
/* Typedef for MISCSTAT */
#include "miscstat.h"
/****************************************************
MakeAddr:
base: DLword*
offset: word offset from base
return: DLword*
****************************************************/
#define MakeAddr(base, offset) ((DLword *)(base + (int)offset))
/****************************************************
GetHiWord:
*****************************************************/
#define GetHiWord(x) ((DLword)((x)>>16))
/****************************************************
GetLoWord:
*****************************************************/
#define GetLoWord(x) ((DLword)(x))
/****************************************************
GetLongWord:
address: DLword*
retrun: int
*****************************************************/
#define GetLongWord(address) (*((LispPTR *) (address)))
/****************************************************
PopCStack:
#define PopCStack {TopOfStack = *((LispPTR *)(--CurrentStackPTR)); --CurrentStackPTR;}
*****************************************************/
#define PopCStack {TopOfStack = *((LispPTR *)(CurrentStackPTR)); CurrentStackPTR -= 2;}
/****************************************************
PopStackTo: CSTK -> Place
#define PopStackTo(Place) {Place= *((LispPTR *)(--CurrentStackPTR)); CurrentStackPTR--; }
*****************************************************/
#define PopStackTo(Place) {Place= *((LispPTR *)(CurrentStackPTR)); CurrentStackPTR -= 2; }
/****************************************************
PushCStack:
#define PushCStack {*((int *)(++CurrentStackPTR)) = TopOfStack; ++CurrentStackPTR;}
*****************************************************/
#define PushCStack {CurrentStackPTR += 2;*((LispPTR *)(CurrentStackPTR)) = TopOfStack; }
/****************************************************
PushStack:
#define PushStack(x) {*((LispPTR *)(++CurrentStackPTR))=x;CurrentStackPTR++;}
*****************************************************/
#define PushStack(x) {CurrentStackPTR += 2;*((LispPTR *)(CurrentStackPTR))=x;}
/****************************************************
SmashStack:
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR-1))=x)
*****************************************************/
#define SmashStack(x) (*((LispPTR *)(CurrentStackPTR))=x)
/*********************************************************
Get_BYTE(byteptr) byteptr: pointer to 8 bit data
**********************************************************/
/***** OLD definition ************* 13 Nov 1987 takeshi ***
#define Get_BYTE(byteptr) (((unsigned)(*(byteptr))) & 0xff)
**********************************************/
#define Get_BYTE(byteptr) (((BYTECODE *)BYTEPTR(byteptr))->code)
/**********************************************************
DOSTACKOVERFLOW(argnum,bytenum) if it needs hardreturn-cleanup
then upnt to contextsw and immediately return
**********************************************************/
#define DOSTACKOVERFLOW(argnum,bytenum) { \
if(do_stackoverflow(T)) \
{ PushStack(S_POSITIVE | argnum); \
contextsw(SubovFXP,bytenum,1); \
return;\
} \
}
/************************************************************************/
/* */
/* E X T E R N A L F U N C T I O N S */
/* */
/* Declare all functions that will default incorrectly under */
/* normal C inference rules. These functions are the ones */
/* that return pointers, because on DEC Alpha, a pointer is 8 */
/* bytes--but the default fn decl is int, a 4-byte return. */
/* */
/************************************************************************/
extern DLword *createcell68k();
extern LispPTR *alloc_mdspage();
extern UNSIGNED N_OP_unwind();
extern char *getenv();
#include <stdlib.h>
/************************************************************************/
/* */
/* E R R O R & T I M E R P U N T C A S E S */
/* */
/* Set up the top-of-stack so we can continue gracefully after */
/* handling the timer interrupt (e.g., FMEMB, which walks down */
/* the list being searched, pushes its current state on TOS */
/* so that it picks up where it left off after the interrupt. */
/* */
/* Call Interface where neg number indicates an error return */
/* */
/************************************************************************/
#define ERROR_EXIT(tos) {TopOfStack=tos; Error_Exit = 1; return(-1);}
#ifdef ISC
#define INLINE_ERROR_EXIT(tos,retlbl) {TopOfStack=tos; Error_Exit=1 asm("movl $-1,%0\n" retlbl ":" : "=g" (result) : "0" (result)); return(result); }
#endif
#define TIMER_EXIT(tos) {TopOfStack=tos; Error_Exit = 1; return(-2);}
#define WARN(message,operation) {warn(message);operation;return;}
#define NO_WOP {}
#define NIL 0 /* added 29-jan */
#define T 1
#define ATOM_T 0114 /* T's AtomIndex Number 114Q */
#define NIL_PTR 0 /* from cell.h 24-mar-87 take */
#define NOBIND_PTR 1
#define STKLIM 0x1FFFF
#define FRAMESIZE 10 /* size of frameex1: 10 words */
#define FNHEADSIZE 8 /* size of fnhead: 8 words */
#define BFSIZE 2 /* size of basci frame pointer: 2 words */
#define BITSPER_DLWORD 16
#define BITSPER_CELL 32
#define BYTESPER_DLWORD 2
#define BYTESPER_CELL 4
#define BYTESPER_QUAD 8
#define BYTESPER_PAGE 512
#define CELLSPER_QUAD 2
#define CELLSPER_PAGE 128
#define CELLSPER_SEGMENT 32768
#define DLWORDSPER_CELL 2
#define DLWORDSPER_QUAD 4
#define DLWORDSPER_PAGE 256
#define DLWORDSPER_SEGMENT 65536
#define PAGESPER_SEGMENT 256
#define PAGESPER_MDSUNIT 2
#define MDSINCREMENT 512
#define GUARDSTORAGEFULL 128
#define GUARD1STORAGEFULL 64
#define SFS_NOTSWITCHABLE 1
#define SFS_SWITCHABLE 2
#define SFS_ARRAYSWITCHED 3
#define SFS_FULLYSWITCHED 4
#define AtomHTSIZE 256 * DLWORDSPER_PAGE
#define MAXPNCHARS 255 /* Maximam length of PnChars */
#define GET_NATIVE_ADDR(fnobject) \
*((int *) ((UNSIGNED)fnobject + fnobject->startpc - 4))
#define FALSE 0
#define TRUE !FALSE
typedef unsigned int boolean;
/************************************************************************/
/* Define sizes of FN and FNX opcodes; depends on atom size */
/************************************************************************/
#ifdef BIGVM
#define FN_OPCODE_SIZE 5
#define FNX_OPCODE_SIZE 6
#elif defined(BIGATOMS)
#define FN_OPCODE_SIZE 4
#define FNX_OPCODE_SIZE 5
#else
#define FN_OPCODE_SIZE 3
#define FNX_OPCODE_SIZE 4
#endif /* BIGATOMS */
/************************************************************************/
/* */
/* Definitions for "NEW" Symbols */
/* */
/* Offsets within the "New symbols that go with 3-byte atoms. */
/* */
/************************************************************************/
#ifdef BIGATOMS
typedef struct newatom
{
LispPTR na_pname; /* Pointer to the print name */
LispPTR na_value; /* The value cell */
LispPTR na_defn; /* The definition cell */
LispPTR na_plist; /* The property list */
LispPTR na_flags; /* flags from other cells, to make BIGVM work ok */
} NEWATOM;
/* Offsets, in WORDS, from the start of the NEWATOM structure */
#define NEWATOM_PNAME_OFFSET 0
#define NEWATOM_VALUE_OFFSET 2
#define NEWATOM_DEFN_OFFSET 4
#define NEWATOM_PLIST_OFFSET 6
/* Offsets, in cells from start of the NEWATOM structure */
#define NEWATOM_PNAME_PTROFF 0
#define NEWATOM_VALUE_PTROFF 1
#define NEWATOM_DEFN_PTROFF 2
#define NEWATOM_PLIST_PTROFF 3
#endif
/************************************************************************/
/* */
/* Mask to mask off relevant bits in a pointer. */
/* */
/************************************************************************/
#ifdef BIGVM
#define POINTERMASK 0xfffffff
#define SEGMASK 0xfff0000
#define PAGEMASK 0xfffff00
#else
#define POINTERMASK 0xffffff
#define SEGMASK 0xff0000
#define PAGEMASK 0xffff00
#endif /* BIGVM */
/************************************************************************/
/* */
/* F P t o V P M a n i p u l a t i o n */
/* */
/* */
/* */
/************************************************************************/
#ifdef BIGVM
#define GETFPTOVP(b,o) b[o]
#define GETPAGEOK(b,o) (b[o]>>16)
#else
#define GETFPTOVP GETWORDBASEWORD
#define GETPAGEOK GETWORDBASEWORD
#endif

388
inc/lispmap.h Executable file
View File

@@ -0,0 +1,388 @@
/* $Id: lispmap.h,v 1.3 1999/01/03 02:06:08 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-98 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/*
File Name : lispmap.h(for TEST)
**************NOTE*****************
OLD DEFs are MOVED to lispmap.FULL
**************NOTE*****************
Global variables for LispSYSOUT
Date : December 18, 1986
Edited by : Takeshi Shimizu
*/
/* Whole Lisp size */
#define LWORLD_SIZE 0x420000 /* byte */
/* 1 MDS entry size is 2(page) * 512 Byte */
#define MDSTT_SIZE (LWORLD_SIZE >> 10 )
/* if you want to use the ATOMSPACE for Dummy then it must be 0x10000 take */
#define MAP_SHIFT 0x0
/* Following constants mean LISP word offset. */
/* these correspond with lisp mem map */
/* for IOCBPAGE */
#define IOCBPAGE_OFFSET 256
#define IOCB_SIZE 1
#ifdef BIGBIGVM
/**********************************************/
/* */
/* BIG-BIG-VM sysout layout (256Mb sysout) */
/* */
/**********************************************/
/* for ATOMSPACE */
#define ATOM_HI 0
#define ATOM_OFFSET 0x00000
#define ATOM_SIZE 0x10000
/* for IOPAGE */
#define IOPAGE_OFFSET 0x0FF00
#define IOPAGE_SIZE 1
/* for STACKSPACE */
#define STK_HI 1
#define STK_OFFSET 0x10000
#define STK_SIZE 0x10000
/* for PLISTSPACE */
#define PLIS_HI 2 /* place holder, really -- keep the olde value, even though it's inconsistent with the OFFSET, because it's known by LISP, and is used as a dispatch constant. */
#define PLIS_OFFSET 0x30000
#define PLIS_SIZE 0x10
#define FPTOVP_HI 4 /* again, inconsistent with OFFSET. */
#define FPTOVP_OFFSET 0x20000
#define FPTOVP_SIZE 0x100000
/*for PAGEMAP */
#define PAGEMAP_HI 5 /* Again, fake */
#define PAGEMAP_OFFSET 0x50000
#define PAGEMAP_SIZE 0x10000
/* for InterfacePage */
#define IFPAGE_HI 20
#define IFPAGE_OFFSET 0x140000
#define IFPAGE_SIZE 0x200
/* for PageMapTBL */
#define PAGEMAPTBL_OFFSET 0x140200
#define PAGEMAPTBL_SIZE 0x800
/* for MISCSTATS */
#define MISCSTATS_OFFSET 0x140A00
#define MISCSTATS_SIZE 0x200
/* for UFNTable */
#define UFNTBL_OFFSET 0x140C00
#define UFNTBL_SIZE 0x200
/* for DTDspace */
#define DTD_HI 20
#define DTD_OFFSET 0x141000
#define DTD_SIZE 0x1000
/* for LOCKEDPAGETBL */
#define LOCKEDPAGETBL_OFFSET 0x147000
#define LOCKEDPAGETBL_SIZE 0x1000
/* for MDSTT */
#define MDS_HI 24
#define MDS_OFFSET 0x180000
#define MDS_SIZE 0x40000
/* for AtomHashTable */
#define ATMHT_HI 21
#define ATMHT_OFFSET 0x150000
#define ATMHT_SIZE 0x10000
/* for PNPSPACE */
/* Now used to hold initial atoms */
#define PNP_HI 8 /* Fake */
#define PNP_OFFSET 0x80000
#define PNP_SIZE 0x20000
#define ATOMS_HI 44
#define ATOMS_OFFSET 0x2c0000
#define ATOMS_SIZE 0x20000
/* for DEFSPACE */
#define DEFS_HI 10 /* Fake */
#define DEFS_OFFSET 0xA0000
#define DEFS_SIZE 0x20000
/* for VALSPACE */
#define VALS_HI 12 /* Fake */
#define VALS_OFFSET 0xC0000
#define VALS_SIZE 0x20000
/* for Small Positive */
#define SPOS_HI 14 /* Fake */
#define S_POSITIVE 0xE0000
#define SPOS_SIZE 0x10000
/* for Small Negative */
#define SNEG_HI 15 /* Fake */
#define S_NEGATIVE 0xF0000
#define SNEG_SIZE 0x10000
/* for characters */
#define S_CHAR 0x70000
/* for HTMAIN */
#define HTMAIN_HI 22
#define HTMAIN_OFFSET 0x160000
#define HTMAIN_SIZE 0x10000
/* for HTOVERFLOW */
#define HTOVERFLOW_OFFSET 0x170000
#define HTOVERFLOW_SIZE 0x100
/* for HTBIGCOUNT */
#define HTBIG_HI 23
#define HTBIG_OFFSET 0x170100
#define HTBIG_SIZE 0x8000
/* for HTCOLL */
#define HTCOLL_HI 28
#define HTCOLL_OFFSET 0x1C0000
#define HTCOLL_SIZE 0x100000
/* DISPLAYREGION */
#define DISPLAY_HI 18
#define DISPLAY_OFFSET 0x120000
#define ARRAY_OFFSET 0x2e0000
/* #define MDS_BOTTOM_OFFSET 0x200000 NOT USED ANYWHERE 1/29/98 JDS */
#else
/* NOT BIG-BIG VM */
/* for ATOMSPACE */
#define ATOM_HI 0
#define ATOM_OFFSET 0x00000
#define ATOM_SIZE 0x10000
/* for IOPAGE */
#define IOPAGE_OFFSET 0x0FF00
#define IOPAGE_SIZE 1
/* for STACKSPACE */
#define STK_HI 1
#define STK_OFFSET 0x10000
#define STK_SIZE 0x10000
/* for PLISTSPACE */
#ifndef BIGVM
#define PLIS_HI 2
#define PLIS_OFFSET 0x20000
#define PLIS_SIZE 0x20000
#else
#define PLIS_HI 2 /* place holder, really -- keep the olde value, even though it's inconsistent with the OFFSET, because it's known by LISP, and is used as a dispatch constant. */
#define PLIS_OFFSET 0x30000
#define PLIS_SIZE 0x10
#endif
#ifdef BIGVM
#define FPTOVP_HI 4 /* again, inconsistent with OFFSET. */
#define FPTOVP_OFFSET 0x20000
#define FPTOVP_SIZE 0x40000
#else
/* for FPTOVP */
#define FPTOVP_HI 4
#define FPTOVP_OFFSET 0x40000
#define FPTOVP_SIZE 0x10000
#endif /* BIGVM */
/*for PAGEMAP */
#define PAGEMAP_HI 5
#define PAGEMAP_OFFSET 0x50000
#define PAGEMAP_SIZE 0x10000
/* for InterfacePage */
#define IFPAGE_HI 6
#define IFPAGE_OFFSET 0x60000
#define IFPAGE_SIZE 0x200
/* for PageMapTBL */
#define PAGEMAPTBL_OFFSET 0x60200
#define PAGEMAPTBL_SIZE 0x800
/* for MISCSTATS */
#define MISCSTATS_OFFSET 0x60A00
#define MISCSTATS_SIZE 0x200
/* for UFNTable */
#define UFNTBL_OFFSET 0x60C00
#define UFNTBL_SIZE 0x200
/* for DTDspace */
#define DTD_HI 6
#define DTD_OFFSET 0x61000
#define DTD_SIZE 0x1000
/* for LOCKEDPAGETBL */
#define LOCKEDPAGETBL_OFFSET 0x67000
#define LOCKEDPAGETBL_SIZE 0x1000
/* for MDSTT */
#ifdef BIGVM
/* In BIGVM, MDS type table is at 19.,,0 for 1 segment */
#define MDS_HI 20
#define MDS_OFFSET 0x140000
#define MDS_SIZE 0x10000
#else
#define MDS_HI 6
#define MDS_OFFSET 0x68000
#define MDS_SIZE 0x8000
#endif /* BIGVM */
/* for AtomHashTable */
#define ATMHT_HI 7
#define ATMHT_OFFSET 0x70000
#define ATMHT_SIZE 0x10000
/* for PNPSPACE */
#define PNP_HI 8
#define PNP_OFFSET 0x80000
#define PNP_SIZE 0x20000
#define ATOMS_HI 8
#define ATOMS_OFFSET 0x80000
#define ATOMS_SIZE 0x20000
/* for DEFSPACE */
#define DEFS_HI 10
#define DEFS_OFFSET 0xA0000
#define DEFS_SIZE 0x20000
/* for VALSPACE */
#define VALS_HI 12
#define VALS_OFFSET 0xC0000
#define VALS_SIZE 0x20000
/* for Small Positive */
#define SPOS_HI 14
#define S_POSITIVE 0xE0000
#define SPOS_SIZE 0x10000
/* for Small Negative */
#define SNEG_HI 15
#define S_NEGATIVE 0xF0000
#define SNEG_SIZE 0x10000
/* for characters */
#define S_CHAR 0x70000
#ifdef BIGVM
/* for HTMAIN */
#define HTMAIN_HI 16
#define HTMAIN_OFFSET 0x100000
#define HTMAIN_SIZE 0x10000
/* for HTOVERFLOW */
#define HTOVERFLOW_OFFSET 0x110000
#define HTOVERFLOW_SIZE 0x100
/* for HTBIGCOUNT */
#define HTBIG_HI 16
#define HTBIG_OFFSET 0x110100
#define HTBIG_SIZE 0x8000
/* for HTCOLL */
#define HTCOLL_HI 10
#define HTCOLL_OFFSET 0xA0000
#define HTCOLL_SIZE 0x40000
#else
/* for HTMAIN */
#define HTMAIN_HI 16
#define HTMAIN_OFFSET 0x100000
#define HTMAIN_SIZE 0x8000
/* for HTOVERFLOW */
#define HTOVERFLOW_OFFSET 0x108000
#define HTOVERFLOW_SIZE 0x100
/* for HTBIGCOUNT */
#define HTBIG_HI 16
#define HTBIG_OFFSET 0x108100
#define HTBIG_SIZE 0x8000
/* for HTCOLL */
#define HTCOLL_HI 17
#define HTCOLL_OFFSET 0x110000
#define HTCOLL_SIZE 0x10000
#endif /* BIGVM */
/* DISPLAYREGION */
#define DISPLAY_HI 18
#define DISPLAY_OFFSET 0x120000
#ifdef MEDLEY
/* for ARRAYSPACE & MDS for PROT-LISP */
#define ARRAY_OFFSET 0x150000
#elif defined(BIGVM)
#define ARRAY_OFFSET 0x150000
#else
#define ARRAY_OFFSET 0x130000
#endif
/* #define MDS_BOTTOM_OFFSET 0x200000 NOT used anywhere JDS 1/29/98 */
#endif /* BIGBIGVM */
/* for PnCharSpace(use only PROT-LISP ) */
#define PNCHAR_HI 0x20
#define PNCHAR_OFFSET 0x200000
#define PNCHAR_SIZE 0x10000
/***** SEG definitions for AtomCellN *****/
/* following defs correspond with D machine memory layout */
/**** NOTE!! if D's layout changes, modify following defs */
#define D_PLISHI 2
#define D_PNHI 010
#define D_DEFSHI 012
#define D_VALSHI 014

44
inc/lispver1.h Executable file
View File

@@ -0,0 +1,44 @@
/* $Id: lispver1.h,v 1.2 1999/01/03 02:06:08 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* DOS version of LispVersionToUnixVersion */
#define LispVersionToUnixVersion(pathname, ver) \
{ \
\
register char *cp; \
register char *vp; \
char ver_buf[VERSIONLEN]; \
\
cp = pathname; \
vp = NULL; \
while (*cp) \
{ \
switch (*cp) \
{ \
\
case ';': \
*cp = 0; \
cp++; \
vp = cp; \
break; \
\
case '\'': \
if (*(cp + 1) != 0) cp += 2; \
else cp++; \
break; \
\
default: \
cp++; \
break; \
} \
} \
\
if (vp) \
{ \
NumericStringP(vp, YES, NO); \
NO: *vp = 0; \
YES: \
if ((*vp)) ver = atoi(vp); \
else ver = -1; \
} \
else ver = -1; \
}

71
inc/lispver2.h Executable file
View File

@@ -0,0 +1,71 @@
/* $Id: lispver2.h,v 1.2 1999/01/03 02:06:09 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* non-DOS version of LispVersionToUnixVersion */
#define LispVersionToUnixVersion(pathname){ \
\
register char *cp; \
register char *vp; \
register int ver; \
char ver_buf[VERSIONLEN]; \
\
cp = pathname; \
vp = NULL; \
while (*cp) { \
switch (*cp) { \
\
case ';': \
vp = cp; \
cp++; \
break; \
\
case '\'': \
if (*(cp + 1) != 0) cp += 2; \
else cp++; \
break; \
\
default: \
cp++; \
break; \
} \
} \
\
if (vp != NULL) { \
/* \
* A semicolon which is not quoted has been found. \
*/ \
if (*(vp + 1) == 0) { \
/* \
* The empty version field. \
* This is regared as a versionless file. \
*/ \
*vp = 0; \
} else { \
NumericStringP((vp + 1), YES, NO); \
YES: \
/* \
* Convert the remaining field to digit. \
*/ \
ver = atoi(vp + 1); \
if (ver == 0) { \
/* versionless */ \
*vp = 0; \
} else { \
sprintf(ver_buf, ".~%d~", ver); \
*vp = 0; \
strcat(pathname, ver_buf); \
} \
goto CONT; \
\
NO: \
strcpy(ver_buf, vp + 1); \
strcat(ver_buf, "~"); \
*vp++ = '.'; \
*vp++ = '~'; \
*vp = 0; \
strcat(pathname, ver_buf); \
CONT: \
vp--; /* Just for label */ \
} \
} \
}

219
inc/lldsp.h Executable file
View File

@@ -0,0 +1,219 @@
/* $Id: lldsp.h,v 1.2 1999/01/03 02:06:09 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/***************************************************************/
/*
lldsp.h
By Takeshi Shimizu
typedef for
FONTDESC,CHARSETINFO,SCREEN,WINDOW
*/
/***************************************************************/
#ifndef BYTESWAP
#ifdef BIGVM
typedef struct {
LispPTR FONTDEVICE;
LispPTR FONTFAMILY;
LispPTR FONTSIZE;
LispPTR FONTFACE;
DLword SFAscent;
DLword SFDescent;
DLword SFHeight;
DLword ROTATION;
short FBBOX;
short FBBOY;
short FBBDX;
short FBBDY;
LispPTR SFLKerns;
LispPTR SFRWidths;
LispPTR FONTDEVICESPEC;
LispPTR OTHERDEVICEFONTPROPS;
LispPTR FONTSCALE;
unsigned SFFACECODE : 8;
unsigned nil : 8;
DLword FONTAVGCHARWIDTH;
LispPTR FONTIMAGEWIDTHS;
LispPTR FONTCHARSETVECTOR;
LispPTR FONTEXTRAFIELD2;
} FONTDESC;
#else
typedef struct {
LispPTR FONTDEVICE;
LispPTR SFObsolete1;
LispPTR FONTFAMILY;
LispPTR FONTSIZE;
LispPTR FONTFACE;
LispPTR SFObsolete2;
LispPTR SFObsolete3;
LispPTR SFObsolete4;
DLword SFObsolete5;
DLword SFObsolete6;
DLword SFAscent;
DLword SFDescent;
DLword SFHeight;
DLword ROTATION;
short FBBOX;
short FBBOY;
short FBBDX;
short FBBDY;
unsigned SFFACECODE : 8;
unsigned SFLKerns :24;
LispPTR SFRWidths;
LispPTR FONTDEVICESPEC;
LispPTR OTHERDEVICEFONTPROPS;
LispPTR FONTSCALE;
DLword FONTAVGCHARWIDTH;
DLword dum;
LispPTR FONTIMAGEWIDTHS;
LispPTR FONTCHARSETVECTOR;
LispPTR FONTEXTRAFIELD2;
} FONTDESC;
#endif /* BIGVM */
typedef struct {
LispPTR WIDTHS;
LispPTR OFFSETS;
LispPTR IMAGEWIDTHS;
LispPTR CHARSETBITMAP;
LispPTR YWIDTHS;
DLword CHARSETASCENT;
DLword CHARSETDESCENT;
LispPTR LEFTKERN;
} CHARSETINFO;
#else /* BYTESWAP */
#ifdef BIGVM
typedef struct {
LispPTR FONTDEVICE;
LispPTR SFObsolete1;
LispPTR FONTFAMILY;
LispPTR FONTSIZE;
LispPTR FONTFACE;
LispPTR SFObsolete2;
LispPTR SFObsolete3;
LispPTR SFObsolete4;
DLword SFObsolete6;
DLword SFObsolete5;
DLword SFDscent;
DLword SFAescent;
DLword ROTATION;
DLword SFHeight;
short FBBOY;
short FBBOX;
short FBBDY;
short FBBDX;
unsigned SFLKerns :24;
LispPTR SFRWidths;
LispPTR FONTDEVICESPEC;
LispPTR OTHERDEVICEFONTPROPS;
LispPTR FONTSCALE;
DLword FONTAVGCHARWIDTH;
unsigned nil : 8;
unsigned SFFACECODE : 8;
LispPTR FONTIMAGEWIDTHS;
LispPTR FONTCHARSETVECTOR;
LispPTR FONTEXTRAFIELD2;
} FONTDESC;
#else
typedef struct {
LispPTR FONTDEVICE;
LispPTR SFObsolete1;
LispPTR FONTFAMILY;
LispPTR FONTSIZE;
LispPTR FONTFACE;
LispPTR SFObsolete2;
LispPTR SFObsolete3;
LispPTR SFObsolete4;
DLword SFObsolete6;
DLword SFObsolete5;
DLword SFDscent;
DLword SFAescent;
DLword ROTATION;
DLword SFHeight;
short FBBOY;
short FBBOX;
short FBBDY;
short FBBDX;
unsigned SFLKerns :24;
unsigned SFFACECODE : 8;
LispPTR SFRWidths;
LispPTR FONTDEVICESPEC;
LispPTR OTHERDEVICEFONTPROPS;
LispPTR FONTSCALE;
DLword dum;
DLword FONTAVGCHARWIDTH;
LispPTR FONTIMAGEWIDTHS;
LispPTR FONTCHARSETVECTOR;
LispPTR FONTEXTRAFIELD2;
} FONTDESC;
#endif /* BIGVM */
typedef struct {
LispPTR WIDTHS;
LispPTR OFFSETS;
LispPTR IMAGEWIDTHS;
LispPTR CHARSETBITMAP;
LispPTR YWIDTHS;
DLword CHARSETDESCENT;
DLword CHARSETASCENT;
LispPTR LEFTKERN;
} CHARSETINFO;
#endif /* BYTESWAP */
typedef struct {
LispPTR SCONOFF;
LispPTR SCDESTINATION;
LispPTR SCWIDTH;
LispPTR SCHEIGHT;
LispPTR SCTOPW;
LispPTR SCTOPWDS;
LispPTR SCTITLEDS;
LispPTR SCFDEV;
LispPTR SCDS;
LispPTR SCDATA;
} SCREEN;
typedef struct {
LispPTR DSP;
LispPTR NEXTW;
LispPTR SAVE;
LispPTR REG;
LispPTR BUTTONEVENTFN;
LispPTR RIGHTBUTTONFN;
LispPTR CURSORINFN;
LispPTR CURSOROUTFN;
LispPTR CURSORMOVEFN;
LispPTR REPAINTFN;
LispPTR RESHAPEFN;
LispPTR EXTENT;
LispPTR USERDATA;
LispPTR VERTSCROLLREG;
LispPTR HORIZSCROLLREG;
LispPTR SCROLLFN;
LispPTR VERTSCROLLWINDOW;
LispPTR HORIZSCROLLWINDOW;
LispPTR CLOSEFN;
LispPTR MOVEFN;
LispPTR WTITLE;
LispPTR NEWREGION;
LispPTR WBORDER;
LispPTR PROCESS;
LispPTR WINDOWENTRYFN;
LispPTR SCREEN;
} WINDOW;

35
inc/lnk-Xdeflt.h Executable file
View File

@@ -0,0 +1,35 @@
/* $Id: lnk-Xdeflt.h,v 1.2 1999/01/03 02:06:09 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
* Define the X window Medley runs in.
*
*/
/************************************************************************/
/* */
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define DEF_WIN_X 20
#define DEF_WIN_Y 20
#define DEF_WIN_WIDTH 565
#define DEF_WIN_HEIGHT 430
#define WIN_MIN_WIDTH 150
#define WIN_MIN_HEIGHT 100
#define DEF_BDRWIDE 2
#define SCROLL_WIDTH 18
#define WINDOW_NAME "Medley (C) Copyright 1980-94 Venue"
#define ICON_NAME "Medley"

443
inc/lnk-debug.h Executable file
View File

@@ -0,0 +1,443 @@
/* $Id: lnk-debug.h,v 1.2 1999/01/03 02:06:10 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifndef BYTESWAP
/************************************************/
/* Normal byte-order version of definitions */
/************************************************/
typedef struct{
DLword W0;
DLword W1;
DLword W2;
DLword W3;
DLword WU;
DLword W4;
DLword W5;
int TIME;
unsigned MOUSESTATE : 3;
unsigned SHIFT1 : 1;
unsigned SHIFT2 : 1;
unsigned keLOCK : 1;
unsigned keCTRL : 1;
unsigned keMETA : 1;
unsigned keFONT : 1;
unsigned USERMODE1 : 1;
unsigned USERMODE2 : 1;
unsigned USERMODE3 : 1;
unsigned NIL1 : 4;
DLword MOUSEX;
DLword MOUSEY;
} KEYBOARDEVENT;
typedef struct{
DLword READ;
DLword WRITE;
} RING;
typedef struct{
LispPTR FLAGS;
LispPTR CODES;
LispPTR SHIFTCODES;
LispPTR ARMED;
LispPTR INTERRUPTLIST;
} KEYACTION;
typedef struct{
unsigned int EVENTWAKEUPPENDING : 1;
unsigned int nil1 : 7;
unsigned int EVENTQUEUETAIL : 24;
LispPTR EVENTNAME;
} EVENT;
typedef struct{
unsigned int nil1 : 1;
unsigned int MLOCKPERPROCESS : 1;
unsigned int nil2 : 6;
unsigned int MLOCKQUEUETAIL : 24;
LispPTR MLOCKOWNER;
LispPTR MLOCKNAME;
LispPTR MLOCKLINK;
} MONITORLOCK;
typedef struct{
DLword PROCFX0;
DLword PROCFX;
unsigned int PROCSTATUS : 8;
unsigned int PROCNAME : 24;
unsigned int PROCPRIORITY : 8;
unsigned int PROCQUEUE : 24;
unsigned int nil1 : 8;
unsigned int NEXTPROCHANDLE : 24;
unsigned int PROCTIMERSET : 1;
unsigned int PROCBEINGDELETED : 1;
unsigned int PROCDELETED : 1;
unsigned int PROCSYSTEMP : 1;
unsigned int PROCNEVERSTARTED : 1;
unsigned int nil2 : 3;
unsigned int PROCWAKEUPTIMER : 24;
LispPTR PROCTIMERLINK;
LispPTR PROCTIMERBOX;
LispPTR WAKEREASON;
LispPTR PROCEVENTORLOCK;
LispPTR PROCFORM;
LispPTR RESTARTABLE;
LispPTR PROCWINDOW;
LispPTR PROCFINISHED;
LispPTR PROCRESULT;
LispPTR PROCFINISHEVENT;
LispPTR PROCMAILBOX;
LispPTR PROCDRIBBLEOUTPUT;
LispPTR PROCINFOHOOK;
LispPTR PROCTYPEAHEAD;
LispPTR PROCREMOTEINFO;
LispPTR PROCUSERDATA;
LispPTR PROCEVENTLINK;
LispPTR PROCAFTEREXIT;
LispPTR PROCBEFOREEXIT;
LispPTR PROCOWNEDLOCKS;
LispPTR PROCEVAPPLYRESULT;
LispPTR PROCTTYENTRYFN;
LispPTR PROCEXITFN;
LispPTR PROCHARDRESETINFO;
LispPTR PROCRESTARTFORM;
LispPTR PROCOLDTTYPROC;
LispPTR nil3;
} PROCESS;
typedef struct{
unsigned int PQPRIORITY : 8;
unsigned int PQHIGHER : 24;
LispPTR PQLOWER;
LispPTR PQNEXT;
LispPTR PQLAST;
} PROCESSQUEUE;
typedef struct fdev{
unsigned RESETABLE : 1;
unsigned RANDOMACCESSP : 1;
unsigned NODIRECTORIES : 1;
unsigned PAGEMAPPED : 1;
unsigned FDBINABLE : 1;
unsigned FDBOUTABLE : 1;
unsigned FDEXTENDABLE : 1;
unsigned BUFFERED : 1;
unsigned DEVICENAME : 24;
unsigned REMOTEP : 1;
unsigned SUBDIRECTORIES : 1;
unsigned INPUT_INDIRECTED : 1;
unsigned OUTPUT_INDIRECTED : 1;
unsigned NIL1 : 4;
unsigned DEVICEINFO : 24;
LispPTR OPENFILELST ;
LispPTR HOSTNAMEP ;
LispPTR EVENTFN ;
LispPTR DIRECTORYNAMEP ;
LispPTR OPENFILE ;
LispPTR CLOSEFILE ;
LispPTR REOPENFILE ;
LispPTR GETFILENAME ;
LispPTR DELETEFILE ;
LispPTR GENERATEFILES ;
LispPTR RENAMEFILE ;
LispPTR OPENP ;
LispPTR REGISTERFILE ;
LispPTR UNREGISTERFILE ;
LispPTR FREEPAGECOUNT ;
LispPTR MAKEDIRECTORY ;
LispPTR CHECKFILENAME ;
LispPTR HOSTALIVEP ;
LispPTR BREAKCONNECTION ;
LispPTR BIN ;
LispPTR BOUT ;
LispPTR PEEKBIN ;
LispPTR READCHAR ;
LispPTR WRITECHAR ;
LispPTR PEEKCHAR ;
LispPTR UNREADCHAR ;
LispPTR READP ;
LispPTR EOFP ;
LispPTR BLOCKIN ;
LispPTR BLOCKOUT ;
LispPTR FORCEOUTPUT ;
LispPTR GETFILEINFO ;
LispPTR SETFILEINFO ;
LispPTR CHARSETFN ;
LispPTR INPUTSTREAM ;
LispPTR OUTPUTSTREAM ;
LispPTR GETFILEPTR ;
LispPTR GETEOFPTR ;
LispPTR SETFILEPTR ;
LispPTR BACKFILEPTR ;
LispPTR SETEOFPTR ;
LispPTR LASTC ;
LispPTR GETNEXTBUFFER ;
LispPTR RELEASEBUFFER ;
LispPTR READPAGES ;
LispPTR WRITEPAGES ;
LispPTR TRUNCATEFILE ;
LispPTR WINDOWOPS ;
LispPTR WINDOWDATA ;
}FDEV;
typedef struct package{
LispPTR INDEX ;
LispPTR TABLES ;
LispPTR NAME ;
LispPTR NAMESYMBOL ;
LispPTR NICKNAMES ;
LispPTR USE_LIST ;
LispPTR USED_BY_LIST ;
LispPTR EXTERNAL_ONLY ;
LispPTR INTERNAL_SYMBOLS ;
LispPTR EXTERNAL_SYMBOLS ;
LispPTR SHADOWING_SYMBOLS ;
} PACKAGE;
#ifdef NEVER
typedef struct {
unsigned nil1 : 8 ;
unsigned BASE : 24 ;
unsigned READ_ONLY_P : 1 ;
unsigned nil2 : 1 ;
unsigned BIT_P : 1 ;
unsigned STRING_P : 1 ;
unsigned nil3 : 1 ;
unsigned DISPLACED_P : 1 ;
unsigned FILL_POINTER_P : 1 ;
unsigned EXTENDABLE_P : 1 ;
unsigned TYPE_NUMBER : 8 ;
DLword OFFSET;
DLword FILL_POINTER;
DLword TOTAL_SIZE;
} ONED_ARRAY;
#endif /* NEVER */
#else
/****************************************************************/
/* Byte-swapped, word-swapped definitions, for e.g. 80386's */
/****************************************************************/
typedef struct{
DLword W1;
DLword W0;
DLword W3;
DLword W2;
DLword W4;
DLword WU;
/* only swapped down to here, and MOUSEX & Y -- there */
/* looks like a missing word in the block at this point. */
DLword W5;
int TIME;
unsigned MOUSESTATE : 3;
unsigned SHIFT1 : 1;
unsigned SHIFT2 : 1;
unsigned LOCK : 1;
unsigned CTRL : 1;
unsigned META : 1;
unsigned FONT : 1;
unsigned USERMODE1 : 1;
unsigned USERMODE2 : 1;
unsigned USERMODE3 : 1;
unsigned NIL1 : 4;
DLword MOUSEY;
DLword MOUSEX;
} KEYBOARDEVENT;
typedef struct{
DLword WRITE;
DLword READ;
} RING;
typedef struct{
LispPTR FLAGS;
LispPTR CODES;
LispPTR SHIFTCODES;
LispPTR ARMED;
LispPTR INTERRUPTLIST;
} KEYACTION;
typedef struct{
unsigned int EVENTQUEUETAIL : 24;
unsigned int nil1 : 7;
unsigned int EVENTWAKEUPPENDING : 1;
LispPTR EVENTNAME;
} EVENT;
typedef struct{
unsigned int MLOCKQUEUETAIL : 24;
unsigned int nil2 : 6;
unsigned int MLOCKPERPROCESS : 1;
unsigned int nil1 : 1;
LispPTR MLOCKOWNER;
LispPTR MLOCKNAME;
LispPTR MLOCKLINK;
} MONITORLOCK;
typedef struct{
DLword PROCFX;
DLword PROCFX0;
unsigned int PROCNAME : 24;
unsigned int PROCSTATUS : 8;
unsigned int PROCQUEUE : 24;
unsigned int PROCPRIORITY : 8;
unsigned int NEXTPROCHANDLE : 24;
unsigned int nil1 : 8;
unsigned int PROCWAKEUPTIMER : 24;
unsigned int nil2 : 3;
unsigned int PROCNEVERSTARTED : 1;
unsigned int PROCSYSTEMP : 1;
unsigned int PROCDELETED : 1;
unsigned int PROCBEINGDELETED : 1;
unsigned int PROCTIMERSET : 1;
LispPTR PROCTIMERLINK;
LispPTR PROCTIMERBOX;
LispPTR WAKEREASON;
LispPTR PROCEVENTORLOCK;
LispPTR PROCFORM;
LispPTR RESTARTABLE;
LispPTR PROCWINDOW;
LispPTR PROCFINISHED;
LispPTR PROCRESULT;
LispPTR PROCFINISHEVENT;
LispPTR PROCMAILBOX;
LispPTR PROCDRIBBLEOUTPUT;
LispPTR PROCINFOHOOK;
LispPTR PROCTYPEAHEAD;
LispPTR PROCREMOTEINFO;
LispPTR PROCUSERDATA;
LispPTR PROCEVENTLINK;
LispPTR PROCAFTEREXIT;
LispPTR PROCBEFOREEXIT;
LispPTR PROCOWNEDLOCKS;
LispPTR PROCEVAPPLYRESULT;
LispPTR PROCTTYENTRYFN;
LispPTR PROCEXITFN;
LispPTR PROCHARDRESETINFO;
LispPTR PROCRESTARTFORM;
LispPTR PROCOLDTTYPROC;
LispPTR nil3;
} PROCESS;
typedef struct{
unsigned int PQHIGHER : 24;
unsigned int PQPRIORITY : 8;
LispPTR PQLOWER;
LispPTR PQNEXT;
LispPTR PQLAST;
} PROCESSQUEUE;
typedef struct fdev{
unsigned DEVICENAME : 24;
unsigned BUFFERED : 1;
unsigned FDEXTENDABLE : 1;
unsigned FDBOUTABLE : 1;
unsigned FDBINABLE : 1;
unsigned PAGEMAPPED : 1;
unsigned NODIRECTORIES : 1;
unsigned RANDOMACCESSP : 1;
unsigned RESETABLE : 1;
unsigned DEVICEINFO : 24;
unsigned NIL1 : 4;
unsigned OUTPUT_INDIRECTED : 1;
unsigned INPUT_INDIRECTED : 1;
unsigned SUBDIRECTORIES : 1;
unsigned REMOTEP : 1;
LispPTR OPENFILELST ;
LispPTR HOSTNAMEP ;
LispPTR EVENTFN ;
LispPTR DIRECTORYNAMEP ;
LispPTR OPENFILE ;
LispPTR CLOSEFILE ;
LispPTR REOPENFILE ;
LispPTR GETFILENAME ;
LispPTR DELETEFILE ;
LispPTR GENERATEFILES ;
LispPTR RENAMEFILE ;
LispPTR OPENP ;
LispPTR REGISTERFILE ;
LispPTR UNREGISTERFILE ;
LispPTR FREEPAGECOUNT ;
LispPTR MAKEDIRECTORY ;
LispPTR CHECKFILENAME ;
LispPTR HOSTALIVEP ;
LispPTR BREAKCONNECTION ;
LispPTR BIN ;
LispPTR BOUT ;
LispPTR PEEKBIN ;
LispPTR READCHAR ;
LispPTR WRITECHAR ;
LispPTR PEEKCHAR ;
LispPTR UNREADCHAR ;
LispPTR READP ;
LispPTR EOFP ;
LispPTR BLOCKIN ;
LispPTR BLOCKOUT ;
LispPTR FORCEOUTPUT ;
LispPTR GETFILEINFO ;
LispPTR SETFILEINFO ;
LispPTR CHARSETFN ;
LispPTR INPUTSTREAM ;
LispPTR OUTPUTSTREAM ;
LispPTR GETFILEPTR ;
LispPTR GETEOFPTR ;
LispPTR SETFILEPTR ;
LispPTR BACKFILEPTR ;
LispPTR SETEOFPTR ;
LispPTR LASTC ;
LispPTR GETNEXTBUFFER ;
LispPTR RELEASEBUFFER ;
LispPTR READPAGES ;
LispPTR WRITEPAGES ;
LispPTR TRUNCATEFILE ;
LispPTR WINDOWOPS ;
LispPTR WINDOWDATA ;
}FDEV;
typedef struct package{
LispPTR INDEX ;
LispPTR TABLES ;
LispPTR NAME ;
LispPTR NAMESYMBOL ;
LispPTR NICKNAMES ;
LispPTR USE_LIST ;
LispPTR USED_BY_LIST ;
LispPTR EXTERNAL_ONLY ;
LispPTR INTERNAL_SYMBOLS ;
LispPTR EXTERNAL_SYMBOLS ;
LispPTR SHADOWING_SYMBOLS ;
} PACKAGE;
#ifdef NEVER
typedef struct {
unsigned BASE : 24 ;
unsigned nil1 : 8 ;
DLword OFFSET;
unsigned TYPE_NUMBER : 8 ;
unsigned EXTENDABLE_P : 1 ;
unsigned FILL_POINTER_P : 1 ;
unsigned DISPLACED_P : 1 ;
unsigned nil3 : 1 ;
unsigned STRING_P : 1 ;
unsigned BIT_P : 1 ;
unsigned nil2 : 1 ;
unsigned READ_ONLY_P : 1 ;
DLword TOTAL_SIZE;
DLword FILL_POINTER;
} ONED_ARRAY;
#endif /* NEVER */
#endif /* BYTESWAP */

166
inc/lnk-fast_dsp.h Executable file
View File

@@ -0,0 +1,166 @@
/* $Id: lnk-fast_dsp.h,v 1.2 1999/01/03 02:06:10 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* These are the Macros Used to generate fast dispatch inline code.
*/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1991 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* F A S T O P C O D E D I S P A T C H M A C R O S */
/* */
/* These macros generate better opcode-dispatch code than the */
/* native compiler will. The difference may be only one or */
/* two instructions, but in the inner loop, that's a LOT. */
/* */
/* To add a new architecture, you must define 5 macros: */
/* */
/* nextop0 - for single-byte opcodes */
/* nextop1 - skip a byte and grab an opcode */
/* nextop2 - skip 2 bytes and grab an opcode */
/* nextop3 - skip 3 bytes and grab an opcode */
/* nextop4 - skip 4 bytes and grab an opcode */
/* */
/* (These macros are already defined naively, so undef them.) */
/* */
/* For existing implementations, these often expand out to */
/* calls to inline functions. */
/* */
/* */
/* */
/************************************************************************/
#ifdef OPDISP /* Only do any of this if OPDISP is set. */
/* Sun 3 */
#ifdef mc68020
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
/* JRB - fast case is now nextop1 */
#define nextop0 { fast0_dispatcher(); goto nextopcode; }
#define nextop1 { fast1_dispatcher(); goto nextopcode; }
#define nextop2 { fast1_dispatcher2(); }
#define nextop3 { PCMACL += 2; nextop1; }
#define nextop4 { PCMACL += 3; nextop1; }
#endif
/* Sun 386i */
#ifdef I386
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
/* JRB - fast case is now nextop1 */
#define nextop0 { fast0_dispatcher(); goto nextopcode; }
#define nextop1 { fast1_dispatcher(); goto nextopcode; }
#define nextop2 { fast2_dispatcher(); }
#define nextop3 { PCMACL += 2; nextop1; }
#define nextop4 { PCMACL += 3; nextop1; }
#endif
/* ISC 386 using gcc */
#ifdef ISC
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
#define nextop0 { fast0_dispatcher(); goto nextopcode; }
#define nextop1 { fast1_dispatcher(); goto nextopcode; }
#define nextop2 { fast2_dispatcher(); goto nextopcode;}
#define nextop3 { fast3_dispatcher(); goto nextopcode;}
#define nextop4 { fast4_dispatcher(); goto nextopcode;}
#define fast0_dispatcher() \
asm volatile(" \n\
// leal -1(%0),%%eax \n\
/ xorb $3,%%al \n\
/ movzbl (%%eax),%%eax \n\
movzbl -1(%0),%%eax \n\
jmp *optable(,%%eax,4)" : : "r" (pccache): "ax");
#define fast1_dispatcher() \
asm volatile(" \n\
/ movl %0,%%eax \n\
/ xorb $3,%%al \n\
movzbl (%0),%%eax \n\
incl %0 \n\
/ movzbl (%%eax),%%eax \n\
jmp *optable(,%%eax,4)" : "=r" (pccache) : "0" (pccache): "ax");
#define fast2_dispatcher() \
asm volatile(" \n\
/ leal 1(%0),%%eax \n\
movzbl 1(%0),%%eax \n\
addl $2,%0 \n\
/ xorb $3,%%al \n\
/ movzbl (%%eax),%%eax \n\
jmp *optable(,%%eax,4)" :"=r" (pccache) : "0" (pccache): "ax");
#define fast3_dispatcher() \
asm volatile(" \n\
/ leal 2(%0),%%eax \n\
movzbl 2(%0),%%eax \n\
addl $3,%0 \n\
/ xorb $3,%%al \n\
/ movzbl (%%eax),%%eax \n\
jmp *optable(,%%eax,4)" :"=r" (pccache) : "0" (pccache): "ax");
#define fast4_dispatcher() \
asm volatile(" \n\
/ leal 3(%0),%%eax \n\
movzbl 3(%0),%%eax \n\
addl $4,%0 \n\
/ xorb $3,%%al \n\
/ movzbl (%%eax),%%eax \n\
jmp *optable(,%%eax,4)" :"=r" (pccache) : "0" (pccache): "ax");
#endif
#endif /* OPDISP */
#ifdef SPARCDISP
#undef nextop0
#undef nextop1
#undef nextop2
#undef nextop3
#undef nextop4
#define nextop0 { fast_dispatcher(table, Get_BYTE(PCMAC)); goto nextopcode; }
#define nextop_n(n) { \
PCMACL += n; \
nextop0; \
}
#define nextop1 { nextop_n(1); }
#define nextop2 { nextop_n(2); }
#define nextop3 { nextop_n(3); }
#define nextop4 { nextop_n(4); }
#endif /* SPARCDISP */

1074
inc/lnk-inlineC.h Executable file

File diff suppressed because it is too large Load Diff

247
inc/lnk-lispmap.h Executable file
View File

@@ -0,0 +1,247 @@
/* $Id: lnk-lispmap.h,v 1.2 1999/01/03 02:06:11 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/*
File Name : lispmap.h(for TEST)
**************NOTE*****************
OLD DEFs are MOVED to lispmap.FULL
**************NOTE*****************
Global variables for LispSYSOUT
Date : December 18, 1986
Edited by : Takeshi Shimizu
*/
/**********************************************************************/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
/* Whole Lisp size */
#define LWORLD_SIZE 0x420000 /* byte */
/* 1 MDS entry size is 2(page) * 512 Byte */
#define MDSTT_SIZE (LWORLD_SIZE >> 10 )
/* if you want to use the ATOMSPACE for Dummy then it must be 0x10000 take */
#define MAP_SHIFT 0x0
/* Following constants mean LISP word offset. */
/* these correspond with lisp mem map */
/* for IOCBPAGE */
#define IOCBPAGE_OFFSET 256
#define IOCB_SIZE 1
/* for ATOMSPACE */
#define ATOMS_HI 0
#define ATOMS_OFFSET 0x00000
#define ATOMS_SIZE 0x10000
/* for IOPAGE */
#define IOPAGE_OFFSET 0x0FF00
#define IOPAGE_SIZE 1
/* for STACKSPACE */
#define STK_HI 1
#define STK_OFFSET 0x10000
#define STK_SIZE 0x10000
/* for PLISTSPACE */
#ifndef BIGVM
#define PLIS_HI 2
#define PLIS_OFFSET 0x20000
#define PLIS_SIZE 0x20000
#else
#define PLIS_HI 2 /* place holder, really -- keep the olde value, even though it's inconsistent with the OFFSET, because it's known by LISP, and is used as a dispatch constant. */
#define PLIS_OFFSET 0x30000
#define PLIS_SIZE 0x10
#endif
#ifdef BIGVM
#define FPTOVP_HI 4 /* again, inconsistent with OFFSET. */
#define FPTOVP_OFFSET 0x20000
#define FPTOVP_SIZE 0x40000
#else
/* for FPTOVP */
#define FPTOVP_HI 4
#define FPTOVP_OFFSET 0x40000
#define FPTOVP_SIZE 0x10000
#endif /* BIGVM */
/*for PAGEMAP */
#define PAGEMAP_HI 5
#define PAGEMAP_OFFSET 0x50000
#define PAGEMAP_SIZE 0x10000
/* for InterfacePage */
#define IFPAGE_HI 6
#define IFPAGE_OFFSET 0x60000
#define IFPAGE_SIZE 0x200
/* for PageMapTBL */
#define PAGEMAPTBL_OFFSET 0x60200
#define PAGEMAPTBL_SIZE 0x800
/* for MISCSTATS */
#define MISCSTATS_OFFSET 0x60A00
#define MISCSTATS_SIZE 0x200
/* for UFNTable */
#define UFNTBL_OFFSET 0x60C00
#define UFNTBL_SIZE 0x200
/* for DTDspace */
#define DTD_HI 6
#define DTD_OFFSET 0x61000
#define DTD_SIZE 0x1000
/* for LOCKEDPAGETBL */
#define LOCKEDPAGETBL_OFFSET 0x67000
#define LOCKEDPAGETBL_SIZE 0x1000
/* for MDSTT */
#ifdef BIGVM
/* In BIGVM, MDS type table is at 19.,,0 for 1 segment */
#define MDS_HI 20
#define MDS_OFFSET 0x140000
#define MDS_SIZE 0x10000
#else
#define MDS_HI 6
#define MDS_OFFSET 0x68000
#define MDS_SIZE 0x8000
#endif /* BIGVM */
/* for AtomHashTable */
#define ATMHT_HI 7
#define ATMHT_OFFSET 0x70000
#define ATMHT_SIZE 0x10000
/* for PNPSPACE */
#define PNP_HI 8
#define PNP_OFFSET 0x80000
#define PNP_SIZE 0x20000
/* for DEFSPACE */
#define DEFS_HI 10
#define DEFS_OFFSET 0xA0000
#define DEFS_SIZE 0x20000
/* for VALSPACE */
#define VALS_HI 12
#define VALS_OFFSET 0xC0000
#define VALS_SIZE 0x20000
/* for Small Positive */
#define SPOS_HI 14
#define S_POSITIVE 0xE0000
#define SPOS_SIZE 0x10000
/* for Small Negative */
#define SNEG_HI 15
#define S_NEGATIVE 0xF0000
#define SNEG_SIZE 0x10000
/* for characters */
#define S_CHAR 0x70000
#ifdef BIGVM
/* for HTMAIN */
#define HTMAIN_HI 16
#define HTMAIN_OFFSET 0x100000
#define HTMAIN_SIZE 0x10000
/* for HTOVERFLOW */
#define HTOVERFLOW_OFFSET 0x110000
#define HTOVERFLOW_SIZE 0x100
/* for HTBIGCOUNT */
#define HTBIG_HI 16
#define HTBIG_OFFSET 0x110100
#define HTBIG_SIZE 0x8000
/* for HTCOLL */
#define HTCOLL_HI 10
#define HTCOLL_OFFSET 0xA0000
#define HTCOLL_SIZE 0x40000
#else
/* for HTMAIN */
#define HTMAIN_HI 16
#define HTMAIN_OFFSET 0x100000
#define HTMAIN_SIZE 0x8000
/* for HTOVERFLOW */
#define HTOVERFLOW_OFFSET 0x108000
#define HTOVERFLOW_SIZE 0x100
/* for HTBIGCOUNT */
#define HTBIG_HI 16
#define HTBIG_OFFSET 0x108100
#define HTBIG_SIZE 0x8000
/* for HTCOLL */
#define HTCOLL_HI 17
#define HTCOLL_OFFSET 0x110000
#define HTCOLL_SIZE 0x10000
#endif /* BIGVM */
/* DISPLAYREGION */
#define DISPLAY_HI 18
#define DISPLAY_OFFSET 0x120000
#ifdef MEDLEY
/* for ARRAYSPACE & MDS for PROT-LISP */
#define ARRAY_OFFSET 0x150000
#elif defined(BIGVM)
#define ARRAY_OFFSET 0x150000
#else
#define ARRAY_OFFSET 0x130000
#endif
#define MDS_BOTTOM_OFFSET 0x200000
/* for PnCharSpace(use only PROT-LISP ) */
#define PNCHAR_HI 0x20
#define PNCHAR_OFFSET 0x200000
#define PNCHAR_SIZE 0x10000
/***** SEG definitions for AtomCellN *****/
/* following defs correspond with D machine memory layout */
/**** NOTE!! if D's layout changes, modify following defs */
#define D_PLISHI 2
#define D_PNHI 010
#define D_DEFSHI 012
#define D_VALSHI 014

794
inc/lnk-tosfns.h Executable file
View File

@@ -0,0 +1,794 @@
/* $Id: lnk-tosfns.h,v 1.2 1999/01/03 02:06:11 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-1994 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/****************************************************************/
/****** CURRENT Stack Overflow checks ********/
/****************************************************************/
#define FN_STACK_CHECK \
if ((int)CSTKPTR > (Irq_Stk_Check=(Irq_Stk_End-STK_MIN(LOCFNCELL)))) \
goto check_interrupt;
/****************************************************************/
/****** LOCAL MACROS ********/
/****************************************************************/
#ifdef BIGVM
#define SWAP_FNHEAD
#else
#undef SWAP_FNHEAD
#define SWAP_FNHEAD(x) SWAP_WORDS(x)
#endif /* BIGVM */
#ifdef NATIVETRAN
#define FN_CALL_NATIVE_CHECK(fncell, args, extra_code) \
{ \
if (fncell->native) \
{ \
extra_code; \
FuncObj = fncell; \
HARD_PUSH(TOPOFSTACK); \
CALL_NATIVE(fncell, args); \
} \
}
#define FN_CALL_NATIVE_CHECK2(fncell, args, extra_code) \
{ \
if (fncell->native) \
{ \
extra_code; \
(int) PC = args; \
FuncObj = fncell; \
HARD_PUSH(TOPOFSTACK); \
CALL_NATIVE2(fncell, args); \
} \
}
#define ASM_LABEL_OF_FN_COMMON asm_label_op_fn_common()
#else
#ifdef GCC386
#define ASM_LABEL_OF_FN_COMMON asm("fn_common:");
#else
#define ASM_LABEL_OF_FN_COMMON
#endif /* GCC386 */
#define FN_CALL_NATIVE_CHECK(fncell, args, extra_code)
#define FN_CALL_NATIVE_CHECK2(fncell, args, extra_code)
#endif /* NATIVETRAN */
/************************************************************************/
/* */
/* A P P L Y _ P O P _ P U S H _ T E S T */
/* */
/* Part of op_fn_common; decide what to do to the stack, depending */
/* on whether we're FNcalling, APPLYing, or calling a UFN. What */
/* happens depends on the value of fn_apply, which is set by */
/* the various opcode macros, as follows: */
/* */
/* 0 Normal function calls; do nothing additional. */
/* 1 APPLY: POP the #ARGS and FN-NAME arguments. */
/* 2 UFN with 0 args from the opcode byte stream. Do nothing. */
/* 3 UFN with 1 byte of arg from the code stream as a SMALLP */
/* 4 UFN with 2 bytes of arg from the code stream as a SMALLP */
/* 5 UFN with 3 bytes of arg from the code stream as a SMALLP */
/* or as a symbol (for big atoms, e.g.) */
/* 6 UFN with 4 bytes of arg from the code stream as a SMALLP */
/* or as a symbol (for big atoms, e.g.) */
/* */
/* The latter 3 cases push the additional argument; THE 3-BYTE */
/* CASE IS INCOMPLETE: IT SHOULD BOX ANY NON-SMALLP VALUES! */
/* */
/************************************************************************/
#ifdef BIGATOMS
#define APPLY_POP_PUSH_TEST \
{ \
switch (fn_apply) \
{ \
case 0: break; /* do nothing */ \
case 1: POP; POP; break; /* from apply */ \
case 2: break; /* ufn 0 args */ \
case 3: PUSH(S_POSITIVE | Get_BYTE_PCMAC1); break; \
case 4: PUSH(S_POSITIVE | Get_DLword_PCMAC1); break; \
case 6: /* BIGVM possibility */ \
case 5: { \
unsigned int atm = Get_AtomNo_PCMAC1; \
if (atm & SEGMASK) PUSH(atm) /* new atom */ \
else PUSH(S_POSITIVE | atm); /* old atom as SMALLP*/\
} \
break; \
default: error("Storage error: invalid UFN entry"); \
} \
if (needpush) PUSH(fn_atom_index); \
}
#else /* not big atoms */
#define APPLY_POP_PUSH_TEST \
{ \
switch (fn_apply) \
{ \
case 0: break; /* do nothing */ \
case 1: POP; POP; break; /* from apply */ \
case 2: break; /* ufn 0 args */ \
case 3: PUSH(S_POSITIVE | Get_BYTE_PCMAC1); break; \
case 4: PUSH(S_POSITIVE | Get_DLword_PCMAC1); break; \
case 5: PUSH(S_POSITIVE | Get_AtomNo_PCMAC1); break; \
default: error("Storage error: invalid UFN entry"); \
} \
if (needpush) PUSH(fn_atom_index); \
}
#endif /* BIGATOMS */
#define N_APPLY_POP_PUSH_TEST { \
APPLY_POP_PUSH_TEST; \
native_closure_env=closure_env; \
}
#define N_ENVCALL_POP_TEST { \
CSTKPTRL -=2; \
native_closure_env=closure_env; \
}
/****************************************************************/
/****** OPAPPLY ********/
/****************************************************************/
#ifndef BIGATOMS
#define OPAPPLY { \
if ( GET_TOS_1_HI == SPOS_HI ) { \
fn_num_args = GET_TOS_1_LO; \
fn_opcode_size = 1; \
fn_apply = 1; \
fn_atom_index = TOPOFSTACK; \
FNTRACER(Trace_APPLY(fn_atom_index)); \
FNCHECKER(if (quick_stack_check()) Trace_APPLY(fn_atom_index)); \
if ( (SEGMASK & TOPOFSTACK) == 0) \
{ fn_defcell = (DefCell *) GetDEFCELL68k(TOPOFSTACK); \
goto op_fn_common; \
} \
else \
if (GetTypeNumber(TOPOFSTACK)==TYPE_COMPILED_CLOSURE) \
{ TopOfStack=TOPOFSTACK; \
fn_defcell = (DefCell *) &TopOfStack; \
goto op_fn_common; \
} \
else { fn_defcell = (DefCell *) GetDEFCELL68k(NIL_PTR); \
goto op_fn_common; \
} \
} \
goto op_ufn; \
} /* OPAPPLY */
#else
#define OPAPPLY { \
if ( GET_TOS_1_HI == SPOS_HI ) { \
fn_num_args = GET_TOS_1_LO; \
fn_opcode_size = 1; \
fn_apply = 1; \
fn_atom_index = TOPOFSTACK; \
FNTRACER(Trace_APPLY(fn_atom_index)); \
FNCHECKER(if (quick_stack_check()) Trace_APPLY(fn_atom_index)); \
if ( (SEGMASK & TOPOFSTACK) == 0) \
{ fn_defcell = (DefCell *) GetDEFCELLlitatom(TOPOFSTACK); \
goto op_fn_common; \
} \
else switch (GetTypeNumber(TOPOFSTACK)) \
{ \
case TYPE_NEWATOM: \
fn_defcell = (DefCell *) GetDEFCELLnew(TOPOFSTACK); \
goto op_fn_common; \
case TYPE_COMPILED_CLOSURE: \
TopOfStack=TOPOFSTACK; \
fn_defcell = (DefCell *) &TopOfStack; \
goto op_fn_common; \
default: fn_defcell = (DefCell *) GetDEFCELL68k(NIL_PTR); \
goto op_fn_common; \
} /* end of switch */ \
} \
goto op_ufn; \
} /* OPAPPLY */
#endif /* BIGATOMS */
/****************************************************************/
/****** OPFN(x) ********/
/****************************************************************/
#if (defined(SUN3_OS3_OR_OS4_IL) && !(defined(NOASMFNCALL)) )
#ifdef NATIVETRAN
#define OPFN(x, num_args_fn, fn_xna_args, fn_native) \
{ /* asm inlines for fn call (much care put into keeping optimizer \
from moving things around). */ \
fn_section1(); \
fn_section2(); \
num_args_fn(); \
fn_native_test(); \
fn_section3(); \
fn_xna_args(); \
fn_section4(); \
fast1_dispatcher(); /* nextop0 don't work here */ \
fn_native(); \
fn_section5(); \
/* asm code jumps here when not ccodep */ \
{ fn_atom_index = Get_AtomNo_PCMAC1; \
fn_defcell = (DefCell *) GetDEFCELL68k(fn_atom_index); \
fn_num_args = x; \
fn_opcode_size = FN_OPCODE_SIZE; \
fn_apply = 0; \
goto op_fn_common; \
} \
}
#define OPFNX \
{ /* asm inlines for fn call (much care put into keeping optimizer \
from moving things around. */ \
fnx_section1(); \
fn_section2(); \
fnx_args(); \
fn_native_test(); \
fn_section3(); \
fnx_xna(); \
fn_section4(); \
fast1_dispatcher(); /* nextop0 don't work here */ \
fnx_native(); \
fn_section5(); \
fn_atom_index = Get_AtomNo_PCMAC2; \
fn_defcell = (DefCell *) GetDEFCELL68k(fn_atom_index); \
fn_num_args = Get_BYTE_PCMAC1; \
fn_opcode_size = FNX_OPCODE_SIZE; \
fn_apply = 0; \
goto op_fn_common; \
/* *** these carefully arranged to satisfy optimizer */ \
label1: fast1_dispatcher(); \
label2: to_native_label(); \
\
}
#else
#define OPFN(x, num_args_fn, fn_xna_args, fn_native) \
{ /* asm inlines for fn call (much care put into keeping optimizer \
from moving things around). */ \
fn_section1(); \
fn_section2(); \
num_args_fn(); \
fn_section3(); \
fn_xna_args(); \
fn_section4(); \
fast1_dispatcher(); /* nextop0 don't work here */ \
fn_section5(); \
/* asm code jumps here when not ccodep */ \
{ fn_atom_index = Get_AtomNo_PCMAC1; \
fn_defcell = (DefCell *) GetDEFCELL68k(fn_atom_index); \
fn_num_args = x; \
fn_opcode_size = FN_OPCODE_SIZE; \
fn_apply = 0; \
goto op_fn_common; \
} \
}
#define OPFNX \
{ /* asm inlines for fn call (much care put into keeping optimizer \
from moving things around. */ \
fnx_section1(); \
fn_section2(); \
fnx_args(); \
fn_section3(); \
fnx_xna(); \
fn_section4(); \
fast1_dispatcher(); /* nextop0 don't work here */ \
fn_section5(); \
fn_atom_index = Get_AtomNo_PCMAC2; \
fn_defcell = (DefCell *) GetDEFCELL68k(fn_atom_index); \
fn_num_args = Get_BYTE_PCMAC1; \
fn_opcode_size = FNX_OPCODE_SIZE; \
fn_apply = 0; \
goto op_fn_common; \
/* *** these carefully arranged to satisfy optimizer */ \
label1: fast1_dispatcher(); \
\
}
#endif /* NATIVETRAN */
#else
#define OPFN(argcount, num_args_fn, fn_xna_args, fn_native) \
{ /* argcount is a number of the arguments on stack */ \
register struct fnhead *LOCFNCELL; \
register int defcell_word; \
register int NEXTBLOCK; \
FNTRACER(Trace_FNCall(argcount, Get_AtomNo_PCMAC1, TOPOFSTACK, CSTKPTR-1)); \
FNCHECKER(if (quick_stack_check()) Trace_FNCall(argcount, Get_AtomNo_PCMAC1, TOPOFSTACK,CSTKPTR-1)); \
fn_defcell = (DefCell *)GetDEFCELL68k(fn_atom_index = Get_AtomNo_PCMAC1); \
defcell_word = *(int *)fn_defcell; \
FNTPRINT((" def cell = 0x%x.\n", defcell_word)); \
if(!(fn_defcell->ccodep)) \
{ /* it's not a CCODEP */ \
fn_num_args = argcount; \
fn_opcode_size = FN_OPCODE_SIZE; \
fn_apply = 0; \
goto op_fn_common; \
} \
LOCFNCELL = (struct fnhead *)Addr68k_from_LADDR((defcell_word &= POINTERMASK));\
BCE_CURRENTFX->pc = ((unsigned int)PCMAC - (unsigned int)FuncObj) + FN_OPCODE_SIZE;\
FN_CALL_NATIVE_CHECK(LOCFNCELL,-argcount,{}); \
FN_STACK_CHECK; \
{register int newivar; \
newivar = (int) (IVARL = (DLword *)(CSTKPTR-argcount+1)); \
BCE_CURRENTFX->nextblock = \
NEXTBLOCK = \
StkOffset_from_68K(newivar); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if( LOCFNCELL->na >= 0 ) \
{register int RESTARGS; \
RESTARGS = argcount - LOCFNCELL->na; \
while(RESTARGS <0) { \
HARD_PUSH(NIL_PTR); \
RESTARGS++; \
} \
CSTKPTRL -= (RESTARGS); \
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell_word); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *) CSTKPTR; \
{register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) \
{register LispPTR unboundval; \
unboundval = (LispPTR) 0xffffffff; \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
if (result > 0) \
{HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result-=1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \
PCMACL = (ByteCode *)LOCFNCELL + LOCFNCELL->startpc + 1; \
FuncObj = LOCFNCELL; \
nextop0; \
} /* end OPFN */
/*************** OPFNX *************/
#define OPFNX { \
register struct fnhead *LOCFNCELL; \
register DefCell *defcell; /* this reg is not allocated */ \
register int NEXTBLOCK; \
int num_args = Get_BYTE_PCMAC1; \
defcell = (DefCell *) GetDEFCELL68k(Get_AtomNo_PCMAC2); \
FNTRACER(Trace_FNCall(num_args, Get_AtomNo_PCMAC2, TOPOFSTACK, CSTKPTR-1)); \
FNCHECKER(if (quick_stack_check()) Trace_FNCall(num_args, Get_AtomNo_PCMAC2, TOPOFSTACK, CSTKPTR-1)); \
if( defcell->ccodep == 0 ) \
{ fn_defcell = defcell; \
fn_num_args = num_args; \
fn_opcode_size = FNX_OPCODE_SIZE; \
fn_atom_index = Get_AtomNo_PCMAC2; \
fn_apply = 0; \
goto op_fn_common; \
} \
LOCFNCELL = (struct fnhead *)Addr68k_from_LADDR(defcell->defpointer); \
BCE_CURRENTFX->pc = ((unsigned int)PCMAC - (unsigned int)FuncObj) + FNX_OPCODE_SIZE;\
FN_CALL_NATIVE_CHECK2(LOCFNCELL, - num_args, {}); \
FN_STACK_CHECK; \
{register int newivar; \
newivar = (int)(IVARL = (DLword *)(CSTKPTR-num_args+1)); \
BCE_CURRENTFX->nextblock = \
NEXTBLOCK = \
StkOffset_from_68K(newivar); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if( LOCFNCELL->na >= 0 ) \
{register int RESTARGS; \
RESTARGS = num_args - LOCFNCELL->na; \
while(RESTARGS <0) { \
HARD_PUSH(NIL_PTR); \
RESTARGS++; \
} \
CSTKPTRL -= (RESTARGS); \
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell->defpointer);\
CSTKPTRL = (LispPTR *) (((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *) CSTKPTR; \
{register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) \
{register LispPTR unboundval; \
unboundval = (LispPTR) 0xffffffff; \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
if (result > 0) \
{HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result-=1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \
PCMACL = (ByteCode *)LOCFNCELL + LOCFNCELL->startpc + 1; \
FuncObj = LOCFNCELL; \
} /* end OPFN */
#endif /* NOASMFNCALL */
/****************************************************************/
/****** OPCHECKAPPLY ********/
/****************************************************************/
#ifdef BIGATOMS
#define OPCHECKAPPLY { \
register DefCell *defcell; \
defcell = (DefCell *) GetDEFCELL68k(TOPOFSTACK & POINTERMASK); \
if (!( defcell->ccodep && (((TOPOFSTACK & SEGMASK) == 0) || (GetTypeNumber(TOPOFSTACK) == TYPE_NEWATOM)) && \
( ( defcell->argtype == 0 ) || ( defcell->argtype == 2 ) ) ) ) \
goto op_ufn; \
}
#else
#define OPCHECKAPPLY { \
register DefCell *defcell; \
defcell = (DefCell *) GetDEFCELL68k(TOPOFSTACK & POINTERMASK); \
if (!( defcell->ccodep && ((TOPOFSTACK & SEGMASK) == 0) ) && \
( ( defcell->argtype == 0 ) || ( defcell->argtype == 2 ) ) ) \
goto op_ufn; \
}
#endif /* BIGATOMS */
/****************************************************************/
/* UFN_COMMON at op_ufn /
/****************************************************************/
#define GetUFNEntry(num) (((UFN *)UFNTable) + (num))
#define UFN_COMMON \
op_ufn: use code in XC.c \
{ register UFN *entry68k; \
entry68k = (UFN *)GetUFNEntry(Get_BYTE_PCMAC0); \
fn_num_args = entry68k->arg_num; \
fn_opcode_size = entry68k->byte_num+1; \
fn_atom_index = entry68k->atom_name; \
fn_defcell = (DefCell *) GetDEFCELL68k(fn_atom_index); \
fn_apply = 0; \
goto op_fn_common; \
};
/****************************************************************/
/****** OP_FN_COMMON ********/
/* vars: */
/* fn_atom_index */
/* fn_num_args */
/* fn_opcode_size */
/* fn_defcell */
/* fn_apply */
/* */
/* All Closure Calls go through here */
/****************************************************************/
#define needpush NEXTBLOCK
#define OP_FN_COMMON \
op_fn_common: \
ASM_LABEL_OF_FN_COMMON; \
{ register struct fnhead *LOCFNCELL; \
register DefCell *defcell; /* this reg is not allocated */ \
CClosure *closure; \
LispPTR closure_env = (LispPTR) 0xffffffff; \
{register int NEXTBLOCK = NIL; \
defcell = fn_defcell; \
if( (defcell->ccodep == 0) ) \
if(GetTypeNumber(defcell->defpointer)==TYPE_COMPILED_CLOSURE) \
{ /* setup closure */ \
closure=(CClosure *)Addr68k_from_LADDR(defcell->defpointer);\
defcell=(DefCell *)closure; \
/* not a closure if closure's env is NIL */ \
if(closure->env_ptr ) \
{closure_env = (LispPTR) (closure->env_ptr); \
} \
} /* if end */ \
else { \
/* NOT compiled object . We must use Interpreter*/ \
defcell = (DefCell *)GetDEFCELL68k(ATOM_INTERPRETER); \
needpush = 1; \
} /*else end */ \
LOCFNCELL = (struct fnhead *)Addr68k_from_LADDR(defcell->defpointer); \
BCE_CURRENTFX->pc = ((unsigned int)PCMAC \
- (unsigned int)FuncObj) + fn_opcode_size; \
FNTPRINT(("Saving PC = 0%o (0x%x).\n", \
BCE_CURRENTFX->pc, PCMAC+fn_opcode_size)); \
FN_CALL_NATIVE_CHECK2(LOCFNCELL, -fn_num_args, N_APPLY_POP_PUSH_TEST) \
FN_STACK_CHECK; \
APPLY_POP_PUSH_TEST; \
{register int newivar; \
newivar = (int)(IVARL = (DLword *) (CSTKPTR+(1-fn_num_args-needpush))); \
BCE_CURRENTFX->nextblock = \
NEXTBLOCK = \
StkOffset_from_68K(newivar); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if( LOCFNCELL->na >= 0 ) \
{register int RESTARGS; \
RESTARGS = fn_num_args - LOCFNCELL->na; \
while(RESTARGS <0) { \
HARD_PUSH(NIL_PTR); \
RESTARGS++; \
} \
CSTKPTRL -= (RESTARGS); \
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
} /* NEXTBLOCK BLOCK */ \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell->defpointer);\
CSTKPTRL = (LispPTR *) (((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *) CSTKPTR; \
{register int result; \
register LispPTR unboundval; \
unboundval = (LispPTR) 0xffffffff; \
result = LOCFNCELL->pv; \
HARD_PUSH(closure_env); \
HARD_PUSH(unboundval); \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} /* result, unboundval block */ \
CSTKPTRL += 1; \
PCMACL = (ByteCode *)LOCFNCELL + LOCFNCELL->startpc + 1; \
FuncObj = LOCFNCELL; \
SWAPPED_FN_CHECK; /* see if callee needs swapping */ \
CHECK_INTERRUPT; \
nextop0; \
} /* end OP_FN_COMMON */
/************************************************************************/
/* */
/* O P _ E N V C A L L */
/* */
/* Environment call on a code object. Takes an arg count on */
/* the stack, along with a pointer to an environment. If non- */
/* NIL, the environment is stuffed into the PVAR0 slot of the */
/* frame. [This NIL check is in the UFN, and seems to be meant */
/* to allow closures to be called without an environment, without */
/* the compiler having to emit special code.] */
/* */
/************************************************************************/
#define OP_ENVCALL { \
register struct fnhead *LOCFNCELL; \
register int NEXTBLOCK; \
register LispPTR closure_env = TOPOFSTACK; \
register int num_args; \
register LispPTR Fn_DefCell= GET_TOS_1; \
LOCFNCELL = (struct fnhead *)Addr68k_from_LADDR(Fn_DefCell); \
FNTPRINT(("ENVCall.\n")); \
FNCHECKER(if (quick_stack_check()) printf("In ENVCALL.\n")); \
N_GETNUMBER(GET_TOS_2, num_args, op_ufn); \
BCE_CURRENTFX->pc = ((unsigned int)PCMAC - (unsigned int)FuncObj) + 1;\
FN_CALL_NATIVE_CHECK2(LOCFNCELL, -num_args, N_ENVCALL_POP_TEST); \
FN_STACK_CHECK; \
CSTKPTRL -= 2; \
{register int newivar; \
newivar = (int) (IVARL = (DLword *) (CSTKPTR-num_args)); \
BCE_CURRENTFX->nextblock = \
NEXTBLOCK = \
StkOffset_from_68K(newivar); \
} \
if( LOCFNCELL->na >= 0 ) \
{register int RESTARGS; \
RESTARGS = num_args - LOCFNCELL->na; \
while(RESTARGS <0) { \
HARD_PUSH(NIL_PTR); \
RESTARGS++; \
} \
CSTKPTRL -= (RESTARGS); \
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(Fn_DefCell); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *) CSTKPTR; \
{register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) \
{register LispPTR unboundval; \
unboundval = (LispPTR) 0xffffffff; \
if (closure_env == NIL_PTR) HARD_PUSH(unboundval); \
else HARD_PUSH(closure_env); \
HARD_PUSH(unboundval); \
if (result > 0) \
{HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result-=1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \
PCMACL = (ByteCode *)LOCFNCELL + LOCFNCELL->startpc + 1; \
FuncObj = LOCFNCELL; \
SWAPPED_FN_CHECK; \
} /* end OP_ENVCALL */
/***************************/
/* */
/* Check a code block to make sure, on a byte-swapped */
/* machine, that the code stream has been put back */
/* in "natural order" for faster fetching. */
/* (Only in on ISC, now. */
/********************************************************/
#ifdef RESWAPPEDCODESTREAM
#define SWAPPED_FN_CHECK \
if (!FuncObj->byteswapped) { byte_swap_code_block(FuncObj); FuncObj->byteswapped = 1;}
#else
#define SWAPPED_FN_CHECK
#endif /* RESWAPPEDCODESTREAM */
/****************************************************************/
/****** EVAL ********/
/****************************************************************/
#ifndef BIGATOMS
#define EVAL \
{ \
LispPTR scratch; \
register LispPTR work; \
register LispPTR lookuped; /* keep looked up value */ \
\
switch(TOPOFSTACK & SEGMASK) \
{ \
case S_POSITIVE: \
case S_NEGATIVE: nextop1; \
\
case ATOMS_OFFSET: if( (TOPOFSTACK==NIL_PTR) \
||(TOPOFSTACK==ATOM_T)) \
goto Hack_Label; \
nnewframe(CURRENTFX,&scratch, \
TOPOFSTACK & 0xffff); \
work = ((scratch & 0xffff0000)>> 16) | \
((scratch & 0x00ff) <<16); \
lookuped = *((LispPTR *) \
(Addr68k_from_LADDR(work))); \
if(lookuped==NOBIND_PTR) goto op_ufn; \
TOPOFSTACK = lookuped; \
Hack_Label: nextop1; \
\
default: switch(GetTypeNumber(TOPOFSTACK)) \
{ \
case TYPE_FIXP : \
case TYPE_FLOATP : \
case TYPE_STRINGP : \
case TYPE_ONED_ARRAY : \
case TYPE_GENERAL_ARRAY : nextop1; \
\
case TYPE_LISTP : \
fn_atom_index = ATOM_EVALFORM; \
fn_num_args = 1; \
fn_opcode_size = 1; \
fn_defcell = (DefCell *) \
GetDEFCELL68k(ATOM_EVALFORM); \
fn_apply = 0; \
goto op_fn_common; \
\
default : goto op_ufn; \
} \
\
} /* end switch */ \
\
}/* EVAL end */
#else
#define EVAL \
{ \
LispPTR scratch; \
register LispPTR work; \
register LispPTR lookuped; /* keep looked up value */ \
\
switch(TOPOFSTACK & SEGMASK) \
{ \
case S_POSITIVE: \
case S_NEGATIVE: nextop1; \
\
case ATOMS_OFFSET: if( (TOPOFSTACK==NIL_PTR) \
||(TOPOFSTACK==ATOM_T)) \
goto Hack_Label; \
nnewframe(CURRENTFX,&scratch, \
TOPOFSTACK & 0xffff); \
work = ((scratch & 0xffff0000)>> 16) | \
((scratch & 0x0fff) <<16); \
lookuped = *((LispPTR *) \
(Addr68k_from_LADDR(work))); \
if(lookuped==NOBIND_PTR) goto op_ufn; \
TOPOFSTACK = lookuped; \
Hack_Label: nextop1; \
\
default: switch(GetTypeNumber(TOPOFSTACK)) \
{ \
case TYPE_FIXP : \
case TYPE_FLOATP : \
case TYPE_STRINGP : \
case TYPE_ONED_ARRAY : \
case TYPE_GENERAL_ARRAY : nextop1; \
\
case TYPE_LISTP : \
fn_atom_index = ATOM_EVALFORM; \
fn_num_args = 1; \
fn_opcode_size = 1; \
fn_defcell = (DefCell *) \
GetDEFCELL68k(ATOM_EVALFORM); \
fn_apply = 0; \
goto op_fn_common; \
\
case TYPE_NEWATOM: \
nnewframe(CURRENTFX, &scratch, TOPOFSTACK); \
work = POINTERMASK & SWAP_WORDS(scratch); \
lookuped = *((LispPTR *) \
(Addr68k_from_LADDR(work))); \
if(lookuped==NOBIND_PTR) goto op_ufn; \
TOPOFSTACK = lookuped; \
nextop1; \
default : goto op_ufn; \
} \
\
} /* end switch */ \
\
}/* EVAL end */
#endif /* BIGATOMS */

90
inc/lnk-tosret.h Executable file
View File

@@ -0,0 +1,90 @@
/* $Id: lnk-tosret.h,v 1.2 1999/01/03 02:06:12 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1992 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* t o s r e t m a c r o . h */
/* */
/* Implements RETURN for the inner evaluation loop. There are */
/* two versions--one for when hand optimization has been done, */
/* and one for the naive case. To use the hand-optimization */
/* version, you'll need to define an inline function or macro */
/* called opreturn(). It must fall thru if alink is odd, but */
/* must handle all other cases. You can rely on check_interrupt */
/* being a defined label. */
/* */
/************************************************************************/
#ifdef NATIVETRAN
#define RETD6 SaveD6 = 0x100
#define RET_CHECK_NATIVE(x) if(x ->native) { RET_TO_NATIVE; }
#else
#define RETD6
#define RET_CHECK_NATIVE(x)
#endif
#if ((defined(ISC) || defined(SUN3_OS3_OR_OS4_IL)) && !(defined(NOASMFNCALL)) )
#define OPRETURN \
{ opreturn(); \
EXT; if(slowreturn()) goto stackoverflow_help; RET; \
Irq_Stk_Check = STK_END_COMPUTE(EndSTKP,FuncObj); \
if (((int)(CSTKPTR) > Irq_Stk_Check) || (Irq_Stk_End <= 0)) \
{ RETD6; goto check_interrupt; } \
Irq_Stk_End = (int) EndSTKP; \
RET_CHECK_NATIVE(BCE_CURRENTFX); \
}
#else
#define OPRETURN { \
register struct frameex2 *returnFX ; \
register int alink; \
alink = ((struct frameex2 *) BCE_CURRENTFX)->alink; \
FNTPRINT(("RETURN = 0x%x, ", TOPOFSTACK)); \
FNTRACER(prindatum(TOPOFSTACK); printf("\n"); fflush(stdout);) \
if (alink & 1) { EXT; if(slowreturn()) goto stackoverflow_help; RET; \
Irq_Stk_Check = STK_END_COMPUTE(EndSTKP,FuncObj); \
if (((int)(CSTKPTR) > Irq_Stk_Check) || (Irq_Stk_End <= 0)) \
{ RETD6; goto check_interrupt; } \
Irq_Stk_End = (int) EndSTKP; \
RET_CHECK_NATIVE(BCE_CURRENTFX); \
goto retxit; \
}; \
CSTKPTRL = (LispPTR *) IVAR; \
returnFX = (struct frameex2 *) \
((DLword *) \
(PVARL = (DLword *) Addr68k_from_StkOffset(alink)) \
- FRAMESIZE); \
IVARL = (DLword *) \
Addr68k_from_StkOffset(GETWORD((DLword *)returnFX -1)); \
/* Get PC from Retunee's pc slot in FX */ \
PCMACL = returnFX->pc + (ByteCode *) \
(FuncObj = (struct fnhead *) \
Addr68k_from_LADDR(SWAP_FNHEAD(returnFX->fnheader) & POINTERMASK)) + 1;\
Irq_Stk_Check = STK_END_COMPUTE(EndSTKP,FuncObj); \
FNCHECKER(if (quick_stack_check()) printf("In RETURN.\n")); \
if (((int)(CSTKPTR) > Irq_Stk_Check) || (Irq_Stk_End <= 0)) \
{ RETD6; goto check_interrupt; } \
Irq_Stk_End = (int) EndSTKP; \
RET_CHECK_NATIVE(returnFX); \
retxit: {} \
} /* OPRETURN end */
#endif

99
inc/lnk-version.h Executable file
View File

@@ -0,0 +1,99 @@
/* $Id: lnk-version.h,v 1.2 1999/01/03 02:06:12 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* V E R S I O N . H */
/* */
/* Version control: Set the two values that keep sysouts and emul- */
/* ators in sync: The LVERSION and MINBVERSION fields in the IFPAGE */
/* */
/* MINBVERSION is the current emulator version, incremented with each */
/* modification. This must be >= a sysout's ifpage.minbversion. */
/* */
/* LVERSION is the minimum lisp version that will run with this emu- */
/* lator. This must be <= a sysouts's ifpage.lversion. */
/* */
/* The loadup process sets both of these values in the sysout. */
/* */
/* */
/* */
/* C O N F I G U R A T I O N / O P T I O N C O N T R O L */
/* */
/* Given a release specification, set flags for the features */
/* that release has. This lets us set one flag in the make- */
/* file, rather than remembering all the options that must change. */
/* */
/* -DRELEASE=115 Medley 1.15, small atoms */
/* -DRELEASE=200 Medley 2.0 as released */
/* -DRELEASE=201 Medley with DOS & European kbd support */
/* -DRELEASE=210 Medley with big VM */
/* -DRELEASE=300 Medley bigvm as released. */
/* */
/* */
/************************************************************************/
/* The current values */
#define LVERSION 21000
#define MINBVERSION 21001
/* But remember old values, if we can figure them out from ifdef's */
#if (RELEASE == 115)
#undef LVERSION
#undef MINBVERSION
#define LVERSION 15000
#define MINBVERSION 15000
#undef BIGATOMS
#define NOEUROKBD
#define NOFORN
#define NOVERSION
#elif (RELEASE == 200)
/* Medley 2.0 as released */
#undef LVERSION
#undef MINBVERSION
#define LVERSION 20000
#define MINBVERSION 20000
#define BIGATOMS
#define NOEUROKBD
#define NOVERSION
#elif (RELEASE == 201 )
/* Medley 2.0 with EUROKBD modification */
#undef LVERSION
#undef MINBVERSION
#define LVERSION 20100
#define MINBVERSION 20100
#define BIGATOMS
#undef NOEUROKBD
#define NOVERSION
#elif (RELEASE == 210)
/* Medley 2.1, big-vm Medley while in beta-test */
#undef LVERSION
#undef MINBVERSION
#define LVERSION 21000
#define MINBVERSION 21000
#define BIGATOMS
#define BIGVM
#define NEWCDRCODING
# elif (RELEASE == 300 )
#endif

707
inc/locfile.h Executable file
View File

@@ -0,0 +1,707 @@
/* $Id: locfile.h,v 1.2 1999/01/03 02:06:13 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define PAGE_SIZE 512 /* 1 page == 512 byte */
#define RECOG_OLD S_POSITIVE | 0
#define RECOG_OLDEST S_POSITIVE | 1
#define RECOG_NEW S_POSITIVE | 2
#define RECOG_OLD_NEW S_POSITIVE | 3
#define RECOG_NON S_POSITIVE | 5
#define ACCESS_INPUT S_POSITIVE | 0
#define ACCESS_OUTPUT S_POSITIVE | 1
#define ACCESS_BOTH S_POSITIVE | 2
#define ACCESS_APPEND S_POSITIVE | 3
/* For getfileinfo */
#define LENGTH S_POSITIVE | 1
#define WDATE S_POSITIVE | 2
#define RDATE S_POSITIVE | 3
#define AUTHOR S_POSITIVE | 5
#define PROTECTION S_POSITIVE | 6
#define EOL S_POSITIVE | 7
#define ALL S_POSITIVE | 8
extern DLword *Lisp_world; /* To access LispSysout area */
#define ToLispTime(x) ((int)x + 29969152)
/* For getfileinfo. For WDATE&RDATE */
/* 29969152 == (timer.c)LISP_UNIX_TIME_DIFF */
/* - 61200 == - 17hours */
#define ToUnixTime(x) ((int)x - 29969152)
/* For getfileinfo. For WDATE&RDATE */
/* 29969152 == (timer.c)LISP_UNIX_TIME_DIFF */
#define StrNCpyFromCToLisp(lispbuf, cbuf ,len) { register int i; \
register char *sptr,*dptr; \
for(i=0,sptr=(cbuf),dptr =(lispbuf);i<(len);i++)\
GETBYTE(dptr++) = *sptr++; \
}
#define StrNCpyFromLispToC(cbuf , lispbuf, len) { register int i; \
register char *sptr,*dptr; \
for(i=0,sptr=(lispbuf),dptr =(cbuf);i<(len);i++)\
*dptr++ = GETBYTE(sptr++); \
}
#define FGetNum(ptr, place) { \
if(((ptr) & SEGMASK)== S_POSITIVE) {(place) = ((ptr) & 0xffff);}\
else if(((ptr) & SEGMASK)== S_NEGATIVE) {(place) = (int)((ptr)| 0xffff0000);}\
else {return(NIL);}}
/************************************************************************/
/* */
/* L i s p S t r i n g T o C S t r i n g */
/* */
/* Convert the Lisp string in Lisp into a null-terminated C */
/* string in C. MaxLen is, for safety, the maximum length of */
/* the resulting string, so the buffer doesn't overflow and */
/* smash memory. */
/* */
/* WARNINGS: The Lisp string is truncated to fit the C string */
/* without warning to the user. FAT Lisp strings have only */
/* the low 8 bits of each character copied over. */
/* */
/************************************************************************/
#ifndef BYTESWAP
#define LispStringToCString(Lisp, C, MaxLen) \
{ \
OneDArray *arrayp; \
char *base, *dp; \
short *sbase; \
int i, length; \
arrayp = (OneDArray *)(Addr68k_from_LADDR(Lisp)); \
length = min(MaxLen, arrayp->fillpointer); \
switch(arrayp->typenumber) \
{ \
case THIN_CHAR_TYPENUMBER: \
base = ((char *)(Addr68k_from_LADDR(arrayp->base))) \
+ ((int)(arrayp->offset)); \
strncpy(C, base, length); \
C[length] = '\0'; \
break; \
\
case FAT_CHAR_TYPENUMBER: \
sbase = ((short *)(Addr68k_from_LADDR(arrayp->base))) \
+ ((int)(arrayp->offset)); \
for(i=0,dp=C;i<(length);i++) \
*dp++ = (char)(*sbase++); \
*dp = '\0'; \
break; \
default: \
error("LispStringToCString: Not a character array.\n"); \
} \
}
#else /* BYTESWAP == T CHANGED-BY-TAKE */
#define LispStringToCString(Lisp, C, MaxLen) \
{ \
OneDArray *arrayp; \
char *base, *dp; \
short *sbase; \
int i, length; \
arrayp = (OneDArray *)(Addr68k_from_LADDR(Lisp)); \
length = min(MaxLen, arrayp->fillpointer); \
switch(arrayp->typenumber) \
{ \
case THIN_CHAR_TYPENUMBER: \
base = ((char *)(Addr68k_from_LADDR(arrayp->base))) \
+ ((int)(arrayp->offset)); \
/*for(i=0,dp=C;i<length;i++) \
{*dp++ =(char)(GETBYTE(base++));}**/ \
StrNCpyFromLispToC(C , base , length ); \
C[length] = '\0'; \
break; \
\
case FAT_CHAR_TYPENUMBER: \
sbase = ((short *)(Addr68k_from_LADDR(arrayp->base))) \
+ ((int)(arrayp->offset)); \
for(i=0,dp=C;i<(length);i++,sbase++) \
*dp++ = (char)(GETWORD(sbase)); \
*dp = '\0'; \
break; \
default: \
error("LispStringToCString: Not a character array.\n"); \
} \
}
#endif /* BYTESWAP */
/************************************************************************/
/* */
/* L i s p S t r i n g L e n g t h */
/* */
/* Get the byte length of the string in Lisp. */
/* */
/* As a side effect, sets FatP to 1 if LispString is fat, 0 otherwise */
/* Errors if LispString isn't a string (1-d array of characters) */
/* */
/************************************************************************/
#define LispStringLength(LispString, Length, FatP) \
{ \
OneDArray *arrayp; \
arrayp = (OneDArray *)(Addr68k_from_LADDR(LispString)); \
switch(arrayp->typenumber) \
{ \
case THIN_CHAR_TYPENUMBER: \
Length = arrayp->fillpointer; \
FatP = 0; \
break; \
\
case FAT_CHAR_TYPENUMBER: \
Length = arrayp->fillpointer * 2; \
FatP = 1; \
break; \
default: \
error("LispStringLength: Not a character array.\n"); \
} \
}
/************************************************************************/
/* */
/* S T R I N G _ B A S E */
/* */
/* Return (C-pointer) to the characters in lstringp, in cstringp. */
/* */
/************************************************************************/
#define STRING_BASE(lstringp, cstringp) \
{ \
register LispPTR *naddress; \
naddress = (LispPTR *)(Addr68k_from_LADDR(lstringp)); \
cstringp = (char *)(Addr68k_from_LADDR(((OneDArray *)naddress)->base)); \
}
#ifndef min
#define min(a, b) ((a <= b)?a:b)
#endif /* min */
#define LispNumToCInt(Lisp) \
( ((Lisp & SEGMASK) == S_POSITIVE) ? \
(Lisp & 0xFFFF) : (*((int *)(Addr68k_from_LADDR(Lisp)))) );
#define UPLOWDIFF 0x20
#define DOWNCASE(name){ \
\
register char *cp; \
\
for(cp = name; *cp!='\0'; ++cp) \
if((*cp >= 'A') && (*cp <= 'Z')) *cp += UPLOWDIFF; \
}
#define UPCASE(name){ \
\
register char *cp; \
\
for(cp = name; *cp!='\0'; ++cp) \
if((*cp >= 'a') && (*cp <= 'z')) *cp -= UPLOWDIFF; \
}
#define DIR_OR_FILE_P(name, type){ \
register int result; \
struct stat sbuf; \
\
TIMEOUT(result = stat(name, &sbuf)); \
if (result < 0) { \
*Lisp_errno = errno; \
type = 0; \
} else { \
switch (sbuf.st_mode & S_IFMT) { \
\
case S_IFDIR: \
type = -1; \
break; \
\
case S_IFREG: \
type = 1; \
break; \
\
default: \
/* \
* Should we deal with the other \
* types? \
*/ \
type = 0; \
break; \
} \
} \
}
#ifdef FSERROR
#define DIRP(path, dir, buf){ \
int rval; \
struct stat statbuf; \
strcpy(buf, path); \
strcat(buf, dir); \
TIMEOUT( rval=stat(buf, &statbuf) ); \
if( rval == 0){ \
if( (statbuf.st_mode & S_IFMT) == S_IFDIR ){ \
strcat(path, dir); \
return(1); \
} \
} \
if( rval == -1 && errno == 60){ \
*Lisp_errno = 60; \
return(0); \
} \
}
#else
#define DIRP(path, dir, buf){ \
int rval; \
struct stat statbuf; \
strcpy(buf, path); \
strcat(buf, dir); \
TIMEOUT( rval=stat(buf, &statbuf) ); \
if( rval == 0){ \
if( (statbuf.st_mode & S_IFMT) == S_IFDIR ){ \
strcat(path, dir); \
return(1); \
} \
} \
}
#endif
#define FILEP(path, file, buf){ \
int rval; \
strcpy(buf, path); \
strcat(buf, file); \
TIMEOUT( rval=access(buf, F_OK) ); \
if( access(buf, F_OK) == 0){ \
strcat(path, file); \
return(1); \
} \
}
#define STREQ(name1, name2)( \
(*name1 == *name2) && (strcmp(name1, name2) == 0) \
)
#define SPECIALFILEMARK -1
#define NumericStringP(str, truetag, falsetag) { \
register char *cp; \
\
if (*str == '\0') goto falsetag; \
\
for(cp = str; *cp!='\0'; ++cp) \
if(*cp < '0' || '9' < *cp) \
goto falsetag; \
goto truetag; \
}
/*
* Name: LispVersionToUnixVersion
*
* Argument: char *pathname
* Xerox Lisp syntax pathname.
*
* Value: If succeed, returns 1, otherwise 0.
*
* Side Effect: The version part of pathname is destructively modified.
*
* Description:
*
* Destructively modify the version part of pathname which is following the
* Xerox Lisp file naming convention to UNIX one.
* If the file name which is passed from Lisp has the version part, it must be
* a valid one (i.e. construected with only number). This is guaranteed by Lisp
* code.
* This macro should be called at the top of the routines which accept the
* file name from lisp before converting it into UNIX file name, because
* locating the version part, the informations about quoted characters are needed.
* They might be lost in the course of the conversion.
*
*/
#ifdef DOS
/* DOS version of LispVersionToUnixVersion */
/* * * * * This is done this way because DOS can't handle the non-DOS version -- */
/* * * * * it gived "Too many characters in a character constant" errors! */
#include "lispver1.h"
#else /* DOS */
/* NON-DOS version of the macro LispVersionToUnixVersion */
#include "lispver2.h"
#endif /* DOS */
/*
* Name: UnixVersionToLispVersion
*
* Argument: char *pathname
* UNIX syntax pathname.
* int vlessp
* If 0, versionless file is converted to version 1.
* Otherwise, remains as versionless.
*
* Value: If succeed, returns 1, otherwise 0.
*
* Side Effect: The version part of pathname is destructively modified.
*
* Description:
*
* Destructively modify the version part of pathname which is following the
* UNIX file naming convention to Xerox Lisp one.
* This macro should be called, in the routines which convert the UNIX pathname
* to Lisp one, just before it returns the result to Lisp, because converting
* version field will append a semicolon and it might make the routine be
* confused.
* The file which has not a valid version field, that is ".~##~" form, is
* dealt with as version 1.
*/
#define UnixVersionToLispVersion(pathname, vlessp){ \
\
register char *start; \
register char *end; \
register char *cp; \
register int len, ver_no; \
char ver_buf[VERSIONLEN]; \
\
if ((start = strchr(pathname, '~')) != NULL) { \
/* First of all, find the version field in pathname. */ \
end = start; \
cp = start + 1; \
while (*cp) { \
if (*cp == '~') { \
start = end; \
end = cp; \
cp++; \
} else { \
cp++; \
} \
} \
\
if (start != end && *(start - 1) == '.' && end == (cp - 1)) { \
/* \
* pathname ends in the form ".~###~". But we \
* check ### is a valid number or not. \
*/ \
len = (int)end - (int)start - 1; \
strncpy(ver_buf, start + 1, len); \
ver_buf[len] = '\0'; \
NumericStringP(ver_buf, YES, NO); \
YES: \
*(start - 1) = ';'; \
*start = '\0'; \
*end = '\0'; \
/* call ato i to eliminate leading 0s. */ \
ver_no = atoi(start + 1); \
sprintf(ver_buf, "%d", ver_no); \
strcat(pathname, ver_buf); \
goto CONT; \
\
NO: \
/* Dealt with as version 1 unless vlessp */ \
if (!vlessp) strcat(pathname, ";1"); \
CONT: \
cp--; /* Just for label */ \
} else { \
/* Dealt with as version 1 unless vlessp. */ \
if (!vlessp) strcat(pathname, ";1"); \
} \
} else { \
/* Dealt with as version 1 unless vlessp. */ \
if (!vlessp) strcat(pathname, ";1"); \
} \
}
/*
* Name: ConcDirAndName
*
* Argument: char *dir The name of the directory.
* char *name The name of a file.
* char *fname The place where the full file name should be
* stored.
* Value: N/A
*
* Side Effect: fname is replaced with the full file name.
*
* Description:
*
* Concatenate the directory name and root file name. Checks if dir contains
* the trail directory delimiter or not.
*
*/
#define ConcDirAndName(dir, name, fname){ \
\
register char *cp1, *cp2; \
\
cp1 = dir; \
cp2 = dir; \
\
while (*cp2 != '\0') { \
switch (*cp2) { \
\
case '/': \
cp1 = cp2; \
cp2++; \
break; \
\
default: \
cp2++; \
break; \
} \
} \
if (cp1 == (cp2 - 1)) { \
if (cp1 == dir) { \
/* dir is a root directory. */ \
strcpy(fname, "/"); \
strcat(fname, name); \
} else { \
/* The trail directory is included. */ \
strcpy(fname, dir); \
strcat(fname, name); \
} \
} else { \
/* The trail directory is not included */ \
strcpy(fname, dir); \
strcat(fname, "/"); \
strcat(fname, name); \
} \
}
/*
* Name: ConcNameAndVersion
*
* Argument: char *name The root file name.
* char *ver The file version.
* char *rname The place where the concatenated file name will be
* stored.
* Value: N/A
*
* Side Effect: rname is replaced with the concatenated file name.
*
* Description:
*
* Concatenate the root file name and its version in UNIX format.
*
*/
#define ConcNameAndVersion(name, ver, rname){ \
if (*ver != '\0') { \
strcpy(rname, name); \
strcat(rname, ".~"); \
strcat(rname, ver); \
strcat(rname, "~"); \
} else { \
strcpy(rname, name); \
} \
}
#define VERSIONLEN 16
#define MAXVERSION 999999999
#define LASTVERSIONARRAY 0xFFFFFFFF
#define VERSIONARRAYLENGTH 200
#define NoFileP(varray) \
((varray->version_no == LASTVERSIONARRAY)? 1 : 0)
#ifdef DOS
#define OnlyVersionlessP(varray) 0
#else
#define OnlyVersionlessP(varray) \
((varray->version_no == 0 && (varray + 1)->version_no == LASTVERSIONARRAY) ? \
1 : 0)
#endif /* DOS */
/* An argument of AddDodNoExtention must be LispVersion convention */
/* Like "foo/fee.fee;3" or "/foo/foo;3" */
/* AddDodNoExtention must be put after UnixVersionToLispVersion */
#define AddDodNoExtention(file){ \
register char *cp; \
register char *cp1; \
if( (strrchr(file,'.')== 0) && ((cp=strrchr(file,';'))!=0) ){ \
for(cp1=cp;*cp1!='\0';cp1++); \
*(cp1+1) = '\0'; \
for(;cp!=cp1;cp1--) \
*cp1 = *(cp1-1); \
*cp = '.'; \
} \
}
/* An argument of RemoveDodNoExtenstion must be LispVersion convention */
/* Like "foo/fee.fee;3" or "/foo/foo.;3" */
/* RemoveDodNoExtenstion must be put before LispVersionToUnixVersion */
#define RemoveDodNoExtenstion(file){ \
register char *cp; \
if( ((cp=strrchr(file, ';'))!=0) && (*(cp-1)=='.') ){ \
for(;*cp!='\0';++cp) \
*(cp-1) = *cp; \
*(cp-1) = '\0'; \
} \
}
extern int errno;
#define ChangeToVersionless(pathname){ \
register char *cp; \
if( (cp=strrchr(pathname, ';')) != 0) \
*cp = '\0'; \
}
#ifdef FSERROR
#define UNLINK(x){ \
TIMEOUT(rval=unlink(x)); \
if(rval == -1){ \
err_mess("unlink", errno); \
*Lisp_errno = errno; \
return(0); \
} \
}
#else
#define UNLINK(x){ \
TIMEOUT(rval=unlink(x)); \
if(rval == -1){ \
err_mess("unlink", errno); \
return(0); \
} \
}
#endif
#ifdef FSERROR
#define LINK(x,y){ \
TIMEOUT(rval=link(x, y)); \
if(rval == -1){ \
if(errno == 2) \
return(1); \
else{ \
err_mess("link", errno);\
*Lisp_errno = errno; \
return(0); \
} \
} \
}
#else
#define LINK(x,y){ \
TIMEOUT(rval=link(x, y)); \
if(rval == -1){ \
if(errno == 2) \
return(1); \
else{ \
err_mess("link", errno);\
return(0); \
} \
} \
}
#endif
#ifdef FSERROR
#define RENAME(x,y){ \
TIMEOUT(rval=rename(x, y)); \
if(rval == -1){ \
switch(errno){ \
case 2: \
return(1); \
case 18: \
*Lisp_errno = errno; \
return(0); \
default: \
err_mess("rename", errno);\
*Lisp_errno = errno; \
return(0); \
} \
} \
}
#else
#define RENAME(x,y){ \
TIMEOUT(rval=rename(x, y)); \
if(rval == -1){ \
switch(errno){ \
case 2: \
return(1); \
default: \
err_mess("rename", errno);\
return(0); \
} \
} \
}
#endif
#ifdef FSERROR
#define STAT(x,y){ \
TIMEOUT(rval=stat(x, y)); \
if(rval != 0){ \
err_mess("stat", errno); \
*Lisp_errno = errno; \
return(-1); \
} \
}
#else
#define STAT(x,y){ \
TIMEOUT(rval=stat(x, y)); \
if(rval != 0){ \
err_mess("stat", errno); \
return(-1); \
} \
}
#endif
/*
* For file name length check
*/
#define FNAMETOOLONG 200
#define FileNameTooLong(val) { \
*Lisp_errno = FNAMETOOLONG; \
return((val)); \
}
/********************************************************/
/* file-system-specific defns */
/* */
/* DIRSEP = OS-specific directory separator character. */
/* UNIXDIRSEP = UNIX's " */
/* DRIVESEP = OS-specific drive separator character. */
/* (only used with DOS as of 3/93) */
/********************************************************/
#ifdef DOS
#define DIRSEP '\\'
#define DIRSEPSTR "\\"
#define DRIVESEP ':'
#define UNIXDIRSEP '/'
#define MAXNAMLEN _MAX_PATH
#else
#define DIRSEPSTR "/"
#define DIRSEP '/'
#define UNIXDIRSEP '/'
#endif

195
inc/lpdefs.h Executable file
View File

@@ -0,0 +1,195 @@
/* $Id: lpdefs.h,v 1.2 1999/01/03 02:06:13 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#include <stdio.h>
#include <math.h>
#include <setjmp.h>
#ifndef OS4
#include <stdlib.h>
#else
#include <sys/types.h>
#endif /* OS4 */
#include <string.h>
#include <setjmp.h>
#define HASHSIZE 10007 /* prime number is better, MB */
#define ETA_START_SIZE 10000 /* start size of array Eta. Realloced if needed */
#define FNAMLEN 64
#define NAMELEN 25
#define MAXSTRL (NAMELEN-1)
#define STD_ROW_NAME_PREFIX "r_"
#define FALSE 0
#define TRUE 1
#define LE 0
#define EQ 1
#define GE 2
#define OF 3
#define OPTIMAL 0
#define MILP_FAIL 1
#define INFEASIBLE 2
#define UNBOUNDED 3
#define TIMEOUT 4
#define INT_SOLN 5
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define my_min(x, y) ((x) < (y) ? (x) : (y))
#define my_max(x, y) ((x) > (y) ? (x) : (y))
#define CALLOC(ptr, nr, type) if(!(ptr = calloc((size_t)(nr),\
sizeof(type)))) { fprintf(stderr, "calloc failed\n"); ERROR(ERR_NOMEM); }
#define MALLOC(ptr, nr, type) if(!(ptr = malloc((size_t)((nr) * \
sizeof(type))))) { fprintf(stderr, "malloc failed\n"); ERROR(ERR_NOMEM); }
#define DEFAULT_INFINITE 1.0e24 /* limit for dynamic range */
#define DEFAULT_EPSB 0.0001 /* for rounding RHS values to 0 */
#define DEFAULT_EPSEL 1.0e-8 /* for rounding other values to 0 */
#define DEFAULT_EPSD 0.0001 /* ?? MB */
#define DEFAULT_EPSILON 1e-6 /* to determine if a float value is integer */
#define INVITER 50 /* number of iterations between inversions */
#ifndef REAL /* to allow -DREAL=<float type> while compiling */
#define REAL double
#endif
typedef char nstring[NAMELEN];
typedef struct _column
{
int row;
float value;
struct _column *next ;
} column;
typedef struct _constraint_name
{
char name[NAMELEN];
int row;
struct _constraint_name *next;
} constraint_name;
typedef struct _bound
{
REAL upbo;
REAL lowbo;
} bound;
typedef struct _hashelem
{
nstring colname;
struct _hashelem *next;
struct _column *col;
struct _bound *bnd;
int must_be_int;
} hashelem;
typedef struct _rside /* contains relational operator and rhs value */
{
REAL value;
struct _rside *next;
short relat;
} rside;
/* structure or final data-storage */
typedef struct _matrec
{
int rownr;
REAL value;
} matrec;
typedef struct _lispmr
{
int rownr;
float value;
} lispmr;
typedef struct _tmp_store_struct
{
nstring name;
int row;
REAL value;
REAL rhs_value;
short relat;
} tmp_store_struct;
typedef struct _intrec
{
int varnr;
struct _intrec *next;
}
intrec;
/************************************************************************/
/* */
/* S T A T E - S A V I N G F O R T I M E - O U T S */
/* */
/* */
/* */
/************************************************************************/
typedef struct solve_state
{
int saved; /* 0 = not used, else states below */
int notint; /* variable # of the non-integer var chosen */
int bound; /* integer lower bound for variable notint */
int res1, res2;
struct solve_state *next; /* The next state holder in the chain */
} sstate;
#define ST_LO 1 /* We got to before calling solve on the lower bound side */
#define ST_HI 2 /* We got to before calling solve on the upper bound side */
#define ST_SOLN 3 /* We got past calling solve, not to analyzing */
/*************************************************************************/
/* */
/* E R R O R H A N D L I N G F O R L I B R A R Y */
/* */
/* */
/* */
/* */
/* */
/*************************************************************************/
#define ERROR(x) longjmp(LP_jmpbuf,256|x)
#define ERR_NOMEM 0x10 /* Any out-of-memory problem */
#define ERR_ST 0x11 /* ran out allocating State-infos */
#define ERR_NUM 0x20 /* Any numeric stability problem */
#define ERR_BUG 0x40 /* Any lp_solve-bug exit */
#define ERR_BUG_CONDCOL 0x41 /* Condensecol out-of-bounds */

79
inc/lpglob.h Executable file
View File

@@ -0,0 +1,79 @@
/* $Id: lpglob.h,v 1.2 1999/01/03 02:06:13 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* Globals */
extern lprec *Lp; /* extern pointer to active problem */
extern int Rows;
extern int Columns;
extern int Sum;
extern int Non_zeros;
extern int Level;
extern matrec *Mat;
extern int *Col_no;
extern int *Col_end;
extern int *Row_end;
extern REAL *Orig_rh;
extern REAL *Rh;
extern REAL *Rhs;
extern short *Must_be_int;
extern REAL *Orig_upbo;
extern REAL *Orig_lowbo;
extern REAL *Upbo;
extern REAL *Lowbo;
extern int *Bas;
extern short *Basis;
extern short *Lower;
extern int Eta_alloc;
extern int Eta_size;
extern int Num_inv;
extern REAL *Eta_value;
extern int *Eta_row_nr;
extern int *Eta_col_end;
extern REAL *Solution;
extern REAL *Best_solution;
extern REAL Infinite;
extern REAL Epsilon;
extern REAL Epsb;
extern REAL Epsd;
extern REAL Epsel;
extern REAL TREJ;
extern REAL TINV;
extern short Maximise;
extern short Floor_first;
extern REAL Extrad;
extern int Warn_count;
extern short just_inverted;
extern short status;
extern short do_iter;
extern short do_invert;
/* Globals for parser */
extern FILE *yyin;
extern FILE *lpfilename;
extern short Molve_dual;
extern short Maximise;
extern short *relat;
extern int Verbose;
extern int yylineno;
extern int yyleng;
extern int Lin_term_count;
extern int Sign;
extern constraint_name *First_constraint_name;
/* I hate #ifdefs, but there seems to be no "standard" way to do this */
#if defined(__hpux) || defined(__apollo) || defined(_AIX)
/* for HP and Apollo (and possibly others) */
extern unsigned char yytext[];
#else
/* For other computers */
extern char yytext[];
#endif
extern hashelem *Hash_tab[];
extern rside *First_rside;
extern short Ignore_decl;
extern tmp_store_struct tmp_store;

82
inc/lpglobl.h Executable file
View File

@@ -0,0 +1,82 @@
/* $Id: lpglobl.h,v 1.2 1999/01/03 02:06:14 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/* function declarations */
#include "lpproto.h"
/* global variables */
extern int Rows, Columns, Nonnuls, Sum;
extern double Extrad;
extern double *Pcol; /* [Rows+1] */
extern nstring Probname;
extern int Totnum, Classnr, Linenr;
extern short Bounds, Ranges, Verbose, Debug, Show_results, Print_duals;
extern unsigned Cur_eta_size;
extern double *Eta_value;
extern int *Eta_rownr;
extern constraint_name *First_constraint_name;
extern matrec *Mat;
extern double *Upbo, *Lowbo;
extern nstring *Names;
extern int *Cend;
extern double *Rh;
extern short *Relat;
extern short *Chsign;
extern int *Endetacol;
extern int *Rend, *Bas;
extern double *Rhs;
extern int *Colno;
extern short *Basis, *Lower;
extern short Maximise;
extern double *Solution, *Best_solution, *Orig_rh, *Orig_upbo, *Orig_lowbo;
extern short *Must_be_int;
extern short Having_ints;
extern matrec *Orig_mat;
extern int Level;
extern short Floorfirst;
extern intrec *First_int;
/* external variables for yy_trans and the yacc parser */
extern int yylineno;
extern int yyleng;
extern int Lin_term_count;
extern int Sign;
/* I hate #ifdefs, but there seems to be no "standard" way to do this */
#if defined(__hpux) || defined(__apollo)
/* for HP and Apollo (and possibly others) */
extern unsigned char yytext[];
#else
/* For other computers */
extern char yytext[];
#endif
/*extern hashelem *Hash_tab[HASH_SIZE];*/
extern rside *First_rside;
extern short Ignore_decl;
extern tmp_store_struct tmp_store;
extern int SolveCount;
extern jmp_buf LP_jmpbuf;

537
inc/lpkit.h Executable file
View File

@@ -0,0 +1,537 @@
/* $Id: lpkit.h,v 1.2 1999/01/03 02:06:14 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
Main header file of the LP_SOLVE toolkit.
By Jeroen Dirks, 21-2-95
include this file in your program and link with liblps.a
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define FAIL -1
#define NULL 0
#define FALSE 0
#define TRUE 1
#define DEFNUMINV 50
/* solve status values */
#define OPTIMAL 0
#define MILP_FAIL 1
#define INFEASIBLE 2
#define UNBOUNDED 3
#define FAILURE 4
#define RUNNING 5
#define INT_SOLN 6
#define TIMEOUT 7
/* lag_solve extra status values */
#define FEAS_FOUND 6
#define NO_FEAS_FOUND 7
#define BREAK_BB 8
#define FIRST_NI 0
#define RAND_NI 1
#define LE 0
#define EQ 1
#define GE 2
#define OF 3
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define my_min(x, y) ((x) < (y) ? (x) : (y))
#define my_max(x, y) ((x) > (y) ? (x) : (y))
#define MAX_WARN_COUNT 20
#ifdef CHECK
#define my_round(val, eps) { \
REAL absv; \
absv = ((val) < 0 ? -(val) : (val)); \
if(absv < (eps)) \
val = 0; \
if(Warn_count < MAX_WARN_COUNT) \
{ \
if(absv > 0.5 * (eps) && absv < 2 * (eps)) \
{ \
Warn_count++; \
fprintf(stderr, \
"Warning Value close to epsilon V: %e E: %e\n", \
(double)absv, (double)(eps)); \
if(Warn_count == MAX_WARN_COUNT) \
{ \
fprintf(stderr, \
"*** Surpressing further rounding warnings\n"); \
} \
} \
} \
}
#else
#define my_round(val,eps) { \
if (((val) < 0 ? -(val) : (val)) < (eps)) \
val = 0; \
}
#endif
#define debug_print(x,y,z,w,e,r,t,q)
#define debug_print_bounds(x,y)
#define debug_print_solution()
#define DEF_INFINITE 1e24 /* limit for dynamic range */
#define DEF_EPSB 5.01e-7 /* for rounding RHS values to 0 determine
infeasibility basis */
#define DEF_EPSEL 1e-8 /* for rounding other values (vectors) to 0 */
#define DEF_EPSD 1e-6 /* for rounding reduced costs to zero */
#define DEF_EPSILON 1e-3 /* to determine if a float value is integer */
#define PREJ 1e-3 /* pivot reject (try others first) */
#ifndef REAL /* to allow -DREAL=<float type> while compiling */
#define REAL double
#endif
#define HASHSIZE 10007 /* prime number is better, MB */
#define ETA_START_SIZE 10000 /* start size of array Eta. Realloced if needed */
#define FNAMLEN 64
#define NAMELEN 25
#define MAXSTRL (NAMELEN-1)
#define STD_ROW_NAME_PREFIX "r_"
#define CALLOC(ptr, nr, type) \
if (!(ptr = (type *) calloc((size_t)(nr), sizeof(type)))) \
{ fprintf(stderr, "calloc failed on line %d of file %s\n", __LINE__, __FILE__); \
ERROR(ERR_NOMEM); }
#define MALLOC(ptr, nr, type) if(!(ptr = (type *) malloc((size_t)((nr) * sizeof(type))))) { fprintf(stderr, "malloc failed on line %d of file %s\n", __LINE__, __FILE__); ERROR(ERR_NOMEM); }
#define REALLOC(ptr, nr, type) if(!(ptr = (type *) realloc(ptr,(size_t)(nr)*sizeof(type)))) { fprintf(stderr, "realloc failed on line %d of file %s\n", __LINE__, __FILE__); ERROR(ERR_NOMEM); }
#define MALLOCCPY(nptr,optr,nr,type) {MALLOC(nptr, nr, type); memcpy(nptr, optr, (size_t)((nr) * sizeof(type)));}
#define MEMCPY(nptr,optr,nr,type) {memcpy(nptr,optr, (size_t)((nr) * sizeof(type)));}
typedef char nstring[NAMELEN];
typedef struct _matrec
{
int row_nr;
REAL value;
} matrec;
typedef struct _lispmr
{
int rownr;
float value;
} lispmr;
typedef struct _column
{
int row;
float value;
struct _column *next ;
} column;
typedef struct _constraint_name
{
char name[NAMELEN];
int row;
struct _constraint_name *next;
} constraint_name;
typedef struct _bound
{
REAL upbo;
REAL lowbo;
} bound;
typedef struct _tmp_store_struct
{
nstring name;
int row;
REAL value;
REAL rhs_value;
short relat;
} tmp_store_struct;
typedef struct _hashelem
{
nstring colname;
struct _hashelem *next;
struct _column *col;
struct _bound *bnd;
int must_be_int;
} hashelem;
typedef struct _rside /* contains relational operator and rhs value */
{
REAL value;
struct _rside *next;
short relat;
} rside;
/************************************************************************/
/* */
/* S T A T E - S A V I N G F O R T I M E - O U T S */
/* */
/* */
/* */
/************************************************************************/
typedef struct solve_state
{
int saved; /* 0 = not used, else states below */
int notint; /* variable # of the non-integer var chosen */
int bound; /* integer lower bound for variable notint */
int res1, res2;
struct solve_state *next; /* The next state holder in the chain */
} sstate;
#define ST_LO 1 /* We got to before calling solve on the lower bound side */
#define ST_HI 2 /* We got to before calling solve on the upper bound side */
#define ST_SOLN 3 /* We got past calling solve, not to analyzing */
/* fields indicated with ## may be modified directly */
/* pointers will have there size in the comments */
typedef struct _lprec
{
nstring lp_name; /* the name of the lp */
short active; /*TRUE if the globals point to this structure*/
short verbose; /* ## Verbose flag */
short print_duals; /* ## PrintDuals flag for PrintSolution */
short print_sol; /* ## used in lp_solve */
short debug; /* ## Print B&B information */
short print_at_invert; /* ## Print information at every reinversion */
short trace; /* ## Print information on pivot selection */
short anti_degen; /* ## Do perturbations */
int rows; /* Nr of constraint rows in the problem */
int rows_alloc; /* The allocated memory for Rows sized data */
int columns; /* The number of columns (= variables) */
int columns_alloc;
int sum; /* The size of the variables + the slacks */
int sum_alloc;
short names_used; /* Flag to indecate if names for rows and
columns are used */
nstring *row_name; /* rows_alloc+1 */
nstring *col_name; /* columns_alloc+1 */
/* Row[0] of the sparce matrix is the objective function */
int non_zeros; /* The number of elements in the sparce matrix*/
int mat_alloc; /* The allocated size for matrix sized
structures */
matrec *mat; /* mat_alloc :The sparse matrix */
int *col_end; /* columns_alloc+1 :Cend[i] is the index of the
first element after column i.
column[i] is stored in elements
col_end[i-1] to col_end[i]-1 */
int *col_no; /* mat_alloc :From Row 1 on, col_no contains the
column nr. of the
nonzero elements, row by row */
short row_end_valid; /* true if row_end & col_no are valid */
int *row_end; /* rows_alloc+1 :row_end[i] is the index of the
first element in Colno after row i */
REAL *orig_rh; /* rows_alloc+1 :The RHS after scaling & sign
changing, but before `Bound transformation' */
REAL *rh; /* rows_alloc+1 :As orig_rh, but after Bound
transformation */
REAL *rhs; /* rows_alloc+1 :The RHS of the curent simplex
tableau */
short *must_be_int; /* sum_alloc+1 :TRUE if variable must be
Integer */
REAL *orig_upbo; /* sum_alloc+1 :Bound before transformations */
REAL *orig_lowbo; /* " " */
REAL *upbo; /* " " :Upper bound after transformation
& B&B work*/
REAL *lowbo; /* " " :Lower bound after transformation
& B&B work */
short basis_valid; /* TRUE is the basis is still valid */
int *bas; /* rows_alloc+1 :The basis column list */
short *basis; /* sum_alloc+1 : basis[i] is TRUE if the column
is in the basis */
short *lower; /* " " :TRUE is the variable is at its
lower bound (or in the basis), it is FALSE
if the variable is at its upper bound */
short eta_valid; /* TRUE if current Eta structures are valid */
int eta_alloc; /* The allocated memory for Eta */
int eta_size; /* The number of Eta columns */
int num_inv; /* The number of real pivots */
int max_num_inv; /* ## The number of real pivots between
reinvertions */
REAL *eta_value; /* eta_alloc :The Structure containing the
values of Eta */
int *eta_row_nr; /* " " :The Structure containing the Row
indexes of Eta */
int *eta_col_end; /* rows_alloc + MaxNumInv : eta_col_end[i] is
the start index of the next Eta column */
short bb_rule; /* what rule for selecting B&B variables */
short break_at_int; /* TRUE if stop at first integer better than
break_value */
REAL break_value;
REAL obj_bound; /* ## Objective function bound for speedup of
B&B */
int iter; /* The number of iterations in the simplex
solver (LP) */
int total_iter; /* The total number of iterations (B&B) (ILP)*/
int max_level; /* The Deepest B&B level of the last solution */
int total_nodes; /* total number of nodes processed in b&b */
REAL *solution; /* sum_alloc+1 :The Solution of the last LP,
0 = The Optimal Value,
1..rows The Slacks,
rows+1..sum The Variables */
REAL *best_solution; /* " " :The Best 'Integer' Solution */
REAL *duals; /* rows_alloc+1 :The dual variables of the
last LP */
short maximise; /* TRUE if the goal is to maximise the
objective function */
short floor_first; /* TRUE if B&B does floor bound first */
short *ch_sign; /* rows_alloc+1 :TRUE if the Row in the matrix
has changed sign
(a`x > b, x>=0) is translated to
s + -a`x = -b with x>=0, s>=0) */
short scaling_used; /* TRUE if scaling is used */
short columns_scaled; /* TRUE is the columns are scaled too, Only use
if all variables are non-integer */
REAL *scale; /* sum_alloc+1 :0..Rows the scaling of the Rows,
Rows+1..Sum the scaling of the columns */
int nr_lagrange; /* Nr. of Langrangian relaxation constraints */
REAL **lag_row; /* NumLagrange, columns+1:Pointer to pointer of
rows */
REAL *lag_rhs; /* NumLagrange :Pointer to pointer of Rhs */
REAL *lambda; /* NumLagrange :Lambda Values */
short *lag_con_type; /* NumLagrange :TRUE if constraint type EQ */
REAL lag_bound; /* the lagrangian lower bound */
short valid; /* Has this lp pased the 'test' */
REAL infinite; /* ## numercal stuff */
REAL epsilon; /* ## */
REAL epsb; /* ## */
REAL epsd; /* ## */
REAL epsel; /* ## */
sstate *solve_states; /* for time out */
} lprec;
/* function interface for the user */
lprec *make_lp(int rows, int columns);
/* create and initialise a lprec structure
defaults:
Empty (Rows * Columns) matrix,
Minimise the objective function
constraints all type <=
Upperbounds all Infinite
no integer variables
floor first in B&B
no scaling
default basis */
lprec *read_lp_file(FILE *input, short verbose, nstring lp_name);
/* create and read an .lp file from input (input must be open) */
void delete_lp(lprec *lp);
/* Remove problem from memory */
lprec *copy_lp(lprec *lp);
/* copy a lp structure */
void set_mat(lprec *lp, int row, int column, REAL value);
/* fill in element (Row,Column) of the matrix
Row in [0..Rows] and Column in [1..Columns] */
void set_obj_fn(lprec *lp, REAL *row);
/* set the objective function (Row 0) of the matrix */
void str_set_obj_fn(lprec *lp, char *row);
/* The same, but with string input */
void add_constraint(lprec *lp, REAL *row, short constr_type, REAL rh);
/* Add a constraint to the problem,
row is the constraint row,
rh is the right hand side,
constr_type is the type of constraint (LE (<=), GE(>=), EQ(=)) */
void str_add_constraint(lprec *lp, char *row_string ,short constr_type, REAL rh);
/* The same, but with string input */
void del_constraint(lprec *lp,int del_row);
/* Remove constrain nr del_row from the problem */
void add_lag_con(lprec *lp, REAL *row, short con_type, REAL rhs);
/* add a Lagrangian constraint of form Row' x contype Rhs */
void str_add_lag_con(lprec *lp, char *row, short con_type, REAL rhs);
/* The same, but with string input */
void add_column(lprec *lp, REAL *column);
/* Add a Column to the problem */
void str_add_column(lprec *lp, char *col_string);
/* The same, but with string input */
void del_column(lprec *lp, int column);
/* Delete a column */
void set_upbo(lprec *lp, int column, REAL value);
/* Set the upperbound of a variable */
void set_lowbo(lprec *lp, int column, REAL value);
/* Set the lowerbound of a variable */
void set_int(lprec *lp, int column, short must_be_int);
/* Set the type of variable, if must_be_int = TRUE then the variable must be integer */
void set_rh(lprec *lp, int row, REAL value);
/* Set the right hand side of a constraint row */
void set_rh_vec(lprec *lp, REAL *rh);
/* Set the right hand side vector */
void str_set_rh_vec(lprec *lp, char *rh_string);
/* The same, but with string input */
void set_maxim(lprec *lp);
/* maximise the objective function */
void set_minim(lprec *lp);
/* minimise the objective function */
void set_constr_type(lprec *lp, int row, short con_type);
/* Set the type of constraint in row Row (LE, GE, EQ) */
void set_row_name(lprec *lp, int row, nstring new_name);
/* Set the name of a constraint row, make sure that the name has < 25 characters */
void set_col_name(lprec *lp, int column, nstring new_name);
/* Set the name of a varaible column, make sure that the name has < 25 characters */
void auto_scale(lprec *lp);
/* Automatic scaling of the problem */
void unscale(lprec *lp);
/* Remove all scaling from the problem */
int solve(lprec *lp);
/* Solve the problem */
short Isvalid(lprec *lp);
int milpsolve (sstate *st, REAL *upbo, REAL *lowbo, short *sbasis, short *slower, int *sbas);
int lag_solve(lprec *lp, REAL start_bound, int num_iter, short verbose);
/* Do NumIter iterations with Lagrangian relaxation constraints */
void reset_basis(lprec *lp);
/* Reset the basis of a problem, can be usefull in case of degeneracy - JD */
REAL mat_elm(lprec *lp, int row, int column);
/* get a single element from the matrix */
void get_row(lprec *lp, int row_nr, REAL *row);
/* fill row with the row row_nr from the problem */
void get_column(lprec *lp, int col_nr, REAL *column);
/* fill column with the column col_nr from the problem */
void get_reduced_costs(lprec *lp, REAL *rc);
/* get the reduced costs vector */
short is_feasible(lprec *lp, REAL *values);
/* returns TRUE if the vector in values is a feasible solution to the lp */
short column_in_lp(lprec *lp, REAL *column);
/* returns TRUE if column is already present in lp. (Does not look at bounds
and types, only looks at matrix values */
lprec *read_mps(FILE *input, short verbose);
/* read a MPS file */
void write_MPS(lprec *lp, FILE *output);
/* write a MPS file to output */
void write_LP(lprec *lp, FILE *output);
/* write a LP file to output */
void print_lp(lprec *lp);
/* Print the current problem, only usefull in very small (test) problems.
Shows the effect of scaling */
void print_solution(lprec *lp);
/* Print the solution to stdout */
void print_duals(lprec *lp);
/* Print the dual variables of the solution */
void print_scales(lprec *lp);
/* If scaling is used, print the scaling factors */
/* functions used internaly by the lp toolkit */
void error(char *format, ...);
void inc_mat_space(lprec *lp, int max_extra);
void inc_row_space(lprec *lp);
void inc_col_space(lprec *lp);
static REAL minmax_to_scale(REAL min, REAL max);
void unscale_columns(lprec *lp);
void set_globals(lprec *lp);
void ftran(int start, int end, REAL *pcol);
void btran(REAL *row);
void invert(void);
/*************************************************************************/
/* */
/* E R R O R H A N D L I N G F O R L I B R A R Y */
/* */
/* */
/* */
/* */
/* */
/*************************************************************************/
#define ERROR(x) longjmp(LP_jmpbuf,256|x)
#define ERR_NOMEM 0x10 /* Any out-of-memory problem */
#define ERR_ST 0x11 /* ran out allocating State-infos */
#define ERR_NUM 0x20 /* Any numeric stability problem */
#define ERR_BUG 0x40 /* Any lp_solve-bug exit */
#define ERR_BUG_CONDCOL 0x41 /* Condensecol out-of-bounds */
#include <setjmp.h>
extern jmp_buf LP_jmpbuf;
extern int SolveCount;

2
inc/lppatch.h Executable file
View File

@@ -0,0 +1,2 @@
/* $Id: lppatch.h,v 1.2 1999/01/03 02:06:15 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
#define PATCHLEVEL "1.5"

36
inc/lpproto.h Executable file
View File

@@ -0,0 +1,36 @@
/* $Id: lpproto.h,v 1.2 1999/01/03 02:06:15 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* dual.c */
void rowdual(int *rownr);
short coldual(int rownr, int *colnr, short minit, REAL *prow, REAL *drow);
/* lp.c */
int yyparse(void);
/* read.c */
void yyerror(char *string);
void check_decl(char *str);
void add_int_var(char *name);
void init_read(void);
void null_tmp_store(void);
void store_re_op(void);
void rhs_store(REAL value);
void var_store(char *var, int row, REAL value);
int store_bounds(void);
void add_constraint_name(char *name, int row);
void readinput(int *cend, REAL *rh, short *relat, REAL *lowbo, REAL *upbo, matrec *mat, nstring *names);
/* tran.c */
void ftran(int start, int end, REAL *pcol);
void btran(int numc, REAL *row);
/* main.c */
/* solve.c */
int solve(REAL *upbo, REAL *lowbo, short *sbasis, short *slower, int *sbas,
sstate *t);
/* write.c */
void print_solution(FILE *stream, REAL *sol, REAL *duals);
void debug_print_solution(REAL *sol);
void debug_print_bounds(REAL *upbo, REAL *lowbo);
void debug_print(char *format, ...);

192
inc/lspglob.h Executable file
View File

@@ -0,0 +1,192 @@
/* $Id: lspglob.h,v 1.2 1999/01/03 02:06:15 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/**********************************************************************/
/*
File Name : lspglob.h
Global variables for LispSYSOUT
Date : December 16, 1986
Edited by : Takeshi Shimizu
Changed : Jan 13 1987 Take.
Changed : Feb 16 1987 Take.
Changed : Mar 25 1987 Take.
Changed : Apr 24 1987 take
Changed : Jul 02 1987 take
*/
/**********************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
extern DLword *Atomspace; /* ATOMSPACE */
extern DLword *Stackspace; /* STACKSPACE*/
extern DLword *Plistspace; /* PLISTSPACE */
extern DLword *DTDspace; /* DTDSPACE */
extern DLword *MDStypetbl; /* MDSTT */
extern DLword *AtomHT; /* AtomHashTable */
extern DLword *Pnamespace; /* PNSPACE */
extern DLword *AtomSpace; /* New atoms, initial set */
extern DLword *Defspace; /* DEFSPACE */
extern DLword *Valspace; /* VALSPACE */
extern DLword *Spospspace; /* POSITIVE Smallp */
extern DLword *Snegspace; /* NEGATIVE Smallp */
/* For Virtual Mem Management */
#ifdef BIGVM
extern LispPTR *FPtoVP;
#else
extern DLword *FPtoVP ;
#endif /* BIGVM */
extern DLword *PAGEMap;
extern DLword *PageMapTBL ;
extern DLword *LockedPageTable;
/* For Interface to Micro or Device */
extern DLword *IOCBPage ;
extern IOPAGE *IOPage ;
extern IFPAGE *InterfacePage ;
extern MISCSTATS *MiscStats ;
/* UFN Tbl */
extern DLword *UFNTable ;
/* Internal Hash Table for GC */
#ifdef BIGVM
extern LispPTR *HTmain;
extern LispPTR *HToverflow;
extern LispPTR *HTbigcount;
extern LispPTR *HTcoll;
#else
extern DLword *HTmain;
extern DLword *HToverflow;
extern DLword *HTbigcount;
extern DLword *HTcoll;
#endif /* BIGVM */
/* DISPLAY */
extern DLword *DisplayRegion ;
/* FLEX STORAGES */
extern DLword *Arrayspace; /* Start of ARRAYSPACE */
extern DLword *MDS_space_bottom; /* Start of MDS (pre -2) */
extern DLword *PnCharspace ; /* Space for PN char codes (Thin only) */
extern struct dtd *ListpDTD ; /* DTD for LISTP chang. 25-mar-87 take */
extern DLword *Next_Array ; /* Next available ARRAY space */
extern DLword *Next_MDSpage; /* Next available MDS space */
/* Pointers in Cell or any object means DLword offset from Lisp_world.
So, 24 bit Lisp pointers can points 32Mbyte area.
But, ATOMSPACE may be treated as special index space for LITATOM. In another way, it means that the Pointers points ATOMSPACE has no allocated memory, and Thease are used as index for access one of ATOM's prop. */
extern DLword *Lisp_world; /* Lisp Start BASE */
/******* CACHE 68k address for LISP SYSVAL *******/
extern LispPTR *Next_MDSpage_word;
extern LispPTR *Next_Array_word;
extern LispPTR *MDS_free_page_word;
extern LispPTR *Reclaim_cnt_word ;
extern int FileIOFlag, TimerFlag;
/*** cache values for array reclaimer by Tomtom 30-Sep-1987 ***/
extern LispPTR *GcDisabled_word;
extern LispPTR *CdrCoding_word;
extern LispPTR *FreeBlockBuckets_word;
extern LispPTR *Array_Block_Checking_word;
extern LispPTR *ArrayMerging_word;
extern LispPTR *ArraySpace_word;
extern LispPTR *ArraySpace2_word;
extern LispPTR *ArrayFrLst_word;
extern LispPTR *ArrayFrLst2_word;
extern LispPTR *Hunk_word;
extern LispPTR *System_Buffer_List_word;
/*** The end of the addition of cache values for reclaimer by Tomtom ***/
/*** cashe valuses for top level reclaimer Tomtom 15-Oct-1987 ***/
extern LispPTR *GcMess_word;
extern LispPTR *ReclaimMin_word;
extern LispPTR *GcTime1_word;
extern LispPTR *GcTime2_word;
extern LispPTR *MaxTypeNumber_word;
/*** The end of the addition of cashe values for the top level reclaimer ***/
/*** The addition cache for closure-caching ***/
extern LispPTR *Package_from_Index_word;
extern LispPTR *Package_from_Name_word;
extern LispPTR *Keyword_Package_word;
extern LispPTR *Deleted_Implicit_Hash_Slot_word;
extern LispPTR *Closure_Cache_Enabled_word;
extern LispPTR *Closure_Cache_word;
extern LispPTR First_index;
/*** The end of cache value for closure-caching ***/
/* CACHE values for 32Mb MDS/Array by Take */
extern LispPTR *STORAGEFULLSTATE_word;
extern LispPTR *STORAGEFULL_word;
extern LispPTR *PENDINGINTERRUPT_word;
extern LispPTR *LeastMDSPage_word;
extern LispPTR *SecondMDSPage_word;
extern LispPTR *SecondArrayPage_word;
extern LispPTR *INTERRUPTSTATE_word;
extern LispPTR *SYSTEMCACHEVARS_word;
extern LispPTR *MACHINETYPE_word;
extern LispPTR STORAGEFULLSTATE_index;
/******* 7-Oct-87 take********/
extern LispPTR *LASTVMEMFILEPAGE_word;
extern LispPTR *VMEM_FULL_STATE_word;
/* Array for N-tran */
extern int native_load_address;
extern LispPTR native_closure_env;
/* Vars for Stack operations */
extern LispPTR *STACKOVERFLOW_word;
extern LispPTR *GuardStackAddr_word;
extern LispPTR *LastStackAddr_word;
extern LispPTR *NeedHardreturnCleanup_word;
/* I/O Pipe for Unix Interface */
extern int UnixPipeIn;
extern int UnixPipeOut;
extern int UnixPID;
/* Atom index for IL:\MVLIST, for the VALUES opcode */
extern LispPTR MVLIST_index;

718
inc/lsptypes.h Executable file
View File

@@ -0,0 +1,718 @@
/* @(#) lsptypes.h Version 1.4 (12/29/94). copyright Venue */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/**********************************************************************/
/*
File Name : lsptypes.h
Define Constants for Datatype
*/
/**********************************************************************/
/************************************************************************/
/* */
/* T Y P E T A B L E M A S K B I T S */
/* */
/* These are used for quick type checks, and are ORed into the type */
/* number in the DTD. */
/* */
/* [TT_LISPREF renamed to TT_SYMBOLP 2/7/91 by JDS for 3-byte atoms] */
/* */
/************************************************************************/
#define TT_ATOM 0x0800 /* ATOM in CL sense */
#define TT_NUMBERP 0x1000 /* It's a number. */
#define TT_FIXP 0x2000 /* It's an integer. */
#define TT_SYMBOLP 0x4000 /* It's a symbol (LITATOM or NEWATOM. */
#define TT_NOREF 0x8000 /* Don't Refcount these objects. */
/************************************************************************/
/* */
/* T Y P E N U M B E R S */
/* */
/* These are the type numbers "known to the microcode". This must */
/* match the list \BUILT-IN-SYSTEM-TYPES, in LLDATATYPE. It's the */
/* list of types that MUST be known to microcode or emulator, and */
/* which can't rely on the luck of what's loaded when for assignment. */
/* */
/* Change History: 2/27/89 Sybalsky Added BIGNUM-PATHNAME, to */
/* support SXHASH opcode. */
/* 3/1/89 Sybalsky Added type #s for hunked */
/* storage, for use in GC, in */
/* place of absolute #s (!!) */
/* 7/25/90 Osamu Added type# for NEWATOM. */
/************************************************************************/
#define TYPE_ARRAYBLOCK 0 /* Pseudo type # for array blocks */
#define TYPE_SMALLP 1
#define TYPE_FIXP 2
#define TYPE_FLOATP 3
#define TYPE_LITATOM 4
#define TYPE_LISTP 5
#define TYPE_ARRAYP 6
#define TYPE_STRINGP 7 /* old IL strings (obs) */
#define TYPE_STACKP 8
#define TYPE_CHARACTERP 9
#define TYPE_VMEMPAGEP 10
#define TYPE_STREAM 11
#define TYPE_BITMAP 12
#define TYPE_COMPILED_CLOSURE 13
#define TYPE_ONED_ARRAY 14 /* array, string */
#define TYPE_TWOD_ARRAY 15
#define TYPE_GENERAL_ARRAY 16
#define TYPE_BIGNUM 17 /* Bignums */
#define TYPE_RATIO 18 /* Commonlisp rationals */
#define TYPE_COMPLEX 19 /* Commonlisp complex's */
#define TYPE_PATHNAME 20 /* CL path-name structure */
#ifdef BIGATOMS
#define TYPE_NEWATOM 21 /* New Atom */
/* type number 22~30 reserved for future use */
#define TYPE_PTRHUNK1 31 /********************************/
#define TYPE_PTRHUNK2 32 /* */
#define TYPE_PTRHUNK3 33 /* Type numbers for "hunked" */
#define TYPE_PTRHUNK4 34 /* Storage region, used for */
#define TYPE_PTRHUNK5 35 /* small arrays. This range */
#define TYPE_PTRHUNK6 36 /* is for arrays of pointers. */
#define TYPE_PTRHUNK7 37 /* */
#define TYPE_PTRHUNK8 38 /********************************/
#define TYPE_PTRHUNK9 39
#define TYPE_PTRHUNK10 40
#define TYPE_PTRHUNK11 41
#define TYPE_PTRHUNK12 42
#define TYPE_PTRHUNK13 43
#define TYPE_UNBOXEDHUNK1 44 /********************************/
#define TYPE_UNBOXEDHUNK2 45 /* */
#define TYPE_UNBOXEDHUNK3 46 /* This range is for arrays */
#define TYPE_UNBOXEDHUNK4 47 /* of unboxed items -- the */
#define TYPE_UNBOXEDHUNK5 48 /* contents are not GC'd */
#define TYPE_UNBOXEDHUNK6 49 /* */
#define TYPE_UNBOXEDHUNK7 50 /********************************/
#define TYPE_UNBOXEDHUNK8 51
#define TYPE_UNBOXEDHUNK9 52
#define TYPE_UNBOXEDHUNK10 53
#define TYPE_UNBOXEDHUNK11 54
#define TYPE_UNBOXEDHUNK12 55
#define TYPE_UNBOXEDHUNK13 56
#define TYPE_UNBOXEDHUNK14 57
#define TYPE_UNBOXEDHUNK15 58
#define TYPE_UNBOXEDHUNK16 59
#define TYPE_UNBOXEDHUNK17 60
#define TYPE_UNBOXEDHUNK18 61
#define TYPE_UNBOXEDHUNK19 62
#define TYPE_UNBOXEDHUNK20 63
#define TYPE_CODEHUNK1 64 /********************************/
#define TYPE_CODEHUNK2 65 /* */
#define TYPE_CODEHUNK3 66 /* This range is for small */
#define TYPE_CODEHUNK4 67 /* CODE blocks -- the code */
#define TYPE_CODEHUNK5 68 /* for small functions. It */
#define TYPE_CODEHUNK6 69 /* gets reclaimed using the */
#define TYPE_CODEHUNK7 70 /* function reclaimcodeblock. */
#define TYPE_CODEHUNK8 71 /* */
#define TYPE_CODEHUNK9 72 /********************************/
#define TYPE_CODEHUNK10 73
#define INIT_TYPENUM 74
#else
#define TYPE_PTRHUNK1 21 /********************************/
#define TYPE_PTRHUNK2 22 /* */
#define TYPE_PTRHUNK3 23 /* Type numbers for "hunked" */
#define TYPE_PTRHUNK4 24 /* Storage region, used for */
#define TYPE_PTRHUNK5 25 /* small arrays. This range */
#define TYPE_PTRHUNK6 26 /* is for arrays of pointers. */
#define TYPE_PTRHUNK7 27 /* */
#define TYPE_PTRHUNK8 28 /********************************/
#define TYPE_PTRHUNK9 29
#define TYPE_PTRHUNK10 30
#define TYPE_PTRHUNK11 31
#define TYPE_PTRHUNK12 32
#define TYPE_PTRHUNK13 33
#define TYPE_UNBOXEDHUNK1 34 /********************************/
#define TYPE_UNBOXEDHUNK2 35 /* */
#define TYPE_UNBOXEDHUNK3 36 /* This range is for arrays */
#define TYPE_UNBOXEDHUNK4 37 /* of unboxed items -- the */
#define TYPE_UNBOXEDHUNK5 38 /* contents are not GC'd */
#define TYPE_UNBOXEDHUNK6 39 /* */
#define TYPE_UNBOXEDHUNK7 40 /********************************/
#define TYPE_UNBOXEDHUNK8 41
#define TYPE_UNBOXEDHUNK9 42
#define TYPE_UNBOXEDHUNK10 43
#define TYPE_UNBOXEDHUNK11 44
#define TYPE_UNBOXEDHUNK12 45
#define TYPE_UNBOXEDHUNK13 46
#define TYPE_UNBOXEDHUNK14 47
#define TYPE_UNBOXEDHUNK15 48
#define TYPE_UNBOXEDHUNK16 49
#define TYPE_UNBOXEDHUNK17 50
#define TYPE_UNBOXEDHUNK18 51
#define TYPE_UNBOXEDHUNK19 52
#define TYPE_UNBOXEDHUNK20 53
#define TYPE_CODEHUNK1 54 /********************************/
#define TYPE_CODEHUNK2 55 /* */
#define TYPE_CODEHUNK3 56 /* This range is for small */
#define TYPE_CODEHUNK4 57 /* CODE blocks -- the code */
#define TYPE_CODEHUNK5 58 /* for small functions. It */
#define TYPE_CODEHUNK6 59 /* gets reclaimed using the */
#define TYPE_CODEHUNK7 60 /* function reclaimcodeblock. */
#define TYPE_CODEHUNK8 61 /* */
#define TYPE_CODEHUNK9 62 /********************************/
#define TYPE_CODEHUNK10 63
#define INIT_TYPENUM 64
#endif /* BIGATOMS */
#ifndef BYTESWAP
/* Normal byte-order versions of declarations */
#ifdef BIGVM
struct dtd {
unsigned unuse :2 ;
unsigned dtd_obsolate :1 ;
unsigned dtd_finalizable :1 ;
unsigned dtd_name: 28 ; /* type name */
DLword dtd_cnt0 ;
DLword dtd_size ;
LispPTR dtd_free ; /* really a FULLXPOINTER */
unsigned dtd_lockedp : 1 ;
unsigned dtd_hunkp : 1 ;
unsigned dtd_gctype :2 ;
unsigned dtd_descrs: 28;
LispPTR dtd_typespecs;
LispPTR dtd_ptrs ;
int dtd_oldcnt;
int dtd_nextpage ;
DLword dtd_typeentry ;
DLword dtd_supertype ;
};
typedef struct stringp {
unsigned origin : 1 ;
unsigned substringed : 1 ;
unsigned readonly : 1 ;
unsigned nil : 1 ;
unsigned base : 28 ;
unsigned type : 4 ;
unsigned length: 28 ;
LispPTR offset ;
} STRINGP ;
typedef struct oned_array {
unsigned int nil1 : 4 ;
unsigned int base : 28 ;
unsigned int readonlyp :1 ;
unsigned int indirectp : 1; /* as used arrayheader */
unsigned int bitp :1 ;
unsigned int stringp : 1;
unsigned int ajustablep : 1; /* as used arrayheader */
unsigned int displacedp : 1;
unsigned int fillpointerp :1;
unsigned int extendablep : 1;
unsigned int typenumber : 8 ;
DLword offset;
LispPTR fillpointer ;
LispPTR totalsize ; } OneDArray;
typedef struct oned_array NEWSTRINGP;
typedef struct general_array {
unsigned int nil1 : 4 ;
unsigned int base : 28 ;
unsigned int readonlyp :1 ;
unsigned int indirectp : 1; /* as used arrayheader */
unsigned int bitp :1 ;
unsigned int stringp : 1;
unsigned int ajustablep : 1; /* as used arrayheader */
unsigned int displacedp : 1;
unsigned int fillpointerp :1;
unsigned int extendablep : 1;
unsigned int typenumber : 8 ;
unsigned int nil2:16;
LispPTR Dim0;
LispPTR totalsize;
LispPTR Dim1 ;
LispPTR Dim2 ; } LispArray;
typedef struct compiled_closure {
unsigned int nil1 : 4 ;
unsigned int def_ptr : 28; /* function */
unsigned int nil2 : 4 ;
unsigned int env_ptr : 28; /* environment */
} CClosure ;
#else
/* Structure for DTD */
struct dtd {
DLword dtd_namelo ;
DLword dtd_size ;
LispPTR dtd_free ; /* really a FULLXPOINTER */
unsigned unuse :2 ;
unsigned dtd_obsolate :1 ;
unsigned dtd_finalizable :1 ;
unsigned dtd_lockedp : 1 ;
unsigned dtd_hunkp : 1 ;
unsigned dtd_gctype :2 ;
unsigned dtd_descrs : 24;
unsigned dtd_namehi : 8;
unsigned dtd_typespecs : 24 ;
LispPTR dtd_ptrs ;
int dtd_oldcnt;
DLword dtd_cnt0 ;
DLword dtd_nextpage ;
DLword dtd_typeentry ;
DLword dtd_supertype ;
};
typedef struct stringp {
unsigned origin : 1 ;
unsigned substringed : 1 ;
unsigned readonly : 1 ;
unsigned nil : 1 ;
unsigned type : 4 ;
unsigned base : 24 ;
DLword length ;
DLword offset ;
} STRINGP ;
typedef struct oned_array {
unsigned int nil1 : 8 ;
unsigned int base : 24 ;
unsigned int readonlyp :1 ;
unsigned int indirectp : 1; /* as used arrayheader */
unsigned int bitp :1 ;
unsigned int stringp : 1;
unsigned int ajustablep : 1; /* as used arrayheader */
unsigned int displacedp : 1;
unsigned int fillpointerp :1;
unsigned int extendablep : 1;
unsigned int typenumber : 8 ;
DLword offset;
DLword fillpointer ;
DLword totalsize ; } OneDArray;
typedef struct oned_array NEWSTRINGP;
typedef struct general_array {
unsigned int nil1 : 8 ;
unsigned int base : 24 ;
unsigned int readonlyp :1 ;
unsigned int indirectp : 1; /* as used arrayheader */
unsigned int bitp :1 ;
unsigned int stringp : 1;
unsigned int ajustablep : 1; /* as used arrayheader */
unsigned int displacedp : 1;
unsigned int fillpointerp :1;
unsigned int extendablep : 1;
unsigned int typenumber : 8 ;
DLword Dim0;
DLword totalsize;
DLword Dim1 ;
DLword Dim2 ; } LispArray;
typedef struct compiled_closure {
unsigned int nil1 : 8 ;
unsigned int def_ptr : 24; /* function */
unsigned int nil2 : 8 ;
unsigned int env_ptr : 24; /* environment */
} CClosure ;
#endif /* BIGVM */
/* Structure for initialdtdcontents */
struct system_dtd_contents {
char *dtd_name ; /* type name string >> changed 4-feb-87 */
DLword name_len ; /* type name length in BYTE 27-Mar-87 take */
DLword dtd_size ;
};
typedef struct{
LispPTR bmbase;
DLword bmrasterwidth;
DLword bmheight;
DLword bmwidth;
DLword bmbitperpixel;
}BITMAP;
/****************************************************************/
/* Byte- and Word-array access macros */
/* */
/* Use these macros instead of dereferencing a char pointer */
/* so we can encapsulate byte-ordering effects on different */
/* hardware! */
/* */
/****************************************************************/
#define GETBYTE(base) (* (base))
/* GETBASEWORD only works if base points to a 32-bit bounday */
#define GETBASEWORD(base, offset) (* ((base)+(offset)))
/* GETWORDBASEWORD works right with base on a 16-bit boundary. */
#define GETWORDBASEWORD(base, offset) (* (((DLword *)(base))+(offset)))
#define GETWORD(base) (* (base))
#define WORDPTR(base) (base)
#define BYTEPTR(base) (base)
#else
/********************************************************/
/* */
/* Byte-swapped structure definitions, for 80386 &c */
/* */
/********************************************************/
#ifdef BIGVM
struct dtd {
unsigned dtd_name: 28 ; /* type name */
unsigned dtd_finalizable :1 ;
unsigned dtd_obsolate :1 ;
unsigned unuse :2 ;
DLword dtd_size ;
DLword dtd_cnt0 ;
LispPTR dtd_free ; /* really a FULLXPOINTER */
unsigned dtd_descrs: 28;
unsigned dtd_gctype :2 ;
unsigned dtd_hunkp : 1 ;
unsigned dtd_lockedp : 1 ;
LispPTR dtd_typespecs;
LispPTR dtd_ptrs ;
int dtd_oldcnt;
int dtd_nextpage ;
DLword dtd_supertype ;
DLword dtd_typeentry ;
};
typedef struct stringp {
unsigned base : 28 ;
unsigned nil : 1 ;
unsigned readonly : 1 ;
unsigned substringed : 1 ;
unsigned origin : 1 ;
unsigned length: 28 ;
unsigned type : 4 ;
LispPTR offset ;
} STRINGP ;
typedef struct oned_array {
unsigned int base : 28 ;
unsigned int nil1 : 4 ;
DLword offset;
unsigned int typenumber : 8 ;
unsigned int extendablep : 1;
unsigned int fillpointerp :1;
unsigned int displacedp : 1;
unsigned int ajustablep : 1; /* as used arrayheader */
unsigned int stringp : 1;
unsigned int bitp :1 ;
unsigned int indirectp : 1; /* as used arrayheader */
unsigned int readonlyp :1 ;
LispPTR fillpointer ;
LispPTR totalsize ; } OneDArray;
typedef struct oned_array NEWSTRINGP;
typedef struct general_array {
unsigned int base : 28 ;
unsigned int nil1 : 4 ;
unsigned int nil2:16;
unsigned int typenumber : 8 ;
unsigned int extendablep : 1;
unsigned int fillpointerp :1;
unsigned int displacedp : 1;
unsigned int ajustablep : 1; /* as used arrayheader */
unsigned int stringp : 1;
unsigned int bitp :1 ;
unsigned int indirectp : 1; /* as used arrayheader */
unsigned int readonlyp :1 ;
LispPTR Dim0;
LispPTR totalsize;
LispPTR Dim1 ;
LispPTR Dim2 ; } LispArray;
typedef struct compiled_closure {
unsigned int def_ptr : 28; /* function */
unsigned int nil1 : 4 ;
unsigned int env_ptr : 28; /* environment */
unsigned int nil2 : 4 ;
} CClosure ;
#else
/* Structure for DTD */
struct dtd {
DLword dtd_size ;
DLword dtd_namelo ;
LispPTR dtd_free ; /* really a FULLXPOINTER */
unsigned dtd_descrs : 24;
unsigned dtd_gctype :2 ;
unsigned dtd_hunkp : 1 ;
unsigned dtd_lockedp : 1 ;
unsigned dtd_finalizable :1 ;
unsigned dtd_obsolate :1 ;
unsigned unuse :2 ;
unsigned dtd_typespecs : 24 ;
unsigned dtd_namehi : 8;
LispPTR dtd_ptrs ;
int dtd_oldcnt;
DLword dtd_nextpage ;
DLword dtd_cnt0 ;
DLword dtd_supertype ;
DLword dtd_typeentry ;
};
typedef struct stringp
{
unsigned base : 24 ;
unsigned type : 4 ;
unsigned nil : 1 ;
unsigned readonly : 1 ;
unsigned substringed : 1 ;
unsigned origin : 1 ;
DLword offset ;
DLword length ;
} STRINGP ;
typedef struct oned_array
{
unsigned int base : 24 ;
unsigned int nil1 : 8 ;
DLword offset;
unsigned int typenumber : 8 ;
unsigned int extendablep : 1;
unsigned int fillpointerp :1;
unsigned int displacedp : 1;
unsigned int ajustablep : 1; /* as used arrayheader */
unsigned int stringp : 1;
unsigned int bitp :1 ;
unsigned int indirectp : 1; /* as used arrayheader */
unsigned int readonlyp :1 ;
DLword totalsize ;
DLword fillpointer ;
} OneDArray;
typedef struct oned_array NEWSTRINGP;
typedef struct general_array
{
unsigned int base : 24 ;
unsigned int nil1 : 8 ;
DLword Dim0;
unsigned int typenumber : 8 ;
unsigned int extendablep : 1;
unsigned int fillpointerp :1;
unsigned int displacedp : 1;
unsigned int ajustablep : 1; /* as used arrayheader */
unsigned int stringp : 1;
unsigned int bitp :1 ;
unsigned int indirectp : 1; /* as used arrayheader */
unsigned int readonlyp :1 ;
DLword Dim2 ;
DLword Dim1 ;
} LispArray;
typedef struct compiled_closure
{
unsigned int def_ptr : 24; /* function */
unsigned int nil1 : 8 ;
unsigned int env_ptr: 24; /* environment */
unsigned int nil2 : 8 ;
} CClosure ;
#endif /* BIGVM */
/* Structure for initialdtdcontents */
struct system_dtd_contents
{
char *dtd_name ; /* type name string >> changed 4-feb-87 */
DLword dtd_size ;
DLword name_len ; /* type name length in BYTE 27-Mar-87 take */
};
typedef struct
{
LispPTR bmbase;
DLword bmheight;
DLword bmrasterwidth;
DLword bmbitperpixel;
DLword bmwidth;
}BITMAP;
/****************************************************************/
/* Byte- and Word-array access macros */
/* */
/* Use these macros instead of dereferencing a char pointer */
/* so we can encapsulate byte-ordering effects on different */
/* hardware! */
/* */
/****************************************************************/
#define GETBYTE(base) (* (char *) (3^(UNSIGNED)(base)))
/* GETBASEWORD only works if base points to a 32-bit bounday */
#define GETBASEWORD(base, offset) GETWORDBASEWORD((base),(offset))
#define GETWORDBASEWORD(base, offset) (* (DLword *) (2^(UNSIGNED)((base)+(offset))))
#define GETWORD(base) (* (DLword *) (2^(UNSIGNED)(base)))
#define WORDPTR(base) ((DLword *)(2^(UNSIGNED)(base)))
#define BYTEPTR(base) ((char *) (3^(UNSIGNED)(base)))
#endif /* BYTESWAP */
#define ST_POS16 1
#define ST_BYTE 0
#define THIN_CHAR_TYPENUMBER 67
#define FAT_CHAR_TYPENUMBER 68
/************************************************************************/
/* */
/* T Y P E E N T R Y A C C E S S O R S */
/* */
/* GetDTD Gets the (C-native) address for the DTD */
/* (Data Type Descriptor) for the type whose */
/* number you hand it (LESS the mask bits!). */
/* */
/* GetTypeEntry Gets the entire 16-bit "type number" field */
/* from the DTD, including type-mask bits. */
/* Use this one when you want the mask bits for */
/* a quick category check. */
/* */
/* GetTypeNumber Gets only the Type Number (without mask bits) */
/* from the DTD for the object you give it. */
/* Use this one for doing type checks and */
/* dispatching. */
/* */
/* Listp If 'address' is the address of a cons cell, */
/* returns TRUE. Equivalent to the LISTP pred. */
/* */
/************************************************************************/
#ifndef I386
/* Get DTD pointer(68k) from typenum */
#ifdef BIGVM
#define GetDTD(typnum) (DTDspace + ((typnum)<<4)+((typnum)<<1))
#else
#define GetDTD(typnum) (DTDspace + ((typnum)<<4))
#endif /* BIGVM */
/* Get all type entry */
#define GetTypeEntry(address) ( GETWORD(MDStypetbl+((address)>>9)) )
#else
/* Because the 386i's code generator does bettter with them */
/* in this order (does an add, rather than mov-add) */
/* JDS 22-mar-90 */
/* Get DTD pointer(68k) from typenum */
#define GetDTD(typnum) (((typnum)<<4) + DTDspace)
/* Get all type entry */
#define GetTypeEntry(address) ( GETWORD(((address)>>9) + MDStypetbl) )
#endif /* I386 */
/* the type number is in the low 11 bits */
#define GetTypeNumber(address) (GetTypeEntry(address) & 0x7ff)
/* This MACRO is similar to LISTP */
#define Listp(address) (GetTypeNumber(address) == TYPE_LISTP)
/******************************************/
/* Lisp's PATHNAME datatype */
/* */
/* This MUST change whenever the Lisp */
/* definition of the PATHNAME structure */
/* changes. */
/* */
/******************************************/
typedef
struct
{
LispPTR host;
LispPTR device;
LispPTR directory;
LispPTR name;
LispPTR type;
LispPTR version;
} PATHNAME;
/******************************************/
/* Lisp's COMPLEX datatype */
/* */
/* This MUST change whenever the Lisp */
/* definition of the COMPLEX structure */
/* changes. */
/* */
/******************************************/
typedef
struct
{
LispPTR real;
LispPTR imaginary;
} COMPLEX;
/******************************************/
/* Lisp's RATIO datatype */
/* */
/* This MUST change whenever the Lisp */
/* definition of the RATIO structure */
/* changes. */
/* */
/******************************************/
typedef
struct
{
LispPTR numerator;
LispPTR denominator;
} RATIO;
/******************************************/
/* Lisp's BIGNUM datatype */
/* */
/* This MUST change whenever the Lisp */
/* definition of the BIGNUM structure */
/* changes. */
/* */
/******************************************/
typedef
struct
{
LispPTR contents; /* a list of 12-bit segments of value, */
/* low-order 12 bits first. */
} BIGNUM;

126
inc/medleyfp.h Executable file
View File

@@ -0,0 +1,126 @@
/* $Id: medleyfp.h,v 1.2 1999/01/03 02:06:16 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-94 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* */
/* */
/* */
/* */
/************************************************************************/
#ifdef DOS
#include <i32.h>
#endif /* DOS */
#ifdef ULTRIX
#include <ieeefp.h>
#endif /* ULTRIX */
#ifdef RISCOS
/*#include <ieeefp.h> */
/*#define isnan isnand */
#define isnan(x) 0
#endif /* RISCOS */
/* --------------------------------------------------
FPCLEAR - clear status as necessary
FPTEST(result) - check result or status
Sun 4 compiler w. -O2 moves too much code around
to use FLTINT.
-------------------------------------------------- */
#ifdef FLTINT
volatile extern int FP_error;
/* Note that a compiler may very likely move code around the arithmetic
operation, causing this test (set by an interrupt handler) to be
incorrect. For example, the Sun SPARC compiler with -O2 makes
this test incorrect.
*/
#define FPCLEAR FP_error = 0;
#define FPTEST(result) FP_error
#else
/* fpstatus_ is a FORTRAN library routine (in libc) which
can be called to determine floating point status results.
Documented in the Sun manual, "Floating Point Programmer's Guide",
(Rev. A 19-Sep-86), pg. 34, it does *not* exist in libc for the
SPARC.
For sparc, should also check for isnan? Don't know what isnormal
& issubnormal do (these are sunos4.0 only)
*/
#ifdef OS5
#define FPCLEAR
#define FPTEST(result) (!finite(result))
#elif (defined(sparc) || defined(I386) || defined(HPUX))
#define FPCLEAR
#define FPTEST(result) (isinf(result) || isnan(result))
#elif APOLLO
/**********************************************************/
/* Need values.h & nan.h, so we all parts of IsNANorINF */
/* are defined. IsNANorINF uses structure aliasing to */
/* get at pieces of the float to test it, so the item */
/* being tested can't be a register variable. Sigh. */
/**********************************************************/
#include </sys5/usr/include/values.h>
#include </sys5/usr/include/nan.h>
#define FPCLEAR
#define FPTEST(result) (IsNANorINF(result))
#undef REGISTER
#define REGISTER
#elif OSF1
#include <fp.h>
#define FPCLEAR
#define FPTEST(result) (!FINITE(result))
#elif INDIGO
#include <nan.h>
#define FPCLEAR
#define FPTEST(result) (IsNANorINF(result))
#else
#ifdef AIX
#define FPCLEAR
#define FPTEST(result) ((!finite(result)) || isnan(result))
#elif DOS
#define FPCLEAR
#define FPTEST(result) (_getrealerror() & ( I87_ZERO_DIVIDE | I87_OVERFLOW | I87_UNDERFLOW))
#else
static int constant0 = 0;
unsigned int fpstatus_();
#define FPCLEAR fpstatus_(&constant0);
#define FPTEST(result) (fpstatus_(&constant0) & 0xF0)
#endif /* AIX */
#endif /* sparc | I386 */
#endif /* FLTINT */

53
inc/miscstat.h Executable file
View File

@@ -0,0 +1,53 @@
/* $Id: miscstat.h,v 1.2 1999/01/03 02:06:17 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
* Copyright (C) 1987 by Fuji Xerox Co., Ltd. All rights reserved.
*
* by : Yasuhiko Kiuchi
*/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
typedef struct misc
{
int starttime;
int totaltime;
int swapwaittime;
int pagefaults;
int swapwrites;
int diskiotime;
int diskops;
int keyboardwaittime;
int gctime;
int netiotime;
int netioops;
int swaptemp0;
int swaptemp1;
unsigned int rclksecond;
unsigned int secondsclock;
unsigned int millisecondsclock;
unsigned int baseclock;
unsigned int rclktemp0;
unsigned int secondstmp;
unsigned int millisecondstmp;
unsigned int basetmp;
int excesstimetmp;
int clocktemp0;
int disktemp0;
int disktemp1;
int teleraidtemp1;
int teleraidtemp2;
int teleraidtemp3;
int lastuseraction;
int dlmousetimer;
int dlmousetemp;
} MISCSTATS;

529
inc/mnxdefs.h Executable file
View File

@@ -0,0 +1,529 @@
/* $Id: mnxdefs.h,v 1.2 1999/01/03 02:06:17 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifdef XTK
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Box.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Label.h>
#include <X11/Xmu/Converters.h>
#include <X11/Xaw/Scrollbar.h>
#endif /* XTK */
typedef void (*PFV)(); /* Pointer to Function returning Void */
typedef int (*PFI)(); /* Pointer to Function returning Int */
typedef char (*PFC)(); /* Pointer to Function returning Char */
typedef float (*PFF)(); /* Pointer to Function returning Float */
typedef int (*PFP)(); /* Pointer to Function returning a Pointer */
typedef unsigned long (*PFUL)(); /* Pointer to Function returning an unsigned long */
typedef struct {
int x;
int y;
int width;
int height;
} MRegion;
typedef struct {
int x;
int y;
} MPoint,
MPosition;
typedef struct {
unsigned left:1;
unsigned middle:1;
unsigned right:1;
unsigned nil:28;
} MButton;
typedef union
{
struct {
PFI InitW; /* Initialize a window */
PFI Openw;
PFI Closew;
PFI MoveW;
PFI ShapeW;
PFI TotopW;
PFI BuryW;
PFI ShrinkW;
PFI ExpandW;
PFI DestroyW; /* Finalize a window */
PFI GCIndicator;
PFI Query;
PFI DestroyMe; /* Finalize self */
PFI MakePromptW;
PFI BBTtoWin; /* Bitblt cases lisp -> native window, */
PFI BBTfromWin; /* native window -> lisp bitmap */
PFI BBTWinWin; /* native window -> native window */
PFI GetWindowProp;
PFI PutWindowProp;
PFI GrabPointer;
PFI UngrabPointer;
PFI DrawBox;
PFI MovePointer;
PFI MouseConfirm;
PFI SetCursor;
} Method;
PFI vector[ 25 ];
} DisplayDispatchTableRec, *DisplayDispatchTable;
typedef union
{
struct {
PFI CloseFn;
PFI XPosition;
PFI YPosItion;
PFI Font;
PFI FontCreate;
PFI StringWidth;
PFI CharWidth;
PFI CharWidthY;
PFI LeftMargin;
PFI RightMargin;
PFI TopMargin;
PFI BottomMargin;
PFI ClippingRegion;
PFI PushState;
PFI PopState;
PFI DefaultState;
PFI Scale;
PFI Scale2;
PFI Translate;
PFI Rotate;
PFI Color;
PFI BackColor;
PFI Operation;
PFI MoveTo;
PFI Reset;
PFI NewPage;
PFI LineFeed;
PFI TerPri;
PFI ScaleFactor;
PFI OutcharFn;
PFI CharSet;
PFI DrawPoint;
PFI DrawLine;
PFI DrawCurve;
PFI DrawCircle;
PFI DrawElips;
PFI DrawPolygon;
PFI FillPolygon;
PFI FillCircle;
PFI DrawArc;
PFI BltShade;
PFI BitBlt;
PFI ScaledBitBlt;
PFI WritePixel;
PFI BitmapSize;
PFI Offsets;
} Method;
PFI vector[ 44 ];
} ImageOpDispatchTableRec, *ImageOpDispatchTable;
typedef struct wifrec
{
int error; /* Place to save error number for diagnosis */
MRegion windowreg; /* The position Lisp thinks the window is in, LISP coordinates! */
MRegion topregion; /* The toplevel widget's size. */
MRegion outerregion; /* The window's outer size. */
MRegion innerregion; /* The window's inner size. */
MRegion extent; /* The extent of the whole window. */
int whiteborder; /* The white border of the window. */
int blackborder2;
Window blackframe; /* The black part of the windowframe */
Window handle; /* The actual X window for displaying things */
Pixmap backing; /* Pixmap to store window image / temp results */
GC ReplaceGC; /* GC for operations in REPLACE mode */
GC InvertGC; /* GC for operations in INVERT mode */
GC PaintGC1; /* Gc #1 for operations in PAINT mode */
GC PaintGC2; /* GC #2 for operations in PAINT mode */
GC EraseGC1; /* GC #1 for operations in ERASE mode */
GC EraseGC2; /* GC #2 for operations in ERASE mode */
GC gc; /* GC for random use */
/* Window Methods */
ImageOpDispatchTable Dispatch;
LispPTR MedleyWindow; /* The Lisp WINDOW this corresponds to */
LispPTR MedleyScreen; /* The Lisp SCREEN this corresponds to */
Screen *screen; /* The X screen this uses */
int depth; /* Depth of the window */
int op; /* current OP of window (0 = replace, etc) */
int xoffset; /* X offset, from the stream */
int yoffset; /* Y offset, from the stream */
LispPTR FGcolor; /* Foreground color (fixp or bitmap for fill ops) */
LispPTR BGcolor; /* Background color (fixp or bitmap for fill ops) */
Pixmap fgpixmap; /* These two slots are caches to make sure that */
Pixmap bgpixmap; /* the pixmaps in them a) stay around till they */
/* are needed, and (b) get garbage collected */
unsigned not_exposed:1; /* T if next Expose should decache SAVE bitmap */
unsigned moving:1; /* T if lisp MOVEW called, so ignore X event */
unsigned reshaping:1; /* T if lisp SHAPEW called, so ignore X event */
unsigned scrollfn:1; /* T if we have a scrollfn */
unsigned noscrollbars:1; /* T if windowprop NOSCROLLBARS is set. */
unsigned open:1; /* T if this window is open; NIL if not */
unsigned move_pend:1; /* T if we moved this window while closed */
unsigned shape_pend:1; /* T if we reshaped this window while closed */
unsigned nil:24; /* space for future flags */
struct wifrec *next; /* Thread all windows on this screen */
Window parent; /* The parent window of this window */
struct dspifrec *dspif; /* the dspif for this window */
#ifdef XTK
Widget topwidget; /* The hold on the widget of this window */
Widget formwidget;
Widget framewidget; /* The widget to represent the frame */
Widget windowwidget; /* The white region of the window */
char gstring[32]; /* A string to hold geometry strings in. */
#endif /*XTK */
} WindowInterfaceRec, *WindowInterface;
/******************************************************/
/* */
/* D S P I N T E R F A C E R E C */
/* */
/* Display-interface record: The interface from */
/* Medley to the X display for a given Medley- */
/* Native-Windows screen. */
/* */
/******************************************************/
typedef struct dspifrec
{
int error; /* A generic errornumber */
Display *handle; /* The X Display this dspif describes */
Mask DisableEventMask;
Mask EnableEventMask;
XImage image; /* The scratch image structure (used in blt'ing) */
XImage tmpimage; /* The tmp image (used for depth conversion) */
GC TitleGC; /* The gc for title blitting. */
DisplayDispatchTableRec Dispatch; /* The methods for the display */
ImageOpDispatchTableRec ImageOp;
LispPTR screen; /* The lisp SCREEN this display corresponds to */
Screen *xscreen; /* The X screen we're on on this display */
Window root; /* The root window for this screen */
Cursor cursor; /* The cursor in effect on this screen */
int black; /* black pixel for this screen */
int white; /* white pixel for this screen */
int width; /* Width of the screen, in pixels */
int height; /* Height of the screen, in pixels */
int depth; /* SCDEPTH for this screen -- Medley's view */
WindowInterface CreatedWifs; /* A list of all windows on this screen */
WindowInterface promptw; /* The PROMPTWINDOW for this screen */
#ifdef XTK
XtAppContext xtcontext; /* The application context for this display */
#endif /*XTK */
int bw_plane; /* plane-mask for the plane that distinguishes B & W */
int bw_inverted; /* T if B & W are backwards from Lisp */
GC PixRGC; /* GC for blt'ing FROM window in REPLACE mode */
GC PixPGC; /* GC for blt'ing FROM window in PAINT mode */
GC PixIGC; /* GC for blt'ing FROM window in INVERT mode */
GC PixEGC; /* GC for blt'ing FROM window in ERASE mode */
GC BoxingGC; /* GC for drawing boxes on full screen */
Widget gcindicator;
Widget legatewidget;
} DspInterfaceRec, *DspInterface;
#ifdef NEVER
/******************************************/
/* The Legate window structure is a */
/* WindowInterfaceRec with some stuff on */
/* the tail end of the record. This is */
/* to be viewed as the subclassing of the */
/* ordinary WindowInterfaceRec. */
/******************************************/
typedef struct
{
WindowInterfaceRec promptw; /* The prompt window. */
Widget barwidget; /* A place to hold the bar widgets. */
Widget gcindicator; /* The garbage collector status window */
Widget menuwindow; /* The background popup menu window */
} LegateWindowInterfaceRec, *LegateWindowInterface;
#endif /* NEVER */
typedef struct{
LispPTR SCONOFF;
LispPTR SCDESTINATION;
LispPTR SCWIDTH;
LispPTR SCHEIGHT;
LispPTR SCTOPW;
LispPTR SCTOPWDS;
LispPTR SCTITLEDS;
LispPTR SCFDEV;
LispPTR SCDS;
LispPTR SCDATA;
DspInterface NativeIf;
#ifdef THIRTYTWOBITS
int junk;
#endif /* BITS */
LispPTR NATIVE_INFO;
LispPTR NATIVETYPE;
LispPTR WINIMAGEOPS;
LispPTR WINFDEV;
LispPTR CREATEWFN;
LispPTR OPENWFN;
LispPTR CLOSEWFN;
LispPTR MOVEWFN;
LispPTR RELMOVEWFN;
LispPTR SHRINKWFN;
LispPTR EXPANDWFN;
LispPTR SHAPEWFN;
LispPTR REDISPLAYFN;
LispPTR GETWINDOWPROPFN;
LispPTR SETWINDOWPROPFN;
LispPTR BURYWFN;
LispPTR TOTOPWFN;
LispPTR IMPORTWFN;
LispPTR EXPORTWFN;
LispPTR DESTROYFN;
LispPTR SETCURSORFN;
LispPTR PROMPTW;
LispPTR SHOWGCFN;
LispPTR DSPCREATEFN;
LispPTR BBTTOWIN;
LispPTR BBTFROMWIN;
LispPTR BBTWINWIN;
LispPTR SCCURSOR;
LispPTR SCKEYBOARD;
LispPTR SCDEPTH;
} MedleyScreenRec, *MedleyScreen;
typedef struct{
LispPTR DSP;
LispPTR NEXTW;
LispPTR SAVE;
LispPTR REG;
LispPTR BUTTONEVENTFN;
LispPTR RIGHTBUTTONFN;
LispPTR CURSORINFN;
LispPTR CURSOROUTFN;
LispPTR CURSORMOVEFN;
LispPTR REPAINTFN;
LispPTR RESHAPEFN;
LispPTR EXTENT;
LispPTR USERDATA;
LispPTR VERTSCROLLREG;
LispPTR HORIZSCROLLREG;
LispPTR SCROLLFN;
LispPTR VERTSCROLLWINDOW;
LispPTR HORIZSCROLLWINDOW;
LispPTR CLOSEFN;
LispPTR MOVEFN;
LispPTR WTITLE;
LispPTR NEWREGION;
LispPTR WBORDER; /* Assumed to allways be a SMALLP */
LispPTR PROCESS;
LispPTR WINDOWENTRYFN;
LispPTR SCREEN;
WindowInterface NativeIf;
#ifdef THIRTYTWOBITS
int junk1;
#endif /* THIRTYTWOBITS */
LispPTR MISCNATIVE;
#ifdef THIRTYTWOBITS
int junk2;
#endif /* THIRTYTWOBITS */
LispPTR NATIVE_P1;
} MedleyWindowRec, *MedleyWindow;
typedef LispPTR *LispArgs;
typedef struct WinList
{
struct WinList *prior;
struct WinList *next;
WindowInterfaceRec *thiswin;
} winlist;
/* Structure that defines an entry in the ring buffer of MNW events */
/* This uses the same ring-buffer scheme as keyboard codes do */
typedef struct {
LispPTR screen; /* lisp SCREEN this event happened for */
LispPTR window; /* lisp WINDOW this event happened for */
int event; /* What kind of event this is (see defs below for code) */
int pad[4]; /* Ad hoc fields to be able to access slots by */
/* position in the struct rather than name. */
} MNWAnyEvent,
MNWCloseEvent,
MNWFocusEvent,
MNWFocusInEvent,
MNWFocusOutEvent,
MNWToTopEvent;
typedef struct {
LispPTR screen; /* lisp SCREEN this event happened for */
LispPTR window; /* lisp WINDOW this event happened for */
int event; /* What kind of event this is (see defs below for code) */
MPosition pos;
} MNWMoveEvent,
MNWPointerMotionEvent;
typedef struct {
LispPTR screen; /* lisp SCREEN this event happened for */
LispPTR window; /* lisp WINDOW this event happened for */
int event; /* What kind of event this is (see defs below for code) */
MRegion reg;
} MNWReshapeEvent,
MNWShapeReqEvent;
typedef struct {
LispPTR screen; /* lisp SCREEN this event happened for */
LispPTR window; /* lisp WINDOW this event happened for */
int event; /* What kind of event this is (see defs below for code) */
MPosition pos;
MButton button;
} MNWButtonEvent,
MNWButtonDownEvent,
MNWButtonUpEvent;
typedef struct {
LispPTR screen; /* lisp SCREEN this event happened for */
LispPTR window; /* lisp WINDOW this event happened for */
int event; /* What kind of event this is (see defs below for code) */
MPosition pos;
MButton button;
} MNWMouseEvent,
MNWMouseInEvent,
MNWMouseOutEvent;
typedef struct {
LispPTR screen; /* lisp SCREEN this event happened for */
LispPTR window; /* lisp WINDOW this event happened for */
int event; /* What kind of event this is (see defs below for code) */
int dx;
int dy;
} MNWScrollReqEvent;
typedef struct {
LispPTR screen; /* lisp SCREEN this event happened for */
LispPTR window; /* lisp WINDOW this event happened for */
int event; /* What kind of event this is (see defs below for code) */
float xpercent;
float ypercent;
} MNWJumpScrollReqEvent;
typedef union mnwevenT
{
MNWAnyEvent Any;
MNWCloseEvent Close;
MNWFocusEvent Focus;
MNWFocusInEvent FocusBegin;
MNWFocusOutEvent FocusEnd;
MNWToTopEvent Top;
MNWMoveEvent Move;
MNWReshapeEvent Reshape;
MNWShapeReqEvent ShapeReq;
MNWButtonEvent Button;
MNWButtonDownEvent ButtonDown;
MNWButtonUpEvent ButtonUp;
MNWMouseEvent Mouse;
MNWMouseInEvent MouseIn;
MNWMouseOutEvent MouseOut;
MNWScrollReqEvent ScrollReq;
MNWJumpScrollReqEvent JumpScrollReq;
} MNWEvent;
#define MNWClose 1
#define MNWMove 2
#define MNWReshape 3 /* This window was reshaped */
#define MNWFocusIn 4 /* Focus moved into this window */
#define MNWFocusOut 5 /* Focus moved out of this window */
#define MNWButton 6
#define MNWButtonUp 7
#define MNWMouseIn 8
#define MNWMouseOut 9 /* Mouse moved out of this window */
#define MNWToTop 10 /* This window brought to top */
#define MNWShapeReq 11 /* Window mgr asked to reshape this window */
#define MNWScrollReq 12 /* Window widget asked for incremental scroll. */
#define MNWScrollJmpReq 13 /* Window widget asked for jmp scroll. */
#define MNWPointerMotion 14
#define MINMNWEVENT 2 /* allow 2 words for the ring buffer */
#define MNWEVENTSIZE ((sizeof(MNWEvent)+1)>>1)
#define MAXMNWEVENT (MINMNWEVENT + (100* MNWEVENTSIZE))
#define MNWTitle 0
#define MNWScrollFn 1
#define MNWNoScrollbars 2
#define MNWScrollExtent 3
#define MNWScrollExtentUse 4
#define MNWBorder 5
#define REPLACE 0 /* Operations for BITBLT, etc, as they come from lisp */
#define PAINT 1
#define INVERT 2
#define ERASE 3
/***************************************************/
/* Macros for dealing with pointer complexity. */
/***************************************************/
/***************************************************/
/* The argument for all these macros is a LispPTR */
/* to a Medley window structure. */
/* The result of the calculation is a C pointer. */
/***************************************************/
#define Cptr(LADDR) Addr68k_from_LADDR(LADDR)
#define WIfFromMw(win) (((MedleyWindow)Cptr(win))->NativeIf)
#define ScrnFromMw(win) ((MedleyScreenRec *)Cptr(((MedleyWindow)Cptr(win))->SCREEN))
#define DspstreamFromMw(win) ((Stream *)Cptr(((MedleyWindow)Cptr(win))->DSP))
#define ImDataFromMw(win) ((DISPLAYDATA *)Cptr(DspstreamFromMw(win)->IMAGEDATA))
#define MScrFromMw(win) ((MedleyScreen)Cptr(((MedleyWindow)Cptr(win))->SCREEN))
#define TitleDSFromMw(win) ((Stream *)Cptr(MScrFromMw(win)->SCTITLEDS))
#define TitleDDFromMw(win) ((DISPLAYDATA *)Cptr(TitleDSFromMw(win)->IMAGEDATA))
#define DspIfFromMw(win) (MScrFromMw(win)->NativeIf)
#define XDisplayFromMw(win) (DspIfFromMw(win)->handle)
#define XWindowFromMw(win) (WIfFromMw(win)->handle)
#define DspIfFromMscr(scr) (((MedleyScreen)Cptr(scr))->NativeIf)
#ifndef max
#define max( a, b ) (((a)>(b))?(a):(b))
#endif /* max */
#ifndef min
#define min( a, b ) (((a)<(b))?(a):(b))
#endif /* min */

236
inc/my.h Executable file
View File

@@ -0,0 +1,236 @@
/* @(#) my.h Version 2.15 (2/8/93). copyright venue */
/************************************************************************/
/* */
/* M Y . H */
/* */
/* */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define S_CHARACTER 0x70000
#ifdef BIGVM
#define IsNumber(address) ((GETWORD(MDStypetbl +(((address) & 0x0fffff00)>>9))) & 0x1000)
#else
#define IsNumber(address) ((GETWORD(MDStypetbl +(((address) & 0x0ffff00)>>9))) & 0x1000)
#endif
/************************************************************************/
/* */
/* N _ M a k e F l o a t */
/* */
/* Get a numeric argument as a flowting-point number, converting */
/* from SMALLP or FIXP, if necessary. */
/* */
/************************************************************************/
#ifndef I386
#define N_MakeFloat(arg, dest, tos){ \
switch (SEGMASK & (LispPTR)arg) { \
case S_POSITIVE: \
dest = (float)(0xFFFF & (LispPTR)arg); \
break; \
case S_NEGATIVE: \
dest = (float)((int)(0xFFFF0000 | (LispPTR)arg)); \
break; \
default: \
switch (GetTypeNumber(arg)) { \
case TYPE_FLOATP: \
dest = *((float *)Addr68k_from_LADDR(arg)); \
break; \
case TYPE_FIXP: \
dest = (float)(*((int *)Addr68k_from_LADDR(arg))); \
break; \
default: ERROR_EXIT(tos); \
} \
} \
}
#else
#define N_MakeFloat(arg, dest, tos){ I386Reset; \
switch (SEGMASK & (int)arg) { \
case S_POSITIVE: \
dest = (float)(0xFFFF & (int)arg); \
break; \
case S_NEGATIVE: \
dest = (float)((int)(0xFFFF0000 | (int)arg)); \
break; \
default: \
switch (GetTypeNumber(arg)) { \
case TYPE_FLOATP: I386Reset; \
dest = *((float *)Addr68k_from_LADDR(arg)); \
break; \
case TYPE_FIXP: \
dest = (float)(*((int *)Addr68k_from_LADDR(arg))); \
break; \
default: ERROR_EXIT(tos); \
} \
} \
}
#endif /* I386 */
#define N_GetPos(arg, dest, tos){ \
if ((arg & SEGMASK) == S_POSITIVE) \
dest = arg & 0xFFFF; \
else { \
if (GetTypeNumber(arg) != TYPE_FIXP) ERROR_EXIT(tos); \
if ((dest = *((int *)Addr68k_from_LADDR(arg))) & 0x80000000) \
ERROR_EXIT(tos); \
} \
}
#ifdef OS4
#define aref_switch(type, tos, baseL, index) \
{ \
LispPTR result; \
DLword *wordp; \
\
switch (type) { \
case 38: /* pointer : 32 bits */ \
return(*(((int *)Addr68k_from_LADDR(baseL)) + index)); \
case 20: /* signed : 16 bits */ \
result = (GETWORD(((DLword *)Addr68k_from_LADDR(baseL)) + index)) & 0xFFFF; \
if (result & 0x8000) return(result | S_NEGATIVE); \
else return(result | S_POSITIVE); \
case 67: /* Character : 8 bits */ \
return(S_CHARACTER | ((GETBYTE(((char *)Addr68k_from_LADDR(baseL)) + index)) & 0xFF)); \
case 22: /* signed : 32 bits */ \
result = *(((int *)Addr68k_from_LADDR(baseL)) + index); \
N_ARITH_SWITCH(result); \
case 0: /* unsigned : 1 bit per element */ \
return(S_POSITIVE | (((GETBYTE(((char *)Addr68k_from_LADDR(baseL)) + (index >> 3))) >> (7 - (index & 7))) & 1)); \
case 3: /* unsigned : 8 bits per element */ \
return(S_POSITIVE | ((GETBYTE(((char *)Addr68k_from_LADDR(baseL)) + index)) & 0xFF)); \
case 4: /* unsigned : 16 bits per element */ \
return(S_POSITIVE | ((GETWORD(((DLword *)Addr68k_from_LADDR(baseL)) + index)) & 0xFFFF)); \
case 54: /* Float : 32 bits */ \
wordp = createcell68k(TYPE_FLOATP); \
*((int *)wordp) = *(((int *)Addr68k_from_LADDR(baseL)) + index); \
return(LADDR_from_68k(wordp)); \
case 68: /* Character : 16 bits */ \
return(S_CHARACTER | ((GETWORD(((DLword *)Addr68k_from_LADDR(baseL)) + index)) & 0xFFFF)); \
case 86: /* XPointer : 32 bits */ \
return(*(((int *)Addr68k_from_LADDR(baseL)) + index)); \
default: /* Illegal or Unimplemented */ \
ERROR_EXIT(tos); \
}/* end switch typenumber */ \
}
#else
static LispPTR __inline__
aref_switch(int type, LispPTR tos, LispPTR baseL, int index)
{
LispPTR result;
DLword *wordp;
switch (type)
{
case 38: /* pointer : 32 bits */
return(*(((LispPTR *)Addr68k_from_LADDR(baseL)) + index));
case 20: /* signed : 16 bits */
result = (GETWORD(((DLword *)Addr68k_from_LADDR(baseL)) + index)) & 0xFFFF;
if (result & 0x8000) return(result | S_NEGATIVE);
else return(result | S_POSITIVE);
case 67: /* Character : 8 bits */
return(S_CHARACTER | ((GETBYTE(((char *)Addr68k_from_LADDR(baseL)) + index)) & 0xFF));
case 22: /* signed : 32 bits */
result = *(((LispPTR *)Addr68k_from_LADDR(baseL)) + index);
N_ARITH_SWITCH(result);
case 0: /* unsigned : 1 bit per element */
return(S_POSITIVE | (((GETBYTE(((char *)Addr68k_from_LADDR(baseL)) + (index >> 3))) >> (7 - (index & 7))) & 1));
case 3: /* unsigned : 8 bits per element */
return(S_POSITIVE | ((GETBYTE(((char *)Addr68k_from_LADDR(baseL)) + index)) & 0xFF));
case 4: /* unsigned : 16 bits per element */
return(S_POSITIVE | ((GETWORD(((DLword *)Addr68k_from_LADDR(baseL)) + index)) & 0xFFFF));
case 54: /* Float : 32 bits */
wordp = createcell68k(TYPE_FLOATP);
*((LispPTR *)wordp) = *(((LispPTR *)Addr68k_from_LADDR(baseL)) + index);
return(LADDR_from_68k(wordp));
case 68: /* Character : 16 bits */
return(S_CHARACTER | ((GETWORD(((DLword *)Addr68k_from_LADDR(baseL)) + index)) & 0xFFFF));
case 86: /* XPointer : 32 bits */
return(*(((LispPTR *)Addr68k_from_LADDR(baseL)) + index));
default: /* Illegal or Unimplemented */
ERROR_EXIT(tos);
}/* end switch typenumber */
}
#endif /* NEVER */
#define aset_switch(type, tos) \
{ \
switch (type) { \
case 38: /* pointer : 32 bits */ \
GCLOOKUP(*(((int *)Addr68k_from_LADDR(base)) + index), DELREF); \
GCLOOKUP(data, ADDREF); \
*(((int *)Addr68k_from_LADDR(base)) + index) = data; \
return(data); \
case 20: /* signed : 16 bits */ \
new = data & 0xFFFF; \
if ((((data & SEGMASK) == S_POSITIVE) && ((data & 0x8000) == 0)) ||\
(((data & SEGMASK) == S_NEGATIVE) && (data & 0x8000))) \
GETWORD(((DLword *)Addr68k_from_LADDR(base)) + index) = new; \
else ERROR_EXIT(tos); \
return(data); \
case 67: /* Character : 8 bits */ \
if ((data & SEGMASK) != S_CHARACTER) ERROR_EXIT(tos); \
new = data & 0xFFFF; \
if (new > 0xFF) ERROR_EXIT(tos); \
GETBYTE(((char *)Addr68k_from_LADDR(base)) + index) = new; \
return(data); \
case 22: /* signed : 32 bits */ \
N_GETNUMBER(data, new, doufn); \
*(((int *)Addr68k_from_LADDR(base)) + index) = new; \
return(data); \
case 0: /* unsigned : 1 bit per element */ \
N_GetPos(data, new, tos); \
if (new > 1) ERROR_EXIT(tos); \
if (new) { \
new = (1 << (7 - (index & 7))); \
GETBYTE(((char *)Addr68k_from_LADDR(base)) + (index >> 3)) |= new; \
} \
else { \
new = 0xFF - (1 << (7 - (index & 7))); \
GETBYTE(((char *)Addr68k_from_LADDR(base)) + (index >> 3)) &= new; \
} \
return(data); \
case 3: /* unsigned : 8 bits per element */ \
N_GetPos(data, new, tos); \
if (new > 0xFF) ERROR_EXIT(tos); \
GETBYTE(((char *)Addr68k_from_LADDR(base)) + index) = new; \
return(data); \
case 4: /* unsigned : 16 bits per element */ \
N_GetPos(data, new, tos); \
if (new > 0xFFFF) ERROR_EXIT(tos); \
GETWORD(((DLword *)Addr68k_from_LADDR(base)) + index) = new; \
return(data); \
case 54: /* Float : 32 bits */ \
if (GetTypeNumber(data) != TYPE_FLOATP) ERROR_EXIT(tos); \
*(((int *)Addr68k_from_LADDR(base)) + index) = *((int *)Addr68k_from_LADDR(data)); \
return(data); \
case 68: /* Character : 16 bits */ \
if ((data & SEGMASK) != S_CHARACTER) ERROR_EXIT(tos); \
new = data & 0xFFFF; \
GETWORD(((DLword *)Addr68k_from_LADDR(base)) + index) = new; \
return(data); \
case 86: /* XPointer : 32 bits */ \
*(((int *)Addr68k_from_LADDR(base)) + index) = data; \
return(data); \
default: /* Illegal or Unimplemented */ \
ERROR_EXIT(tos); \
}/* end switch typenumber */ \
}

829
inc/native.h Executable file
View File

@@ -0,0 +1,829 @@
/* $Id: native.h,v 1.2 1999/01/03 02:06:18 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-98 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/* ******
#include "lispemul.h"
#include "emlglob.h"
#include "address.h"
#include "adr68k.h"
#include "stack.h"
#include "lspglob.h"
#include "lsptypes.h"
#include "lispmap.h"
#include "cell.h"
****** */
/* ************************************************************************* */
/* ************** EMULATOR MACROS ************ */
/* ************************************************************************* */
typedef char ByteCode;
typedef unsigned short DLword;
typedef unsigned int LispPTR;
typedef struct consstr {
unsigned cdr_code : 8 ;
unsigned car_field : 24 ;
} ConsCell;
#define CDR_INDIRECT 0
#define CDR_NIL 128
#define CDR_ONPAGE 128
struct state{
DLword *ivar;
DLword *pvar;
};
#define ATOM_T 0114 /* T's AtomIndex Number 114Q */
#define NIL_PTR 0 /* from cell.h 24-mar-87 take */
#define NOBIND_PTR 1
#define FRAMESIZE 10 /* size of frameex1: 10 words */
#define FNHEADSIZE 8 /* size of fnhead: 8 words */
#define GET_NATIVE_ADDR(fnobject) \
*((int *) ((int)fnobject + fnobject->startpc - 4))
#define CALL_NATIVE(defcell, num_args) \
asmgoto(((int *)(GET_NATIVE_ADDR(defcell)))[num_args+(6+2)]);
#define CURRENTFX ((struct frameex1 *)((DLword *) PVar - FRAMESIZE))
#define IVar MachineState.ivar
#define PVar MachineState.pvar
#define GetLongWord(address) (*((int *) (address)))
#define LADDR_from_68k(ptr68k) (((unsigned int)(ptr68k) - (unsigned int)Lisp_world) >>1)
#define Addr68k_from_LADDR(Lisp_addr) (Lisp_world + (Lisp_addr))
#define StkOffset_from_68K(ptr68k)\
(((unsigned int)(ptr68k) - (unsigned int)Stackspace) >>1)
#define Addr68k_from_StkOffset(stkoffset)\
(Stackspace + (stkoffset))
#define POINTER_PAGEBASE(datum) ((datum) & 0x0ffff00)
#define GetDTD(typnum) (DTDspace + ((typnum)<<4))
#define GetTypeEntry(address) *(MDStypetbl + ((((int)address) & 0x0ffff00)>>9))
#define GetTypeNumber(address) ((*(MDStypetbl +((((int)address) & 0x0ffff00)>>9))) & 2047)
#define Listp(address) (GetTypeNumber(address) == TYPE_LISTP)
#define BF_MARK 0x8000
#define BF_MARK32 0x80000000
#define FX_MARK 0xc000
#define FX_MARK_NATIVE 0xc800
#define STK_SAFE 32 /* added with stkmin */
struct fnhead{
DLword stkmin; /* ?? */
short na; /* Numbers of arguments */
short pv; /* ?? */
DLword startpc;
/* head of ByteCodes, DLword offset from stkmin */
unsigned native :1; /* native translated? */
unsigned nil1 :1 ; /* not used */
unsigned argtype : 2; /* ?? */
unsigned nil2 :4 ; /* not used */
unsigned framename : 24; /* index in AtomSpace */
DLword ntsize; /* size of NameTable */
unsigned nlocals :8; /* ?? */
unsigned fvaroffset :8;
/* DLword offset from head of NameTable */
/* NameTable of variavle length is follwing with this structure. */
};
typedef struct frameex1{
unsigned flags :3;
unsigned fast :1;
unsigned native :1; /* This frame treats N-func */
unsigned incall :1;
unsigned validnametable :1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned nopush :1;
unsigned usecount :8;
DLword alink; /* alink pointer (Low addr) */
DLword lofnheader; /* pointer to FunctionHeader (Low addr) */
unsigned hi1fnheader : 8; /* pointer to FunctionHeader (Hi1 addr) */
unsigned hi2fnheader : 8; /* pointer to FunctionHeader (Hi2 addr) */
DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */
DLword lonametable; /* pointer to NameTable of this FrameEx (Low addr) */
unsigned hi1nametable :8; /* pointer to NameTable of this FrameEx (Hi1 addr) */
unsigned hi2nametable :8; /* pointer to NameTable of this FrameEx (Hi2 addr) */
DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */
} FX ;
typedef struct frameex2{
unsigned flags :3;
unsigned fast :1;
unsigned native :1; /* This frame treats N-func */
unsigned incall :1;
unsigned validnametable :1;
/* 0: look for FunctionHeader
1: look for NameTable on this FrameEx */
unsigned nopush :1;
unsigned usecount :8;
DLword alink; /* alink pointer (Low addr) */
LispPTR fnheader; /* pointer to FunctionHeader (swapped) */
DLword nextblock; /* pointer to FreeStackBlock */
DLword pc; /* Program counter */
LispPTR nativera; /* address of native ra */
DLword blink; /* blink pointer (Low addr) */
DLword clink; /* clink pointer (Low addr) */
} FX2 ;
typedef struct basic_frame {
unsigned flags : 3 ;
unsigned nil : 3 ;
unsigned residual :1 ;
unsigned padding : 1 ;
unsigned usecnt : 8 ;
DLword ivar ;
} Bframe ;
/* Structure for DTD */
struct dtd {
DLword dtd_name ;
DLword dtd_size ;
LispPTR dtd_free ;
unsigned unuse :2 ;
unsigned dtd_obsolate :1 ;
unsigned dtd_finalizable :1 ;
unsigned dtd_lockedp : 1 ;
unsigned dtd_hunkp : 1 ;
unsigned dtd_gctype :2 ;
unsigned dtd_descrs : 24;
LispPTR dtd_typespecs ;
LispPTR dtd_ptrs ;
int dtd_oldcnt;
DLword dtd_cnt0 ;
DLword dtd_nextpage ;
DLword dtd_typeentry ;
DLword dtd_supertype ;
};
#define TYPE_SMALLP 1
#define TYPE_FIXP 2
#define TYPE_FLOATP 3
#define TYPE_LITATOM 4
#define TYPE_LISTP 5
#define TYPE_ARRAYP 6
#define TYPE_STRINGP 7
#define TYPE_STACKP 8
#define TYPE_CHARACTERP 9
#define TYPE_VMEMPAGEP 10
#define TYPE_STREAM 11
#define TYPE_BITMAP 12
#define TYPE_COMPILED_CLOSURE 13
#define TYPE_ONED_ARRAY 14
#define TYPE_TWOD_ARRAY 15
#define TYPE_GENERAL_ARRAY 16
typedef struct compiled_closure {
unsigned int nil1 : 8 ;
unsigned int def_ptr : 24; /* function */
unsigned int nil2 : 8 ;
unsigned int env_ptr : 24; /* environment */
} CClosure ;
typedef struct definition_cell {
unsigned ccodep : 1 ;
unsigned fastp : 1 ;
unsigned argtype : 2 ;
unsigned pseudocodep : 1 ;
unsigned nil : 3 ;
unsigned defpointer : 24;
} DefCell ;
#define GetDEFCELL68k(index) ((LispPTR *)Defspace + (index) )
#define GetVALCELL68k(index) ((LispPTR *)Valspace + (index))
#define S_POSITIVE 0xE0000
#define S_NEGATIVE 0xF0000
#define S_CHARACTER 0x70000
/* ************************************************************************* */
/* ************** NATIVE ONLY MACROS ************ */
/* ************************************************************************* */
/************************************************************************/
/* TOP OF STACK OPERATIONS */
/************************************************************************/
#define PUSH(x) {*((LispPTR *) CSTKPTR++) = (LispPTR) x;}
#define PUSH16(x) *((DLword *) CSTKPTR++) = x;
#define PUSH16s(x, y) { PUSH16(x); PUSH16(y); }
#define PUSH_SWAPED(x) { register LispPTR temp;\
temp = x; \
PUSH16(temp); \
PUSH16(swapx(temp)); \
}
#define POP *((LispPTR *) --CSTKPTR)
#define TOS *((LispPTR *) CSTKPTR-1)
#define COPY_TOP TOS
#define SAVE_PUSH_TOP TOS
#define PREV_TOS *((LispPTR *) CSTKPTR-2)
#define GET_POPPED *CSTKPTR
#define GET_POPPED_2 *((LispPTR *) CSTKPTR+1)
#define LSTACK (CSTKPTR - 1)
/************************************************************************/
/* MACROS TO SAVE & RESTORE STATE FOR OP_xx OPCODE ROUTINES */
/* TO CALL OLD STYLE OPCODE ROUTINE */
/************************************************************************/
#define NATIVE_EXT(call_pc) \
{ PC = (ByteCode *) call_pc; \
TopOfStack = POP; \
CurrentStackPTR = (DLword *) (CSTKPTR-1); \
}
#define NATIVE_RET \
{ CSTKPTR = (LispPTR *) CurrentStackPTR + 1; \
PUSH(TopOfStack); \
}
#define CALL_OP_FN(callpc, nextpc, opcodefn) { \
NATIVE_EXT(callpc); \
opcodefn(); \
NATIVE_RET; \
if (nextpc != (unsigned int) PC) { \
QUIT_NATIVE(PC); \
} \
}
/************************************************************************/
/* RETURN TO DISPATCH TO EXECUTE NEW FRAME */
/************************************************************************/
#define NATIVE_CURRENTFX ((struct frameex1 *)((DLword *) PVAR - FRAMESIZE))
#define C_RETURN_TO_DISPATCH \
{ \
asmgoto(&c_ret_to_dispatch); \
}
/************************************************************************/
/* RETURN TO DISPATCH TO EXECUTE OPCODE & RETURN TO NATIVE CODE */
/************************************************************************/
#define BCE(ret_pc) { \
setpc_jmp(ret_pc, &ret_to_unimpl); \
}
/************************************************************************/
/* RETURN TO DISPATCH TO EXECUTE OPCODE & STAY IN EMULATOR */
/************************************************************************/
#define QUIT_NATIVE(ret_pc) \
{ \
setpc_jmp(ret_pc, &ret_to_dispatch); \
}
/************************************************************************/
/* RETURN TO DISPATCH TO EXECUTE FN CALL */
/************************************************************************/
#define RETURN_TO_FN_CALL(ret_pc, golabel) \
{ \
setpc_jmp(ret_pc, &golabel); \
}
/************************************************************************/
/* RETURN TO DISPATCH TO EXECUTE UFN CALL */
/************************************************************************/
#define CALL_UFN(call_pc, opcode) \
{ \
setpc_jmp(call_pc, &ret_to_ufn); \
}
/************************************************************************/
/* RETURN TO DISPATCH TO EXECUTE TIMER INTERRUPT */
/************************************************************************/
#define RETURN_TO_TIMER(call_pc) \
{ \
setpc_jmp(call_pc, &ret_to_timer); \
}
/************************************************************************/
/* STACK OVERFLOW & TIMER CHECKS */
/************************************************************************/
#define STK_MIN(fnobj) ((fnobj->stkmin+STK_SAFE) << 1)
#define STK_END_COMPUTE(stk_end,fnobj) \
( (int)stk_end - STK_MIN(fnobj) )
#define CLR_IRQ \
{Irq_Stk_Check = STK_END_COMPUTE((Irq_Stk_End = (int) EndSTKP), \
FuncObj); \
}
#define STACK_ONLY_CHECK(stkmin) \
{ if ((int) CSTKPTR > (EndSTKP - ((stkmin+STK_SAFE) << 1))){ \
IVar = (DLword *) IVAR; \
PVar = (DLword *) PVAR; \
TopOfStack = POP; \
CurrentStackPTR = (DLword *) (CSTKPTR-1); \
if (do_stackoverflow(0)) { \
printf("REAL STACK OVERFLOW\n"); \
asmgoto(&ret_to_dispatch); \
} \
CSTKPTR = (LispPTR *) CurrentStackPTR + 1; \
PUSH(TopOfStack); \
IVAR = CSTKPTR + entry_pc; \
PVAR = (LispPTR *) PVar; \
} \
}
#define TIMER_STACK_CHECK(pc) \
{ if ( (int) CSTKPTR > Irq_Stk_Check ) {if(pc ==1) {printf("before timer exit\n"); do_brk();} RETURN_TO_TIMER(pc);} }
/************************************************************************/
/* FUNCTION ENTRY SETUP */
/************************************************************************/
/* The code generator must expand this differently, depending on
the number of paramaters available to the function.
*/
#define framesetup(x, stkmin, swapped_func_obj) { \
register int NEXTBLOCK; \
{ \
register struct frameex1 *LocFX; \
LocFX = NATIVE_CURRENTFX; \
LocFX->nextblock = NEXTBLOCK = StkOffset_from_68K(IVAR); \
} \
IVar = (DLword *) IVAR ; \
Irq_Stk_Check = ( (int)Irq_Stk_End - ( (stkmin+STK_SAFE) << 1) ); \
\
/* Set up BF */ \
PUSH((BF_MARK << 16) | NEXTBLOCK); \
PUSH((FX_MARK_NATIVE << 16) | StkOffset_from_68K(PVAR)); \
PUSH(swapped_func_obj); \
(DLword *) PVAR = PVar = (DLword *) CSTKPTR = (((DLword *) CSTKPTR) + (FRAMESIZE-4)) ; \
} /* end framesetup */
/************************************************************************/
/* FUNCTION CALL & RETURN */
/************************************************************************/
#define fncall_self(args, pc_assign, newpcval, golabel) { \
NATIVE_CURRENTFX->pc = newpcval; \
IVAR = CSTKPTR - args; \
pc_assign; \
goto golabel; \
} /* end fncall */
#define newdefcell ((struct fnhead *) DATUM68K)
#define fncall_other(args, call_args, pc_assign, currpc, newpcval, atom_index, fn_def_cell_addr_68K, return_label) {\
/* register struct fnhead *newdefcell; */ \
if ( (((DefCell *)fn_def_cell_addr_68K)->ccodep ) && \
( newdefcell = (struct fnhead *)Addr68k_from_LADDR( \
((DefCell *) fn_def_cell_addr_68K)->defpointer))->native) \
{ \
NATIVE_CURRENTFX->pc = newpcval; \
FuncObj = (struct fnhead *)newdefcell; \
IVAR = CSTKPTR - args; \
pc_assign; \
CALL_NATIVE(newdefcell, -call_args); \
}; \
RETURN_TO_FN_CALL(currpc, return_label); \
} /* end fncall */
#define envcall_native(retpcval, args, fncell, native_addr_slot, environment) {\
FuncObj = (struct fnhead *) fncell; \
native_closure_env = environment; \
NATIVE_CURRENTFX->pc = retpcval; \
IVAR = CSTKPTR - args; \
IF (args > 5) {(int) PC = -args; CALL_NATIVE(fncell, -6);} \
CALL_NATIVE(fncell, -args); \
} /* end envcall */
#define returnFX ((struct frameex2 *) DATUM68K)
#define return_op(pcval, swapped_func_obj, ret_result, slow_ret_result) \
{ \
/* *** op_return(pcval,swapped_func_obj); */ \
register DLword alink; \
alink = NATIVE_CURRENTFX->alink; \
if ( alink & 1 ) { slow_ret_result; BCE(pcval); } \
ret_result; /* NOTE: this smashes the BF word if fn called with 0 args */\
CSTKPTR = IVAR + 1; \
returnFX = (struct frameex2 *) \
((DLword *) \
(PVAR = (LispPTR *) Addr68k_from_StkOffset(alink)) \
- FRAMESIZE); \
IVAR = (LispPTR *) Addr68k_from_StkOffset(*((DLword *)returnFX -1)) ; \
IVar = (DLword *) IVAR; \
PVar = (DLword *) PVAR; \
if (returnFX->native) { \
if (returnFX->fnheader == swapped_func_obj) \
{(unsigned int) PC = (unsigned int) returnFX->pc; \
goto switchlabel; \
} \
else \
{register struct fnhead *newfncell; \
newfncell = FuncObj = (struct fnhead *) \
Addr68k_from_LADDR(0x0ffffff & swapx(returnFX->fnheader));\
CALL_NATIVE(newfncell, (unsigned int) returnFX->pc); \
} \
} \
else \
{register struct fnhead *LocFnObj; \
FuncObj = LocFnObj = (struct fnhead *) \
Addr68k_from_LADDR(0x0ffffff & swapx(returnFX->fnheader)); \
Irq_Stk_Check = STK_END_COMPUTE(EndSTKP,LocFnObj); \
if (((int)(CSTKPTR) > Irq_Stk_Check) || (Irq_Stk_End <= 0)) \
RETURN_TO_TIMER(returnFX->pc + (int) FuncObj); \
C_RETURN_TO_DISPATCH; \
} \
} /* return_op end */
/************************************************************************/
/* MACORS FOR OPCODES */
/************************************************************************/
#define MYARGCOUNT \
( ( ( \
( ((NATIVE_CURRENTFX->alink & 1) == 0) \
? (int) ((LispPTR *)NATIVE_CURRENTFX - 1) \
: (int) (Stackspace + NATIVE_CURRENTFX->blink) \
) \
- (int) IVAR) >> 2) )
#define N_OP_CHECKAPPLY(tos, abs_pc) { \
register DefCell *defcell; \
defcell = (DefCell *) GetDEFCELL68k(tos & 0xffff) ; \
if (!( defcell->ccodep && ((tos & 0xffff0000) == 0) && \
( ( defcell->argtype == 0 ) || ( defcell->argtype == 2 ) ) ) ) \
BCE(abs_pc); \
}
#define N_OP_TYPEMASK(n) \
( ( ( ((DLword)GetTypeEntry(TEMPREG = TOS)) & (DLword)n) == 0) \
? NIL_PTR \
: TEMPREG \
)
#define GETBASE_N(ptr, n)\
( *((DLword *)Addr68k_from_LADDR((0xFFFFFF & ptr) + n)))
#define GETBASEPTR_N(ptr, n)\
(0xFFFFFF & *((LispPTR *)Addr68k_from_LADDR((0xFFFFFF & ptr) + n)))
#define N_OP_PUTBASEPTR_N(tos_1, tos, n) \
*((LispPTR *)((DLword *)Addr68k_from_LADDR(0xffffff & tos_1) + n)) = tos;
#define N_OP_PUTBASE_N(tos_1, tos, n, error_label) \
{ \
if ( ((unsigned short)(swapx(TEMPREG = (LispPTR)tos))) != (S_POSITIVE >> 16)) \
goto error_label; \
*((DLword *)Addr68k_from_LADDR(0xffffff & tos_1) + n) = (DLword) TEMPREG; \
}
#define N_OP_GETBITS_N_FD(tos, offset, bit_mask, shift_amount) \
( \
(( ( *((DLword *)Addr68k_from_LADDR(0xFFFFFF & tos) + offset)) \
>> shift_amount ) \
& bit_mask ) \
)
#define N_OP_PUTBITS_N_FD(tos_1, tos, offset, bit_mask, shift_amount, error_label)\
{register LispPTR toscache, base; \
if ( ((unsigned short)(swapx(toscache = (LispPTR)tos))) != (S_POSITIVE >> 16)) \
goto error_label; \
(DLword *) DATUM68K = (DLword *)Addr68k_from_LADDR(base = 0xffffff & tos_1) + offset;\
*((DLword *)DATUM68K )= \
( (toscache << shift_amount) & \
(bit_mask << shift_amount)) | \
(*((DLword *)DATUM68K ) & (~(bit_mask << shift_amount)));\
}
#define N_OP_GETBASEBYTE(tos_1, tos, error_label) \
(( ((TEMPREG = (TOS_CACHE = tos) & 0xffff0000) == S_POSITIVE)\
? (*((char *) Addr68k_from_LADDR(0xffffff & tos_1) + (unsigned short) TOS_CACHE))\
:( (TEMPREG == S_NEGATIVE)\
? (*((char *) Addr68k_from_LADDR(0xffffff & tos_1) + (0xffff0000 | TOS_CACHE)))\
:( ( GetTypeNumber(TOS_CACHE) == TYPE_FIXP )\
? (*((char *) Addr68k_from_LADDR(0xffffff & tos_1) + \
*((int *)Addr68k_from_LADDR(TOS_CACHE))))\
: asmgoto(error_label)\
)\
)\
))
#define N_OP_PUTBASEBYTE(tos_2, tos_1, tos, error_label) \
{register LispPTR toscache, base; \
toscache = tos; \
TEMPREG = tos_1; \
base = 0xffffff & tos_2; \
if( ((0xFFFF0000 & toscache ) != S_POSITIVE) || \
((unsigned short)toscache >= 256)) \
goto error_label; \
switch( (0xFFFF0000 & TEMPREG) ){ \
case S_POSITIVE: \
TEMPREG &= 0x0000FFFF; \
break; \
case S_NEGATIVE: \
TEMPREG |= 0xFFFF0000; \
break; \
default: \
goto error_label; \
} \
*((char*)Addr68k_from_LADDR(0xFFFFFF & base) + TEMPREG) = \
0xFF & toscache; \
}
#define N_OP_CAR(tos, error_label) \
(Listp(TOS_CACHE = tos) \
? ( \
(((ConsCell *) \
(DATUM68K = (LispPTR *)(Addr68k_from_LADDR(TOS_CACHE))))\
->cdr_code == CDR_INDIRECT) \
? ((LispPTR) ( ((ConsCell *) \
Addr68k_from_LADDR( ((ConsCell *)DATUM68K)->car_field))->car_field))\
: ((LispPTR)(((ConsCell *)DATUM68K)->car_field)) \
) \
: ( (TOS_CACHE == NIL_PTR) \
? TOS_CACHE \
: \
( ( TOS_CACHE == ATOM_T) \
? TOS_CACHE \
: asmgoto(error_label) \
) \
) \
)
#define N_OP_CDR(tos, error_label) \
(Listp(TOS_CACHE = tos) \
? ( ((TEMPREG = (LispPTR) \
( ((ConsCell *) \
(DATUM68K = ((LispPTR *)(Addr68k_from_LADDR(TOS_CACHE)))))\
->cdr_code)) == CDR_NIL) \
? (LispPTR) NIL_PTR \
: (LispPTR) ( (TEMPREG > CDR_ONPAGE) \
? \
/* cdr-samepage */ \
(POINTER_PAGEBASE(TOS_CACHE) + \
((TEMPREG & 127) << 1)) \
: (LispPTR) ( (TEMPREG == CDR_INDIRECT) \
? ((LispPTR) cdr (((ConsCell *)DATUM68K)->car_field)) \
: (LispPTR) ((ConsCell *)(Addr68k_from_LADDR \
(POINTER_PAGEBASE(TOS_CACHE) + (TEMPREG << 1))))->car_field\
) \
) \
) \
: (LispPTR) ( (TOS_CACHE == NIL_PTR) ? NIL_PTR : asmgoto(error_label)) \
)
#define N_OP_CDDR(tos, error_label) \
(Listp(TOS_CACHE = tos) \
? ( ((TEMPREG = (LispPTR) \
( ((ConsCell *) \
(DATUM68K = ((LispPTR *)(Addr68k_from_LADDR(TOS_CACHE)))))\
->cdr_code)) == CDR_NIL) \
? (LispPTR) NIL_PTR \
: (LispPTR) ( (TEMPREG > CDR_ONPAGE) \
? \
/* cdr-samepage */ \
(SAME_PAGE_CDR) \
: (LispPTR) ( (TEMPREG == CDR_INDIRECT) \
? N_OP_CDR(cdr(((ConsCell *)DATUM68K)->car_field),error_label)\
: N_OP_CDR( \
((ConsCell *) \
(Addr68k_from_LADDR \
(POINTER_PAGEBASE(TOS_CACHE) + \
(TEMPREG << 1) \
) \
) \
)->car_field \
, error_label) \
) \
) \
) \
: (LispPTR) ( (TOS_CACHE == NIL_PTR) ? NIL_PTR : asmgoto(error_label)) \
)
#define SAME_PAGE_CDR \
/* take CDR of List Cell */ \
( ((TEMPREG = (LispPTR) \
( ((ConsCell *) \
(DATUM68K = (LispPTR *) \
(((int)DATUM68K & 0xfffffe00) | \
(((int) TEMPREG & 127) << 2)) \
)) \
->cdr_code)) == CDR_NIL) \
? (LispPTR) NIL_PTR \
: (LispPTR) ( (TEMPREG > CDR_ONPAGE) \
? /* cdr-samepage */ \
(POINTER_PAGEBASE(TOS_CACHE) + \
((TEMPREG & 127) << 1)) \
: (LispPTR) ( (TEMPREG == CDR_INDIRECT) \
? ((LispPTR) cdr (((ConsCell *)DATUM68K)->car_field)) \
: (LispPTR) ((ConsCell *)(Addr68k_from_LADDR \
(POINTER_PAGEBASE(TOS_CACHE) + (TEMPREG << 1))))->car_field\
) \
) \
)
#define N_OP_FVAR(slot, dl_slot) \
( GetLongWord(Addr68k_from_LADDR(swapx( \
( ( ((DLword *)PVAR)[dl_slot] & 1 ) \
? native_newframe(slot) \
: PVAR[slot] \
)))))
#define N_OP_UNBIND(tos) \
/* {register LispPTR SAVE_TOS = tos; CSTKPTR = (LispPTR *) N_OP_unbind(CSTKPTR); PUSH(SAVE_TOS);} */ \
nop_unbind(tos);
#define N_OP_DUNBIND \
/* { CSTKPTR = (LispPTR *) N_OP_dunbind(CSTKPTR); } THIS MAY NOT WORK */ \
nop_dunbind();
#define N_OP_CLARITHEQUAL(tos_1, tos, error_addr) \
( (((TEMPREG = tos) & 0xfffe0000) == (S_POSITIVE & 0xfffe0000)) \
? ((TEMPREG == tos_1) ? ATOM_T : NIL_PTR) \
: ((((int) DATUM68K = GetTypeNumber(TEMPREG)) == TYPE_FIXP)\
? ((TEMPREG == tos_1) ? ATOM_T : NIL_PTR) \
: (((int) DATUM68K == TYPE_FLOATP) \
? ((TEMPREG == tos_1) ? ATOM_T : NIL_PTR) \
: (N_OP_eqq(tos_1, TEMPREG, error_addr)) \
) \
) \
)
#define N_OP_CLEQUAL_ILEQL(tos_1, tos, error_addr, op_function) \
( (((TOS_CACHE = tos) & 0xfffe0000) <= (S_POSITIVE & 0xfffe0000)) \
? ((TOS_CACHE == tos_1) ? ATOM_T : NIL_PTR) \
:( (((TEMPREG = tos_1) & 0xfffe0000) <= \
(S_POSITIVE & 0xfffe0000)) \
? ((TOS_CACHE == TEMPREG) ? ATOM_T : NIL_PTR) \
: op_function(TEMPREG, TOS_CACHE, error_addr) \
) \
)
#define N_OP_EQUAL(tos_1, tos, error_addr) \
( (((TOS_CACHE = tos) & 0xffff0000) <= S_CHARACTER) \
? ((TOS_CACHE == tos_1) ? ATOM_T : NIL_PTR) \
:( (((TEMPREG = tos_1) & 0xffff0000) <= S_CHARACTER) \
? ((TOS_CACHE == TEMPREG) ? ATOM_T : NIL_PTR) \
: N_OP_equal(TEMPREG, TOS_CACHE, error_addr) \
) \
)
#define N_OP_DTEST(atom_index, exit_pc, opcode) \
{ /* must have stack up to date */ \
register struct dtd *dtd68k ; \
for(dtd68k=(struct dtd *) GetDTD(GetTypeNumber(TOS)); \
atom_index != dtd68k->dtd_name ; \
dtd68k=(struct dtd *) GetDTD(dtd68k->dtd_supertype)) \
{ \
if( dtd68k->dtd_supertype == 0) \
{ \
CALL_UFN(exit_pc, opcode); \
} \
} \
}
#ifdef sun3
/* these take advantage of the Shift Amount Register d5 */
#define NSMALLP_RANGE(x) nop_nsmallp_range(x)
#define SMALLP_UNBOX(x) nop_smallp_unbox(x)
#define SMALL_BOX(x) nop_smallp_box(x)
#else
#define NSMALLP_RANGE(x) (((int)((int)x << 15) >> 15) ^ x)
#define SMALLP_UNBOX(x) ( (int) (x << 15) >> 15)
#define SMALL_BOX(x) (((unsigned int)(x << 15) >> 15) | S_POSITIVE)
#endif
#define NSMALLP(x) (((x) >> 17) ^ 7)
#define MAKE_BOX(type, value) Create_n_Set_Cell(type, value)
#define GET_BOX(type, laddr) (* ((type *) (Addr68k_from_LADDR(laddr))))
#define FIXP_UNBOX(value) \
( NSMALLP((TEMPREG = value)) \
? GET_BOX(int, TEMPREG) \
: SMALLP_UNBOX(TEMPREG) \
)
#define FIXP_UNBOX_UFN(value, errorlabel) \
( NSMALLP((TEMPREG = value)) \
?( (GetTypeNumber(TEMPREG) == TYPE_FIXP) \
?GET_BOX(int, TEMPREG) \
:asmgoto(errorlabel) \
) \
: SMALLP_UNBOX(TEMPREG) \
)
#define FLOATP_UNBOX(value) \
GET_BOX(floatvalue)
#define FIXP_BOX(x) \
( NSMALLP_RANGE((TEMPREG = x)) \
? MAKE_BOX(TYPE_FIXP, TEMPREG) \
: SMALL_BOX(TEMPREG) \
)
#define FLOATP_BOX(x) Create_n_Set_Cell(TYPE_FLOATP, x)
/************************************************************************/
/* EXTERNAL ENTRY POINTS */
/************************************************************************/
extern DLword *Atomspace; /* ATOMSPACE */
extern DLword *Stackspace; /* STACKSPACE*/
extern DLword *Defspace; /* DEFSPACE */
extern DLword *Valspace; /* VALSPACE */
extern DLword *Lisp_world; /* Lisp Start BASE */
extern DLword *MDStypetbl;
extern DLword *DTDspace; /* DTDSPACE */
extern DLword *CurrentStackPTR; /* rhS,S */
extern LispPTR TopOfStack ; /* TOSH(high 16),TOS (lo 16) */
extern LispPTR Scratch_CSTK ;
extern ByteCode *PC; /* Pointer to executing Byte Code */
extern struct state MachineState;
extern struct fnhead *FuncObj; /* Pointer to current ccode obj */
extern int EndSTKP; /* End of Current Frame */
extern int *c_ret_to_dispatch;
extern int *ret_to_dispatch;
extern int *ret_to_unimpl;
extern int *ret_to_timer;
extern int *ret_to_fn0;
extern int *ret_to_fn1;
extern int *ret_to_fn2;
extern int *ret_to_fn3;
extern int *ret_to_fn4;
extern int *ret_to_fnx;
extern int *ret_to_apply;
extern int *ret_to_envcall;
extern int *ret_to_ufn;
extern int Irq_Stk_End;
extern int Irq_Stk_Check;
extern LispPTR native_closure_env;

43
inc/nfsfh.h Executable file
View File

@@ -0,0 +1,43 @@
/* $Id: nfsfh.h,v 1.2 1999/01/03 02:06:18 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
* nfsfh.h - NFS file handle definitions (for portable use)
*
* Jeffrey C. Mogul
* Digital Equipment Corporation
* Western Research Laboratory
*
* $Log: nfsfh.h,v $
* Revision 1.2 1999/01/03 02:06:18 sybalsky
* Add ID comments / static to files for CVS use
*
* Revision 1.1.1.1 1998/12/17 05:03:18 sybalsky
* Import of Medley 3.5 emulator
*
* Revision 1.1 93/10/01 16:09:01 mogul
* Initial revision
*
*/
/*
* Internal representation of dev_t, because different NFS servers
* that we might be spying upon use different external representations.
*/
typedef struct {
u_long Minor; /* upper case to avoid clashing with macro names */
u_long Major;
} my_devt;
#define dev_eq(a,b) ((a.Minor == b.Minor) && (a.Major == b.Major))
/*
* Many file servers now use a large file system ID. This is
* our internal representation of that.
*/
typedef struct {
my_devt fsid_dev;
u_long fsid_code;
} my_fsid;
#define fsid_eq(a,b) ((a.fsid_code == b.fsid_code) &&\
dev_eq(a.fsid_dev, b.fsid_dev))

430
inc/nfswatch.h Executable file
View File

@@ -0,0 +1,430 @@
/* $Id: nfswatch.h,v 1.2 1999/01/03 02:06:18 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
* $Header: /disk/disk3/cvsroot/medley/inc/nfswatch.h,v 1.2 1999/01/03 02:06:18 sybalsky Exp $
*
* nfswatch.h - definitions for nfswatch.
*
* David A. Curry Jeffrey C. Mogul
* Purdue University Digital Equipment Corporation
* Engineering Computer Network Western Research Laboratory
* 1285 Electrical Engineering Building 250 University Avenue
* West Lafayette, IN 47907-1285 Palo Alto, CA 94301
* davy@ecn.purdue.edu mogul@decwrl.dec.com
*
* $Log: nfswatch.h,v $
* Revision 1.2 1999/01/03 02:06:18 sybalsky
* Add ID comments / static to files for CVS use
*
* Revision 1.1.1.1 1998/12/17 05:03:18 sybalsky
* Import of Medley 3.5 emulator
*
* Revision 4.8 1996/02/12 13:22:29 davy
* Updated version number.
*
* Revision 4.7 1995/03/20 01:07:34 davy
* Upped version number.
*
* Revision 4.6 1995/03/20 01:05:20 davy
* Fixed int32 declaration.
*
* Revision 4.5 1993/11/30 21:55:38 davy
* Upgraded version number.
*
* Revision 4.4 1993/10/01 14:56:51 mogul
* Bugfix to compile on SunOS
*
* Revision 4.3 93/10/01 10:45:54 mogul
* Revert to int32, u_int32 names
*
* Revision 4.2 93/09/30 20:33:44 davy
* Increased MAXCLIENTS, MAXEXPORTS, MAXAUTHS.
* Fixed the int32 and u_int32 type names for portability.
*
* Revision 4.1 1993/09/28 21:27:40 mogul
* Portable internal representation for file handle info
* explicit 32-bit data types
* explicit data type for IP addresses
*
* Revision 4.0 1993/03/01 19:59:00 davy
* NFSWATCH Version 4.0.
*
* Revision 3.9 1993/02/24 17:44:45 davy
* Added -auth mode, changes to -proc mode, -map option, -server option.
*
* Revision 3.8 1993/01/16 19:12:54 davy
* Moved cpp controls to left margin.
*
* Revision 3.7 1993/01/16 19:08:59 davy
* Corrected Jeff's address.
*
* Revision 3.6 1993/01/15 19:33:39 davy
* Miscellaneous cleanups.
*
* Revision 3.5 1993/01/15 15:43:36 davy
* Assorted changes for porting to Solaris 2.x/SVR4.
*
* Revision 3.4 1993/01/13 21:24:40 davy
* Portability change.
*
* Revision 3.3 1993/01/13 20:18:17 davy
* Put in OS-specific define scheme, and merged in Tim Hudson's code for
* SGI systems (as yet untested).
*
* Revision 3.2 1992/07/24 18:49:09 mogul
* Changed version number to 3.1
*
* Revision 3.1 1992/07/24 18:47:57 mogul
* Added FDDI support
*
* Revision 3.0 1991/01/23 08:23:13 davy
* NFSWATCH Version 3.0.
*
* Revision 1.4 91/01/17 10:12:29 davy
* New features from Jeff Mogul.
*
* Revision 1.6 91/01/07 15:34:42 mogul
* Support for client hash table
*
* Revision 1.5 91/01/07 14:10:01 mogul
* Added SHOWHELP, SHOW_MAXCODE
*
* Revision 1.4 91/01/04 14:12:11 mogul
* Support for client counters
*
* Revision 1.3 91/01/03 17:38:18 mogul
* Support for per-procedure counters
*
* Revision 1.2 90/08/17 15:47:04 davy
* NFSWATCH Version 2.0.
*
* Revision 1.1 88/11/29 11:20:28 davy
* NFSWATCH Release 1.0
*
*/
/*
* Version number.
*/
#define VERSION "4.3 of 12 February 1996"
/*
* Stuff for representing NFS file handles
*/
#include "nfsfh.h"
/*
* General definitions.
*/
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
/*
* Declarations of several data types that must be 32 bits wide,
* no matter what machine we are running on. "long" is unsafe
* because on DEC Alpha machines that means 64 bits. "int" is
* unsafe because on some machines that means 16 bits.
*
* Use int32 or u_int32 whenever you mean "32 bits" and not
* "some large number of bits".
*
* NEVER use int or int32 or u_int32 (or, for that matter, long)
* when the variable might contain a pointer value.
*/
#if defined(pdp11)
/* other 16-bit machines? */
typedef long int32;
typedef unsigned long u_int32;
#else
/* works almost everywhere */
#if !defined(SUNOS54)
/* SunOS 5.4 declares int32 in <rpc/rpc_sztypes.h> */
typedef int int32;
#endif
#if !defined(U_INT32_DECLARED_IN_AUTH) || !defined(AUTH_UNIX)
/* SunOS declares u_int32 in <rpc/auth.h> */
typedef unsigned int u_int32;
#endif
#endif
/* Define a specific type for representing IP addresses */
typedef u_int32 ipaddrt;
#ifdef SVR4
#define MOUNTTABLE "/etc/mnttab" /* mounted file systems */
#define SHARETAB "/etc/dfs/sharetab" /* shared file systems */
#endif
#define PROMPT "nfswatch>" /* prompt string */
#define LOGFILE "nfswatch.log" /* log file name */
#define MAXEXPORT 1024 /* max exported file systems */
#define CYCLETIME 10 /* screen update cycle time */
#define PACKETSIZE 4096 /* max size of a packet */
#define MAXNFSPROC 18 /* max number of NFS procedures */
#define MAXHOSTADDR 16 /* max. network addrs per host */
#define MAXCLIENTS 1024 /* max. # of client counters */
/* MUST be even number */
#define MAXAUTHS 1024 /* max. # of auth counters */
/* MUST be even number */
#define MAXINTERFACES 16 /* Max. number of interfaces */
#define SNAPSHOTFILE "nfswatch.snap" /* snapshot file name */
#define SHOWINDVFILES 1 /* show individual files */
#define SHOWFILESYSTEM 2 /* show NFS file systems */
#define SHOWNFSPROCS 3 /* show NFS procedure counts */
#define SHOWCLIENTS 4 /* show client host names */
#define SHOWAUTH 5 /* show authorizations */
#define SHOWHELP 6 /* show help text */
#define SHOW_MAXCODE 6 /* number of different displays */
/*
* Network Interface Tap (NIT) definitions.
*/
#ifdef USE_NIT
#define NIT_DEV "/dev/nit" /* network interface tap device */
#define NIT_BUF "nbuf" /* nit stream buffering module */
#define NIT_CHUNKSIZE 8192 /* chunk size for grabbing pkts */
#endif
/*
* Pfilt definitions.
*/
#ifdef USE_PFILT
#define PFILT_CHUNKSIZE 8192 /* chunk size for grabbing pkts */
#endif
/*
* Snoop definitions.
*/
#ifdef USE_SNOOP
#define SNOOP_BUFFER_SIZE (55 * 1024) /* for grabbing packets */
#endif
/*
* Data Link Provider Interface (DLPI) definitions.
*/
#ifdef USE_DLPI
#define DLPI_DEVDIR "/dev/" /* path to device dir */
#define DLPI_BUFMOD "bufmod" /* streams buffering */
#define DLPI_MAXWAIT 15 /* max timeout */
#define DLPI_MAXDLBUF 8192 /* buffer size */
#define DLPI_MAXDLADDR 1024 /* max address size */
#define DLPI_CHUNKSIZE (8192 * sizeof(long)) /* buffer size */
#define DLPI_DEFAULTSAP 0x0800 /* IP protocol */
#endif /* USE_DLPI */
/*
* Packet counter definitions.
*/
#define PKT_NCOUNTERS 16 /* number of packet counters */
#define PKT_NDREAD 0 /* ND read requests */
#define PKT_NDWRITE 1 /* ND write requests */
#define PKT_NFSREAD 2 /* NFS read requests */
#define PKT_NFSWRITE 3 /* NFS write requests */
#define PKT_NFSMOUNT 4 /* NFS mount requests */
#define PKT_YELLOWPAGES 5 /* Yellow Pages requests */
#define PKT_RPCAUTH 6 /* RPC authorization requests */
#define PKT_OTHERRPC 7 /* other RPC requests */
#define PKT_TCP 8 /* TCP packets */
#define PKT_UDP 9 /* UDP packets */
#define PKT_ICMP 10 /* ICMP packets */
#define PKT_ROUTING 11 /* routing control packets */
#define PKT_ARP 12 /* address resolution packets */
#define PKT_RARP 13 /* reverse addr resol packets */
#define PKT_BROADCAST 14 /* ethernet broadcast packets */
#define PKT_OTHER 15 /* none of the above packets */
typedef unsigned long Counter;
/*
* Packet counting structure.
*/
typedef struct {
char *pc_name; /* name of counter */
Counter pc_interval; /* packets this interval */
Counter pc_total; /* packets since start */
short pc_intx, pc_inty; /* screen coords of pc_interval */
short pc_totx, pc_toty; /* screen coords of pc_total */
short pc_pctx, pc_pcty; /* screen coords of percentage */
short pc_namex, pc_namey; /* screen coords of pc_name */
} PacketCounter;
/*
* NFS request counting structure.
*/
typedef struct {
my_devt nc_dev; /* device numbers of file sys */
my_fsid nc_fsid; /* for "learning" file systems */
ipaddrt nc_ipaddr; /* keep track of server address */
char *nc_name; /* name of file system */
Counter nc_total; /* requests since start */
Counter nc_interval; /* requests this interval */
Counter nc_proc[MAXNFSPROC]; /* each nfs proc counters */
short nc_intx, nc_inty; /* screen coords of nc_interval */
short nc_totx, nc_toty; /* screen coords of nc_total */
short nc_pctx, nc_pcty; /* screen coords of percentage */
short nc_namex, nc_namey; /* screen coords of nc_name */
} NFSCounter;
/*
* Specific file request counting structure.
*/
typedef struct {
my_devt fc_dev; /* device number of file sys */
ino_t fc_ino; /* inode number of file */
char *fc_name; /* file name */
Counter fc_total; /* requests since start */
Counter fc_interval; /* requests this interval */
Counter fc_proc[MAXNFSPROC]; /* each nfs proc counters */
short fc_intx, fc_inty; /* screen coords of fc_interval */
short fc_totx, fc_toty; /* screen coords of fc_total */
short fc_pctx, fc_pcty; /* screen coords of percentage */
short fc_namex, fc_namey; /* screen coords of fc_name */
} FileCounter;
/*
* Per-procedure counting structure.
*/
typedef struct {
int pr_type; /* procedure type */
char *pr_name; /* procedure name */
Counter pr_total; /* requests since start */
Counter pr_interval; /* requests this interval */
Counter pr_complete; /* requests with replies */
double pr_response; /* sum of all response times */
double pr_respsqr; /* sum of squares of resp times */
double pr_maxresp; /* maximum response time */
short pr_intx, pr_inty; /* screen coords of pr_interval */
short pr_totx, pr_toty; /* screen coords of pr_total */
short pr_pctx, pr_pcty; /* screen coords of percentage */
short pr_namex, pr_namey; /* screen coords of pr_name */
short pr_compx, pr_compy; /* screen coords of pr_complete */
short pr_respx, pr_respy; /* screen coords of pr_response */
short pr_rsqrx, pr_rsqry; /* screen coords of pr_respsqr */
short pr_rmaxx, pr_rmaxy; /* screen coords of pr_maxresp */
} ProcCounter;
/*
* NFS client counting structure.
*/
typedef struct _cl_ {
ipaddrt cl_ipaddr; /* client IP address */
char *cl_name; /* name of client system */
Counter cl_total; /* requests since start */
Counter cl_interval; /* requests this interval */
short cl_intx, cl_inty; /* screen coords of cl_interval */
short cl_totx, cl_toty; /* screen coords of cl_total */
short cl_pctx, cl_pcty; /* screen coords of percentage */
short cl_namex, cl_namey; /* screen coords of cl_name */
struct _cl_ *cl_next; /* hash chain link */
} ClientCounter;
/*
* NFS authentication counting structure.
*/
typedef struct _ac_ {
long ac_uid; /* authorization type */
char *ac_name; /* name of user id */
Counter ac_total; /* requests since start */
Counter ac_interval; /* requests this interval */
short ac_intx, ac_inty; /* screen coords of ac_interval */
short ac_totx, ac_toty; /* screen coords of ac_total */
short ac_pctx, ac_pcty; /* screen coords of percentage */
short ac_namex, ac_namey; /* screen coords of ac_name */
struct _ac_ *ac_next; /* hash chain link */
} AuthCounter;
/*
* NFS call structure, for remembering relevant timing information.
*/
#define NFSCALLHASHSIZE 255
typedef struct _nc_ {
int used;
ipaddrt client;
u_short clientport;
u_int32 xid;
u_long proc;
u_long time_sec;
u_long time_usec;
} NFSCall;
/*
* Device type definitions (borrowed from the Berkeley Packet Filter)
*/
#ifndef DLT_NULL
#define DLT_NULL 0 /* no link-layer encapsulation */
#define DLT_EN10MB 1 /* Ethernet (10Mb) */
#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
#define DLT_AX25 3 /* Amateur Radio AX.25 */
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
#define DLT_CHAOS 5 /* Chaos */
#define DLT_IEEE802 6 /* IEEE 802 Networks */
#define DLT_ARCNET 7 /* ARCNET */
#define DLT_SLIP 8 /* Serial Line IP */
#define DLT_PPP 9 /* Point-to-point Protocol */
#define DLT_FDDI 10 /* FDDI */
#endif
/*
* Definitions for earlier systems which don't have these from 4.3BSD.
*/
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
#ifndef NFDBITS
typedef long fd_mask;
#define NFDBITS (sizeof(fd_mask) * NBBY)
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p) (void) bzero((char *)(p), sizeof(*(p)))
#endif /* NFDBITS */
/*
* Maximum control/data buffer size (in long's !!) for getmsg().
*/
#define MAXDLBUF 8192
/*
* Maximum number of seconds we'll wait for any
* particular DLPI acknowledgment from the provider
* after issuing a request.
*/
#define MAXWAIT 15
/*
* Maximum address buffer length.
*/
#define MAXDLADDR 1024
/*
* Handy macro.
*/
#define OFFADDR(s, n) (u_char*)((char*)(s) + (int)(n))

259
inc/ocr.h Executable file
View File

@@ -0,0 +1,259 @@
/* $Id: ocr.h,v 1.2 1999/01/03 02:06:19 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-96 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifdef OCR
extern int OCR_sock;
extern int OCR_sv;
extern int OCR_fd;
extern int OCR_procID;
/*
* Device file for OCR
*/
#define OCRDEV "/dev/ocr0"
/*
* SUBR_OCR_COMM alpha byte
*/
#define DO_OPEN 0
#define DO_SCAN 1
#define DO_IMG_INFO 2
#define DO_IMG_UPLD 3
#define DO_SET_RPARA 4
#define DO_CLR_RPARA 5
#define DO_READ 6
#define DO_READ_INFO 7
#define DO_GET_RESULT 8
#define DO_ABORT 9
#define DO_CLOSE 10
#define DO_CODE_CONV 11
#define DO_TEST 12
/*
* OCR state indicated in IL:\OCR.STATE.FLAGS
*/
#define OCR_ST_FAIL 1
#define OCR_ST_SCANNING 2
#define OCR_ST_UPLDING 3
#define OCR_ST_PROC_DEAD 4
#define OCR_ST_READING 5
/*
* OCR SCAN parameter. In Lisp, BLOCKRECORD OCR.SCAN.PARAMS
*/
struct ocr_scan_para {
u_char size : 3,
direction : 1,
dencity : 3,
binary : 1;
u_char resolution : 3,
adf : 1,
filter : 1,
threshold : 3;
u_char noise : 3,
doc : 1,
smooth : 1,
compo : 3;
};
#define OCR_SIZE_A4 0
#define OCR_SIZE_B4 1
#define OCR_SIZE_A5 2
#define OCR_SIZE_B5 3
#define OCR_SIZE_LG 4
#define OCR_SIZE_LT 5
#define OCR_DIRECT_VT 0
#define OCR_DIRECT_HR 1
#define OCR_RES_200 0
#define OCR_RES_240 1
#define OCR_RES_300 2
#define OCR_RES_400 3
#define OCR_DENC_0 0
#define OCR_DENC_1 1
#define OCR_DENC_2 2
#define OCR_DENC_3 3
#define OCR_DENC_4 4
#define OCR_DENC_5 5
#define OCR_DENC_6 6
#define OCR_DENC_7 7
#define OCR_SCANNER_FL 0
#define OCR_SCANNER_AD 1
#define OCR_FILTER_NR 0
#define OCR_FILTER_BP 1
#define OCR_THRES_0 0
#define OCR_THRES_1 1
#define OCR_THRES_2 2
#define OCR_THRES_3 3
#define OCR_THRES_4 4
#define OCR_THRES_5 5
#define OCR_NOISE_0 0
#define OCR_NOISE_2 1
#define OCR_NOISE_3 2
#define OCR_NOISE_4 3
#define OCR_NOISE_5 4
#define OCR_DOC_NR 0
#define OCR_DOC_NW 1
#define OCR_SMTH_CH 0
#define OCR_SMTH_IM 1
#define OCR_COMPO_LD 0
#define OCR_COMPO_PN 1
#define OCR_COMPO_PH 2
#define OCR_COMPO_PL 3
/*
* OCR Image Info structure. In Lisp, BLOCKRECORD OCR.IMG.INFO
* On SPARC, the size of this structure is 20.
*/
struct ocr_image_info {
u_short xs;
u_short ys;
u_short xe;
u_short ye;
u_short line_width;
u_int size;
u_char resolution : 3,
compress : 3,
: 2;
};
/*
* OCR Image Upload parameter. In Lisp, BLOCKRECORD OCR.IMG.UPLD.PARA
* On SPARC, the size of this structure is 10.
*/
struct ocr_up_para {
u_short xs;
u_short ys;
u_short xe;
u_short ye;
u_char resolution : 3,
compress : 3,
: 2;
};
#define OCR_COMP_NONE 0
#define OCR_COMP_2 1
#define OCR_COMP_4 2
#define OCR_COMP_8 3
/*
* Maximum number of regions to read per page
*/
#define OCR_MAX_RD_PARAMS 200
/*
* OCR Read Parameter. In Lisp, BLOCKRECORD OCR.IMG.READ.PARA
* On SPARC, the size of this structure is 14.
*/
struct ocr_read_para {
u_short xs;
u_short ys;
u_short xe;
u_short ye;
u_char format;
u_char csize;
u_char reject;
u_char cunit : 2,
deform : 4,
: 2;
u_char ck_num : 1,
ck_alph : 1,
ck_grk : 1,
ck_jvt : 1,
ck_jhr : 1,
ck_sym : 1,
ck_kana : 1,
ck_joyou : 1;
u_char ck_jis1 : 1,
ck_jmisc : 1,
ck_gaiji : 1,
: 5;
};
#define OCR_FMT_H1 0
#define OCR_FMT_H2 1
#define OCR_FMT_H3 2
#define OCR_FMT_H4 3
#define OCR_FMT_V1 4
#define OCR_FMT_V2 5
#define OCR_FMT_V3 6
#define OCR_FMT_V4 7
#define OCR_CUNIT_PO 0
#define OCR_CUNIT_KY 1
#define OCR_CUNIT_MM 2
#define OCR_REJ_0 0
#define OCR_REJ_1 1
#define OCR_REJ_2 2
#define OCR_REJ_3 3
#define OCR_REJ_4 4
#define OCR_REJ_5 5
#define OCR_DFRM_1 0
#define OCR_DFRM_2 1
#define OCR_DFRM_3 2
#define OCR_DFRM_4 3
#define OCR_DFRM_NR 4
#define OCR_DFRM_6 5
#define OCR_DFRM_7 6
#define OCR_DFRM_8 7
#define OCR_DFRM_9 8
/*
* Header for bulk data transfer
*/
struct bd_header {
u_int len;
u_int cont;
};
#define BD_LAST 0
#define BD_CONT 1
/*
* The comm/res packet length used by OCR process
*/
#define PKTLEN 3
#define EPKTLEN 65536
#endif /* OCR */

44
inc/opcodes.h Executable file
View File

@@ -0,0 +1,44 @@
/* $Id: opcodes.h,v 1.2 1999/01/03 02:06:19 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* O P C O D E D E F I N I T I O N S */
/* */
/* Symbolic equivalents for Lisp Opcodes */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
#define opc_X 000
#define opc_CAR 001
#define opc_CDR 002
#define opc_LISTP 003
#define opc_NTYPEX 004
#define opc_TYPEP 005
#define opc_UNWIND 007
#define opc_FN0 010
#define opc_FN1 011
#define opc_FN2 012
#define opc_FN3 013
#define opc_FN4 014
#define opc_FNX 015
#define opc_APPLY 016
#define opc_RETURN 020
#define opc_UNBIND 022
#define opc_DUNBIND 023
#define opc_SLRETURN 077
#define opc_JUMP 0200
#define opc_FJUMP 0220
#define opc_TJUMP 0240
#define opc_JUMPX 0260
#define opc_JUMPXX 0261

126
inc/os.h Executable file
View File

@@ -0,0 +1,126 @@
/* $Id: os.h,v 1.2 1999/01/03 02:06:19 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*
*
* os.h - operating system definitions.
*
* David A. Curry Jeffrey C. Mogul
* Purdue University Digital Equipment Corporation
* Engineering Computer Network Western Research Laboratory
* 1285 Electrical Engineering Building 250 University Avenue
* West Lafayette, IN 47907-1285 Palo Alto, CA 94301
* davy@ecn.purdue.edu mogul@decwrl.dec.com
*
* $Log: os.h,v $
* Revision 1.2 1999/01/03 02:06:19 sybalsky
* Add ID comments / static to files for CVS use
*
* Revision 1.1.1.1 1998/12/17 05:03:18 sybalsky
* Import of Medley 3.5 emulator
*
* Revision 4.5 1996/02/12 13:20:26 davy
* Updated for Solaris 2.5
*
* Revision 4.4 1993/10/13 01:13:25 mogul
* IRIX40 fix
*
* Revision 4.3 1993/10/01 14:56:38 mogul
* Bugfix to compile on SunOS
*
* Revision 4.2 93/10/01 10:45:55 mogul
* Revert to int32, u_int32 names
*
* Revision 4.1 93/09/28 21:17:14 mogul
* Added support for DECOSF
*
* Revision 4.0 1993/03/01 19:59:00 davy
* NFSWATCH Version 4.0.
*
* Revision 1.6 1993/01/16 19:12:54 davy
* Moved cpp controls to left margin.
*
* Revision 1.5 1993/01/16 19:08:59 davy
* Corrected Jeff's address.
*
* Revision 1.4 1993/01/15 19:33:39 davy
* Miscellaneous cleanups.
*
* Revision 1.3 1993/01/13 21:41:37 davy
* Got rid of old IRIX versions.
*
* Revision 1.2 1993/01/13 21:24:54 davy
* Added IRIX40.
*
* Revision 1.1 1993/01/13 20:18:17 davy
* Initial revision
*
*/
#ifdef IRIX40
#ifndef USE_SNOOP
#define USE_SNOOP 1
#endif
#define signal sigset
#define U_INT32_DECLARED_IN_AUTH 1
#endif
#ifdef SUNOS4
#ifndef USE_NIT
#define USE_NIT 1
#endif
#define U_INT32_DECLARED_IN_AUTH 1
#endif
#ifdef OS5
#ifndef SVR4
#define SVR4 1
#endif
#ifndef USE_DLPI
#define USE_DLPI 1
#endif
#define U_INT32_DECLARED_IN_AUTH 1
#endif
#ifdef SUNOS5
#ifndef SVR4
#define SVR4 1
#endif
#ifndef USE_DLPI
#define USE_DLPI 1
#endif
#define U_INT32_DECLARED_IN_AUTH 1
#endif
#ifdef SUNOS55
#ifndef SUNOS54
#define SUNOS54 1
#endif
#undef U_INT32_DECLARED_IN_AUTH
#define index strchr
#define rindex strrchr
#define bzero(b,n) memset(b,0,n)
#define bcmp(a,b,n) memcmp(a,b,n)
#define bcopy(a,b,n) memcpy(b,a,n)
#endif
#ifdef SVR4
#ifndef USE_DLPI
#define USE_DLPI 1
#endif
#define index strchr
#define rindex strrchr
#define signal sigset
#define bzero(b,n) memset(b,0,n)
#define bcmp(a,b,n) memcmp(a,b,n)
#define bcopy(a,b,n) memcpy(b,a,n)
#endif
#ifdef ULTRIX
#ifndef USE_PFILT
#define USE_PFILT 1
#endif
#endif
#ifdef DECOSF
#ifndef USE_PFILT
#define USE_PFILT 1
#endif
#endif

27
inc/osmsg.h Executable file
View File

@@ -0,0 +1,27 @@
/* $Id: osmsg.h,v 1.2 1999/01/03 02:06:20 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/*************************************************
This is OSMESSAGE stuf.
Print a console message.
*************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989-98 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#define OSMESSAGE_PRINT(print_exp) \
{ \
flush_pty(); \
print_exp; \
}

24
inc/picture.h Executable file
View File

@@ -0,0 +1,24 @@
/* $Id: picture.h,v 1.2 1999/01/03 02:06:20 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-98 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
typedef struct _picture{
DLword width;
DLword height;
DLword bitsperpixel;
DLword nil;
unsigned int storage;
LispPTR userdata;
} LispPicture;

145
inc/pilotbbt.h Executable file
View File

@@ -0,0 +1,145 @@
/* $Id: pilotbbt.h,v 1.2 1999/01/03 02:06:21 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/****************************************************************
* *
* pilotbbt.h July 6, 1987 by Osamu Nakamura *
* *
****************************************************************/
#ifndef BYTESWAP
/**********************************/
/* Normal byte-order declarations */
/**********************************/
typedef struct pilotbbt{
DLword pbtdestlo;
DLword pbtdesthi;
DLword pbtdestbit; /* destination bit address */
short pbtdestbpl; /* destination bits per line
* -- distance in bits to move between items */
DLword pbtsourcelo;
DLword pbtsourcehi;
DLword pbtsourcebit; /* source bit address */
short pbtsourcebpl; /* source bits per line */
DLword pbtwidth; /* width of an item in bits */
DLword pbtheight; /* number of items -- height in scanlines */
unsigned pbtbackward : 1;
unsigned pbtdisjoint : 1;
unsigned pbtdisjointitems : 1;
unsigned pbtusegray : 1;
unsigned pbtsourcetype : 1;
unsigned pbtoperation : 2;
unsigned nil : 9;
DLword dummy[5]; /* unused, needed to make 16-alignment */
} PILOTBBT;
typedef struct texturebbt{
DLword pbtdestlo;
DLword pbtdesthi;
DLword pbtdestbit; /* destination bit address */
short pbtdestbpl; /* destination bits per line
* -- distance in bits to move between items */
DLword pbtsourcelo;
DLword pbtsourcehi;
DLword pbtsourcebit; /* source bit address */
unsigned dummy2 : 4;
/* overlay on pbtsourcebpl when pbtusegray */
unsigned pbtgrayoffset : 4;
/* offset in gray block where bitblt should start */
unsigned pbtgraywidthlessone : 4;
/* width-1 of gray block in words */
unsigned pbtgrayheightlessone : 4;
/* height-1 of gray block */
DLword pbtwidth; /* width of an item in bits */
DLword pbtheight; /* number of items -- height in scanlines */
unsigned pbtbackward : 1;
unsigned pbtdisjoint : 1;
unsigned pbtdisjointitems : 1;
unsigned pbtusegray : 1;
unsigned pbtsourcetype : 1;
unsigned pbtoperation : 2;
unsigned nil : 9;
DLword dummy[5]; /* unused, needed to make 16-alignment */
} TEXTUREBBT;
#else
/****************************/
/* Byte-swapped definitions */
/****************************/
typedef struct pilotbbt
{
DLword pbtdesthi;
DLword pbtdestlo;
short pbtdestbpl; /* destination bits per line
* -- distance in bits to move between items */
DLword pbtdestbit; /* destination bit address */
DLword pbtsourcehi;
DLword pbtsourcelo;
short pbtsourcebpl; /* source bits per line */
DLword pbtsourcebit; /* source bit address */
DLword pbtheight; /* number of items -- height in scanlines */
DLword pbtwidth; /* width of an item in bits */
DLword dummy1;
unsigned nil : 9;
unsigned pbtoperation : 2;
unsigned pbtsourcetype : 1;
unsigned pbtusegray : 1;
unsigned pbtdisjointitems : 1;
unsigned pbtdisjoint : 1;
unsigned pbtbackward : 1;
DLword dummy[4]; /* unused, needed to make 16-alignment */
} PILOTBBT;
typedef struct texturebbt
{
DLword pbtdesthi;
DLword pbtdestlo;
short pbtdestbpl; /* destination bits per line
* -- distance in bits to move between items */
DLword pbtdestbit; /* destination bit address */
DLword pbtsourcehi;
DLword pbtsourcelo;
unsigned pbtgrayheightlessone : 4;
/* height-1 of gray block */
unsigned pbtgraywidthlessone : 4;
/* width-1 of gray block in words */
unsigned pbtgrayoffset : 4;
/* offset in gray block where bitblt should start */
unsigned dummy2 : 4;
/* overlay on pbtsourcebpl when pbtusegray */
DLword pbtsourcebit; /* source bit address */
DLword pbtheight; /* number of items -- height in scanlines */
DLword pbtwidth; /* width of an item in bits */
DLword dummy1;
unsigned nil : 9;
unsigned pbtoperation : 2;
unsigned pbtsourcetype : 1;
unsigned pbtusegray : 1;
unsigned pbtdisjointitems : 1;
unsigned pbtdisjoint : 1;
unsigned pbtbackward : 1;
DLword dummy[4]; /* unused, needed to make 16-alignment */
} TEXTUREBBT;
#endif /* BYTESWAP */

44
inc/print.h Executable file
View File

@@ -0,0 +1,44 @@
/* $Id: print.h,v 1.2 1999/01/03 02:06:21 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-96 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* Syntax-class & character defns for PRINT code in C. */
/* */
/* */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* Copyright 1989, 1990 Venue, Fuji Xerox Co., Ltd, Xerox Corp. */
/* */
/* This file is work-product resulting from the Xerox/Venue */
/* Agreement dated 18-August-1989 for support of Medley. */
/* */
/************************************************************************/
#define LEFT_PAREN 40
#define RIGHT_PAREN 41
#define SPACE 32
#define PERCENT 37
#define DOTCODE 46
#define DOUBLEQUOTE 34
#define ATOMINDEXDOT 48

290
inc/profile.h Executable file
View File

@@ -0,0 +1,290 @@
/* $Id: profile.h,v 1.2 1999/01/03 02:06:21 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* DEFINE PROFILE if you want to turn on profiling */
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifdef PROFILE
#define ASM(OPT,OPT2) asm(OPT2); asm(OPT)
#else
#ifdef ISC
/* ISC 386 version needs assembler labels to make the dispatch table */
#define ASM(OPT,OPT2) asm(OPT)
#else
#define ASM(OPT,OPT2)
#endif /* ISC */
#endif /* PROFILE */
#define CASE000 ASM("_op000:", " .globl _op000"); case000
#define CASE001 ASM("_op001:", " .globl _op001"); case001
#define CASE002 ASM("_op002:", " .globl _op002"); case002
#define CASE003 ASM("_op003:", " .globl _op003"); case003
#define CASE004 ASM("_op004:", " .globl _op004"); case004
#define CASE005 ASM("_op005:", " .globl _op005"); case005
#define CASE006 ASM("_op006:", " .globl _op006"); case006
#define CASE007 ASM("_op007:", " .globl _op007"); case007
#define CASE010 ASM("_op010:", " .globl _op010"); case010
#define CASE011 ASM("_op011:", " .globl _op011"); case011
#define CASE012 ASM("_op012:", " .globl _op012"); case012
#define CASE013 ASM("_op013:", " .globl _op013"); case013
#define CASE014 ASM("_op014:", " .globl _op014"); case014
#define CASE015 ASM("_op015:", " .globl _op015"); case015
#define CASE016 ASM("_op016:", " .globl _op016"); case016
#define CASE017 ASM("_op017:", " .globl _op017"); case017
#define CASE020 ASM("_op020:", " .globl _op020"); case020
#define CASE021 ASM("_op021:", " .globl _op021"); case021
#define CASE022 ASM("_op022:", " .globl _op022"); case022
#define CASE023 ASM("_op023:", " .globl _op023"); case023
#define CASE024 ASM("_op024:", " .globl _op024"); case024
#define CASE025 ASM("_op025:", " .globl _op025"); case025
#define CASE026 ASM("_op026:", " .globl _op026"); case026
#define CASE027 ASM("_op027:", " .globl _op027"); case027
#define CASE030 ASM("_op030:", " .globl _op030"); case030
#define CASE031 ASM("_op031:", " .globl _op031"); case031
#define CASE032 ASM("_op032:", " .globl _op032"); case032
#define CASE033 ASM("_op033:", " .globl _op033"); case033
#define CASE034 ASM("_op034:", " .globl _op034"); case034
#define CASE035 ASM("_op035:", " .globl _op035"); case035
#define CASE036 ASM("_op036:", " .globl _op036"); case036
#define CASE037 ASM("_op037:", " .globl _op037"); case037
#define CASE040 ASM("_op040:", " .globl _op040"); case040
#define CASE041 ASM("_op041:", " .globl _op041"); case041
#define CASE042 ASM("_op042:", " .globl _op042"); case042
#define CASE043 ASM("_op043:", " .globl _op043"); case043
#define CASE044 ASM("_op044:", " .globl _op044"); case044
#define CASE045 ASM("_op045:", " .globl _op045"); case045
#define CASE046 ASM("_op046:", " .globl _op046"); case046
#define CASE047 ASM("_op047:", " .globl _op047"); case047
#define CASE050 ASM("_op050:", " .globl _op050"); case050
#define CASE051 ASM("_op051:", " .globl _op051"); case051
#define CASE052 ASM("_op052:", " .globl _op052"); case052
#define CASE053 ASM("_op053:", " .globl _op053"); case053
#define CASE054 ASM("_op054:", " .globl _op054"); case054
#define CASE055 ASM("_op055:", " .globl _op055"); case055
#define CASE056 ASM("_op056:", " .globl _op056"); case056
#define CASE057 ASM("_op057:", " .globl _op057"); case057
#define CASE060 ASM("_op060:", " .globl _op060"); case060
#define CASE061 ASM("_op061:", " .globl _op061"); case061
#define CASE062 ASM("_op062:", " .globl _op062"); case062
#define CASE063 ASM("_op063:", " .globl _op063"); case063
#define CASE064 ASM("_op064:", " .globl _op064"); case064
#define CASE065 ASM("_op065:", " .globl _op065"); case065
#define CASE066 ASM("_op066:", " .globl _op066"); case066
#define CASE067 ASM("_op067:", " .globl _op067"); case067
#define CASE070 ASM("_op070:", " .globl _op070"); case070
#define CASE071 ASM("_op071:", " .globl _op071"); case071
#define CASE072 ASM("_op072:", " .globl _op072"); case072
#define CASE073 ASM("_op073:", " .globl _op073"); case073
#define CASE074 ASM("_op074:", " .globl _op074"); case074
#define CASE075 ASM("_op075:", " .globl _op075"); case075
#define CASE076 ASM("_op076:", " .globl _op076"); case076
#define CASE077 ASM("_op077:", " .globl _op077"); case077
#define CASE100 ASM("_op100:", " .globl _op100"); case100
#define CASE101 ASM("_op101:", " .globl _op101"); case101
#define CASE102 ASM("_op102:", " .globl _op102"); case102
#define CASE103 ASM("_op103:", " .globl _op103"); case103
#define CASE104 ASM("_op104:", " .globl _op104"); case104
#define CASE105 ASM("_op105:", " .globl _op105"); case105
#define CASE106 ASM("_op106:", " .globl _op106"); case106
#define CASE107 ASM("_op107:", " .globl _op107"); case107
#define CASE110 ASM("_op110:", " .globl _op110"); case110
#define CASE111 ASM("_op111:", " .globl _op111"); case111
#define CASE112 ASM("_op112:", " .globl _op112"); case112
#define CASE113 ASM("_op113:", " .globl _op113"); case113
#define CASE114 ASM("_op114:", " .globl _op114"); case114
#define CASE115 ASM("_op115:", " .globl _op115"); case115
#define CASE116 ASM("_op116:", " .globl _op116"); case116
#define CASE117 ASM("_op117:", " .globl _op117"); case117
#define CASE120 ASM("_op120:", " .globl _op120"); case120
#define CASE121 ASM("_op121:", " .globl _op121"); case121
#define CASE122 ASM("_op122:", " .globl _op122"); case122
#define CASE123 ASM("_op123:", " .globl _op123"); case123
#define CASE124 ASM("_op124:", " .globl _op124"); case124
#define CASE125 ASM("_op125:", " .globl _op125"); case125
#define CASE126 ASM("_op126:", " .globl _op126"); case126
#define CASE127 ASM("_op127:", " .globl _op127"); case127
#define CASE130 ASM("_op130:", " .globl _op130"); case130
#define CASE131 ASM("_op131:", " .globl _op131"); case131
#define CASE132 ASM("_op132:", " .globl _op132"); case132
#define CASE133 ASM("_op133:", " .globl _op133"); case133
#define CASE134 ASM("_op134:", " .globl _op134"); case134
#define CASE135 ASM("_op135:", " .globl _op135"); case135
#define CASE136 ASM("_op136:", " .globl _op136"); case136
#define CASE137 ASM("_op137:", " .globl _op137"); case137
#define CASE140 ASM("_op140:", " .globl _op140"); case140
#define CASE141 ASM("_op141:", " .globl _op141"); case141
#define CASE142 ASM("_op142:", " .globl _op142"); case142
#define CASE143 ASM("_op143:", " .globl _op143"); case143
#define CASE144 ASM("_op144:", " .globl _op144"); case144
#define CASE145 ASM("_op145:", " .globl _op145"); case145
#define CASE146 ASM("_op146:", " .globl _op146"); case146
#define CASE147 ASM("_op147:", " .globl _op147"); case147
#define CASE150 ASM("_op150:", " .globl _op150"); case150
#define CASE151 ASM("_op151:", " .globl _op151"); case151
#define CASE152 ASM("_op152:", " .globl _op152"); case152
#define CASE153 ASM("_op153:", " .globl _op153"); case153
#define CASE154 ASM("_op154:", " .globl _op154"); case154
#define CASE155 ASM("_op155:", " .globl _op155"); case155
#define CASE156 ASM("_op156:", " .globl _op156"); case156
#define CASE157 ASM("_op157:", " .globl _op157"); case157
#define CASE160 ASM("_op160:", " .globl _op160"); case160
#define CASE161 ASM("_op161:", " .globl _op161"); case161
#define CASE162 ASM("_op162:", " .globl _op162"); case162
#define CASE163 ASM("_op163:", " .globl _op163"); case163
#define CASE164 ASM("_op164:", " .globl _op164"); case164
#define CASE165 ASM("_op165:", " .globl _op165"); case165
#define CASE166 ASM("_op166:", " .globl _op166"); case166
#define CASE167 ASM("_op167:", " .globl _op167"); case167
#define CASE170 ASM("_op170:", " .globl _op170"); case170
#define CASE171 ASM("_op171:", " .globl _op171"); case171
#define CASE172 ASM("_op172:", " .globl _op172"); case172
#define CASE173 ASM("_op173:", " .globl _op173"); case173
#define CASE174 ASM("_op174:", " .globl _op174"); case174
#define CASE175 ASM("_op175:", " .globl _op175"); case175
#define CASE176 ASM("_op176:", " .globl _op176"); case176
#define CASE177 ASM("_op177:", " .globl _op177"); case177
#define CASE200 ASM("_op200:", " .globl _op200"); case200
#define CASE201 ASM("_op201:", " .globl _op201"); case201
#define CASE202 ASM("_op202:", " .globl _op202"); case202
#define CASE203 ASM("_op203:", " .globl _op203"); case203
#define CASE204 ASM("_op204:", " .globl _op204"); case204
#define CASE205 ASM("_op205:", " .globl _op205"); case205
#define CASE206 ASM("_op206:", " .globl _op206"); case206
#define CASE207 ASM("_op207:", " .globl _op207"); case207
#define CASE210 ASM("_op210:", " .globl _op210"); case210
#define CASE211 ASM("_op211:", " .globl _op211"); case211
#define CASE212 ASM("_op212:", " .globl _op212"); case212
#define CASE213 ASM("_op213:", " .globl _op213"); case213
#define CASE214 ASM("_op214:", " .globl _op214"); case214
#define CASE215 ASM("_op215:", " .globl _op215"); case215
#define CASE216 ASM("_op216:", " .globl _op216"); case216
#define CASE217 ASM("_op217:", " .globl _op217"); case217
#define CASE220 ASM("_op220:", " .globl _op220"); case220
#define CASE221 ASM("_op221:", " .globl _op221"); case221
#define CASE222 ASM("_op222:", " .globl _op222"); case222
#define CASE223 ASM("_op223:", " .globl _op223"); case223
#define CASE224 ASM("_op224:", " .globl _op224"); case224
#define CASE225 ASM("_op225:", " .globl _op225"); case225
#define CASE226 ASM("_op226:", " .globl _op226"); case226
#define CASE227 ASM("_op227:", " .globl _op227"); case227
#define CASE230 ASM("_op230:", " .globl _op230"); case230
#define CASE231 ASM("_op231:", " .globl _op231"); case231
#define CASE232 ASM("_op232:", " .globl _op232"); case232
#define CASE233 ASM("_op233:", " .globl _op233"); case233
#define CASE234 ASM("_op234:", " .globl _op234"); case234
#define CASE235 ASM("_op235:", " .globl _op235"); case235
#define CASE236 ASM("_op236:", " .globl _op236"); case236
#define CASE237 ASM("_op237:", " .globl _op237"); case237
#define CASE240 ASM("_op240:", " .globl _op240"); case240
#define CASE241 ASM("_op241:", " .globl _op241"); case241
#define CASE242 ASM("_op242:", " .globl _op242"); case242
#define CASE243 ASM("_op243:", " .globl _op243"); case243
#define CASE244 ASM("_op244:", " .globl _op244"); case244
#define CASE245 ASM("_op245:", " .globl _op245"); case245
#define CASE246 ASM("_op246:", " .globl _op246"); case246
#define CASE247 ASM("_op247:", " .globl _op247"); case247
#define CASE250 ASM("_op250:", " .globl _op250"); case250
#define CASE251 ASM("_op251:", " .globl _op251"); case251
#define CASE252 ASM("_op252:", " .globl _op252"); case252
#define CASE253 ASM("_op253:", " .globl _op253"); case253
#define CASE254 ASM("_op254:", " .globl _op254"); case254
#define CASE255 ASM("_op255:", " .globl _op255"); case255
#define CASE256 ASM("_op256:", " .globl _op256"); case256
#define CASE257 ASM("_op257:", " .globl _op257"); case257
#define CASE260 ASM("_op260:", " .globl _op260"); case260
#define CASE261 ASM("_op261:", " .globl _op261"); case261
#define CASE262 ASM("_op262:", " .globl _op262"); case262
#define CASE263 ASM("_op263:", " .globl _op263"); case263
#define CASE264 ASM("_op264:", " .globl _op264"); case264
#define CASE265 ASM("_op265:", " .globl _op265"); case265
#define CASE266 ASM("_op266:", " .globl _op266"); case266
#define CASE267 ASM("_op267:", " .globl _op267"); case267
#define CASE270 ASM("_op270:", " .globl _op270"); case270
#define CASE271 ASM("_op271:", " .globl _op271"); case271
#define CASE272 ASM("_op272:", " .globl _op272"); case272
#define CASE273 ASM("_op273:", " .globl _op273"); case273
#define CASE274 ASM("_op274:", " .globl _op274"); case274
#define CASE275 ASM("_op275:", " .globl _op275"); case275
#define CASE276 ASM("_op276:", " .globl _op276"); case276
#define CASE277 ASM("_op277:", " .globl _op277"); case277
#define CASE300 ASM("_op300:", " .globl _op300"); case300
#define CASE301 ASM("_op301:", " .globl _op301"); case301
#define CASE302 ASM("_op302:", " .globl _op302"); case302
#define CASE303 ASM("_op303:", " .globl _op303"); case303
#define CASE304 ASM("_op304:", " .globl _op304"); case304
#define CASE305 ASM("_op305:", " .globl _op305"); case305
#define CASE306 ASM("_op306:", " .globl _op306"); case306
#define CASE307 ASM("_op307:", " .globl _op307"); case307
#define CASE310 ASM("_op310:", " .globl _op310"); case310
#define CASE311 ASM("_op311:", " .globl _op311"); case311
#define CASE312 ASM("_op312:", " .globl _op312"); case312
#define CASE313 ASM("_op313:", " .globl _op313"); case313
#define CASE314 ASM("_op314:", " .globl _op314"); case314
#define CASE315 ASM("_op315:", " .globl _op315"); case315
#define CASE316 ASM("_op316:", " .globl _op316"); case316
#define CASE317 ASM("_op317:", " .globl _op317"); case317
#define CASE320 ASM("_op320:", " .globl _op320"); case320
#define CASE321 ASM("_op321:", " .globl _op321"); case321
#define CASE322 ASM("_op322:", " .globl _op322"); case322
#define CASE323 ASM("_op323:", " .globl _op323"); case323
#define CASE324 ASM("_op324:", " .globl _op324"); case324
#define CASE325 ASM("_op325:", " .globl _op325"); case325
#define CASE326 ASM("_op326:", " .globl _op326"); case326
#define CASE327 ASM("_op327:", " .globl _op327"); case327
#define CASE330 ASM("_op330:", " .globl _op330"); case330
#define CASE331 ASM("_op331:", " .globl _op331"); case331
#define CASE332 ASM("_op332:", " .globl _op332"); case332
#define CASE333 ASM("_op333:", " .globl _op333"); case333
#define CASE334 ASM("_op334:", " .globl _op334"); case334
#define CASE335 ASM("_op335:", " .globl _op335"); case335
#define CASE336 ASM("_op336:", " .globl _op336"); case336
#define CASE337 ASM("_op337:", " .globl _op337"); case337
#define CASE340 ASM("_op340:", " .globl _op340"); case340
#define CASE341 ASM("_op341:", " .globl _op341"); case341
#define CASE342 ASM("_op342:", " .globl _op342"); case342
#define CASE343 ASM("_op343:", " .globl _op343"); case343
#define CASE344 ASM("_op344:", " .globl _op344"); case344
#define CASE345 ASM("_op345:", " .globl _op345"); case345
#define CASE346 ASM("_op346:", " .globl _op346"); case346
#define CASE347 ASM("_op347:", " .globl _op347"); case347
#define CASE350 ASM("_op350:", " .globl _op350"); case350
#define CASE351 ASM("_op351:", " .globl _op351"); case351
#define CASE352 ASM("_op352:", " .globl _op352"); case352
#define CASE353 ASM("_op353:", " .globl _op353"); case353
#define CASE354 ASM("_op354:", " .globl _op354"); case354
#define CASE355 ASM("_op355:", " .globl _op355"); case355
#define CASE356 ASM("_op356:", " .globl _op356"); case356
#define CASE357 ASM("_op357:", " .globl _op357"); case357
#define CASE360 ASM("_op360:", " .globl _op360"); case360
#define CASE361 ASM("_op361:", " .globl _op361"); case361
#define CASE362 ASM("_op362:", " .globl _op362"); case362
#define CASE363 ASM("_op363:", " .globl _op363"); case363
#define CASE364 ASM("_op364:", " .globl _op364"); case364
#define CASE365 ASM("_op365:", " .globl _op365"); case365
#define CASE366 ASM("_op366:", " .globl _op366"); case366
#define CASE367 ASM("_op367:", " .globl _op367"); case367
#define CASE370 ASM("_op370:", " .globl _op370"); case370
#define CASE371 ASM("_op371:", " .globl _op371"); case371
#define CASE372 ASM("_op372:", " .globl _op372"); case372
#define CASE373 ASM("_op373:", " .globl _op373"); case373
#define CASE374 ASM("_op374:", " .globl _op374"); case374
#define CASE375 ASM("_op375:", " .globl _op375"); case375
#define CASE376 ASM("_op376:", " .globl _op376"); case376
#define CASE377 ASM("_op377:", " .globl _op377"); case377

41
inc/rawrs232c.h Executable file
View File

@@ -0,0 +1,41 @@
/* $Id: rawrs232c.h,v 1.2 1999/01/03 02:06:22 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-96 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
typedef struct raw232cparam {
LispPTR BauRate;
LispPTR BitsPerChar;
LispPTR Parity;
LispPTR LocalLine;
LispPTR NoOfStopBits;
LispPTR FlowCnt;
LispPTR InEOL;
LispPTR OutEOL;
LispPTR InputMaxBell;
LispPTR Canon;
LispPTR Echo;
LispPTR ModemStatusLine;
LispPTR RTSCTSCnt;
} RawRSParam;
#define RAW_RS_NONE 1
#define RAW_RS_ODD 2
#define RAW_RS_EVEN 3
#define RAW_RS_XON 2
#define RAW_RS_CR 1
#define RAW_RS_LF 2
#define RAW_RS_CRLF 3

118
inc/return.h Executable file
View File

@@ -0,0 +1,118 @@
/* $Id: return.h,v 1.2 1999/01/03 02:06:22 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/**************************************************************/
/*
File Name : return.h
Desc. : Macros for return,contextsw
Written by : Takeshi Shimizu
11-May-88
*/
/**************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989-98 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#ifdef BIGVM
#define FX_FNHEADER CURRENTFX->fnheader
#else
#define FX_FNHEADER (CURRENTFX->hi2fnheader << 16) | CURRENTFX->lofnheader
#endif /* BIGVM */
/* FAST case return use */
#ifndef ISC
#define FastRetCALL \
{ \
/* Get IVar from Retunee's IVAR offset slot(BF) */ \
IVar = Addr68k_from_LADDR(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \
/* Get FuncObj from Retunee's FNHEAD slot in FX */ \
FuncObj = (struct fnhead *) \
Addr68k_from_LADDR(FX_FNHEADER); \
/* Get PC from Retunee's pc slot in FX */ \
PC = (ByteCode *)FuncObj + CURRENTFX->pc ; \
}
#else
#define FastRetCALL \
{ \
/* Get IVar from Retunee's IVAR offset slot(BF) */ \
IVar = Addr68k_from_LADDR(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \
/* Get FuncObj from Retunee's FNHEAD slot in FX */ \
FuncObj = (struct fnhead *) \
Addr68k_from_LADDR(FX_FNHEADER); \
/* Get PC from Retunee's pc slot in FX */ \
PC = (ByteCode *)FuncObj + CURRENTFX->pc ; \
if (!(FuncObj->byteswapped)) \
{ \
byte_swap_code_block(FuncObj); \
FuncObj->byteswapped = 1; \
} \
}
#endif /* ISC */
/** in CONTEXTSW , for exchanging context **/
#define Midpunt(fxnum) \
{ register DLword midpunt; \
midpunt = LOLOC(LADDR_from_68k(CURRENTFX)); \
PVar=(DLword *) \
Addr68k_from_StkOffset( \
(GETWORD(((DLword *)InterfacePage) +fxnum))) \
+ FRAMESIZE; \
GETWORD(((DLword *)InterfacePage) +fxnum) = midpunt ; \
}
#define CHECKFX \
if (((UNSIGNED)PVar -(UNSIGNED)CURRENTFX) != 20) \
{ printf("Invalid FX(0x%x) and PV(0x%x) \n", \
LADDR_from_68k(CURRENTFX),LADDR_from_68k(PVar)); \
}
/**** Calls when invoke the function is assumed
that it is called by CONTEXTSW in orginal LISP code **/
#define BEFORE_CONTEXTSW \
{ CurrentStackPTR += 2; \
CURRENTFX->nextblock=StkOffset_from_68K(CurrentStackPTR); \
GETWORD(CurrentStackPTR)=STK_FSB_WORD; \
GETWORD(CurrentStackPTR+1)= (((UNSIGNED)EndSTKP-(UNSIGNED)(CurrentStackPTR))>>1); \
if (GETWORD(CurrentStackPTR+1) == 0) error("0-long free block."); \
}
#define AFTER_CONTEXTSW \
{ register DLword *ptr68k,*freeptr; \
ptr68k = (DLword*)Addr68k_from_StkOffset(CURRENTFX->nextblock); \
if(GETWORD(ptr68k) != STK_FSB_WORD) error("pre_moveframe: MP9316"); \
CHECK_FX(CURRENTFX); \
freeptr=ptr68k; \
while(GETWORD(freeptr) == STK_FSB_WORD) \
EndSTKP=freeptr=freeptr+ GETWORD(freeptr+1); \
S_CHECK(CURRENTFX->incall== NIL, "CONTEXTSW during fn call"); \
/*S_CHECK(CURRENTFX->nopush== NIL, "CONTEXTSW, NOPUSH is set"); ** JDS 4/9/96 this seems not to matter, so I removed it. */\
CurrentStackPTR = ptr68k- 2 ; \
CHECK_FX(CURRENTFX); \
S_CHECK( EndSTKP > CurrentStackPTR, \
"End of stack isn't beyond current stk pointer."); \
}

172
inc/rs232c.h Executable file
View File

@@ -0,0 +1,172 @@
/* $Id: rs232c.h,v 1.2 1999/01/03 02:06:22 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-96 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#include<stdio.h>
#include<fcntl.h>
#include<sgtty.h>
#include "lispemul.h"
#include "adr68k.h"
#include "lispmap.h"
/*
RS232C Buffer Status
*/
#define INACTIVE 0
#define ACTIVE 1
#define TERMINATED 2
/*
DLRS232C.IOP.COMMANDS
*/
#define ON 0
#define OFF 1
#define BREAK_ON 2
#define BREAK_OFF 3
#define ABORT_INPUT 4
#define ABORT_OUTPUT 5
#define SET_RS366_STATUS 6
#define GET_STATUS 7
#define MAJOR_SET_PARAMETERS 8
#define MINOR_SET_PARAMETERS 14
#define SET_CHANNEL_RESET_FLAG 15
/*
Devise Status
*/
#define IOP_DATA_LINE.OCCUPIED 4096
#define PRESENT_NEXT_DIGIT 2048
#define CALL_ORIGINATION_STATUS 1024
#define ABANDON_CALL_AND_RETRY 512
#define POWER_INDICATION 256
#define REAK_DETECTED 128
#define DATA_LOST 64
#define CLEAR_TO.SEND 32
#define NOT_DEFINED 16
#define CARRIER_DETECT 8
#define RING_HEARD 4
#define DATA_SET.READY 2
#define RING_INDICATOR 1
/*
RS232C Data Structure
*/
typedef struct {
DLword frame_timeout;
DLbyte correspondent;
DLbyte synch_char;
unsigned reset_ring_heard : 1;
unsigned reset_break_detected : 1;
unsigned reset_data_lost : 1;
unsigned request_to_send : 1;
unsigned data_terminal_ready : 1;
unsigned stop_bits : 1;
unsigned line_type : 2;
unsigned parity : 3;
unsigned char_length : 2;
unsigned synch_count : 3;
unsigned nil1 : 3;
unsigned line_speed : 5;
DLbyte nil2;
DLword interrupt_mask;
DLword flowcontrol_on;
DLword flowcontrol_xon_char;
DLword flowcontrol_xoff_char;
} DLRS232C_PARAMETER_CSB;
typedef struct {
DLword block_pointer_lo;
DLword block_pointer_hi;
DLword byte_count;
DLword returned_byte_count;
DLword transfer_status;
DLword nil1;
unsigned completed : 1;
unsigned put : 1;
unsigned nil2 : 6;
LispPTR synch_event;
LispPTR next;
} DLRS232C_IOCB;
typedef struct {
unsigned success : 1;
unsigned nil2 : 6;
unsigned data_lost : 1;
unsigned device_error : 1;
unsigned frame_timeout : 1;
unsigned checksum_error : 1;
unsigned parity_error : 1;
unsigned asynch_frame_error : 1;
unsigned invalid_character : 1;
unsigned aborted : 1;
unsigned disaster : 1;
} DLRS232C_IOCB_TRANSFER_STATUS;
typedef struct {
unsigned rs232c_absent : 1;
unsigned nil : 15;
} DLRS232C_HDW_CONF;
typedef struct {
unsigned busy : 1;
unsigned nil : 15;
} DLRS232C_IOP_GET_FLAG;
typedef struct {
unsigned busy : 1;
unsigned nil : 15;
} DLRS232C_IOP_PUT_FLAG;
typedef struct {
unsigned busy : 1;
unsigned nil : 11;
unsigned command : 4;
} DLRS232C_IOP_MISC_CMD;
typedef struct {
unsigned success : 1;
unsigned nil : 14;
unsigned unimplemented : 1;
} DLRS232C_PARAMETER_OUTCOME;
typedef struct {
unsigned nil1 : 3;
unsigned data_line_occupied : 1;
unsigned present_next_digit : 1;
unsigned call_origination_status : 1;
unsigned abandon_call_and_retry : 1;
unsigned power_indication : 1;
unsigned break_detected : 1;
unsigned data_lost : 1;
unsigned clear_to_send : 1;
unsigned nil2 : 1;
unsigned carrier_detect : 1;
unsigned ring_heard : 1;
unsigned data_set_ready : 1;
unsigned ring_indicator : 1;
} DLRS232C_DEVICE_STATUS;
typedef struct {
DLword nil[22];
DLword rs232c_length;
char rs232c_data;
} RS232C_ENCAPSULATION;
extern DLword *Lisp_world;

Some files were not shown because too many files have changed in this diff Show More