1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-15 15:57:13 +00:00
Nick Briggs 0ad69fc6fe Create a new inc/xxxdefs.h for each src/xxx.c containing appropriate function prototypes.
This also involves removing unnecessary forward declarations, inserting
       includes for all cross-file function references, making some definitions
       static if they are not otherwise used, correcting errors that were exposed
       by having correct prototypes.

	new file:   inc/allocmdsdefs.h
	new file:   inc/arith2defs.h
	new file:   inc/arith3defs.h
	new file:   inc/arith4defs.h
	new file:   inc/array2defs.h
	new file:   inc/array3defs.h
	new file:   inc/array4defs.h
	new file:   inc/array5defs.h
	new file:   inc/array6defs.h
	new file:   inc/arraydefs.h
	new file:   inc/bbtsubdefs.h
	new file:   inc/bindefs.h
	new file:   inc/bindsdefs.h
	new file:   inc/bitbltdefs.h
	new file:   inc/bltdefs.h
	new file:   inc/byteswapdefs.h
	new file:   inc/car-cdrdefs.h
	new file:   inc/chardevdefs.h
	new file:   inc/commondefs.h
	new file:   inc/conspagedefs.h
	new file:   inc/dbgtooldefs.h
	new file:   inc/dirdefs.h
	new file:   inc/drawdefs.h
	new file:   inc/dskdefs.h
	new file:   inc/dspifdefs.h
	new file:   inc/dspsubrsdefs.h
	new file:   inc/eqfdefs.h
	new file:   inc/etherdefs.h
	new file:   inc/findkeydefs.h
	new file:   inc/fpdefs.h
	new file:   inc/fvardefs.h
	new file:   inc/gc2defs.h
	new file:   inc/gcarraydefs.h
	new file:   inc/gccodedefs.h
	new file:   inc/gcdefs.h
	new file:   inc/gcfinaldefs.h
	new file:   inc/gchtfinddefs.h
	new file:   inc/gcmain3defs.h
	new file:   inc/gcoflowdefs.h
	new file:   inc/gcrcelldefs.h
	new file:   inc/gcrdefs.h
	new file:   inc/gcscandefs.h
	new file:   inc/gvar2defs.h
	new file:   inc/hacksdefs.h
	new file:   inc/hardrtndefs.h
	new file:   inc/inetdefs.h
	new file:   inc/initdspdefs.h
	new file:   inc/initkbddefs.h
	new file:   inc/initsoutdefs.h
	modified:   inc/inlineC.h
	new file:   inc/intcalldefs.h
	new file:   inc/kbdsubrsdefs.h
	new file:   inc/keyeventdefs.h
	new file:   inc/keylibdefs.h
	new file:   inc/kprintdefs.h
	new file:   inc/ldsoutdefs.h
	new file:   inc/lineblt8defs.h
	new file:   inc/lisp2cdefs.h
	modified:   inc/lispemul.h
	new file:   inc/llcolordefs.h
	new file:   inc/llstkdefs.h
	modified:   inc/lnk-inlineC.h
	new file:   inc/loopsopsdefs.h
	new file:   inc/lowlev1defs.h
	new file:   inc/lowlev2defs.h
	new file:   inc/lsthandldefs.h
	new file:   inc/maindefs.h
	new file:   inc/misc7defs.h
	new file:   inc/miscndefs.h
	new file:   inc/mkatomdefs.h
	new file:   inc/mkcelldefs.h
	new file:   inc/mvsdefs.h
	new file:   inc/osmsgdefs.h
	new file:   inc/perrnodefs.h
	new file:   inc/returndefs.h
	new file:   inc/rpcdefs.h
	new file:   inc/rplconsdefs.h
	new file:   inc/shiftdefs.h
	new file:   inc/storagedefs.h
	new file:   inc/subr0374defs.h
	new file:   inc/subrdefs.h
	new file:   inc/sxhashdefs.h
	new file:   inc/testtooldefs.h
	new file:   inc/timerdefs.h
	new file:   inc/typeofdefs.h
	new file:   inc/ubf1defs.h
	new file:   inc/ubf2defs.h
	new file:   inc/ubf3defs.h
	new file:   inc/ufsdefs.h
	new file:   inc/unixcommdefs.h
	new file:   inc/unwinddefs.h
	new file:   inc/uraiddefs.h
	new file:   inc/usrsubrdefs.h
	new file:   inc/uutilsdefs.h
	new file:   inc/vars3defs.h
	new file:   inc/vmemsavedefs.h
	new file:   inc/xbbtdefs.h
	new file:   inc/xcdefs.h
	new file:   inc/xcursordefs.h
	new file:   inc/xinitdefs.h
	new file:   inc/xlspwindefs.h
	new file:   inc/xmkicondefs.h
	new file:   inc/xrdoptdefs.h
	new file:   inc/xscrolldefs.h
	new file:   inc/xwinmandefs.h
	new file:   inc/z2defs.h
	modified:   src/allocmds.c
	modified:   src/arith2.c
	modified:   src/arith3.c
	modified:   src/arith4.c
	modified:   src/array.c
	modified:   src/array2.c
	modified:   src/array3.c
	modified:   src/array4.c
	modified:   src/array5.c
	modified:   src/array6.c
	modified:   src/bbtsub.c
	modified:   src/bin.c
	modified:   src/binds.c
	modified:   src/bitblt.c
	modified:   src/blt.c
	modified:   src/byteswap.c
	modified:   src/car-cdr.c
	modified:   src/chardev.c
	modified:   src/common.c
	modified:   src/conspage.c
	modified:   src/dbgtool.c
	modified:   src/dir.c
	modified:   src/draw.c
	modified:   src/dsk.c
	modified:   src/dspif.c
	modified:   src/dspsubrs.c
	modified:   src/eqf.c
	modified:   src/ether.c
	modified:   src/findkey.c
	modified:   src/foreign.c
	modified:   src/fp.c
	modified:   src/fvar.c
	modified:   src/gc.c
	modified:   src/gc2.c
	modified:   src/gcarray.c
	modified:   src/gccode.c
	modified:   src/gcfinal.c
	modified:   src/gchtfind.c
	modified:   src/gcmain3.c
	modified:   src/gcoflow.c
	modified:   src/gcr.c
	modified:   src/gcrcell.c
	modified:   src/gcscan.c
	modified:   src/gvar2.c
	modified:   src/hacks.c
	modified:   src/hardrtn.c
	modified:   src/inet.c
	modified:   src/initdsp.c
	modified:   src/initkbd.c
	modified:   src/initsout.c
	modified:   src/intcall.c
	modified:   src/kbdsubrs.c
	modified:   src/keyevent.c
	modified:   src/keylib.c
	modified:   src/kprint.c
	modified:   src/ldsout.c
	modified:   src/lineblt8.c
	modified:   src/lisp2c.c
	modified:   src/llcolor.c
	modified:   src/llstk.c
	modified:   src/loopsops.c
	modified:   src/lowlev1.c
	modified:   src/lowlev2.c
	modified:   src/lsthandl.c
	modified:   src/main.c
	modified:   src/misc7.c
	modified:   src/miscn.c
	modified:   src/mkatom.c
	modified:   src/mkcell.c
	modified:   src/mvs.c
	modified:   src/osmsg.c
	modified:   src/perrno.c
	modified:   src/return.c
	modified:   src/rpc.c
	modified:   src/rplcons.c
	modified:   src/setsout.c
	modified:   src/shift.c
	modified:   src/storage.c
	modified:   src/subr.c
	modified:   src/subr0374.c
	modified:   src/sxhash.c
	modified:   src/testtool.c
	modified:   src/timer.c
	modified:   src/truecolor.c
	modified:   src/tstsout.c
	modified:   src/typeof.c
	modified:   src/ubf1.c
	modified:   src/ubf2.c
	modified:   src/ubf3.c
	modified:   src/ufn.c
	modified:   src/ufs.c
	modified:   src/unixcomm.c
	modified:   src/unwind.c
	modified:   src/uraid.c
	modified:   src/usrsubr.c
	modified:   src/uutils.c
	modified:   src/vars3.c
	modified:   src/vmemsave.c
	modified:   src/xbbt.c
	modified:   src/xc.c
	modified:   src/xcursor.c
	modified:   src/xinit.c
	modified:   src/xlspwin.c
	modified:   src/xmkicon.c
	modified:   src/xrdopt.c
	modified:   src/xscroll.c
	modified:   src/xwinman.c
	modified:   src/z2.c
2020-09-04 18:21:44 -07:00

147 lines
4.4 KiB
C

/* $Id: binds.c,v 1.3 1999/05/31 23:35:24 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
static char *id = "$Id: binds.c,v 1.3 1999/05/31 23:35:24 sybalsky Exp $ Copyright (C) Venue";
/************************************************************************/
/* */
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include "version.h"
#include <stdio.h>
#include "lispemul.h"
#include "lspglob.h"
#include "emlglob.h"
#include "bindsdefs.h"
/**************************************************
N_OP_bind(stack_pointer, tos, n1, n2)
Entry: BIND opcode[021]
1. bind PVAR slot to NIL. (n1 times)
2. bind PVAR slot to value of slot in Evaluation stack. (n2 times)
or push TopOfStack to Evaluation stack.
3. Push [upper word] 1's complement of bind slots
[lower word] 2word offset from PVar
***************************************************/
LispPTR *N_OP_bind(register LispPTR *stack_pointer, register LispPTR tos, int byte1, int byte2) {
register int n1; /* # slots to bind to NIL (0, 0) */
register int n2; /* # slots to bind to value in stack */
register LispPTR *ppvar; /* pointer to argued slot in Pvar area */
register int i; /* temporary for control */
#ifdef TRACE
printPC();
printf("TRACE: N_OP_bind()\n");
#endif
n1 = byte1 >> 4;
n2 = byte1 & 0xf;
ppvar = (LispPTR *)PVar + 1 + byte2;
for (i = 0; i < n1; i++) { *--ppvar = NIL_PTR; }
if (n2 == 0) {
*stack_pointer++ = tos; /* push TopOfStack to Evaluation stack */
} else {
*--ppvar = tos; /* bind to TopOfStack */
for (i = 1; i < n2; i++) { *--ppvar = *(--stack_pointer); }
}
i = ~(n1 + n2); /* x: 1's complement of number of bind slots */
*stack_pointer = (i << 16) | (byte2 << 1);
return (stack_pointer);
}
/**************************************************
LispPTR N_OP_unbind(stackpointer)
Entry: UNBIND opcode[022]
1. pop stackpointer until the slot (num, lastpvar) is found
(Note: TOPOFSTACK is ignored)
2. unbind lastpvar slot (set to 0xFFFF). (num times)
***************************************************/
LispPTR *N_OP_unbind(register LispPTR *stack_pointer) {
register DLword num; /* number of unbind sot */
register LispPTR *ppvar; /* pointer to last PVAR slot. */
register DLword i; /* temporary for control */
register LispPTR value;
#ifdef TRACE
printPC();
printf("TRACE: N_OP_unbind()\n");
#endif
/* now, stack_pointer points the latter part in slot */
for (; !(*--stack_pointer & 0x80000000);)
; /* scan (until MSB == 1) */
value = *stack_pointer;
num = (DLword) ~(value >> 16);
ppvar = (LispPTR *)(PVar + 2 + GetLoWord(value));
value = 0xffffffff;
for (i = 0; i < num; i++) { *--ppvar = value; }
return (stack_pointer);
}
/**************************************************
N_OP_dunbind
Entry: DUNBIND opcode[023]
1. if TopOfStack is unbound
unbind num slots from PVar.
if TopOfStack is bound
pop CurrentStack until the slot (num, lastpvar) is found.
unbind num slots from lastpvar.
2. pop the top of CurrentStackPTR to TopOfStack.
***************************************************/
LispPTR *N_OP_dunbind(register LispPTR *stack_pointer, register LispPTR tos) {
register DLword num; /* number of unbind sot */
register LispPTR *ppvar; /* pointer to last PVAR slot. */
register DLword i; /* temporary for control */
register LispPTR value;
#ifdef TRACE
printPC();
printf("TRACE: N_OP_dunbind()\n");
#endif
if (tos & 0x80000000) {
/* check MSB bit of High word in tos, 1: unbound, 0: bound */
/* tos is unbound */
num = ~(GetHiWord(tos));
value = 0xffffffff;
if (num != 0) {
ppvar = (LispPTR *)(PVar + 2 + GetLoWord(tos));
for (i = 0; i < num; ++i) { *--ppvar = value; }
}
} else {
/* tos is bound */
/* now, stack_pointer points the latter part in slot */
for (; !((*--stack_pointer) & 0x80000000);)
;
/* scan (until MSB == 1) */
value = *stack_pointer;
num = ~(GetHiWord(value));
ppvar = (LispPTR *)(PVar + 2 + GetLoWord(value));
value = 0xffffffff;
for (i = 0; i < num; i++) { *--ppvar = value; }
}
return (stack_pointer);
}