mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-16 08:15:31 +00:00
This also involves removing unnecessary forward declarations, inserting
includes for all cross-file function references, making some definitions
static if they are not otherwise used, correcting errors that were exposed
by having correct prototypes.
new file: inc/allocmdsdefs.h
new file: inc/arith2defs.h
new file: inc/arith3defs.h
new file: inc/arith4defs.h
new file: inc/array2defs.h
new file: inc/array3defs.h
new file: inc/array4defs.h
new file: inc/array5defs.h
new file: inc/array6defs.h
new file: inc/arraydefs.h
new file: inc/bbtsubdefs.h
new file: inc/bindefs.h
new file: inc/bindsdefs.h
new file: inc/bitbltdefs.h
new file: inc/bltdefs.h
new file: inc/byteswapdefs.h
new file: inc/car-cdrdefs.h
new file: inc/chardevdefs.h
new file: inc/commondefs.h
new file: inc/conspagedefs.h
new file: inc/dbgtooldefs.h
new file: inc/dirdefs.h
new file: inc/drawdefs.h
new file: inc/dskdefs.h
new file: inc/dspifdefs.h
new file: inc/dspsubrsdefs.h
new file: inc/eqfdefs.h
new file: inc/etherdefs.h
new file: inc/findkeydefs.h
new file: inc/fpdefs.h
new file: inc/fvardefs.h
new file: inc/gc2defs.h
new file: inc/gcarraydefs.h
new file: inc/gccodedefs.h
new file: inc/gcdefs.h
new file: inc/gcfinaldefs.h
new file: inc/gchtfinddefs.h
new file: inc/gcmain3defs.h
new file: inc/gcoflowdefs.h
new file: inc/gcrcelldefs.h
new file: inc/gcrdefs.h
new file: inc/gcscandefs.h
new file: inc/gvar2defs.h
new file: inc/hacksdefs.h
new file: inc/hardrtndefs.h
new file: inc/inetdefs.h
new file: inc/initdspdefs.h
new file: inc/initkbddefs.h
new file: inc/initsoutdefs.h
modified: inc/inlineC.h
new file: inc/intcalldefs.h
new file: inc/kbdsubrsdefs.h
new file: inc/keyeventdefs.h
new file: inc/keylibdefs.h
new file: inc/kprintdefs.h
new file: inc/ldsoutdefs.h
new file: inc/lineblt8defs.h
new file: inc/lisp2cdefs.h
modified: inc/lispemul.h
new file: inc/llcolordefs.h
new file: inc/llstkdefs.h
modified: inc/lnk-inlineC.h
new file: inc/loopsopsdefs.h
new file: inc/lowlev1defs.h
new file: inc/lowlev2defs.h
new file: inc/lsthandldefs.h
new file: inc/maindefs.h
new file: inc/misc7defs.h
new file: inc/miscndefs.h
new file: inc/mkatomdefs.h
new file: inc/mkcelldefs.h
new file: inc/mvsdefs.h
new file: inc/osmsgdefs.h
new file: inc/perrnodefs.h
new file: inc/returndefs.h
new file: inc/rpcdefs.h
new file: inc/rplconsdefs.h
new file: inc/shiftdefs.h
new file: inc/storagedefs.h
new file: inc/subr0374defs.h
new file: inc/subrdefs.h
new file: inc/sxhashdefs.h
new file: inc/testtooldefs.h
new file: inc/timerdefs.h
new file: inc/typeofdefs.h
new file: inc/ubf1defs.h
new file: inc/ubf2defs.h
new file: inc/ubf3defs.h
new file: inc/ufsdefs.h
new file: inc/unixcommdefs.h
new file: inc/unwinddefs.h
new file: inc/uraiddefs.h
new file: inc/usrsubrdefs.h
new file: inc/uutilsdefs.h
new file: inc/vars3defs.h
new file: inc/vmemsavedefs.h
new file: inc/xbbtdefs.h
new file: inc/xcdefs.h
new file: inc/xcursordefs.h
new file: inc/xinitdefs.h
new file: inc/xlspwindefs.h
new file: inc/xmkicondefs.h
new file: inc/xrdoptdefs.h
new file: inc/xscrolldefs.h
new file: inc/xwinmandefs.h
new file: inc/z2defs.h
modified: src/allocmds.c
modified: src/arith2.c
modified: src/arith3.c
modified: src/arith4.c
modified: src/array.c
modified: src/array2.c
modified: src/array3.c
modified: src/array4.c
modified: src/array5.c
modified: src/array6.c
modified: src/bbtsub.c
modified: src/bin.c
modified: src/binds.c
modified: src/bitblt.c
modified: src/blt.c
modified: src/byteswap.c
modified: src/car-cdr.c
modified: src/chardev.c
modified: src/common.c
modified: src/conspage.c
modified: src/dbgtool.c
modified: src/dir.c
modified: src/draw.c
modified: src/dsk.c
modified: src/dspif.c
modified: src/dspsubrs.c
modified: src/eqf.c
modified: src/ether.c
modified: src/findkey.c
modified: src/foreign.c
modified: src/fp.c
modified: src/fvar.c
modified: src/gc.c
modified: src/gc2.c
modified: src/gcarray.c
modified: src/gccode.c
modified: src/gcfinal.c
modified: src/gchtfind.c
modified: src/gcmain3.c
modified: src/gcoflow.c
modified: src/gcr.c
modified: src/gcrcell.c
modified: src/gcscan.c
modified: src/gvar2.c
modified: src/hacks.c
modified: src/hardrtn.c
modified: src/inet.c
modified: src/initdsp.c
modified: src/initkbd.c
modified: src/initsout.c
modified: src/intcall.c
modified: src/kbdsubrs.c
modified: src/keyevent.c
modified: src/keylib.c
modified: src/kprint.c
modified: src/ldsout.c
modified: src/lineblt8.c
modified: src/lisp2c.c
modified: src/llcolor.c
modified: src/llstk.c
modified: src/loopsops.c
modified: src/lowlev1.c
modified: src/lowlev2.c
modified: src/lsthandl.c
modified: src/main.c
modified: src/misc7.c
modified: src/miscn.c
modified: src/mkatom.c
modified: src/mkcell.c
modified: src/mvs.c
modified: src/osmsg.c
modified: src/perrno.c
modified: src/return.c
modified: src/rpc.c
modified: src/rplcons.c
modified: src/setsout.c
modified: src/shift.c
modified: src/storage.c
modified: src/subr.c
modified: src/subr0374.c
modified: src/sxhash.c
modified: src/testtool.c
modified: src/timer.c
modified: src/truecolor.c
modified: src/tstsout.c
modified: src/typeof.c
modified: src/ubf1.c
modified: src/ubf2.c
modified: src/ubf3.c
modified: src/ufn.c
modified: src/ufs.c
modified: src/unixcomm.c
modified: src/unwind.c
modified: src/uraid.c
modified: src/usrsubr.c
modified: src/uutils.c
modified: src/vars3.c
modified: src/vmemsave.c
modified: src/xbbt.c
modified: src/xc.c
modified: src/xcursor.c
modified: src/xinit.c
modified: src/xlspwin.c
modified: src/xmkicon.c
modified: src/xrdopt.c
modified: src/xscroll.c
modified: src/xwinman.c
modified: src/z2.c
204 lines
6.0 KiB
C
204 lines
6.0 KiB
C
/* $Id: mkcell.c,v 1.3 1999/05/31 23:35:39 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
|
|
*/
|
|
static char *id = "$Id: mkcell.c,v 1.3 1999/05/31 23:35:39 sybalsky Exp $ Copyright (C) Venue";
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
|
/* Manufactured in the United States of America. */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
#include "version.h"
|
|
|
|
/***********************************************************************/
|
|
/*
|
|
File Name : mkcell.c
|
|
|
|
Desc :
|
|
|
|
Date : Jun. 4, 1987
|
|
Edited by : Takeshi Shimizu
|
|
Changed : 9 Jun 1987 take
|
|
26 Oct. 1987 take(add mask)
|
|
|
|
Including : OP_createcell
|
|
|
|
|
|
*/
|
|
/**********************************************************************/
|
|
|
|
#include "lispemul.h"
|
|
#include "lispmap.h"
|
|
#include "emlglob.h"
|
|
#include "lspglob.h"
|
|
#include "lsptypes.h"
|
|
#include "address.h"
|
|
#include "adr68k.h"
|
|
#include "cell.h"
|
|
#include "gc.h"
|
|
|
|
#include "mkcelldefs.h"
|
|
#include "allocmdsdefs.h"
|
|
#include "commondefs.h"
|
|
#include "gchtfinddefs.h"
|
|
|
|
static LispPTR oldoldfree;
|
|
static LispPTR oldfree;
|
|
|
|
LispPTR *alloc_mdspage(register short int type);
|
|
LispPTR initmdspage(register LispPTR *base, register DLword size, register LispPTR prev);
|
|
|
|
LispPTR N_OP_createcell(register LispPTR tos) {
|
|
register struct dtd *dtd68k;
|
|
register DLword *ptr, *lastptr;
|
|
register LispPTR newcell;
|
|
register unsigned int type;
|
|
|
|
if ((tos & SEGMASK) != S_POSITIVE) ERROR_EXIT(tos);
|
|
type = tos & 0xffff;
|
|
|
|
#ifdef DTDDEBUG
|
|
if (type == TYPE_LISTP) error("N_OP_createcell : Can't create Listp cell with CREATECELL");
|
|
check_dtd_chain(type);
|
|
#endif
|
|
|
|
dtd68k = (struct dtd *)GetDTD(type);
|
|
|
|
oldoldfree = oldfree;
|
|
oldfree = dtd68k->dtd_free;
|
|
|
|
if (dtd68k->dtd_size == 0) ERROR_EXIT(tos);
|
|
/* error("OP_createcell : Attempt to create a cell not declared yet"); */
|
|
|
|
retry:
|
|
if ((tos = newcell = ((dtd68k->dtd_free) & POINTERMASK)) != NIL) {
|
|
ptr = (DLword *)Addr68k_from_LADDR(newcell);
|
|
if (917505 == *(LispPTR *)ptr) error("N_OP_createcell E0001 error");
|
|
/* replace dtd_free with newcell's top DLword (it may keep next chain)*/
|
|
dtd68k->dtd_free = (*((LispPTR *)ptr)) & POINTERMASK;
|
|
if (dtd68k->dtd_free & 0x8000001) error("bad entry on free chain.");
|
|
|
|
dtd68k->dtd_oldcnt++;
|
|
|
|
/* clear 0 */
|
|
for (lastptr = ptr + dtd68k->dtd_size; ptr != lastptr; ptr++) { GETWORD(ptr) = 0; }
|
|
|
|
/* IncAllocCnt(1); */
|
|
GCLOOKUP(tos, DELREF);
|
|
return (tos);
|
|
} else {
|
|
dtd68k->dtd_free = initmdspage(alloc_mdspage(dtd68k->dtd_typeentry), dtd68k->dtd_size, NIL);
|
|
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
|
|
goto retry;
|
|
}
|
|
|
|
} /* N_OP_createcell end */
|
|
|
|
DLword *createcell68k(unsigned int type) {
|
|
register struct dtd *dtd68k;
|
|
register DLword *ptr, *lastptr;
|
|
register LispPTR newcell;
|
|
#ifdef DTDDEBUG
|
|
if (type == TYPE_LISTP) error("createcell : Can't create Listp cell with CREATECELL");
|
|
if (type == TYPE_STREAM) stab();
|
|
|
|
check_dtd_chain(type);
|
|
|
|
#endif
|
|
|
|
dtd68k = (struct dtd *)GetDTD(type);
|
|
|
|
if (dtd68k->dtd_size == 0) error("createcell : Attempt to create a cell not declared yet");
|
|
|
|
retry:
|
|
if ((newcell = (dtd68k->dtd_free & POINTERMASK)) != NIL) {
|
|
#ifdef DTDDEBUG
|
|
if (type != GetTypeNumber(newcell)) error("createcell : BAD cell in dtdfree");
|
|
if (newcell > POINTERMASK) error("createcell : BAD Lisp address");
|
|
#endif
|
|
|
|
ptr = Addr68k_from_LADDR(newcell);
|
|
|
|
if (917505 == *(LispPTR *)ptr) error("N_OP_createcell E0001 error");
|
|
|
|
/* replace dtd_free with newcell's top DLword (it may keep next chain)*/
|
|
dtd68k->dtd_free = (*((LispPTR *)ptr)) & POINTERMASK;
|
|
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
|
|
|
|
#ifdef DTDDEBUG
|
|
if ((dtd68k->dtd_free != 0) && (type != GetTypeNumber(dtd68k->dtd_free)))
|
|
error("createcell : BAD cell in next dtdfree");
|
|
check_dtd_chain(type);
|
|
|
|
#endif
|
|
|
|
dtd68k->dtd_oldcnt++;
|
|
|
|
/* clear 0 */
|
|
for (lastptr = ptr + dtd68k->dtd_size; ptr != lastptr; ptr++) { GETWORD(ptr) = 0; }
|
|
|
|
/* IncAllocCnt(1); */
|
|
GCLOOKUP(newcell, DELREF);
|
|
|
|
#ifdef DTDDEBUG
|
|
check_dtd_chain(type);
|
|
#endif
|
|
|
|
return (Addr68k_from_LADDR(newcell));
|
|
|
|
} else {
|
|
dtd68k->dtd_free = initmdspage(alloc_mdspage(dtd68k->dtd_typeentry), dtd68k->dtd_size, NIL);
|
|
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
|
|
|
|
#ifdef DTDDEBUG
|
|
check_dtd_chain(type);
|
|
#endif
|
|
|
|
goto retry;
|
|
}
|
|
|
|
} /* createcell68k end */
|
|
|
|
/**********************************************************/
|
|
/* Create a Cell of Specified Type & Set to given Value */
|
|
/* Works with 32 bit typed values only. */
|
|
/* (Initially used only by native code) */
|
|
/**********************************************************/
|
|
|
|
LispPTR Create_n_Set_Cell(unsigned int type, LispPTR value) {
|
|
register struct dtd *dtd68k;
|
|
register DLword *ptr, *lastptr;
|
|
register LispPTR newcell;
|
|
|
|
dtd68k = (struct dtd *)GetDTD(type);
|
|
|
|
if (dtd68k->dtd_size == 0) error("createcell : Attempt to create a cell not declared yet");
|
|
|
|
retry:
|
|
if ((newcell = (dtd68k->dtd_free & POINTERMASK)) != NIL) {
|
|
ptr = Addr68k_from_LADDR(newcell);
|
|
|
|
/* replace dtd_free with newcell's top DLword (it may keep next chain)*/
|
|
|
|
dtd68k->dtd_free = (*((LispPTR *)ptr)) & POINTERMASK;
|
|
dtd68k->dtd_oldcnt++;
|
|
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
|
|
|
|
/* clear 0 */
|
|
for (lastptr = ptr + dtd68k->dtd_size; ptr != lastptr; ptr++) { GETWORD(ptr) = 0; }
|
|
|
|
/* IncAllocCnt(1); */
|
|
GCLOOKUP(newcell, DELREF);
|
|
(*((LispPTR *)Addr68k_from_LADDR(newcell))) = value;
|
|
return (newcell);
|
|
|
|
} else {
|
|
dtd68k->dtd_free = initmdspage(alloc_mdspage(dtd68k->dtd_typeentry), dtd68k->dtd_size, NIL);
|
|
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
|
|
|
|
goto retry;
|
|
}
|
|
|
|
} /* createcell68k end */
|