LispRef content(LispRef stream, LispRef eos_error_p, LispRef eos_value) { WITH_DEBUG(fprintf(stderr, "content\n")); char tag; read_byte(tag); WITH_DEBUG(fprintf(stderr, " tag: %x\n", tag)); switch (tag) { case TC_NULL: return nullReference(stream, eos_error_p, eos_value); case TC_REFERENCE: return prevObject(stream, eos_error_p, eos_value); case TC_CLASS: return newClass(stream, eos_error_p, eos_value); case TC_OBJECT: return newObject(stream, eos_error_p, eos_value); case TC_STRING: return newString(stream, eos_error_p, eos_value); case TC_STATE: return newState(stream, eos_error_p, eos_value); case TC_VECTOR: return newVector(stream, eos_error_p, eos_value); case TC_STREAM: return newStream(stream, eos_error_p, eos_value); case TC_RESET: return reset(stream, eos_error_p, eos_value); case TC_SELF: return stream; case TC_FUNCTION: return newFunction(stream, eos_error_p, eos_value); case TC_BYTEVECTOR: return newBytevector(stream, eos_error_p, eos_value); case TC_INT: return newInt(stream, eos_error_p, eos_value); case TC_DOUBLE: return newDouble(stream, eos_error_p, eos_value); case TC_SYMBOL: return newSymbol(stream, eos_error_p, eos_value); case TC_KEYWORD: return newKeyword(stream, eos_error_p, eos_value); case TC_CHAR: return newChar(stream, eos_error_p, eos_value); case TC_CONS: return newCons(stream, eos_error_p, eos_value); default: { LispRef str, args; eul_allocate_string(str, "unknown tag in ~a"); eul_allocate_cons(args, stream, eul_nil); eul_serial_error(stream, str, args); return eul_nil; } } }
langObject ArrayBuffer_Bracket(NativeFunction* func, std::vector<langObject> &arg) { if (arg.size() != 2) { throw langRuntimeException("引数の数が違う"); } ArrayBufferClassObject* _this = (ArrayBufferClassObject*)func->thisscope->_this; unsigned char *ptr = (unsigned char*)ArrayBufferGetPointer(_this); int i1 = Int::toInt(arg[0]); unsigned char *obj = &ptr[i1]; langObject i2 = arg[1]; if (i2->type->TypeEnum == _Type) { ObjectType* type = (ObjectType*)i2; switch (type->TypeClass.TypeEnum) { case lang::_Object: break; case lang::_Int: return newInt(*(int*)obj); case lang::_String: return newString((char*)*((size_t*)obj)); case lang::_Char: return new Char(*(char*)obj); case lang::_WChar: return new WChar(*(wchar_t*)obj); case lang::_Double: return newDouble(*(double*)obj); case lang::_Array: break; case lang::_Class: break; case lang::_ClassObject: break; default: throw langRuntimeException("get arraybuffer 不可"); break; } } return NULLOBJECT; }
static void allocateMemories() { SubFieldInfo_S sInfo = field_getSubFieldInfo_S(); Ex = newDComplex(sInfo.SUB_N_CELL); //Ex(i+0.5,j ,k+0.5) -> Ex[i,j,k] Ey = newDComplex(sInfo.SUB_N_CELL); //Ey(i ,j+0.5,k+0.5) -> Ey[i,j,k] Ez = newDComplex(sInfo.SUB_N_CELL); //Ez(i ,j ,k ) -> Ez[i,j,k] Jx = newDComplex(sInfo.SUB_N_CELL); Jy = newDComplex(sInfo.SUB_N_CELL); Jz = newDComplex(sInfo.SUB_N_CELL); Dx = newDComplex(sInfo.SUB_N_CELL); Dy = newDComplex(sInfo.SUB_N_CELL); Dz = newDComplex(sInfo.SUB_N_CELL); Hx = newDComplex(sInfo.SUB_N_CELL); //Hx(i , j+0.5, k )->Hx[i,j,k] Hy = newDComplex(sInfo.SUB_N_CELL); //Hy(i+0.5, j , k )->Hy[i,j,k] Hz = newDComplex(sInfo.SUB_N_CELL); //Hz(i+0.5, j+0.5, k+0.5)->Hz[i,j,k] Mx = newDComplex(sInfo.SUB_N_CELL); My = newDComplex(sInfo.SUB_N_CELL); Mz = newDComplex(sInfo.SUB_N_CELL); Bx = newDComplex(sInfo.SUB_N_CELL); By = newDComplex(sInfo.SUB_N_CELL); Bz = newDComplex(sInfo.SUB_N_CELL); C_JX = newDouble(sInfo.SUB_N_CELL); C_JY = newDouble(sInfo.SUB_N_CELL); C_JZ = newDouble(sInfo.SUB_N_CELL); C_MX = newDouble(sInfo.SUB_N_CELL); C_MY = newDouble(sInfo.SUB_N_CELL); C_MZ = newDouble(sInfo.SUB_N_CELL); C_DX = newDouble(sInfo.SUB_N_CELL); C_DY = newDouble(sInfo.SUB_N_CELL); C_DZ = newDouble(sInfo.SUB_N_CELL); C_BX = newDouble(sInfo.SUB_N_CELL); C_BY = newDouble(sInfo.SUB_N_CELL); C_BZ = newDouble(sInfo.SUB_N_CELL); C_JXHYHZ = newDouble(sInfo.SUB_N_CELL); C_JYHXHZ = newDouble(sInfo.SUB_N_CELL); C_JZHXHY = newDouble(sInfo.SUB_N_CELL); C_MXEYEZ = newDouble(sInfo.SUB_N_CELL); C_MYEXEZ = newDouble(sInfo.SUB_N_CELL); C_MZEXEY = newDouble(sInfo.SUB_N_CELL); C_DXJX0 = newDouble(sInfo.SUB_N_CELL); C_DXJX1 = newDouble(sInfo.SUB_N_CELL); C_DYJY0 = newDouble(sInfo.SUB_N_CELL); C_DYJY1 = newDouble(sInfo.SUB_N_CELL); C_DZJZ0 = newDouble(sInfo.SUB_N_CELL); C_DZJZ1 = newDouble(sInfo.SUB_N_CELL); C_BXMX1 = newDouble(sInfo.SUB_N_CELL); C_BXMX0 = newDouble(sInfo.SUB_N_CELL); C_BYMY1 = newDouble(sInfo.SUB_N_CELL); C_BYMY0 = newDouble(sInfo.SUB_N_CELL); C_BZMZ0 = newDouble(sInfo.SUB_N_CELL); C_BZMZ1 = newDouble(sInfo.SUB_N_CELL); EPS_EX = newDouble(sInfo.SUB_N_CELL); EPS_EY = newDouble(sInfo.SUB_N_CELL); EPS_EZ = newDouble(sInfo.SUB_N_CELL); }
Object * parseNumber(Collector * c, Tokenizer * tt) { return (Object *) newDouble(c, tt->c.number); }