mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-27 20:27:45 +00:00
Combine six small array opcode implementation files into one
Combines the array..array6 files and their associated header files into new arrayops.c/arrayopsdefs.h files, and adjusts the CMakeLists.txt and old-style makefile-tail to reflect these changes.
This commit is contained in:
49
src/array.c
49
src/array.c
@@ -1,49 +0,0 @@
|
||||
/* @(#) array.c Version 2.8 (12/23/88). copyright envos & Fuji Xerox */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
||||
/* Manufactured in the United States of America. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "version.h"
|
||||
#include "arraydefs.h" // for N_OP_misc3
|
||||
#include "emlglob.h"
|
||||
#include "lispemul.h" // for state, LispPTR, ERROR_EXIT
|
||||
#include "lspglob.h"
|
||||
#include "my.h" // for aref_switch, N_GetPos
|
||||
|
||||
|
||||
/************************************************************
|
||||
OP_claref -- op 372/9 (base typenumber index)
|
||||
|
||||
type size typenumber
|
||||
0 0 0 unsigned : 1 bit
|
||||
0 3 3 unsigned : 8 bits
|
||||
0 4 4 unsigned : 16 bits
|
||||
1 4 20 signed : 16 bits
|
||||
1 6 22 signed : 32 bits
|
||||
2 6 38 pointer : 32 bits
|
||||
3 6 54 float : 32 bits
|
||||
4 3 67 character : 8 bits
|
||||
4 4 68 character : 16 bits
|
||||
5 6 86 Xpointer : 32 bits
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
/*** N_OP_misc3 -- op 372/9 (base typenumber index) ***/
|
||||
LispPTR N_OP_misc3(LispPTR baseL, LispPTR typenumber, LispPTR inx, int alpha) {
|
||||
register int index, type;
|
||||
|
||||
if (alpha != 9) ERROR_EXIT(inx);
|
||||
/* test and setup index */
|
||||
N_GetPos(inx, index, inx);
|
||||
|
||||
/* test and setup typenumber */
|
||||
N_GetPos(typenumber, type, inx);
|
||||
|
||||
/* disp on type */
|
||||
return (aref_switch(type, inx, baseL, index));
|
||||
} /* end N_OP_misc3() */
|
||||
52
src/array2.c
52
src/array2.c
@@ -1,52 +0,0 @@
|
||||
/* This is G-file @(#) array2.c Version 2.9 (10/12/88). copyright Xerox & Fuji Xerox */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
||||
/* Manufactured in the United States of America. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* A R R A Y 2 . C */
|
||||
/* */
|
||||
/* Contains N_OP_misc4, the ASET opcode. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
#include "version.h"
|
||||
#include "array2defs.h" // for N_OP_misc4
|
||||
#include "emlglob.h"
|
||||
#include "lispemul.h" // for state, LispPTR, ERROR_EXIT
|
||||
#include "lspglob.h"
|
||||
#include "lsptypes.h"
|
||||
#include "my.h" // for N_GetPos, aset_switch
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* N _ O P _ m i s c 4 */
|
||||
/* */
|
||||
/* CL:ASET opcode op 373/7 (data, base typenumber, index) */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
LispPTR N_OP_misc4(register LispPTR data, register LispPTR base, register LispPTR typenumber,
|
||||
register LispPTR inx, int alpha) {
|
||||
register int new;
|
||||
register int index;
|
||||
int type;
|
||||
|
||||
if (alpha != 7) ERROR_EXIT(inx);
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx, index, inx);
|
||||
|
||||
/* test and setup typenumber */
|
||||
N_GetPos(typenumber, type, inx);
|
||||
|
||||
aset_switch(type, inx);
|
||||
|
||||
doufn:
|
||||
ERROR_EXIT(inx);
|
||||
|
||||
} /* end N_OP_misc4() */
|
||||
49
src/array3.c
49
src/array3.c
@@ -1,49 +0,0 @@
|
||||
/* This is G-file @(#) array3.c Version 2.9 (10/12/88). copyright Xerox & Fuji Xerox */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
||||
/* Manufactured in the United States of America. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "version.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* A R R A Y 3 . C */
|
||||
/* */
|
||||
/* Contains: N_OP_aref1 */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "version.h"
|
||||
#include "adr68k.h" // for Addr68k_from_LADDR
|
||||
#include "array3defs.h" // for N_OP_aref1
|
||||
#include "emlglob.h"
|
||||
#include "lispemul.h" // for state, LispPTR, ERROR_EXIT
|
||||
#include "lspglob.h"
|
||||
#include "lsptypes.h" // for OneDArray, GetTypeNumber, TYPE_ONED_ARRAY
|
||||
#include "my.h" // for aref_switch, N_GetPos
|
||||
|
||||
/*** N_OP_aref1 -- op 266 (array index) ***/
|
||||
LispPTR N_OP_aref1(register LispPTR arrayarg, register LispPTR inx) {
|
||||
register LispPTR baseL;
|
||||
register int index;
|
||||
register OneDArray *arrayblk;
|
||||
|
||||
/* verify array */
|
||||
if (GetTypeNumber(arrayarg) != TYPE_ONED_ARRAY) ERROR_EXIT(inx);
|
||||
arrayblk = (OneDArray *)Addr68k_from_LADDR(arrayarg);
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx, index, inx);
|
||||
if (index >= arrayblk->totalsize) ERROR_EXIT(inx);
|
||||
index += arrayblk->offset;
|
||||
|
||||
/* setup base */
|
||||
baseL = arrayblk->base;
|
||||
|
||||
/* disp on type */
|
||||
return (aref_switch(arrayblk->typenumber, inx, baseL, index));
|
||||
} /* end N_OP_aref1() */
|
||||
62
src/array4.c
62
src/array4.c
@@ -1,62 +0,0 @@
|
||||
/* This is G-file @(#) array4.c Version 2.7 (10/12/88). copyright Xerox & Fuji Xerox */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
||||
/* Manufactured in the United States of America. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "version.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* A R R A Y 4 . C */
|
||||
/* */
|
||||
/* Contains: N_OP_aset1 */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "version.h"
|
||||
#include "adr68k.h" // for Addr68k_from_LADDR
|
||||
#include "array4defs.h" // for N_OP_aset1
|
||||
#include "lispemul.h" // for state, LispPTR, ERROR_EXIT
|
||||
#include "lspglob.h"
|
||||
#include "lsptypes.h" // for OneDArray, GetTypeNumber, TYPE_ONED_ARRAY
|
||||
#include "my.h" // for N_GetPos, aset_switch
|
||||
|
||||
/*** N_OP_aset1 -- op 267 (new-value array index) ***/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* N _ O P _ a s e t 1 */
|
||||
/* */
|
||||
/* 1-dimensional array setter. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
LispPTR N_OP_aset1(register LispPTR data, LispPTR arrayarg, register int inx) {
|
||||
register OneDArray *arrayblk;
|
||||
register LispPTR base;
|
||||
register int new;
|
||||
register int index;
|
||||
|
||||
/* verify array */
|
||||
if (GetTypeNumber(arrayarg) != TYPE_ONED_ARRAY) ERROR_EXIT(inx);
|
||||
arrayblk = (OneDArray *)Addr68k_from_LADDR(arrayarg);
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx, index, inx);
|
||||
if (index >= arrayblk->totalsize) ERROR_EXIT(inx);
|
||||
index += arrayblk->offset;
|
||||
|
||||
/* setup base */
|
||||
base = arrayblk->base;
|
||||
|
||||
/* disp on type */
|
||||
aset_switch(arrayblk->typenumber, inx);
|
||||
|
||||
doufn:
|
||||
ERROR_EXIT(inx);
|
||||
|
||||
} /* end N_OP_aset1() */
|
||||
56
src/array5.c
56
src/array5.c
@@ -1,56 +0,0 @@
|
||||
/* This is G-file @(#) array5.c Version 2.7 (10/12/88). copyright Xerox & Fuji Xerox */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
||||
/* Manufactured in the United States of America. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* A R R A Y 5 . C */
|
||||
/* */
|
||||
/* Contains: N_OP_aref2 2-d AREF opcode */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "version.h"
|
||||
#include "adr68k.h" // for Addr68k_from_LADDR
|
||||
#include "array5defs.h" // for N_OP_aref2
|
||||
#include "emlglob.h"
|
||||
#include "lispemul.h" // for state, LispPTR, ERROR_EXIT
|
||||
#include "lspglob.h"
|
||||
#include "lsptypes.h" // for LispArray, GetTypeNumber, TYPE_TWOD_ARRAY
|
||||
#include "my.h" // for aref_switch, N_GetPos
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* N _ O P _ a r e f 2 */
|
||||
/* */
|
||||
/* 2-d AREF op 356 (array index0 index1) */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
LispPTR N_OP_aref2(LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
|
||||
LispPTR baseL;
|
||||
int arindex, temp;
|
||||
LispArray *arrayblk;
|
||||
int j;
|
||||
|
||||
/* verify array */
|
||||
if (GetTypeNumber(arrayarg) != TYPE_TWOD_ARRAY) ERROR_EXIT(inx1);
|
||||
arrayblk = (LispArray *)Addr68k_from_LADDR(arrayarg);
|
||||
baseL = arrayblk->base;
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx1, temp, inx1);
|
||||
if (temp >= (j = arrayblk->Dim1)) ERROR_EXIT(inx1);
|
||||
N_GetPos(inx0, arindex, inx1);
|
||||
if (arindex >= arrayblk->Dim0) ERROR_EXIT(inx1);
|
||||
arindex *= j;
|
||||
arindex += temp;
|
||||
|
||||
/* disp on type */
|
||||
return (aref_switch(arrayblk->typenumber, inx1, baseL, arindex));
|
||||
} /* end N_OP_aref2() */
|
||||
46
src/array6.c
46
src/array6.c
@@ -1,46 +0,0 @@
|
||||
/* This is G-file @(#) array6.c Version 2.10 (4/21/92). copyright Xerox & Fuji Xerox */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
||||
/* Manufactured in the United States of America. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "version.h"
|
||||
#include "adr68k.h" // for Addr68k_from_LADDR
|
||||
#include "array6defs.h" // for N_OP_aset2
|
||||
#include "emlglob.h"
|
||||
#include "lispemul.h" // for state, LispPTR, ERROR_EXIT
|
||||
#include "lspglob.h"
|
||||
#include "lsptypes.h" // for LispArray, GetTypeNumber, TYPE_TWOD_ARRAY
|
||||
#include "my.h" // for N_GetPos, aset_switch
|
||||
|
||||
/*** N_OP_aset2 -- op 357 (new-value array index0 index1) ***/
|
||||
LispPTR N_OP_aset2(register LispPTR data, LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
|
||||
register LispArray *arrayblk;
|
||||
register LispPTR base;
|
||||
register int new;
|
||||
register int index, temp;
|
||||
int j;
|
||||
|
||||
/* verify array */
|
||||
if (GetTypeNumber(arrayarg) != TYPE_TWOD_ARRAY) ERROR_EXIT(inx1);
|
||||
arrayblk = (LispArray *)Addr68k_from_LADDR(arrayarg);
|
||||
base = arrayblk->base;
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx1, temp, inx1);
|
||||
if (temp >= (j = arrayblk->Dim1)) ERROR_EXIT(inx1);
|
||||
N_GetPos(inx0, index, inx1);
|
||||
if (index >= arrayblk->Dim0) ERROR_EXIT(inx1);
|
||||
index *= j;
|
||||
index += temp;
|
||||
|
||||
/* disp on type */
|
||||
aset_switch(arrayblk->typenumber, inx1);
|
||||
|
||||
doufn:
|
||||
ERROR_EXIT(inx1);
|
||||
|
||||
} /* end N_OP_aset2() */
|
||||
198
src/arrayops.c
Normal file
198
src/arrayops.c
Normal file
@@ -0,0 +1,198 @@
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
|
||||
/* Manufactured in the United States of America. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "version.h"
|
||||
#include "adr68k.h" // for Addr68k_from_LADDR
|
||||
#include "arrayopsdefs.h" // for N_OP_misc3, N_OP_misc4, N_OP_aref1, N_OP_aset1, N_OP_aref2, N_OP_aset2
|
||||
#include "emlglob.h"
|
||||
#include "lispemul.h" // for state, LispPTR, ERROR_EXIT
|
||||
#include "lspglob.h"
|
||||
#include "lsptypes.h"
|
||||
#include "my.h" // for aref_switch, N_GetPos
|
||||
|
||||
|
||||
/************************************************************
|
||||
OP_claref -- op 372/9 (base typenumber index)
|
||||
|
||||
type size typenumber
|
||||
0 0 0 unsigned : 1 bit
|
||||
0 3 3 unsigned : 8 bits
|
||||
0 4 4 unsigned : 16 bits
|
||||
1 4 20 signed : 16 bits
|
||||
1 6 22 signed : 32 bits
|
||||
2 6 38 pointer : 32 bits
|
||||
3 6 54 float : 32 bits
|
||||
4 3 67 character : 8 bits
|
||||
4 4 68 character : 16 bits
|
||||
5 6 86 Xpointer : 32 bits
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
/*** N_OP_misc3 -- op 372/9 (base typenumber index) ***/
|
||||
LispPTR N_OP_misc3(LispPTR baseL, LispPTR typenumber, LispPTR inx, int alpha) {
|
||||
int index, type;
|
||||
|
||||
if (alpha != 9) ERROR_EXIT(inx);
|
||||
/* test and setup index */
|
||||
N_GetPos(inx, index, inx);
|
||||
|
||||
/* test and setup typenumber */
|
||||
N_GetPos(typenumber, type, inx);
|
||||
|
||||
/* dispatch on type */
|
||||
return (aref_switch(type, inx, baseL, index));
|
||||
} /* end N_OP_misc3() */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* N _ O P _ m i s c 4 */
|
||||
/* */
|
||||
/* CL:ASET opcode op 373/7 (data, base typenumber, index) */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
LispPTR N_OP_misc4(LispPTR data, LispPTR base, LispPTR typenumber,
|
||||
LispPTR inx, int alpha) {
|
||||
int new;
|
||||
int index;
|
||||
int type;
|
||||
|
||||
if (alpha != 7) ERROR_EXIT(inx);
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx, index, inx);
|
||||
|
||||
/* test and setup typenumber */
|
||||
N_GetPos(typenumber, type, inx);
|
||||
|
||||
aset_switch(type, inx);
|
||||
|
||||
doufn:
|
||||
ERROR_EXIT(inx);
|
||||
|
||||
} /* end N_OP_misc4() */
|
||||
|
||||
/*** N_OP_aref1 -- op 266 (array index) ***/
|
||||
|
||||
LispPTR N_OP_aref1(LispPTR arrayarg, LispPTR inx) {
|
||||
LispPTR baseL;
|
||||
int index;
|
||||
OneDArray *arrayblk;
|
||||
|
||||
/* verify array */
|
||||
if (GetTypeNumber(arrayarg) != TYPE_ONED_ARRAY) ERROR_EXIT(inx);
|
||||
arrayblk = (OneDArray *)Addr68k_from_LADDR(arrayarg);
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx, index, inx);
|
||||
if (index >= arrayblk->totalsize) ERROR_EXIT(inx);
|
||||
index += arrayblk->offset;
|
||||
|
||||
/* setup base */
|
||||
baseL = arrayblk->base;
|
||||
|
||||
/* dispatch on type */
|
||||
return (aref_switch(arrayblk->typenumber, inx, baseL, index));
|
||||
} /* end N_OP_aref1() */
|
||||
|
||||
/*** N_OP_aset1 -- op 267 (new-value array index) ***/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* N _ O P _ a s e t 1 */
|
||||
/* */
|
||||
/* 1-dimensional array setter. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
LispPTR N_OP_aset1(LispPTR data, LispPTR arrayarg, int inx) {
|
||||
OneDArray *arrayblk;
|
||||
LispPTR base;
|
||||
int new;
|
||||
int index;
|
||||
|
||||
/* verify array */
|
||||
if (GetTypeNumber(arrayarg) != TYPE_ONED_ARRAY) ERROR_EXIT(inx);
|
||||
arrayblk = (OneDArray *)Addr68k_from_LADDR(arrayarg);
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx, index, inx);
|
||||
if (index >= arrayblk->totalsize) ERROR_EXIT(inx);
|
||||
index += arrayblk->offset;
|
||||
|
||||
/* setup base */
|
||||
base = arrayblk->base;
|
||||
|
||||
/* dispatch on type */
|
||||
aset_switch(arrayblk->typenumber, inx);
|
||||
|
||||
doufn:
|
||||
ERROR_EXIT(inx);
|
||||
|
||||
} /* end N_OP_aset1() */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* N _ O P _ a r e f 2 */
|
||||
/* */
|
||||
/* 2-d AREF op 356 (array index0 index1) */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
LispPTR N_OP_aref2(LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
|
||||
LispPTR baseL;
|
||||
int arindex, temp;
|
||||
LispArray *arrayblk;
|
||||
int j;
|
||||
|
||||
/* verify array */
|
||||
if (GetTypeNumber(arrayarg) != TYPE_TWOD_ARRAY) ERROR_EXIT(inx1);
|
||||
arrayblk = (LispArray *)Addr68k_from_LADDR(arrayarg);
|
||||
baseL = arrayblk->base;
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx1, temp, inx1);
|
||||
if (temp >= (j = arrayblk->Dim1)) ERROR_EXIT(inx1);
|
||||
N_GetPos(inx0, arindex, inx1);
|
||||
if (arindex >= arrayblk->Dim0) ERROR_EXIT(inx1);
|
||||
arindex *= j;
|
||||
arindex += temp;
|
||||
|
||||
/* disp on type */
|
||||
return (aref_switch(arrayblk->typenumber, inx1, baseL, arindex));
|
||||
} /* end N_OP_aref2() */
|
||||
|
||||
/*** N_OP_aset2 -- op 357 (new-value array index0 index1) ***/
|
||||
|
||||
LispPTR N_OP_aset2(LispPTR data, LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
|
||||
LispArray *arrayblk;
|
||||
LispPTR base;
|
||||
int new;
|
||||
int index, temp;
|
||||
int j;
|
||||
|
||||
/* verify array */
|
||||
if (GetTypeNumber(arrayarg) != TYPE_TWOD_ARRAY) ERROR_EXIT(inx1);
|
||||
arrayblk = (LispArray *)Addr68k_from_LADDR(arrayarg);
|
||||
base = arrayblk->base;
|
||||
|
||||
/* test and setup index */
|
||||
N_GetPos(inx1, temp, inx1);
|
||||
if (temp >= (j = arrayblk->Dim1)) ERROR_EXIT(inx1);
|
||||
N_GetPos(inx0, index, inx1);
|
||||
if (index >= arrayblk->Dim0) ERROR_EXIT(inx1);
|
||||
index *= j;
|
||||
index += temp;
|
||||
|
||||
/* dispatch on type */
|
||||
aset_switch(arrayblk->typenumber, inx1);
|
||||
|
||||
doufn:
|
||||
ERROR_EXIT(inx1);
|
||||
|
||||
} /* end N_OP_aset2() */
|
||||
7
src/xc.c
7
src/xc.c
@@ -60,12 +60,7 @@
|
||||
#include "arith2defs.h"
|
||||
#include "arith3defs.h"
|
||||
#include "arith4defs.h"
|
||||
#include "arraydefs.h"
|
||||
#include "array2defs.h"
|
||||
#include "array3defs.h"
|
||||
#include "array4defs.h"
|
||||
#include "array5defs.h"
|
||||
#include "array6defs.h"
|
||||
#include "arrayopsdefs.h"
|
||||
#include "bitbltdefs.h"
|
||||
#include "bltdefs.h"
|
||||
#include "byteswapdefs.h"
|
||||
|
||||
Reference in New Issue
Block a user