344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
case OP_BROADCASTEX_D: StackReq(5,0); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_broadcast(obj,t1,t2,t3,t4,t5,0); break;
case OP_BROADCASTSUM: StackReq(4,1); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,NVALUE(0),1)); break;
case OP_BROADCASTSUMEX: StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,t5,1)); break;
case OP_BXOR: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u^t2.u)); break;
case OP_CALLSUB: execute_program(code,code[ptr++],obj); break;
case OP_CLASS: StackReq(0,1); Push(CVALUE(o->class)); break;
case OP_CLASS_C: StackReq(1,1); Push(GetVariableOf(class,CVALUE)); break;
case OP_DIR: StackReq(0,1); Push(NVALUE(o->dir&7)); break;
case OP_DISTANCE: StackReq(0,1); Push(NVALUE(o->distance)); break;
case OP_DROP: StackReq(1,0); Pop(); break;
case OP_DROP_D: StackReq(2,0); Pop(); Pop(); break;
case OP_DUP: StackReq(1,2); t1=Pop(); Push(t1); Push(t1); break;
case OP_EQ: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t2)?1:0)); break;
case OP_GE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?0:1)); break;
case OP_GE_C: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_signed_greater(t2,t1)?0:1)); break;
|
|
|
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
case OP_BROADCASTEX_D: StackReq(5,0); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_broadcast(obj,t1,t2,t3,t4,t5,0); break;
case OP_BROADCASTSUM: StackReq(4,1); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,NVALUE(0),1)); break;
case OP_BROADCASTSUMEX: StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,t5,1)); break;
case OP_BXOR: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u^t2.u)); break;
case OP_CALLSUB: execute_program(code,code[ptr++],obj); break;
case OP_CLASS: StackReq(0,1); Push(CVALUE(o->class)); break;
case OP_CLASS_C: StackReq(1,1); Push(GetVariableOf(class,CVALUE)); break;
case OP_DIR: StackReq(0,1); Push(NVALUE(o->dir)); break;
case OP_DISTANCE: StackReq(0,1); Push(NVALUE(o->distance)); break;
case OP_DROP: StackReq(1,0); Pop(); break;
case OP_DROP_D: StackReq(2,0); Pop(); Pop(); break;
case OP_DUP: StackReq(1,2); t1=Pop(); Push(t1); Push(t1); break;
case OP_EQ: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t2)?1:0)); break;
case OP_GE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?0:1)); break;
case OP_GE_C: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_signed_greater(t2,t1)?0:1)); break;
|
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
static Uint32 broadcast(Uint32 from,int c,Uint16 msg,Value arg1,Value arg2,Value arg3,int s) {
Uint32 t=0;
Uint32 n,p;
Object*o;
Value v;
if(c && !classes[c]->nmsg && (!classes[0] || !classes[0]->nmsg)) {
if(s) return 0;
for(n=0;n<nobjects;n++) if((o=objects[n]) && o->class==c) t++;
return t;
}
if(lastobj==VOIDLINK) return;
n=lastobj;
while(o=objects[n]) {
p=o->prev;
if(!c || o->class==c) {
v=send_message(from,n,msg,arg1,arg2,arg3);
if(s>0) {
switch(v.t) {
case TY_NUMBER: t+=v.u; break;
case TY_CLASS: t++; break;
default:
if(v.t<=TY_MAXTYPE) Throw("Invalid return type for BroadcastSum");
|
|
|
|
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
static Uint32 broadcast(Uint32 from,int c,Uint16 msg,Value arg1,Value arg2,Value arg3,int s) {
Uint32 t=0;
Uint32 n,p;
Object*o;
Value v;
if(c && !classes[c]->nmsg && (!classes[0] || !classes[0]->nmsg)) {
if(s) return 0;
for(n=0;n<nobjects;n++) if((o=objects[n]) && o->class==c && o->generation) t++;
return t;
}
if(lastobj==VOIDLINK) return;
n=lastobj;
while(o=objects[n]) {
p=o->prev;
if((!c || o->class==c) && o->generation) {
v=send_message(from,n,msg,arg1,arg2,arg3);
if(s>0) {
switch(v.t) {
case TY_NUMBER: t+=v.u; break;
case TY_CLASS: t++; break;
default:
if(v.t<=TY_MAXTYPE) Throw("Invalid return type for BroadcastSum");
|