Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.3453
Browse files Browse the repository at this point in the history
Interpreter:
Replace several over-general followField:ofObject: sends with more specific followObjField:ofObject: sends.

BitBlt plugin.
Don't duplicate the default8To32Table.

Slang:
If the value of firstIndexableField: is being assigned to a non-pointer
type (e.g. in an assignment) a cast is needed.
  • Loading branch information
eliotmiranda committed Aug 27, 2024
1 parent 63dfd03 commit a837b70
Show file tree
Hide file tree
Showing 104 changed files with 16,898 additions and 15,076 deletions.
30 changes: 15 additions & 15 deletions src/plugins/B2DPlugin/B2DPlugin.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.3445 uuid: bf34d535-d388-48bb-b497-6a6661b81d9a
VMPluginCodeGenerator VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b
from
BalloonEnginePlugin VMMaker.oscog-eem.3445 uuid: bf34d535-d388-48bb-b497-6a6661b81d9a
BalloonEnginePlugin VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b
*/
static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.3445 uuid: bf34d535-d388-48bb-b497-6a6661b81d9a " __DATE__ ;
static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -838,7 +838,7 @@ extern
#endif
struct VirtualMachine* interpreterProxy;
static void * loadBBFn;
static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.3445 " INT_EXT;
static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.3453 " INT_EXT;
static int* objBuffer;
static sqInt objUsed;
static unsigned int* spanBuffer;
Expand Down Expand Up @@ -1822,7 +1822,7 @@ checkCompressedFillIndexListmaxsegments(sqInt fillList, sqInt maxIndex, sqInt nS
int runValue;

length = slotSizeOf(fillList);
fillPtr = firstIndexableField(fillList);
fillPtr = ((int *) (firstIndexableField(fillList)));
nFills = 0;
for (i = 0; i < length; i += 1) {
runLength = (((usqInt)(((((int *) fillPtr))[i]))) >> 16);
Expand Down Expand Up @@ -1854,7 +1854,7 @@ checkCompressedFills(sqInt indexList)
return 0;
}
length = slotSizeOf(indexList);
fillPtr = firstIndexableField(indexList);
fillPtr = ((int *) (firstIndexableField(indexList)));
for (i = 0; i < length; i += 1) {
/* Make sure the fill is okay */
fillIndex = fillPtr[i];
Expand All @@ -1879,7 +1879,7 @@ checkCompressedLineWidthssegments(sqInt lineWidthList, sqInt nSegments)
sqInt runLength;

length = slotSizeOf(lineWidthList);
ptr = firstIndexableField(lineWidthList);
ptr = ((int *) (firstIndexableField(lineWidthList)));
nItems = 0;
for (i = 0; i < length; i += 1) {
runLength = (((usqInt)(((((int *) ptr))[i]))) >> 16);
Expand Down Expand Up @@ -6212,7 +6212,7 @@ loadBitmapFillcolormaptilefromalongnormalxIndex(sqInt formOop, sqInt cmOop, sqIn
return primitiveFail();
}
cmSize = slotSizeOf(cmOop);
cmBits = firstIndexableField(cmOop);
cmBits = ((int *) (firstIndexableField(cmOop)));
}
if (!(isPointers(formOop))) {
return primitiveFail();
Expand Down Expand Up @@ -8266,7 +8266,7 @@ loadWordTransformFromintolength(sqInt transformOop, float *destPtr, sqInt n)
sqInt i;
float *srcPtr;

srcPtr = firstIndexableField(transformOop);
srcPtr = ((float *) (firstIndexableField(transformOop)));
for (i = 0; i < n; i += 1) {
destPtr[i] = (srcPtr[i]);
}
Expand Down Expand Up @@ -8994,7 +8994,7 @@ primitiveAddBitmapFill(void)
goto l2;
}
cmSize = slotSizeOf(cmOop);
cmBits = firstIndexableField(cmOop);
cmBits = ((int *) (firstIndexableField(cmOop)));
}
if (!(isPointers(formOop))) {
fill = primitiveFail();
Expand Down Expand Up @@ -10075,7 +10075,7 @@ primitiveCopyBuffer(void)
return primitiveFailFor(GEFSizeMismatch);
}
src = workBuffer;
dst = firstIndexableField(buf2);
dst = ((int *) (firstIndexableField(buf2)));
for (i = 0; i < (workBuffer[GWBufferTop]); i += 1) {
dst[i] = (src[i]);
}
Expand Down Expand Up @@ -10229,7 +10229,7 @@ primitiveGetBezierStats(void)
&& ((slotSizeOf(statOop)) >= 4)))) {
return primitiveFailFor(PrimErrBadArgument);
}
stats = firstIndexableField(statOop);
stats = ((int *) (firstIndexableField(statOop)));
stats[0] = ((stats[0]) + (workBuffer[GWBezierMonotonSubdivisions]));
stats[1] = ((stats[1]) + (workBuffer[GWBezierHeightSubdivisions]));
stats[2] = ((stats[2]) + (workBuffer[GWBezierOverflowSubdivisions]));
Expand Down Expand Up @@ -10288,7 +10288,7 @@ primitiveGetCounts(void)
&& ((slotSizeOf(statOop)) >= 9)))) {
return primitiveFailFor(PrimErrBadArgument);
}
stats = firstIndexableField(statOop);
stats = ((int *) (firstIndexableField(statOop)));
stats[0] = ((stats[0]) + (workBuffer[GWCountInitializing]));
stats[1] = ((stats[1]) + (workBuffer[GWCountFinishTest]));
stats[2] = ((stats[2]) + (workBuffer[GWCountNextGETEntry]));
Expand Down Expand Up @@ -10388,7 +10388,7 @@ primitiveGetTimes(void)
&& ((slotSizeOf(statOop)) >= 9)))) {
return primitiveFailFor(PrimErrBadArgument);
}
stats = firstIndexableField(statOop);
stats = ((int *) (firstIndexableField(statOop)));
stats[0] = ((stats[0]) + (workBuffer[GWTimeInitializing]));
stats[1] = ((stats[1]) + (workBuffer[GWTimeFinishTest]));
stats[2] = ((stats[2]) + (workBuffer[GWTimeNextGETEntry]));
Expand Down Expand Up @@ -10977,7 +10977,7 @@ primitiveSetBitBltPlugin(void)
if (length >= 0x100) {
return primitiveFail();
}
ptr = firstIndexableField(pluginName);
ptr = ((char *) (firstIndexableField(pluginName)));
needReload = 0;
for (i = 0; i < length; i += 1) {
/* Compare and store the plugin to be used */
Expand Down
32 changes: 16 additions & 16 deletions src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.3444 uuid: 2a902a4a-be82-4097-91a4-28da2fa623c8
VMPluginCodeGenerator VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b
from
B3DAcceleratorPlugin VMMaker.oscog-eem.3444 uuid: 2a902a4a-be82-4097-91a4-28da2fa623c8
B3DAcceleratorPlugin VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b
*/
static char __buildInfo[] = "B3DAcceleratorPlugin VMMaker.oscog-eem.3444 uuid: 2a902a4a-be82-4097-91a4-28da2fa623c8 " __DATE__ ;
static char __buildInfo[] = "B3DAcceleratorPlugin VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -145,7 +145,7 @@ extern sqInt topRemappableOop(void);
extern
#endif
struct VirtualMachine* interpreterProxy;
static const char *moduleName = "B3DAcceleratorPlugin VMMaker.oscog-eem.3444 " INT_EXT;
static const char *moduleName = "B3DAcceleratorPlugin VMMaker.oscog-eem.3453 " INT_EXT;


/*** Methods ***/
Expand Down Expand Up @@ -182,7 +182,7 @@ checkVertexData(sqInt vertices)
sqInt vtxSize;

vtxSize = slotSizeOf(vertices);
vtxPtr = firstIndexableField(vertices);
vtxPtr = ((float *) (firstIndexableField(vertices)));
for (i = 0; i < vtxSize; i += 1) {
f = vtxPtr[i];
if (isnan(f - f)) {
Expand Down Expand Up @@ -253,16 +253,16 @@ loadClientStateverticescolorsnormalstexCoords(sqInt handle, sqInt vertices, sqIn
return primitiveFail();
}
if (!(colors == nilOop)) {
colorPtr = firstIndexableField(colors);
colorPtr = ((void *) (firstIndexableField(colors)));
}
if (!(normals == nilOop)) {
normalPtr = firstIndexableField(normals);
normalPtr = ((void *) (firstIndexableField(normals)));
}
if (!(texCoords == nilOop)) {
sz = (slotSizeOf(texCoords)) / vtxSize;
txPtr = firstIndexableField(texCoords);
txPtr = ((void *) (firstIndexableField(texCoords)));
}
vertexPtr = firstIndexableField(vertices);
vertexPtr = ((void *) (firstIndexableField(vertices)));
if (!(failed())) {
ok = b3dLoadClientState(handle, vertexPtr, 3, colorPtr, 4, normalPtr, 3, txPtr, sz);
if (!ok) {
Expand Down Expand Up @@ -535,7 +535,7 @@ primitiveDrawArrays(void)
/* Verify the vertex data itself */
/* begin checkVertexData: */
vtxSize1 = slotSizeOf(vertices);
vtxPtr = firstIndexableField(vertices);
vtxPtr = ((float *) (firstIndexableField(vertices)));
for (i = 0; i < vtxSize1; i += 1) {
f = vtxPtr[i];
if (isnan(f - f)) {
Expand Down Expand Up @@ -593,7 +593,7 @@ primitiveDrawElements(void)
return primitiveFail();
}
faceSize = slotSizeOf(faces);
facePtr = firstIndexableField(faces);
facePtr = ((unsigned int *) (firstIndexableField(faces)));
mode = stackIntegerValue(1);
texCoords = stackValue(2);
normals = stackValue(3);
Expand All @@ -608,7 +608,7 @@ primitiveDrawElements(void)
/* Verify the vertex data itself */
/* begin checkVertexData: */
vtxSize = slotSizeOf(vertices);
vtxPtr = firstIndexableField(vertices);
vtxPtr = ((float *) (firstIndexableField(vertices)));
for (i = 0; i < vtxSize; i += 1) {
f = vtxPtr[i];
if (isnan(f - f)) {
Expand Down Expand Up @@ -674,7 +674,7 @@ primitiveDrawRangeElements(void)
return primitiveFail();
}
faceSize = slotSizeOf(faces);
facePtr = firstIndexableField(faces);
facePtr = ((unsigned int *) (firstIndexableField(faces)));
maxIdx = stackIntegerValue(1);
minIdx = stackIntegerValue(2);
mode = stackIntegerValue(3);
Expand All @@ -691,7 +691,7 @@ primitiveDrawRangeElements(void)
/* Verify the vertex data itself */
/* begin checkVertexData: */
vtxSize1 = slotSizeOf(vertices);
vtxPtr = firstIndexableField(vertices);
vtxPtr = ((float *) (firstIndexableField(vertices)));
for (i = 0; i < vtxSize1; i += 1) {
f = vtxPtr[i];
if (isnan(f - f)) {
Expand Down Expand Up @@ -1393,7 +1393,7 @@ primitiveTextureUpload(void)
if (!((slotSizeOf(bits)) == ((((w + ppw) - 1) / ppw) * h))) {
return primitiveFail();
}
bitsPtr = firstIndexableField(bits);
bitsPtr = ((void *) (firstIndexableField(bits)));
handle = stackIntegerValue(1);
renderer = stackIntegerValue(2);
if (failed()) {
Expand Down Expand Up @@ -1543,7 +1543,7 @@ stackPrimitiveIndexArrayofSizevalidateforVertexSize(sqInt stackIndex, sqInt nIte
if (oopSize < nItems) {
return null;
}
idxPtr = firstIndexableField(oop);
idxPtr = ((int *) (firstIndexableField(oop)));
if (aBool) {
for (i = 0; i < nItems; i += 1) {
index = idxPtr[i];
Expand Down
16 changes: 8 additions & 8 deletions src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.3444 uuid: 2a902a4a-be82-4097-91a4-28da2fa623c8
VMPluginCodeGenerator VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b
from
BMPReadWriterPlugin VMMaker.oscog-eem.3444 uuid: 2a902a4a-be82-4097-91a4-28da2fa623c8
BMPReadWriterPlugin VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b
*/
static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.3444 uuid: 2a902a4a-be82-4097-91a4-28da2fa623c8 " __DATE__ ;
static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.3453 uuid: 6917573f-1029-4681-87bc-5f02f287102b " __DATE__ ;


#include "config.h"
Expand Down Expand Up @@ -67,7 +67,7 @@ extern sqInt stackObjectValue(sqInt offset);
extern
#endif
struct VirtualMachine* interpreterProxy;
static const char *moduleName = "BMPReadWriterPlugin VMMaker.oscog-eem.3444 " INT_EXT;
static const char *moduleName = "BMPReadWriterPlugin VMMaker.oscog-eem.3453 " INT_EXT;


/*** Methods ***/
Expand Down Expand Up @@ -118,9 +118,9 @@ primitiveRead24BmpLine(void)
return primitiveFail();
}
formBitsSize = slotSizeOf(formBitsOop);
formBits = firstIndexableField(formBitsOop);
formBits = ((unsigned int *) (firstIndexableField(formBitsOop)));
pixelLineSize = slotSizeOf(pixelLineOop);
pixelLine = firstIndexableField(pixelLineOop);
pixelLine = ((unsigned char *) (firstIndexableField(pixelLineOop)));
if (!((((formBitsIndex + width) - 1) <= formBitsSize)
&& ((width * 3) <= pixelLineSize))) {
return primitiveFail();
Expand Down Expand Up @@ -172,9 +172,9 @@ primitiveWrite24BmpLine(void)
return primitiveFail();
}
formBitsSize = slotSizeOf(formBitsOop);
formBits = firstIndexableField(formBitsOop);
formBits = ((unsigned int *) (firstIndexableField(formBitsOop)));
pixelLineSize = slotSizeOf(pixelLineOop);
pixelLine = firstIndexableField(pixelLineOop);
pixelLine = ((unsigned char *) (firstIndexableField(pixelLineOop)));
if (!((((formBitsIndex + width) - 1) <= formBitsSize)
&& ((width * 3) <= pixelLineSize))) {
return primitiveFail();
Expand Down
Loading

0 comments on commit a837b70

Please sign in to comment.