void GDallocColorRGB(void) { Proto proto; Proto tmp; Proto blob; gdImagePtr imgPtr; char * p; uchar r,g,b; int index; proto = (Proto) stackAt(Cpu, 2); objectGetSlot(proto, stringToAtom("_gdp"), &blob); p = (char *) objectPointerValue(blob); memcpy(&imgPtr, p, sizeof(imgPtr)); tmp = (Proto) stackAt(Cpu, 4); r = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 5); g = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 6); b = objectIntegerValue(tmp); index = gdImageColorAllocate(imgPtr, r, g, b); VMReturn(Cpu, (unsigned int) objectNewInteger(index), 6); }
void GLglutReshapeDelegatewithMethod(void) { GLreshapeObj = (Proto) stackAt(Cpu, 4); GLreshapeMethod = (Proto) stackAt(Cpu, 5); glutReshapeFunc(GLreshape); VMReturn(Cpu, (unsigned int) nil, 5); }
void GLglutKeyboardDelegatewithMethod(void) { GLkeybObj = (Proto) stackAt(Cpu, 4); GLkeybMethod = (Proto) stackAt(Cpu, 5); glutKeyboardFunc(GLkeyboard); VMReturn(Cpu, (unsigned int) nil, 5); }
void GLglutMouseDelegatewithMethod(void) { GLmouseObj = (Proto) stackAt(Cpu, 4); GLmouseMethod = (Proto) stackAt(Cpu, 5); glutMouseFunc(GLmouse); VMReturn(Cpu, (unsigned int) nil, 5); }
void GLglutDisplayDelegatewithMethod(void) { GLdispObj = (Proto) stackAt(Cpu, 4); GLdispMethod = (Proto) stackAt(Cpu, 5); glutDisplayFunc(GLdisplay); VMReturn(Cpu, (unsigned int) nil, 5); }
void GLglutMotionDelegatewithMethod(void) { GLmotionObj = (Proto) stackAt(Cpu, 4); GLmotionMethod = (Proto) stackAt(Cpu, 5); glutMotionFunc(GLmotion); VMReturn(Cpu, (unsigned int) nil, 5); }
void GLglutSetWindowXY(void) { int x,y; Proto tmp; tmp = (Proto) stackAt(Cpu, 4); x = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 5); y = objectIntegerValue(tmp); glutInitWindowPosition(x, y); VMReturn(Cpu, (unsigned int) nil, 5); }
void GLglutSetWindowWidthHeight(void) { int w,h; Proto tmp; tmp = (Proto) stackAt(Cpu, 4); w = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 5); h = objectIntegerValue(tmp); glutInitWindowSize(w, h); VMReturn(Cpu, (unsigned int) nil, 5); }
bool StackFrame::pop() { if (!withinCurrentStack(sp())) { return false; } if (fp() == sp() || withinCurrentStack(stackAt(0)) || isFramePrologueEpilogue(pc())) { fp() = stackAt(0); pc() = stackAt(1); sp() += 16; } else { pc() = stackAt(0); sp() += 8; } return true; }
void GLglutIdleDelegatewithMethod(void) { GLidleObj = (Proto) stackAt(Cpu, 4); GLidleMethod = (Proto) stackAt(Cpu, 5); if (GLidleObj == FalseObj) { glutIdleFunc(NULL); } else { // We do this to resolve the 'self', otherwise we get // the block context GLidleObj = locateObjectWithSlotVia(GLidleMethod, GLidleObj); glutIdleFunc(GLidle); } VMReturn(Cpu, (unsigned int) nil, 5); }
void GLglColorRGB(void) { Proto tmp; double r, g, b; tmp = (Proto) stackAt(Cpu,4); r = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,5); g = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,6); b = objectFloatValue(tmp); glColor3f(r,g,b); VMReturn(Cpu, (unsigned int) nil, 6); }
void GLglVertexXYZ(void) { Proto tmp; double x, y, z; tmp = (Proto) stackAt(Cpu,4); x = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,5); y = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,6); z = objectFloatValue(tmp); glVertex3f(x,y,z); VMReturn(Cpu, (unsigned int) nil, 6); }
void GLglBegin(void) { Proto tmp; uint32 i; tmp = (Proto) stackAt(Cpu, 4); i = objectIntegerValue(tmp); glBegin(i); VMReturn(Cpu, (unsigned int) nil, 4); }
void GLglutCreateWindowNamed(void) { Proto tmp; char * p; tmp = (Proto) stackAt(Cpu, 4); p = string2CString(tmp); glutCreateWindow(p); VMReturn(Cpu, (unsigned int) nil, 4); }
void GLglViewportXYWidthHeight(void) { Proto tmp; int x, y, w, h; tmp = (Proto) stackAt(Cpu,4); x = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu,5); y = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu,6); w = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu,7); h = objectIntegerValue(tmp); glViewport(x,y,w,h); VMReturn(Cpu, (unsigned int) nil, 7); }
void GLglutWireCube(void) { Proto tmp; double f; tmp = (Proto) stackAt(Cpu,4); f = objectFloatValue(tmp); glutWireCube(f); VMReturn(Cpu, (unsigned int) nil, 4); }
void GDlineX1Y1X2Y2Color(void) { Proto proto; Proto tmp; Proto blob; gdImagePtr imgPtr; char * p; int x1,y1,x2,y2; int index; proto = (Proto) stackAt(Cpu, 2); objectGetSlot(proto, stringToAtom("_gdp"), &blob); p = (char *) objectPointerValue(blob); memcpy(&imgPtr, p, sizeof(imgPtr)); tmp = (Proto) stackAt(Cpu, 4); x1 = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 5); y1 = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 6); x2 = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 7); y2 = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 8); index = objectIntegerValue(tmp); gdImageLine(imgPtr, x1, y1, x2, y2, index); VMReturn(Cpu, (unsigned int) objectNewInteger(index), 8); }
void GDallocColorTransparent(void) { Proto proto; Proto tmp; Proto blob; gdImagePtr imgPtr; char * p; uchar t; proto = (Proto) stackAt(Cpu, 2); objectGetSlot(proto, stringToAtom("_gdp"), &blob); p = (char *) objectPointerValue(blob); memcpy(&imgPtr, p, sizeof(imgPtr)); tmp = (Proto) stackAt(Cpu, 4); t = objectIntegerValue(tmp); gdImageColorTransparent(imgPtr, t); VMReturn(Cpu, (unsigned int) proto, 4); }
void GLgluOrtho2DLeftRightBottomTop(void) { Proto tmp; double left, right, bottom, top; tmp = (Proto) stackAt(Cpu,4); left = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,5); right = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,6); bottom = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,7); top = objectFloatValue(tmp); gluOrtho2D(left, right, bottom, top); VMReturn(Cpu, (unsigned int) nil, 7); }
void GLgluPerspectiveAngleAspectzNearzFar(void) { Proto tmp; double yangle, aspect, znear, zfar; tmp = (Proto) stackAt(Cpu,4); yangle = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,5); aspect = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,6); znear = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,7); zfar = objectFloatValue(tmp); gluPerspective(yangle, aspect, znear, zfar); VMReturn(Cpu, (unsigned int) nil, 7); }
void GLglRotateAngleXYZ(void) { Proto tmp; double angle, x, y, z; tmp = (Proto) stackAt(Cpu,4); angle = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,5); x = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,6); y = objectFloatValue(tmp); tmp = (Proto) stackAt(Cpu,7); z = objectFloatValue(tmp); glRotatef(angle,x,y,z); VMReturn(Cpu, (unsigned int) nil, 7); }
void GDcreateWidthHeight (void) { Proto proto; Proto tmp; Proto blob; Proto parent; gdImagePtr imgPtr; char * p; int w,h; tmp = (Proto) stackAt(Cpu, 4); w = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 5); h = objectIntegerValue(tmp); imgPtr = gdImageCreate(w, h); GCOFF(); proto = objectNew(0); blob = objectNewBlob(sizeof(gdImagePtr)); p = objectPointerValue(blob); memcpy(p, &imgPtr, sizeof(gdImagePtr)); objectGetSlot(Globals, stringToAtom("GD"), &parent); objectSetSlot(proto, ATOMparent, PROTO_ACTION_GET, (uint32) parent); objectSetSlot(proto, stringToAtom("_gdp"), PROTO_ACTION_GET, (uint32) blob); GCON(); VMReturn(Cpu, (unsigned int) proto, 5); }
void GDfree(void) { Proto proto; Proto blob; gdImagePtr imgPtr; char * p; proto = (Proto) stackAt(Cpu, 2); objectGetSlot(proto, stringToAtom("_gdp"), &blob); p = (char *) objectPointerValue(blob); memcpy(&imgPtr, p, sizeof(imgPtr)); gdImageDestroy(imgPtr); VMReturn(Cpu, (unsigned int) nil, 3); }
// Check the Argument count // operand: count that arguments should be // ??This should be the first instruction on // a method before setupFrame?? inline void DoCheckArgCount(VM32Cpu * cpu) { int * ip; int count; int j; // Move to the operand cpu->pc++; ip = (int *) cpu->pc; j = std2hostInteger(*ip); cpu->pc += 4; count = stackAt(cpu, 2); if (count != j) { cpu->haltflag = 1; cpu->argCountHook(cpu); } }
void GDasStringPNG(void) { Proto proto; Proto blob; Proto newObj; gdImagePtr imgPtr; char * p; char * buff; int size; proto = (Proto) stackAt(Cpu, 2); objectGetSlot(proto, stringToAtom("_gdp"), &blob); p = (char *) objectPointerValue(blob); memcpy(&imgPtr, p, sizeof(imgPtr)); buff = gdImagePngPtr(imgPtr, &size); newObj = createString(buff, size); gdFree(buff); VMReturn(Cpu, (unsigned int) newObj, 3); }
void GDstringwithFontXYColor(void) { Proto proto; Proto tmp; Proto blob; Proto strObj; gdImagePtr imgPtr; gdFontPtr fntPtr; char * p; int x1,y1; int font; int index; char * buff; proto = (Proto) stackAt(Cpu, 2); objectGetSlot(proto, stringToAtom("_gdp"), &blob); p = (char *) objectPointerValue(blob); memcpy(&imgPtr, p, sizeof(imgPtr)); tmp = (Proto) stackAt(Cpu, 4); strObj = tmp; tmp = (Proto) stackAt(Cpu, 5); font= objectIntegerValue(tmp); fntPtr = getFontPtr(font); tmp = (Proto) stackAt(Cpu, 6); x1 = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 7); y1 = objectIntegerValue(tmp); tmp = (Proto) stackAt(Cpu, 8); index = objectIntegerValue(tmp); buff = string2CString(strObj); gdImageString(imgPtr, fntPtr, x1, y1, buff, index); celfree(buff); VMReturn(Cpu, (unsigned int) proto, 8); }
uintptr_t StackFrame::arg1() { return stackAt(2); }
uintptr_t StackFrame::arg3() { return stackAt(4); }
void StackFrame::ret() { pc() = stackAt(0); sp() += 8; }
uintptr_t StackFrame::arg2() { return stackAt(3); }