mirror of https://github.com/bjornbytes/lovr.git
Update API to work with vectors;
This commit is contained in:
parent
ba192374dc
commit
c7934b3b13
|
@ -1,5 +1,6 @@
|
|||
#include "api.h"
|
||||
#include "api/data.h"
|
||||
#include "api/math.h"
|
||||
#include "audio/audio.h"
|
||||
#include "audio/source.h"
|
||||
#include "data/audioStream.h"
|
||||
|
@ -50,31 +51,21 @@ static int l_lovrAudioGetMicrophoneNames(lua_State* L) {
|
|||
}
|
||||
|
||||
static int l_lovrAudioGetOrientation(lua_State* L) {
|
||||
float angle, ax, ay, az;
|
||||
lovrAudioGetOrientation(&angle, &ax, &ay, &az);
|
||||
lua_pushnumber(L, angle);
|
||||
lua_pushnumber(L, ax);
|
||||
lua_pushnumber(L, ay);
|
||||
lua_pushnumber(L, az);
|
||||
return 4;
|
||||
float orientation[4];
|
||||
lovrAudioGetOrientation(orientation);
|
||||
return luax_pushquat(L, orientation, 1);
|
||||
}
|
||||
|
||||
static int l_lovrAudioGetPosition(lua_State* L) {
|
||||
float x, y, z;
|
||||
lovrAudioGetPosition(&x, &y, &z);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
return 3;
|
||||
float position[3];
|
||||
lovrAudioGetPosition(position);
|
||||
return luax_pushvec3(L, position, 1);
|
||||
}
|
||||
|
||||
static int l_lovrAudioGetVelocity(lua_State* L) {
|
||||
float x, y, z;
|
||||
lovrAudioGetVelocity(&x, &y, &z);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
return 3;
|
||||
float velocity[3];
|
||||
lovrAudioGetVelocity(velocity);
|
||||
return luax_pushvec3(L, velocity, 1);
|
||||
}
|
||||
|
||||
static int l_lovrAudioGetVolume(lua_State* L) {
|
||||
|
@ -162,27 +153,23 @@ static int l_lovrAudioSetDopplerEffect(lua_State* L) {
|
|||
}
|
||||
|
||||
static int l_lovrAudioSetOrientation(lua_State* L) {
|
||||
float angle = luaL_checknumber(L, 1);
|
||||
float ax = luaL_checknumber(L, 2);
|
||||
float ay = luaL_checknumber(L, 3);
|
||||
float az = luaL_checknumber(L, 4);
|
||||
lovrAudioSetOrientation(angle, ax, ay, az);
|
||||
float orientation[4];
|
||||
luax_readquat(L, 1, orientation, NULL);
|
||||
lovrAudioSetOrientation(orientation);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrAudioSetPosition(lua_State* L) {
|
||||
float x = luaL_checknumber(L, 1);
|
||||
float y = luaL_checknumber(L, 2);
|
||||
float z = luaL_checknumber(L, 3);
|
||||
lovrAudioSetPosition(x, y, z);
|
||||
float position[3];
|
||||
luax_readvec3(L, 1, position, NULL);
|
||||
lovrAudioSetPosition(position);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrAudioSetVelocity(lua_State* L) {
|
||||
float x = luaL_checknumber(L, 1);
|
||||
float y = luaL_checknumber(L, 2);
|
||||
float z = luaL_checknumber(L, 3);
|
||||
lovrAudioSetVelocity(x, y, z);
|
||||
float velocity[3];
|
||||
luax_readvec3(L, 1, velocity, NULL);
|
||||
lovrAudioSetVelocity(velocity);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,20 +197,17 @@ const char* WrapModes[] = {
|
|||
};
|
||||
|
||||
static uint32_t luax_readvertices(lua_State* L, int index) {
|
||||
/*
|
||||
bool isTable = lua_istable(L, index);
|
||||
uint32_t vertexCount = (lua_gettop(L) - index + 1) / 3;
|
||||
|
||||
if (!isTable && !lua_isnumber(L, index)) {
|
||||
luaL_error(L, "Expected number or table, got '%s'", lua_typename(L, lua_type(L, 1)));
|
||||
return 0;
|
||||
if (isTable) {
|
||||
lua_rawgeti(L, 1);
|
||||
vertexCount = lua_type(L, -1) == LUA_TNUMBER ? lua_objlen(L, index) / 3 : lua_objlen(L, index);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
uint32_t count = isTable ? lua_objlen(L, index) : lua_gettop(L) - index + 1;
|
||||
if (count % 3 != 0) {
|
||||
luaL_error(L, "Number of coordinates must be a multiple of 3, got '%d'", count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VertexPointer pointer = lovrGraphicsGetVertexPointer(count / 3);
|
||||
VertexPointer pointer = lovrGraphicsGetVertexPointer(count);
|
||||
|
||||
if (isTable) {
|
||||
for (uint32_t i = 1; i <= count; i += 3) {
|
||||
|
@ -231,7 +228,8 @@ static uint32_t luax_readvertices(lua_State* L, int index) {
|
|||
}
|
||||
}
|
||||
|
||||
return count / 3;
|
||||
return count / 3;*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void stencilCallback(void* userdata) {
|
||||
|
@ -588,40 +586,37 @@ static int l_lovrGraphicsOrigin(lua_State* L) {
|
|||
}
|
||||
|
||||
static int l_lovrGraphicsTranslate(lua_State* L) {
|
||||
float x = luaL_optnumber(L, 1, 0.);
|
||||
float y = luaL_optnumber(L, 2, 0.);
|
||||
float z = luaL_optnumber(L, 3, 0.);
|
||||
lovrGraphicsTranslate(x, y, z);
|
||||
float translation[3];
|
||||
luax_readvec3(L, 1, translation, NULL);
|
||||
lovrGraphicsTranslate(translation);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsRotate(lua_State* L) {
|
||||
float angle = luaL_checknumber(L, 1);
|
||||
float axisX = luaL_optnumber(L, 2, 0);
|
||||
float axisY = luaL_optnumber(L, 3, 1);
|
||||
float axisZ = luaL_optnumber(L, 4, 0);
|
||||
lovrGraphicsRotate(angle, axisX, axisY, axisZ);
|
||||
float rotation[4];
|
||||
luax_readquat(L, 1, rotation, NULL);
|
||||
lovrGraphicsRotate(rotation);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsScale(lua_State* L) {
|
||||
float x = luaL_checknumber(L, 1);
|
||||
float y = luaL_optnumber(L, 2, x);
|
||||
float z = luaL_optnumber(L, 3, x);
|
||||
lovrGraphicsScale(x, y, z);
|
||||
float scale[3];
|
||||
luax_readscale(L, 1, scale, 3, NULL);
|
||||
lovrGraphicsScale(scale);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsTransform(lua_State* L) {
|
||||
float transform[16];
|
||||
luax_readtransform(L, 1, transform, 3);
|
||||
luax_readmat4(L, 1, transform, 3, NULL);
|
||||
lovrGraphicsMatrixTransform(transform);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsSetProjection(lua_State* L) {
|
||||
Transform* transform = luax_checktype(L, 1, Transform);
|
||||
lovrGraphicsSetProjection(transform->matrix);
|
||||
float transform[16];
|
||||
luax_readmat4(L, 1, transform, 3, NULL);
|
||||
lovrGraphicsSetProjection(transform);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -718,7 +713,7 @@ static int l_lovrGraphicsPlane(lua_State* L) {
|
|||
drawMode = luaL_checkoption(L, 1, NULL, DrawModes);
|
||||
}
|
||||
float transform[16];
|
||||
luax_readtransform(L, 2, transform, 2);
|
||||
luax_readmat4(L, 2, transform, 2, NULL);
|
||||
lovrGraphicsPlane(drawMode, material, transform);
|
||||
return 0;
|
||||
}
|
||||
|
@ -732,7 +727,7 @@ static int luax_rectangularprism(lua_State* L, int scaleComponents) {
|
|||
drawMode = luaL_checkoption(L, 1, NULL, DrawModes);
|
||||
}
|
||||
float transform[16];
|
||||
luax_readtransform(L, 2, transform, scaleComponents);
|
||||
luax_readmat4(L, 2, transform, scaleComponents, NULL);
|
||||
lovrGraphicsBox(drawMode, material, transform);
|
||||
return 0;
|
||||
}
|
||||
|
@ -759,7 +754,7 @@ static int l_lovrGraphicsArc(lua_State* L) {
|
|||
arcMode = luaL_checkoption(L, index++, NULL, ArcModes);
|
||||
}
|
||||
float transform[16];
|
||||
index = luax_readtransform(L, index, transform, 1);
|
||||
index = luax_readmat4(L, index, transform, 1, NULL);
|
||||
float theta1 = luaL_optnumber(L, index++, 0);
|
||||
float theta2 = luaL_optnumber(L, index++, 2 * M_PI);
|
||||
int segments = luaL_optinteger(L, index, 64) * (MIN(fabsf(theta2 - theta1), 2 * M_PI) / (2 * M_PI));
|
||||
|
@ -776,7 +771,7 @@ static int l_lovrGraphicsCircle(lua_State* L) {
|
|||
drawMode = luaL_checkoption(L, 1, NULL, DrawModes);
|
||||
}
|
||||
float transform[16];
|
||||
int index = luax_readtransform(L, 2, transform, 1);
|
||||
int index = luax_readmat4(L, 2, transform, 1, NULL);
|
||||
int segments = luaL_optnumber(L, index, 32);
|
||||
lovrGraphicsCircle(drawMode, material, transform, segments);
|
||||
return 0;
|
||||
|
@ -803,7 +798,7 @@ static int l_lovrGraphicsSphere(lua_State* L) {
|
|||
float transform[16];
|
||||
int index = 1;
|
||||
Material* material = lua_isuserdata(L, index) ? luax_checktype(L, index++, Material) : NULL;
|
||||
index = luax_readtransform(L, index, transform, 1);
|
||||
index = luax_readmat4(L, index, transform, 1, NULL);
|
||||
int segments = luaL_optnumber(L, index, 30);
|
||||
lovrGraphicsSphere(material, transform, segments);
|
||||
return 0;
|
||||
|
@ -822,7 +817,7 @@ static int l_lovrGraphicsSkybox(lua_State* L) {
|
|||
static int l_lovrGraphicsPrint(lua_State* L) {
|
||||
const char* str = luaL_checkstring(L, 1);
|
||||
float transform[16];
|
||||
int index = luax_readtransform(L, 2, transform, 1);
|
||||
int index = luax_readmat4(L, 2, transform, 1, NULL);
|
||||
float wrap = luaL_optnumber(L, index++, 0);
|
||||
HorizontalAlign halign = luaL_checkoption(L, index++, "center", HorizontalAligns);
|
||||
VerticalAlign valign = luaL_checkoption(L, index++, "middle", VerticalAligns);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "api.h"
|
||||
#include "api/math.h"
|
||||
#include "headset/headset.h"
|
||||
#include "lib/math.h"
|
||||
|
||||
#if defined(EMSCRIPTEN) || defined(LOVR_USE_OCULUS_MOBILE)
|
||||
#define LOVR_HEADSET_HELPER_USES_REGISTRY
|
||||
|
@ -217,63 +219,46 @@ static int l_lovrHeadsetGetBoundsGeometry(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void luax_getPose(lua_State* L, float* x, float* y, float* z, float* angle, float* ax, float* ay, float* az) {
|
||||
static int luax_getPose(lua_State* L, float* x, float* y, float* z, float* angle, float* ax, float* ay, float* az) {
|
||||
if (lua_type(L, 1) == LUA_TSTRING) {
|
||||
HeadsetEye eye = luaL_checkoption(L, 1, NULL, HeadsetEyes);
|
||||
lovrHeadsetDriver->getEyePose(eye, x, y, z, angle, ax, ay, az);
|
||||
return 2;
|
||||
} else {
|
||||
lovrHeadsetDriver->getPose(x, y, z, angle, ax, ay, az);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int l_lovrHeadsetGetPose(lua_State* L) {
|
||||
float x, y, z, angle, ax, ay, az;
|
||||
luax_getPose(L, &x, &y, &z, &angle, &ax, &ay, &az);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
lua_pushnumber(L, angle);
|
||||
lua_pushnumber(L, ax);
|
||||
lua_pushnumber(L, ay);
|
||||
lua_pushnumber(L, az);
|
||||
return 7;
|
||||
int index = luax_getPose(L, &x, &y, &z, &angle, &ax, &ay, &az);
|
||||
return luax_pushpose(L, x, y, x, angle, ax, ay, az, index);
|
||||
}
|
||||
|
||||
static int l_lovrHeadsetGetPosition(lua_State* L) {
|
||||
float x, y, z, angle, ax, ay, az;
|
||||
luax_getPose(L, &x, &y, &z, &angle, &ax, &ay, &az);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
return 3;
|
||||
float position[3], angle, ax, ay, az;
|
||||
int index = luax_getPose(L, &position[0], &position[1], &position[2], &angle, &ax, &ay, &az);
|
||||
return luax_pushvec3(L, position, index);
|
||||
}
|
||||
|
||||
static int l_lovrHeadsetGetOrientation(lua_State* L) {
|
||||
float x, y, z, angle, ax, ay, az;
|
||||
luax_getPose(L, &x, &y, &z, &angle, &ax, &ay, &az);
|
||||
lua_pushnumber(L, angle);
|
||||
lua_pushnumber(L, ax);
|
||||
lua_pushnumber(L, ay);
|
||||
lua_pushnumber(L, az);
|
||||
return 4;
|
||||
float x, y, z, angle, ax, ay, az, q[4];
|
||||
int index = luax_getPose(L, &x, &y, &z, &angle, &ax, &ay, &az);
|
||||
quat_fromAngleAxis(q, angle, ax, ay, az);
|
||||
return luax_pushquat(L, q, index);
|
||||
}
|
||||
|
||||
static int l_lovrHeadsetGetVelocity(lua_State* L) {
|
||||
float vx, vy, vz;
|
||||
lovrHeadsetDriver->getVelocity(&vx, &vy, &vz);
|
||||
lua_pushnumber(L, vx);
|
||||
lua_pushnumber(L, vy);
|
||||
lua_pushnumber(L, vz);
|
||||
return 3;
|
||||
float velocity[3];
|
||||
lovrHeadsetDriver->getVelocity(&velocity[0], &velocity[1], &velocity[2]);
|
||||
return luax_pushvec3(L, velocity, 1);
|
||||
}
|
||||
|
||||
static int l_lovrHeadsetGetAngularVelocity(lua_State* L) {
|
||||
float vx, vy, vz;
|
||||
lovrHeadsetDriver->getAngularVelocity(&vx, &vy, &vz);
|
||||
lua_pushnumber(L, vx);
|
||||
lua_pushnumber(L, vy);
|
||||
lua_pushnumber(L, vz);
|
||||
return 3;
|
||||
float velocity[3];
|
||||
lovrHeadsetDriver->getAngularVelocity(&velocity[0], &velocity[1], &velocity[2]);
|
||||
return luax_pushvec3(L, velocity, 1);
|
||||
}
|
||||
|
||||
static int l_lovrHeadsetGetControllers(lua_State* L) {
|
||||
|
|
|
@ -21,7 +21,7 @@ static const luaL_Reg* lovrMathTypes[] = {
|
|||
|
||||
static int lovrMathTypeRefs[MAX_MATH_TYPES];
|
||||
|
||||
float* luax_tolightmathtype(lua_State* L, int index, MathType* type) {
|
||||
static float* luax_tolightmathtype(lua_State* L, int index, MathType* type) {
|
||||
uintptr_t p = (uintptr_t) lua_touserdata(L, index), aligned = ALIGN(p, POOL_ALIGN);
|
||||
return *type = p - aligned, p ? (float*) aligned : NULL;
|
||||
}
|
||||
|
|
|
@ -2,11 +2,17 @@
|
|||
#include "math/pool.h"
|
||||
#include "math/randomGenerator.h"
|
||||
|
||||
float* luax_tolightmathtype(lua_State* L, int index, MathType* type);
|
||||
void luax_pushlightmathtype(lua_State* L, float* p, MathType type);
|
||||
float* luax_tomathtype(lua_State* L, int index, MathType* type);
|
||||
float* luax_checkmathtype(lua_State* L, int index, MathType type, const char* message);
|
||||
float* luax_checkmathtype(lua_State* L, int index, MathType type, const char* expected);
|
||||
int luax_readvec3(lua_State* L, int index, vec3 v, const char* expected);
|
||||
int luax_readscale(lua_State* L, int index, vec3 v, int components, const char* expected);
|
||||
int luax_readquat(lua_State* L, int index, quat q, const char* expected);
|
||||
int luax_readmat4(lua_State* L, int index, mat4 m, int scaleComponents, const char* expected);
|
||||
int luax_readtransform(lua_State* L, int index, mat4 transform, int scaleComponents);
|
||||
int luax_pushvec3(lua_State* L, vec3 v, int outIndex);
|
||||
int luax_pushquat(lua_State* L, quat q, int outIndex);
|
||||
int luax_pushpose(lua_State* L, float x, float y, float z, float angle, float ax, float ay, float az, int outIndex);
|
||||
Seed luax_checkrandomseed(lua_State* L, int index);
|
||||
int l_lovrRandomGeneratorRandom(lua_State* L);
|
||||
int l_lovrRandomGeneratorRandomNormal(lua_State* L);
|
||||
|
|
|
@ -164,6 +164,8 @@ ffi.metatype(vec3, {
|
|||
|
||||
ffi.metatype(quat, {
|
||||
__index = {
|
||||
_type = C.MATH_QUAT,
|
||||
|
||||
unpack = function(q, raw)
|
||||
checkquat(q)
|
||||
if raw then
|
||||
|
@ -182,9 +184,7 @@ ffi.metatype(quat, {
|
|||
if raw then
|
||||
C.quat_set(q, x, y, z, w)
|
||||
else
|
||||
local axis = new('vec3[1]')
|
||||
axis[0] = vec3(y, z, w)
|
||||
C.quat_fromAngleAxis(q, x, axis)
|
||||
C.quat_fromAngleAxis(q, x, y, z, w)
|
||||
end
|
||||
else
|
||||
local axis = checkvec3(y)
|
||||
|
@ -255,6 +255,8 @@ ffi.metatype(quat, {
|
|||
|
||||
ffi.metatype(mat4, {
|
||||
__index = {
|
||||
_type = C.MATH_MAT4,
|
||||
|
||||
unpack = function(m)
|
||||
checkmat4(m)
|
||||
return -- yum
|
||||
|
|
|
@ -468,375 +468,373 @@ unsigned char math_lua[] = {
|
|||
0x0a, 0x0a, 0x66, 0x66, 0x69, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x79,
|
||||
0x70, 0x65, 0x28, 0x71, 0x75, 0x61, 0x74, 0x2c, 0x20, 0x7b, 0x0a, 0x20,
|
||||
0x20, 0x5f, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x7b,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x20,
|
||||
0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71,
|
||||
0x2c, 0x20, 0x72, 0x61, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x72,
|
||||
0x61, 0x77, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x71,
|
||||
0x2e, 0x78, 0x2c, 0x20, 0x71, 0x2e, 0x79, 0x2c, 0x20, 0x71, 0x2e, 0x7a,
|
||||
0x2c, 0x20, 0x71, 0x2e, 0x77, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d, 0x20, 0x6e,
|
||||
0x65, 0x77, 0x28, 0x27, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5b, 0x34, 0x5d,
|
||||
0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43,
|
||||
0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x67, 0x65, 0x74, 0x41, 0x6e, 0x67,
|
||||
0x6c, 0x65, 0x41, 0x78, 0x69, 0x73, 0x28, 0x71, 0x2c, 0x20, 0x66, 0x20,
|
||||
0x2b, 0x20, 0x30, 0x2c, 0x20, 0x66, 0x20, 0x2b, 0x20, 0x31, 0x2c, 0x20,
|
||||
0x66, 0x20, 0x2b, 0x20, 0x32, 0x2c, 0x20, 0x66, 0x20, 0x2b, 0x20, 0x33,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
|
||||
0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x5b, 0x30, 0x5d, 0x2c, 0x20, 0x66,
|
||||
0x5b, 0x31, 0x5d, 0x2c, 0x20, 0x66, 0x5b, 0x32, 0x5d, 0x2c, 0x20, 0x66,
|
||||
0x5b, 0x33, 0x5d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
|
||||
0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75,
|
||||
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x2c, 0x20, 0x78, 0x2c,
|
||||
0x20, 0x79, 0x2c, 0x20, 0x7a, 0x2c, 0x20, 0x77, 0x2c, 0x20, 0x72, 0x61,
|
||||
0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65,
|
||||
0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28,
|
||||
0x78, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x6e, 0x75, 0x6d, 0x62, 0x65,
|
||||
0x72, 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28,
|
||||
0x79, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x6e, 0x75, 0x6d, 0x62, 0x65,
|
||||
0x72, 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x72, 0x61, 0x77,
|
||||
0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74,
|
||||
0x5f, 0x73, 0x65, 0x74, 0x28, 0x71, 0x2c, 0x20, 0x78, 0x2c, 0x20, 0x79,
|
||||
0x2c, 0x20, 0x7a, 0x2c, 0x20, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c,
|
||||
0x6f, 0x63, 0x61, 0x6c, 0x20, 0x61, 0x78, 0x69, 0x73, 0x20, 0x3d, 0x20,
|
||||
0x6e, 0x65, 0x77, 0x28, 0x27, 0x76, 0x65, 0x63, 0x33, 0x5b, 0x31, 0x5d,
|
||||
0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x61, 0x78, 0x69, 0x73, 0x5b, 0x30, 0x5d, 0x20, 0x3d,
|
||||
0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x79, 0x2c, 0x20, 0x7a, 0x2c, 0x20,
|
||||
0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x66, 0x72,
|
||||
0x6f, 0x6d, 0x41, 0x6e, 0x67, 0x6c, 0x65, 0x41, 0x78, 0x69, 0x73, 0x28,
|
||||
0x71, 0x2c, 0x20, 0x78, 0x2c, 0x20, 0x61, 0x78, 0x69, 0x73, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
|
||||
0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c,
|
||||
0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x61, 0x78, 0x69, 0x73, 0x20,
|
||||
0x3d, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x76, 0x65, 0x63, 0x33, 0x28,
|
||||
0x79, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x2d, 0x2d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c,
|
||||
0x73, 0x65, 0x69, 0x66, 0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28,
|
||||
0x76, 0x65, 0x63, 0x33, 0x2c, 0x20, 0x78, 0x29, 0x20, 0x74, 0x68, 0x65,
|
||||
0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66,
|
||||
0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x76, 0x65, 0x63, 0x33,
|
||||
0x2c, 0x20, 0x79, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x69,
|
||||
0x66, 0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x71, 0x75, 0x61,
|
||||
0x74, 0x2c, 0x20, 0x78, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75, 0x61,
|
||||
0x74, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x28, 0x71, 0x2c, 0x20, 0x78, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x69,
|
||||
0x66, 0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x6d, 0x61, 0x74,
|
||||
0x34, 0x2c, 0x20, 0x78, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75, 0x61,
|
||||
0x74, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x4d, 0x61, 0x74, 0x34, 0x28, 0x71,
|
||||
0x2c, 0x20, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x27, 0x45, 0x78, 0x70, 0x65, 0x63,
|
||||
0x74, 0x65, 0x64, 0x20, 0x61, 0x20, 0x76, 0x65, 0x63, 0x33, 0x2c, 0x20,
|
||||
0x71, 0x75, 0x61, 0x74, 0x2c, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x2c, 0x20,
|
||||
0x6f, 0x72, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x71,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75,
|
||||
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x2c, 0x20, 0x72, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x69, 0x73,
|
||||
0x74, 0x79, 0x70, 0x65, 0x28, 0x71, 0x75, 0x61, 0x74, 0x2c, 0x20, 0x72,
|
||||
0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x3a,
|
||||
0x73, 0x65, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x61, 0x74,
|
||||
0x68, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x61,
|
||||
0x76, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d,
|
||||
0x20, 0x43, 0x2e, 0x4d, 0x41, 0x54, 0x48, 0x5f, 0x51, 0x55, 0x41, 0x54,
|
||||
0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63,
|
||||
0x6b, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x28, 0x71, 0x2c, 0x20, 0x72, 0x61, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74,
|
||||
0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66,
|
||||
0x20, 0x72, 0x61, 0x77, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
|
||||
0x20, 0x71, 0x2e, 0x78, 0x2c, 0x20, 0x71, 0x2e, 0x79, 0x2c, 0x20, 0x71,
|
||||
0x2e, 0x7a, 0x2c, 0x20, 0x71, 0x2e, 0x77, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d,
|
||||
0x20, 0x6e, 0x65, 0x77, 0x28, 0x27, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5b,
|
||||
0x34, 0x5d, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x67, 0x65, 0x74, 0x41,
|
||||
0x6e, 0x67, 0x6c, 0x65, 0x41, 0x78, 0x69, 0x73, 0x28, 0x71, 0x2c, 0x20,
|
||||
0x66, 0x20, 0x2b, 0x20, 0x30, 0x2c, 0x20, 0x66, 0x20, 0x2b, 0x20, 0x31,
|
||||
0x2c, 0x20, 0x66, 0x20, 0x2b, 0x20, 0x32, 0x2c, 0x20, 0x66, 0x20, 0x2b,
|
||||
0x20, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x5b, 0x30, 0x5d, 0x2c,
|
||||
0x20, 0x66, 0x5b, 0x31, 0x5d, 0x2c, 0x20, 0x66, 0x5b, 0x32, 0x5d, 0x2c,
|
||||
0x20, 0x66, 0x5b, 0x33, 0x5d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c,
|
||||
0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20,
|
||||
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x2c, 0x20,
|
||||
0x78, 0x2c, 0x20, 0x79, 0x2c, 0x20, 0x7a, 0x2c, 0x20, 0x77, 0x2c, 0x20,
|
||||
0x72, 0x61, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
|
||||
0x20, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x75, 0x61, 0x74, 0x2c, 0x20,
|
||||
0x71, 0x3a, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x28, 0x29, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x20,
|
||||
0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63,
|
||||
0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x6e, 0x6f,
|
||||
0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x71, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x73, 0x6c, 0x65, 0x72, 0x70, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x2c, 0x20, 0x72, 0x2c, 0x20,
|
||||
0x74, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65,
|
||||
0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61,
|
||||
0x74, 0x28, 0x72, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43,
|
||||
0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x73, 0x6c, 0x65, 0x72, 0x70, 0x28,
|
||||
0x71, 0x2c, 0x20, 0x72, 0x2c, 0x20, 0x74, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x7d, 0x2c, 0x0a, 0x0a, 0x20,
|
||||
0x20, 0x5f, 0x5f, 0x6d, 0x75, 0x6c, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x2c, 0x20, 0x72, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61,
|
||||
0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20,
|
||||
0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x76, 0x65, 0x63, 0x33, 0x2c,
|
||||
0x20, 0x72, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x76, 0x20, 0x3d,
|
||||
0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x76, 0x65, 0x63, 0x33, 0x28, 0x72,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75,
|
||||
0x61, 0x74, 0x5f, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x28, 0x71, 0x2c,
|
||||
0x20, 0x76, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
|
||||
0x74, 0x75, 0x72, 0x6e, 0x20, 0x76, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x72, 0x2c, 0x20, 0x27,
|
||||
0x45, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x61, 0x20, 0x76,
|
||||
0x65, 0x63, 0x33, 0x20, 0x6f, 0x72, 0x20, 0x71, 0x75, 0x61, 0x74, 0x27,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61,
|
||||
0x6c, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x74, 0x68,
|
||||
0x2e, 0x71, 0x75, 0x61, 0x74, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x6d, 0x75, 0x6c,
|
||||
0x28, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x69, 0x6e, 0x69, 0x74,
|
||||
0x28, 0x6f, 0x75, 0x74, 0x2c, 0x20, 0x71, 0x29, 0x2c, 0x20, 0x72, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
|
||||
0x6e, 0x20, 0x6f, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
|
||||
0x64, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20,
|
||||
0x5f, 0x5f, 0x6c, 0x65, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
|
||||
0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74,
|
||||
0x68, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a,
|
||||
0x0a, 0x20, 0x20, 0x5f, 0x5f, 0x74, 0x6f, 0x73, 0x74, 0x72, 0x69, 0x6e,
|
||||
0x67, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x28, 0x71, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x73,
|
||||
0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74,
|
||||
0x28, 0x27, 0x28, 0x25, 0x66, 0x2c, 0x20, 0x25, 0x66, 0x2c, 0x20, 0x25,
|
||||
0x66, 0x2c, 0x20, 0x25, 0x66, 0x29, 0x27, 0x2c, 0x20, 0x71, 0x2e, 0x78,
|
||||
0x2c, 0x20, 0x71, 0x2e, 0x79, 0x2c, 0x20, 0x71, 0x2e, 0x7a, 0x2c, 0x20,
|
||||
0x71, 0x2e, 0x77, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x7d, 0x29, 0x0a,
|
||||
0x0a, 0x66, 0x66, 0x69, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x79, 0x70,
|
||||
0x65, 0x28, 0x6d, 0x61, 0x74, 0x34, 0x2c, 0x20, 0x7b, 0x0a, 0x20, 0x20,
|
||||
0x5f, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x7b, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x20, 0x3d,
|
||||
0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b,
|
||||
0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x2d, 0x2d, 0x20,
|
||||
0x79, 0x75, 0x6d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x6d, 0x2e, 0x6d, 0x5b, 0x30, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b,
|
||||
0x31, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x32, 0x5d, 0x2c, 0x20,
|
||||
0x6d, 0x2e, 0x6d, 0x5b, 0x33, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x34, 0x5d, 0x2c, 0x20,
|
||||
0x6d, 0x2e, 0x6d, 0x5b, 0x35, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b,
|
||||
0x36, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x37, 0x5d, 0x2c, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b,
|
||||
0x38, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x39, 0x5d, 0x2c, 0x20,
|
||||
0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x30, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d,
|
||||
0x5b, 0x31, 0x31, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x32, 0x5d, 0x2c, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x31, 0x33, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b,
|
||||
0x31, 0x34, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x35, 0x5d,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x2c, 0x20, 0x2e, 0x2e, 0x2e,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63,
|
||||
0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x2e, 0x2e, 0x2e, 0x20, 0x74, 0x68,
|
||||
0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x30, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31,
|
||||
0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x32, 0x5d, 0x2c, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x33, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x34, 0x5d, 0x2c, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x35, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x36,
|
||||
0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x37, 0x5d, 0x2c, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x38,
|
||||
0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x39, 0x5d, 0x2c, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x31, 0x30, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b,
|
||||
0x31, 0x31, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x32, 0x5d, 0x2c, 0x20, 0x6d, 0x2e,
|
||||
0x6d, 0x5b, 0x31, 0x33, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31,
|
||||
0x34, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x35, 0x5d, 0x20,
|
||||
0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70,
|
||||
0x65, 0x28, 0x78, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x6e, 0x75, 0x6d,
|
||||
0x62, 0x65, 0x72, 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70,
|
||||
0x65, 0x28, 0x79, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x6e, 0x75, 0x6d,
|
||||
0x62, 0x65, 0x72, 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x72,
|
||||
0x61, 0x77, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75,
|
||||
0x61, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x28, 0x71, 0x2c, 0x20, 0x78, 0x2c,
|
||||
0x20, 0x79, 0x2c, 0x20, 0x7a, 0x2c, 0x20, 0x77, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x66, 0x72, 0x6f, 0x6d,
|
||||
0x41, 0x6e, 0x67, 0x6c, 0x65, 0x41, 0x78, 0x69, 0x73, 0x28, 0x71, 0x2c,
|
||||
0x20, 0x78, 0x2c, 0x20, 0x79, 0x2c, 0x20, 0x7a, 0x2c, 0x20, 0x77, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x61, 0x78, 0x69, 0x73,
|
||||
0x20, 0x3d, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x76, 0x65, 0x63, 0x33,
|
||||
0x28, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x2d, 0x2d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6c, 0x73, 0x65, 0x69, 0x66, 0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65,
|
||||
0x28, 0x76, 0x65, 0x63, 0x33, 0x2c, 0x20, 0x78, 0x29, 0x20, 0x74, 0x68,
|
||||
0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69,
|
||||
0x66, 0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x76, 0x65, 0x63,
|
||||
0x33, 0x2c, 0x20, 0x79, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d,
|
||||
0x2d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
|
||||
0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65,
|
||||
0x69, 0x66, 0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x71, 0x75,
|
||||
0x61, 0x74, 0x2c, 0x20, 0x78, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75,
|
||||
0x61, 0x74, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x28, 0x71, 0x2c, 0x20, 0x78,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65,
|
||||
0x69, 0x66, 0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x2c, 0x20, 0x78, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75,
|
||||
0x61, 0x74, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x4d, 0x61, 0x74, 0x34, 0x28,
|
||||
0x71, 0x2c, 0x20, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x6d, 0x3a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x28,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
|
||||
0x20, 0x6d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x3d, 0x20,
|
||||
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d,
|
||||
0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x61, 0x74, 0x68,
|
||||
0x2e, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x3a, 0x75, 0x6e, 0x70, 0x61,
|
||||
0x63, 0x6b, 0x28, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
|
||||
0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x61, 0x76, 0x65,
|
||||
0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x27, 0x45, 0x78, 0x70, 0x65,
|
||||
0x63, 0x74, 0x65, 0x64, 0x20, 0x61, 0x20, 0x76, 0x65, 0x63, 0x33, 0x2c,
|
||||
0x20, 0x71, 0x75, 0x61, 0x74, 0x2c, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x2c,
|
||||
0x20, 0x6f, 0x72, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
|
||||
0x71, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x3d, 0x20, 0x66,
|
||||
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x2c, 0x20, 0x72,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x69,
|
||||
0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x71, 0x75, 0x61, 0x74, 0x2c, 0x20,
|
||||
0x72, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72,
|
||||
0x3a, 0x73, 0x65, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d, 0x61,
|
||||
0x74, 0x68, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73,
|
||||
0x61, 0x76, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
|
||||
0x6e, 0x20, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x75, 0x61, 0x74, 0x2c,
|
||||
0x20, 0x71, 0x3a, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b, 0x28, 0x29, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65,
|
||||
0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28,
|
||||
0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65,
|
||||
0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x6e,
|
||||
0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x71, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x73, 0x6c, 0x65, 0x72, 0x70, 0x20, 0x3d, 0x20, 0x66, 0x75,
|
||||
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x2c, 0x20, 0x72, 0x2c,
|
||||
0x20, 0x74, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75,
|
||||
0x61, 0x74, 0x28, 0x72, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x73, 0x6c, 0x65, 0x72, 0x70,
|
||||
0x28, 0x71, 0x2c, 0x20, 0x72, 0x2c, 0x20, 0x74, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x7d, 0x2c, 0x0a, 0x0a,
|
||||
0x20, 0x20, 0x5f, 0x5f, 0x6d, 0x75, 0x6c, 0x20, 0x3d, 0x20, 0x66, 0x75,
|
||||
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x2c, 0x20, 0x72, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75,
|
||||
0x61, 0x74, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66,
|
||||
0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x76, 0x65, 0x63, 0x33,
|
||||
0x2c, 0x20, 0x72, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x76, 0x20,
|
||||
0x3d, 0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x76, 0x65, 0x63, 0x33, 0x28,
|
||||
0x72, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x71,
|
||||
0x75, 0x61, 0x74, 0x5f, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x28, 0x71,
|
||||
0x2c, 0x20, 0x76, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72,
|
||||
0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x76, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x72, 0x2c, 0x20,
|
||||
0x27, 0x45, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x61, 0x20,
|
||||
0x76, 0x65, 0x63, 0x33, 0x20, 0x6f, 0x72, 0x20, 0x71, 0x75, 0x61, 0x74,
|
||||
0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63,
|
||||
0x61, 0x6c, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x74,
|
||||
0x68, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x6d, 0x75,
|
||||
0x6c, 0x28, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x69, 0x6e, 0x69,
|
||||
0x74, 0x28, 0x6f, 0x75, 0x74, 0x2c, 0x20, 0x71, 0x29, 0x2c, 0x20, 0x72,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75,
|
||||
0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6e, 0x64, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20,
|
||||
0x20, 0x5f, 0x5f, 0x6c, 0x65, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x71,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
|
||||
0x20, 0x43, 0x2e, 0x71, 0x75, 0x61, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67,
|
||||
0x74, 0x68, 0x28, 0x71, 0x29, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c,
|
||||
0x0a, 0x0a, 0x20, 0x20, 0x5f, 0x5f, 0x74, 0x6f, 0x73, 0x74, 0x72, 0x69,
|
||||
0x6e, 0x67, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x28, 0x71, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
|
||||
0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61,
|
||||
0x74, 0x28, 0x27, 0x28, 0x25, 0x66, 0x2c, 0x20, 0x25, 0x66, 0x2c, 0x20,
|
||||
0x25, 0x66, 0x2c, 0x20, 0x25, 0x66, 0x29, 0x27, 0x2c, 0x20, 0x71, 0x2e,
|
||||
0x78, 0x2c, 0x20, 0x71, 0x2e, 0x79, 0x2c, 0x20, 0x71, 0x2e, 0x7a, 0x2c,
|
||||
0x20, 0x71, 0x2e, 0x77, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x7d, 0x29,
|
||||
0x0a, 0x0a, 0x66, 0x66, 0x69, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x79,
|
||||
0x70, 0x65, 0x28, 0x6d, 0x61, 0x74, 0x34, 0x2c, 0x20, 0x7b, 0x0a, 0x20,
|
||||
0x20, 0x5f, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x7b,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d,
|
||||
0x20, 0x43, 0x2e, 0x4d, 0x41, 0x54, 0x48, 0x5f, 0x4d, 0x41, 0x54, 0x34,
|
||||
0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x75, 0x6e, 0x70, 0x61, 0x63,
|
||||
0x6b, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
|
||||
0x2d, 0x2d, 0x20, 0x79, 0x75, 0x6d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x30, 0x5d, 0x2c, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x31, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x32,
|
||||
0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x33, 0x5d, 0x2c, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x34,
|
||||
0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x35, 0x5d, 0x2c, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x36, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x37,
|
||||
0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x38, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x39,
|
||||
0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x30, 0x5d, 0x2c, 0x20,
|
||||
0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x31, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x32, 0x5d,
|
||||
0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x33, 0x5d, 0x2c, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x31, 0x34, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b,
|
||||
0x31, 0x35, 0x5d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c,
|
||||
0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20,
|
||||
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x2c, 0x20,
|
||||
0x2e, 0x2e, 0x2e, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x2e, 0x2e, 0x2e,
|
||||
0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x30, 0x5d, 0x2c, 0x20, 0x6d, 0x2e,
|
||||
0x6d, 0x5b, 0x31, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x32, 0x5d,
|
||||
0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x33, 0x5d, 0x2c, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x34, 0x5d,
|
||||
0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x35, 0x5d, 0x2c, 0x20, 0x6d, 0x2e,
|
||||
0x6d, 0x5b, 0x36, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x37, 0x5d,
|
||||
0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x2e,
|
||||
0x6d, 0x5b, 0x38, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x39, 0x5d,
|
||||
0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x30, 0x5d, 0x2c, 0x20, 0x6d,
|
||||
0x2e, 0x6d, 0x5b, 0x31, 0x31, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x32, 0x5d, 0x2c,
|
||||
0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31, 0x33, 0x5d, 0x2c, 0x20, 0x6d, 0x2e,
|
||||
0x6d, 0x5b, 0x31, 0x34, 0x5d, 0x2c, 0x20, 0x6d, 0x2e, 0x6d, 0x5b, 0x31,
|
||||
0x35, 0x5d, 0x20, 0x3d, 0x20, 0x2e, 0x2e, 0x2e, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x6d, 0x3a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
|
||||
0x74, 0x79, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74,
|
||||
0x75, 0x72, 0x6e, 0x20, 0x6d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
|
||||
0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x70, 0x79,
|
||||
0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28,
|
||||
0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65,
|
||||
0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6d,
|
||||
0x61, 0x74, 0x34, 0x28, 0x6d, 0x3a, 0x75, 0x6e, 0x70, 0x61, 0x63, 0x6b,
|
||||
0x28, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c,
|
||||
0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
|
||||
0x74, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34,
|
||||
0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x28, 0x6d, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x20, 0x3d,
|
||||
0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b,
|
||||
0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f, 0x75, 0x74, 0x20,
|
||||
0x3d, 0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x28,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x5f, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x28, 0x43, 0x2e,
|
||||
0x6d, 0x61, 0x74, 0x34, 0x5f, 0x73, 0x65, 0x74, 0x28, 0x6f, 0x75, 0x74,
|
||||
0x2c, 0x20, 0x6d, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65, 0x20, 0x3d,
|
||||
0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b,
|
||||
0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f, 0x75, 0x74, 0x20,
|
||||
0x3d, 0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x28,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65,
|
||||
0x61, 0x74, 0x68, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x3a, 0x75,
|
||||
0x6e, 0x70, 0x61, 0x63, 0x6b, 0x28, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73,
|
||||
0x61, 0x76, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
|
||||
0x6e, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x3a, 0x75, 0x6e, 0x70,
|
||||
0x61, 0x63, 0x6b, 0x28, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x64, 0x65,
|
||||
0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28,
|
||||
0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d,
|
||||
0x61, 0x74, 0x34, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,
|
||||
0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c,
|
||||
0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73,
|
||||
0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f,
|
||||
0x75, 0x74, 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43,
|
||||
0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74,
|
||||
0x28, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x73, 0x65, 0x74, 0x28,
|
||||
0x6f, 0x75, 0x74, 0x2c, 0x20, 0x6d, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75,
|
||||
0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74,
|
||||
0x20, 0x20, 0x20, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73,
|
||||
0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x28, 0x6d, 0x2c, 0x20, 0x78, 0x2c, 0x20, 0x79, 0x2c, 0x20, 0x7a, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b,
|
||||
0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28, 0x78, 0x29,
|
||||
0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f,
|
||||
0x75, 0x74, 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x28, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43,
|
||||
0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70,
|
||||
0x6f, 0x73, 0x65, 0x28, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x73,
|
||||
0x65, 0x74, 0x28, 0x6f, 0x75, 0x74, 0x2c, 0x20, 0x6d, 0x29, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
|
||||
0x20, 0x6f, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64,
|
||||
0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73,
|
||||
0x6c, 0x61, 0x74, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x2c, 0x20, 0x78, 0x2c, 0x20, 0x79, 0x2c,
|
||||
0x20, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65,
|
||||
0x28, 0x78, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x6e, 0x75, 0x6d, 0x62,
|
||||
0x65, 0x72, 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f,
|
||||
0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x28, 0x6d, 0x2c,
|
||||
0x20, 0x78, 0x2c, 0x20, 0x79, 0x2c, 0x20, 0x7a, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x76, 0x65,
|
||||
0x63, 0x33, 0x28, 0x78, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x27, 0x76, 0x65,
|
||||
0x63, 0x33, 0x20, 0x6f, 0x72, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72,
|
||||
0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43,
|
||||
0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c,
|
||||
0x61, 0x74, 0x65, 0x28, 0x6d, 0x2c, 0x20, 0x78, 0x2e, 0x78, 0x2c, 0x20,
|
||||
0x78, 0x2e, 0x79, 0x2c, 0x20, 0x78, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x6f,
|
||||
0x74, 0x61, 0x74, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x2c, 0x20, 0x61, 0x6e, 0x67, 0x6c, 0x65,
|
||||
0x2c, 0x20, 0x61, 0x78, 0x2c, 0x20, 0x61, 0x79, 0x2c, 0x20, 0x61, 0x7a,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63,
|
||||
0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28, 0x61,
|
||||
0x6e, 0x67, 0x6c, 0x65, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x6e, 0x75,
|
||||
0x6d, 0x62, 0x65, 0x72, 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61, 0x74,
|
||||
0x34, 0x5f, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x28, 0x6d, 0x2c, 0x20,
|
||||
0x61, 0x6e, 0x67, 0x6c, 0x65, 0x2c, 0x20, 0x61, 0x78, 0x2c, 0x20, 0x61,
|
||||
0x79, 0x2c, 0x20, 0x61, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28,
|
||||
0x61, 0x6e, 0x67, 0x6c, 0x65, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x27, 0x71,
|
||||
0x75, 0x61, 0x74, 0x20, 0x6f, 0x72, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65,
|
||||
0x72, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x72, 0x6f, 0x74, 0x61, 0x74,
|
||||
0x65, 0x51, 0x75, 0x61, 0x74, 0x28, 0x6d, 0x2c, 0x20, 0x61, 0x6e, 0x67,
|
||||
0x6c, 0x65, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
|
||||
0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x3d, 0x20,
|
||||
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x2c, 0x20,
|
||||
0x73, 0x78, 0x2c, 0x20, 0x73, 0x79, 0x2c, 0x20, 0x73, 0x7a, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d,
|
||||
0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28, 0x73, 0x78, 0x29,
|
||||
0x20, 0x3d, 0x3d, 0x20, 0x27, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27,
|
||||
0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x74, 0x72, 0x61,
|
||||
0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x28, 0x6d, 0x2c, 0x20, 0x78, 0x2c,
|
||||
0x20, 0x79, 0x2c, 0x20, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x76, 0x65, 0x63, 0x33, 0x28,
|
||||
0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x73, 0x63, 0x61,
|
||||
0x6c, 0x65, 0x28, 0x6d, 0x2c, 0x20, 0x73, 0x78, 0x2c, 0x20, 0x73, 0x79,
|
||||
0x2c, 0x20, 0x73, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x76, 0x65, 0x63, 0x33, 0x28, 0x73,
|
||||
0x78, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x27, 0x76, 0x65, 0x63, 0x33, 0x20,
|
||||
0x6f, 0x72, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65,
|
||||
0x28, 0x6d, 0x2c, 0x20, 0x78, 0x2e, 0x78, 0x2c, 0x20, 0x78, 0x2e, 0x79,
|
||||
0x2c, 0x20, 0x78, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64,
|
||||
0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x6f, 0x74, 0x61, 0x74,
|
||||
0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x28, 0x6d, 0x2c, 0x20, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x2c, 0x20, 0x61,
|
||||
0x78, 0x2c, 0x20, 0x61, 0x79, 0x2c, 0x20, 0x61, 0x7a, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x69, 0x66, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28, 0x61, 0x6e, 0x67, 0x6c,
|
||||
0x65, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x6e, 0x75, 0x6d, 0x62, 0x65,
|
||||
0x72, 0x27, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x72,
|
||||
0x6f, 0x74, 0x61, 0x74, 0x65, 0x28, 0x6d, 0x2c, 0x20, 0x61, 0x6e, 0x67,
|
||||
0x6c, 0x65, 0x2c, 0x20, 0x61, 0x78, 0x2c, 0x20, 0x61, 0x79, 0x2c, 0x20,
|
||||
0x61, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c,
|
||||
0x73, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x71, 0x75, 0x61, 0x74, 0x28, 0x61, 0x6e, 0x67,
|
||||
0x6c, 0x65, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x27, 0x71, 0x75, 0x61, 0x74,
|
||||
0x20, 0x6f, 0x72, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d,
|
||||
0x61, 0x74, 0x34, 0x5f, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x51, 0x75,
|
||||
0x61, 0x74, 0x28, 0x6d, 0x2c, 0x20, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x2c, 0x20, 0x73, 0x78, 0x2c,
|
||||
0x20, 0x73, 0x79, 0x2c, 0x20, 0x73, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x74, 0x34, 0x5f, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x6d, 0x2c, 0x20,
|
||||
0x73, 0x78, 0x2e, 0x78, 0x2c, 0x20, 0x73, 0x78, 0x2e, 0x79, 0x2c, 0x20,
|
||||
0x73, 0x78, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c,
|
||||
0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x67, 0x65, 0x74, 0x54, 0x72, 0x61,
|
||||
0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34,
|
||||
0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66,
|
||||
0x20, 0x74, 0x79, 0x70, 0x65, 0x28, 0x73, 0x78, 0x29, 0x20, 0x3d, 0x3d,
|
||||
0x20, 0x27, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27, 0x20, 0x74, 0x68,
|
||||
0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43,
|
||||
0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x28,
|
||||
0x6d, 0x2c, 0x20, 0x73, 0x78, 0x2c, 0x20, 0x73, 0x79, 0x2c, 0x20, 0x73,
|
||||
0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73,
|
||||
0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x76, 0x65, 0x63, 0x33, 0x28, 0x73, 0x78, 0x2c, 0x20,
|
||||
0x31, 0x2c, 0x20, 0x27, 0x76, 0x65, 0x63, 0x33, 0x20, 0x6f, 0x72, 0x20,
|
||||
0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f,
|
||||
0x73, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x6d, 0x2c, 0x20, 0x73, 0x78, 0x2e,
|
||||
0x78, 0x2c, 0x20, 0x73, 0x78, 0x2e, 0x79, 0x2c, 0x20, 0x73, 0x78, 0x2e,
|
||||
0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64,
|
||||
0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x67, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66,
|
||||
0x20, 0x20, 0x20, 0x73, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x73, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d,
|
||||
0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28,
|
||||
0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65,
|
||||
0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x65, 0x72,
|
||||
0x73, 0x70, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x20, 0x3d, 0x20, 0x66,
|
||||
0x70, 0x65, 0x72, 0x73, 0x70, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x20,
|
||||
0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63,
|
||||
0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x2d, 0x2d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e,
|
||||
0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x72, 0x74, 0x68,
|
||||
0x6f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x3d, 0x20, 0x66,
|
||||
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x2d, 0x2d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x72, 0x74, 0x68, 0x6f, 0x67, 0x72,
|
||||
0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34, 0x28,
|
||||
0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x41, 0x74, 0x20, 0x3d, 0x20, 0x66,
|
||||
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x7d, 0x2c, 0x0a, 0x0a, 0x20, 0x20,
|
||||
0x5f, 0x5f, 0x6d, 0x75, 0x6c, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x2c, 0x20, 0x6e, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d, 0x61, 0x74, 0x34,
|
||||
0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x69,
|
||||
0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x6d, 0x61, 0x74, 0x34, 0x2c, 0x20,
|
||||
0x6e, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f, 0x75, 0x74, 0x20,
|
||||
0x3d, 0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x28,
|
||||
0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d,
|
||||
0x61, 0x74, 0x34, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x79,
|
||||
0x28, 0x6f, 0x75, 0x74, 0x2c, 0x20, 0x6e, 0x29, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75,
|
||||
0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x76, 0x65,
|
||||
0x63, 0x33, 0x28, 0x6e, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x27, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x20, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x63, 0x33, 0x27, 0x29,
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
|
||||
0x20, 0x66, 0x20, 0x3d, 0x20, 0x6e, 0x65, 0x77, 0x28, 0x27, 0x66, 0x6c,
|
||||
0x6f, 0x61, 0x74, 0x5b, 0x33, 0x5d, 0x27, 0x2c, 0x20, 0x6e, 0x2e, 0x78,
|
||||
0x2c, 0x20, 0x6e, 0x2e, 0x79, 0x2c, 0x20, 0x6e, 0x2e, 0x7a, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34,
|
||||
0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x28, 0x6d,
|
||||
0x2c, 0x20, 0x66, 0x20, 0x2b, 0x20, 0x30, 0x2c, 0x20, 0x66, 0x20, 0x2b,
|
||||
0x20, 0x31, 0x2c, 0x20, 0x66, 0x20, 0x2b, 0x20, 0x32, 0x29, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
|
||||
0x6d, 0x61, 0x74, 0x68, 0x2e, 0x76, 0x65, 0x63, 0x33, 0x28, 0x66, 0x5b,
|
||||
0x30, 0x5d, 0x2c, 0x20, 0x66, 0x5b, 0x31, 0x5d, 0x2c, 0x20, 0x66, 0x5b,
|
||||
0x32, 0x5d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x7d, 0x29, 0x0a
|
||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x41, 0x74, 0x20,
|
||||
0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x7d, 0x2c, 0x0a,
|
||||
0x0a, 0x20, 0x20, 0x5f, 0x5f, 0x6d, 0x75, 0x6c, 0x20, 0x3d, 0x20, 0x66,
|
||||
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x6d, 0x2c, 0x20, 0x6e,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6d,
|
||||
0x61, 0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69,
|
||||
0x66, 0x20, 0x69, 0x73, 0x74, 0x79, 0x70, 0x65, 0x28, 0x6d, 0x61, 0x74,
|
||||
0x34, 0x2c, 0x20, 0x6e, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f,
|
||||
0x75, 0x74, 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x6d, 0x61,
|
||||
0x74, 0x34, 0x28, 0x6d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x43, 0x2e, 0x6d, 0x61, 0x74, 0x34, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69,
|
||||
0x70, 0x6c, 0x79, 0x28, 0x6f, 0x75, 0x74, 0x2c, 0x20, 0x6e, 0x29, 0x0a,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e,
|
||||
0x20, 0x6f, 0x75, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73,
|
||||
0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x68, 0x65, 0x63,
|
||||
0x6b, 0x76, 0x65, 0x63, 0x33, 0x28, 0x6e, 0x2c, 0x20, 0x31, 0x2c, 0x20,
|
||||
0x27, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x6f, 0x72, 0x20, 0x76, 0x65, 0x63,
|
||||
0x33, 0x27, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f,
|
||||
0x63, 0x61, 0x6c, 0x20, 0x66, 0x20, 0x3d, 0x20, 0x6e, 0x65, 0x77, 0x28,
|
||||
0x27, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5b, 0x33, 0x5d, 0x27, 0x2c, 0x20,
|
||||
0x6e, 0x2e, 0x78, 0x2c, 0x20, 0x6e, 0x2e, 0x79, 0x2c, 0x20, 0x6e, 0x2e,
|
||||
0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x2e, 0x6d,
|
||||
0x61, 0x74, 0x34, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72,
|
||||
0x6d, 0x28, 0x6d, 0x2c, 0x20, 0x66, 0x20, 0x2b, 0x20, 0x30, 0x2c, 0x20,
|
||||
0x66, 0x20, 0x2b, 0x20, 0x31, 0x2c, 0x20, 0x66, 0x20, 0x2b, 0x20, 0x32,
|
||||
0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75,
|
||||
0x72, 0x6e, 0x20, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x76, 0x65, 0x63, 0x33,
|
||||
0x28, 0x66, 0x5b, 0x30, 0x5d, 0x2c, 0x20, 0x66, 0x5b, 0x31, 0x5d, 0x2c,
|
||||
0x20, 0x66, 0x5b, 0x32, 0x5d, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65,
|
||||
0x6e, 0x64, 0x0a, 0x20, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x7d, 0x29, 0x0a
|
||||
};
|
||||
unsigned int math_lua_len = 10065;
|
||||
unsigned int math_lua_len = 10044;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "api.h"
|
||||
#include "api/math.h"
|
||||
#include "headset/headset.h"
|
||||
#include "data/modelData.h"
|
||||
#include "graphics/model.h"
|
||||
|
@ -20,55 +21,36 @@ int l_lovrControllerGetPose(lua_State* L) {
|
|||
Controller* controller = luax_checktype(L, 1, Controller);
|
||||
float x, y, z, angle, ax, ay, az;
|
||||
lovrHeadsetDriver->controllerGetPose(controller, &x, &y, &z, &angle, &ax, &ay, &az);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
lua_pushnumber(L, angle);
|
||||
lua_pushnumber(L, ax);
|
||||
lua_pushnumber(L, ay);
|
||||
lua_pushnumber(L, az);
|
||||
return 7;
|
||||
return luax_pushpose(L, x, y, z, angle, ax, ay, az, 2);
|
||||
}
|
||||
|
||||
int l_lovrControllerGetPosition(lua_State* L) {
|
||||
Controller* controller = luax_checktype(L, 1, Controller);
|
||||
float x, y, z, angle, ax, ay, az;
|
||||
lovrHeadsetDriver->controllerGetPose(controller, &x, &y, &z, &angle, &ax, &ay, &az);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
return 3;
|
||||
float position[3], angle, ax, ay, az;
|
||||
lovrHeadsetDriver->controllerGetPose(controller, &position[0], &position[1], &position[2], &angle, &ax, &ay, &az);
|
||||
return luax_pushvec3(L, position, 2);
|
||||
}
|
||||
|
||||
int l_lovrControllerGetOrientation(lua_State* L) {
|
||||
Controller* controller = luax_checktype(L, 1, Controller);
|
||||
float x, y, z, angle, ax, ay, az;
|
||||
float x, y, z, angle, ax, ay, az, q[4];
|
||||
lovrHeadsetDriver->controllerGetPose(controller, &x, &y, &z, &angle, &ax, &ay, &az);
|
||||
lua_pushnumber(L, angle);
|
||||
lua_pushnumber(L, ax);
|
||||
lua_pushnumber(L, ay);
|
||||
lua_pushnumber(L, az);
|
||||
return 4;
|
||||
quat_fromAngleAxis(q, angle, ax, ay, az);
|
||||
return luax_pushquat(L, q, 2);
|
||||
}
|
||||
|
||||
int l_lovrControllerGetVelocity(lua_State* L) {
|
||||
Controller* controller = luax_checktype(L, 1, Controller);
|
||||
float vx, vy, vz;
|
||||
lovrHeadsetDriver->controllerGetVelocity(controller, &vx, &vy, &vz);
|
||||
lua_pushnumber(L, vx);
|
||||
lua_pushnumber(L, vy);
|
||||
lua_pushnumber(L, vz);
|
||||
return 3;
|
||||
float velocity[3];
|
||||
lovrHeadsetDriver->controllerGetVelocity(controller, &velocity[0], &velocity[1], &velocity[2]);
|
||||
return luax_pushvec3(L, velocity, 2);
|
||||
}
|
||||
|
||||
int l_lovrControllerGetAngularVelocity(lua_State* L) {
|
||||
Controller* controller = luax_checktype(L, 1, Controller);
|
||||
float vx, vy, vz;
|
||||
lovrHeadsetDriver->controllerGetAngularVelocity(controller, &vx, &vy, &vz);
|
||||
lua_pushnumber(L, vx);
|
||||
lua_pushnumber(L, vy);
|
||||
lua_pushnumber(L, vz);
|
||||
return 3;
|
||||
float velocity[3];
|
||||
lovrHeadsetDriver->controllerGetAngularVelocity(controller, &velocity[0], &velocity[1], &velocity[2]);
|
||||
return luax_pushvec3(L, velocity, 2);
|
||||
}
|
||||
|
||||
int l_lovrControllerGetAxis(lua_State* L) {
|
||||
|
|
|
@ -3,6 +3,56 @@
|
|||
#include "math/math.h"
|
||||
#include "lib/math.h"
|
||||
|
||||
int luax_readmat4(lua_State* L, int index, mat4 m, int scaleComponents, const char* expected) {
|
||||
switch (lua_type(L, index)) {
|
||||
case LUA_TNIL:
|
||||
case LUA_TNONE:
|
||||
mat4_identity(m);
|
||||
return index + 1;
|
||||
|
||||
case LUA_TLIGHTUSERDATA:
|
||||
case LUA_TUSERDATA:
|
||||
default: {
|
||||
MathType type;
|
||||
float* p = luax_tomathtype(L, index, &type);
|
||||
if (type == MATH_MAT4) {
|
||||
mat4_init(m, p);
|
||||
return index + 1;
|
||||
}
|
||||
} // Fall through
|
||||
|
||||
case LUA_TNUMBER: {
|
||||
float S[3];
|
||||
float R[4];
|
||||
mat4_identity(m);
|
||||
index = luax_readvec3(L, index, m + 12, "mat4, vec3, or number");
|
||||
index = luax_readscale(L, index, S, scaleComponents, NULL);
|
||||
index = luax_readquat(L, index, R, NULL);
|
||||
mat4_rotateQuat(m, R);
|
||||
mat4_scale(m, S[0], S[1], S[2]);
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int luax_pushpose(lua_State* L, float x, float y, float z, float angle, float ax, float ay, float az, int index) {
|
||||
mat4 out;
|
||||
if (index > 0 && !lua_isnoneornil(L, index) && (out = luax_checkmathtype(L, index, MATH_MAT4, NULL)) != NULL) {
|
||||
mat4_setTransform(out, x, y, z, 1, 1, 1, angle, ax, ay, az);
|
||||
lua_settop(L, index);
|
||||
return 1;
|
||||
} else {
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
lua_pushnumber(L, angle);
|
||||
lua_pushnumber(L, ax);
|
||||
lua_pushnumber(L, ay);
|
||||
lua_pushnumber(L, az);
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
|
||||
static int l_lovrMat4Unpack(lua_State* L) {
|
||||
mat4 m = luax_checkmathtype(L, 1, MATH_MAT4, NULL);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
|
@ -13,8 +63,14 @@ static int l_lovrMat4Unpack(lua_State* L) {
|
|||
|
||||
int l_lovrMat4Set(lua_State* L) {
|
||||
mat4 m = luax_checkmathtype(L, 1, MATH_MAT4, NULL);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
m[i] = luaL_checknumber(L, i);
|
||||
switch (lua_gettop(L)) {
|
||||
case 1: mat4_identity(m); break;
|
||||
case 2: m[0] = m[5] = m[10] = m[15] = luaL_checknumber(L, 2); break;
|
||||
default:
|
||||
for (int i = 0; i < 16; i++) {
|
||||
m[i] = luaL_checknumber(L, i + 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
lua_settop(L, 1);
|
||||
return 1;
|
||||
|
|
|
@ -58,7 +58,7 @@ int l_lovrMeshDrawInstanced(lua_State* L) {
|
|||
Mesh* mesh = luax_checktype(L, 1, Mesh);
|
||||
int instances = luaL_checkinteger(L, 2);
|
||||
float transform[16];
|
||||
luax_readtransform(L, 3, transform, 1);
|
||||
luax_readmat4(L, 3, transform, 1, NULL);
|
||||
lovrGraphicsDraw(&(DrawCommand) {
|
||||
.transform = transform,
|
||||
.mesh = mesh,
|
||||
|
|
|
@ -6,7 +6,7 @@ int l_lovrModelDrawInstanced(lua_State* L) {
|
|||
Model* model = luax_checktype(L, 1, Model);
|
||||
int instances = luaL_checkinteger(L, 2);
|
||||
float transform[16];
|
||||
luax_readtransform(L, 3, transform, 1);
|
||||
luax_readmat4(L, 3, transform, 1, NULL);
|
||||
lovrModelDraw(model, transform, instances);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,43 @@
|
|||
#include "api/math.h"
|
||||
#include "math/math.h"
|
||||
|
||||
int luax_readquat(lua_State* L, int index, quat q, const char* expected) {
|
||||
float angle, ax, ay, az;
|
||||
switch (lua_type(L, index)) {
|
||||
case LUA_TNIL:
|
||||
case LUA_TNONE:
|
||||
quat_set(q, 0, 0, 0, 0);
|
||||
return ++index;
|
||||
case LUA_TNUMBER:
|
||||
angle = luaL_optnumber(L, index++, 0.);
|
||||
ax = luaL_optnumber(L, index++, 0.);
|
||||
ay = luaL_optnumber(L, index++, 1.);
|
||||
az = luaL_optnumber(L, index++, 0.);
|
||||
quat_fromAngleAxis(q, angle, ax, ay, az);
|
||||
return index;
|
||||
default:
|
||||
quat_init(q, luax_checkmathtype(L, index++, MATH_QUAT, expected ? expected : "quat or number"));
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
int luax_pushquat(lua_State* L, quat q, int index) {
|
||||
quat out;
|
||||
if (index > 0 && !lua_isnoneornil(L, index) && (out = luax_checkmathtype(L, index, MATH_QUAT, NULL)) != NULL) {
|
||||
quat_init(out, q);
|
||||
lua_settop(L, index);
|
||||
return 1;
|
||||
} else {
|
||||
float angle, ax, ay, az;
|
||||
quat_getAngleAxis(q, &angle, &ax, &ay, &az);
|
||||
lua_pushnumber(L, angle);
|
||||
lua_pushnumber(L, ax);
|
||||
lua_pushnumber(L, ay);
|
||||
lua_pushnumber(L, az);
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
static int l_lovrQuatUnpack(lua_State* L) {
|
||||
quat q = luax_checkmathtype(L, 1, MATH_QUAT, NULL);
|
||||
bool raw = lua_toboolean(L, 2);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "api.h"
|
||||
#include "api/graphics.h"
|
||||
#include "api/math.h"
|
||||
#include "graphics/shader.h"
|
||||
#include "math/transform.h"
|
||||
|
||||
|
@ -13,10 +14,11 @@ static struct TempData tempData;
|
|||
|
||||
int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* dest, const char* debug) {
|
||||
Blob* blob = luax_totype(L, index, Blob);
|
||||
UniformType uniformType = uniform->type;
|
||||
int components = uniform->components;
|
||||
int count = uniform->count;
|
||||
|
||||
if (uniform->type == UNIFORM_MATRIX) {
|
||||
if (uniformType == UNIFORM_MATRIX) {
|
||||
components *= components;
|
||||
}
|
||||
|
||||
|
@ -25,7 +27,7 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des
|
|||
const char* s = elements == 1 ? "" : "s";
|
||||
size_t capacity;
|
||||
|
||||
switch (uniform->type) {
|
||||
switch (uniformType) {
|
||||
case UNIFORM_FLOAT:
|
||||
case UNIFORM_MATRIX:
|
||||
capacity = blob->size / sizeof(float);
|
||||
|
@ -57,7 +59,7 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des
|
|||
j = -1;
|
||||
}
|
||||
|
||||
switch (uniform->type) {
|
||||
switch (uniformType) {
|
||||
case UNIFORM_FLOAT: *((float*) dest + i) = luaL_optnumber(L, j, 0.); break;
|
||||
case UNIFORM_INT: *((int*) dest + i) = luaL_optinteger(L, j, 0); break;
|
||||
case UNIFORM_SAMPLER:
|
||||
|
@ -96,16 +98,28 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des
|
|||
for (int i = 0; i < length; i++) {
|
||||
lua_rawgeti(L, index, i + 1);
|
||||
|
||||
if (uniform->type == UNIFORM_MATRIX && lua_isuserdata(L, -1)) {
|
||||
Transform* transform = luax_checktype(L, -1, Transform);
|
||||
memcpy((float*) dest + i * components, transform->matrix, 16 * sizeof(float));
|
||||
lua_pop(L, 1);
|
||||
continue;
|
||||
if (uniformType == UNIFORM_MATRIX && components == 16) {
|
||||
MathType type;
|
||||
mat4 m = luax_tomathtype(L, -1, &type);
|
||||
if (m && type == MATH_MAT4) {
|
||||
mat4_init((float*) dest + i * components, m);
|
||||
lua_pop(L, 1);
|
||||
continue;
|
||||
}
|
||||
} else if (uniformType == UNIFORM_FLOAT && components == 3) {
|
||||
MathType type;
|
||||
vec3 v = luax_tomathtype(L, -1, &type);
|
||||
if (v && type == MATH_VEC3) {
|
||||
vec3_init((float*) dest + i * components, v);
|
||||
lua_pop(L, 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
luaL_checktype(L, -1, LUA_TTABLE);
|
||||
for (int j = 0; j < components; j++) {
|
||||
lua_rawgeti(L, -1, j + 1);
|
||||
switch (uniform->type) {
|
||||
switch (uniformType) {
|
||||
case UNIFORM_FLOAT:
|
||||
case UNIFORM_MATRIX:
|
||||
*((float*) dest + i * components + j) = luaL_optnumber(L, -1, 0.);
|
||||
|
@ -125,16 +139,26 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des
|
|||
}
|
||||
} else {
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (uniform->type == UNIFORM_MATRIX && lua_isuserdata(L, index + i)) {
|
||||
Transform* transform = luax_checktype(L, index + i, Transform);
|
||||
memcpy((float*) dest + i * components, transform->matrix, 16 * sizeof(float));
|
||||
continue;
|
||||
if (uniformType == UNIFORM_MATRIX && components == 16) {
|
||||
MathType type;
|
||||
mat4 m = luax_tomathtype(L, index + i, &type);
|
||||
if (m && type == MATH_MAT4) {
|
||||
mat4_init((float*) dest + i * components, m);
|
||||
continue;
|
||||
}
|
||||
} else if (uniformType == UNIFORM_FLOAT && components == 3) {
|
||||
MathType type;
|
||||
vec3 v = luax_tomathtype(L, index + i, &type);
|
||||
if (v && type == MATH_VEC3) {
|
||||
vec3_init((float*) dest + i * components, v);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
luaL_checktype(L, index + i, LUA_TTABLE);
|
||||
for (int j = 0; j < components; j++) {
|
||||
lua_rawgeti(L, index + i, j + 1);
|
||||
switch (uniform->type) {
|
||||
switch (uniformType) {
|
||||
case UNIFORM_FLOAT:
|
||||
case UNIFORM_MATRIX:
|
||||
*((float*) dest + i * components + j) = luaL_optnumber(L, -1, 0.);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "api.h"
|
||||
#include "api/math.h"
|
||||
#include "audio/audio.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
|
@ -25,12 +26,9 @@ int l_lovrSourceGetCone(lua_State* L) {
|
|||
}
|
||||
|
||||
int l_lovrSourceGetDirection(lua_State* L) {
|
||||
float x, y, z;
|
||||
lovrSourceGetDirection(luax_checktype(L, 1, Source), &x, &y, &z);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
return 3;
|
||||
float direction[3];
|
||||
lovrSourceGetDirection(luax_checktype(L, 1, Source), &direction[0], &direction[1], &direction[2]);
|
||||
return luax_pushvec3(L, direction, 2);
|
||||
}
|
||||
|
||||
int l_lovrSourceGetDuration(lua_State* L) {
|
||||
|
@ -64,12 +62,9 @@ int l_lovrSourceGetPitch(lua_State* L) {
|
|||
}
|
||||
|
||||
int l_lovrSourceGetPosition(lua_State* L) {
|
||||
float x, y, z;
|
||||
lovrSourceGetPosition(luax_checktype(L, 1, Source), &x, &y, &z);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
return 3;
|
||||
float position[3];
|
||||
lovrSourceGetPosition(luax_checktype(L, 1, Source), &position[0], &position[1], &position[2]);
|
||||
return luax_pushvec3(L, position, 2);
|
||||
}
|
||||
|
||||
int l_lovrSourceGetSampleRate(lua_State* L) {
|
||||
|
@ -85,12 +80,9 @@ int l_lovrSourceGetType(lua_State* L) {
|
|||
}
|
||||
|
||||
int l_lovrSourceGetVelocity(lua_State* L) {
|
||||
float x, y, z;
|
||||
lovrSourceGetVelocity(luax_checktype(L, 1, Source), &x, &y, &z);
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
lua_pushnumber(L, z);
|
||||
return 3;
|
||||
float velocity[3];
|
||||
lovrSourceGetVelocity(luax_checktype(L, 1, Source), &velocity[0], &velocity[1], &velocity[2]);
|
||||
return luax_pushvec3(L, velocity, 2);
|
||||
}
|
||||
|
||||
int l_lovrSourceGetVolume(lua_State* L) {
|
||||
|
@ -195,10 +187,9 @@ int l_lovrSourceSetLooping(lua_State* L) {
|
|||
|
||||
int l_lovrSourceSetDirection(lua_State* L) {
|
||||
Source* source = luax_checktype(L, 1, Source);
|
||||
float x = luaL_checknumber(L, 2);
|
||||
float y = luaL_checknumber(L, 3);
|
||||
float z = luaL_checknumber(L, 4);
|
||||
lovrSourceSetDirection(source, x, y, z);
|
||||
float direction[3];
|
||||
luax_readvec3(L, 2, direction, NULL);
|
||||
lovrSourceSetDirection(source, direction[0], direction[1], direction[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -209,10 +200,9 @@ int l_lovrSourceSetPitch(lua_State* L) {
|
|||
|
||||
int l_lovrSourceSetPosition(lua_State* L) {
|
||||
Source* source = luax_checktype(L, 1, Source);
|
||||
float x = luaL_checknumber(L, 2);
|
||||
float y = luaL_checknumber(L, 3);
|
||||
float z = luaL_checknumber(L, 4);
|
||||
lovrSourceSetPosition(source, x, y, z);
|
||||
float position[3];
|
||||
luax_readvec3(L, 2, position, NULL);
|
||||
lovrSourceSetPosition(source, position[0], position[1], position[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -225,10 +215,9 @@ int l_lovrSourceSetRelative(lua_State* L) {
|
|||
|
||||
int l_lovrSourceSetVelocity(lua_State* L) {
|
||||
Source* source = luax_checktype(L, 1, Source);
|
||||
float x = luaL_checknumber(L, 2);
|
||||
float y = luaL_checknumber(L, 3);
|
||||
float z = luaL_checknumber(L, 4);
|
||||
lovrSourceSetVelocity(source, x, y, z);
|
||||
float velocity[3];
|
||||
luax_readvec3(L, 2, velocity, NULL);
|
||||
lovrSourceSetVelocity(source, velocity[0], velocity[1], velocity[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,59 @@
|
|||
#include "math/math.h"
|
||||
#include "lib/math.h"
|
||||
|
||||
int luax_readvec3(lua_State* L, int index, vec3 v, const char* expected) {
|
||||
switch (lua_type(L, index)) {
|
||||
case LUA_TNIL:
|
||||
case LUA_TNONE:
|
||||
v[0] = v[1] = v[2] = 0.f;
|
||||
return ++index;
|
||||
case LUA_TNUMBER:
|
||||
v[0] = luaL_optnumber(L, index++, 0.);
|
||||
v[1] = luaL_optnumber(L, index++, 0.);
|
||||
v[2] = luaL_optnumber(L, index++, 0.);
|
||||
return index;
|
||||
default:
|
||||
vec3_init(v, luax_checkmathtype(L, index++, MATH_VEC3, expected ? expected : "vec3 or number"));
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
int luax_readscale(lua_State* L, int index, vec3 v, int components, const char* expected) {
|
||||
switch (lua_type(L, index)) {
|
||||
case LUA_TNIL:
|
||||
case LUA_TNONE:
|
||||
v[0] = v[1] = v[2] = 1.f;
|
||||
return index + components;
|
||||
case LUA_TNUMBER:
|
||||
if (components == 1) {
|
||||
v[0] = v[1] = v[2] = luaL_optnumber(L, index++, 0.);
|
||||
} else {
|
||||
v[0] = 1.f;
|
||||
for (int i = 0; i < components; i++) {
|
||||
v[i] = luaL_optnumber(L, index++, v[0]);
|
||||
}
|
||||
}
|
||||
return index;
|
||||
default:
|
||||
vec3_init(v, luax_checkmathtype(L, index++, MATH_VEC3, expected ? expected : "vec3 or number"));
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
int luax_pushvec3(lua_State* L, vec3 v, int index) {
|
||||
vec3 out;
|
||||
if (index > 0 && !lua_isnoneornil(L, index) && (out = luax_checkmathtype(L, index, MATH_VEC3, NULL)) != NULL) {
|
||||
vec3_init(out, v);
|
||||
lua_settop(L, index);
|
||||
return 1;
|
||||
} else {
|
||||
lua_pushnumber(L, v[0]);
|
||||
lua_pushnumber(L, v[1]);
|
||||
lua_pushnumber(L, v[2]);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
static int l_lovrVec3Unpack(lua_State* L) {
|
||||
vec3 v = luax_checkmathtype(L, 1, MATH_VEC3, NULL);
|
||||
lua_pushnumber(L, v[0]);
|
||||
|
|
|
@ -108,20 +108,16 @@ void lovrAudioGetMicrophoneNames(const char* names[MAX_MICROPHONES], uint8_t* co
|
|||
}
|
||||
}
|
||||
|
||||
void lovrAudioGetOrientation(float* angle, float* ax, float* ay, float* az) {
|
||||
quat_getAngleAxis(state.orientation, angle, ax, ay, az);
|
||||
void lovrAudioGetOrientation(quat orientation) {
|
||||
quat_init(orientation, state.orientation);
|
||||
}
|
||||
|
||||
void lovrAudioGetPosition(float* x, float* y, float* z) {
|
||||
*x = state.position[0];
|
||||
*y = state.position[1];
|
||||
*z = state.position[2];
|
||||
void lovrAudioGetPosition(vec3 position) {
|
||||
vec3_init(position, state.position);
|
||||
}
|
||||
|
||||
void lovrAudioGetVelocity(float* x, float* y, float* z) {
|
||||
*x = state.velocity[0];
|
||||
*y = state.velocity[1];
|
||||
*z = state.velocity[2];
|
||||
void lovrAudioGetVelocity(vec3 velocity) {
|
||||
vec3_init(velocity, state.velocity);
|
||||
}
|
||||
|
||||
float lovrAudioGetVolume() {
|
||||
|
@ -166,28 +162,28 @@ void lovrAudioSetDopplerEffect(float factor, float speedOfSound) {
|
|||
alSpeedOfSound(speedOfSound);
|
||||
}
|
||||
|
||||
void lovrAudioSetOrientation(float angle, float ax, float ay, float az) {
|
||||
void lovrAudioSetOrientation(quat orientation) {
|
||||
|
||||
// Rotate the unit forward/up vectors by the quaternion derived from the specified angle/axis
|
||||
float f[3] = { 0, 0, -1 };
|
||||
float u[3] = { 0, 1, 0 };
|
||||
quat_fromAngleAxis(state.orientation, angle, ax, ay, az);
|
||||
quat_init(state.orientation, orientation);
|
||||
quat_rotate(state.orientation, f);
|
||||
quat_rotate(state.orientation, u);
|
||||
|
||||
// Pass the rotated orientation vectors to OpenAL
|
||||
ALfloat orientation[6] = { f[0], f[1], f[2], u[0], u[1], u[2] };
|
||||
alListenerfv(AL_ORIENTATION, orientation);
|
||||
ALfloat directionVectors[6] = { f[0], f[1], f[2], u[0], u[1], u[2] };
|
||||
alListenerfv(AL_ORIENTATION, directionVectors);
|
||||
}
|
||||
|
||||
void lovrAudioSetPosition(float x, float y, float z) {
|
||||
vec3_set(state.position, x, y, z);
|
||||
alListener3f(AL_POSITION, x, y, z);
|
||||
void lovrAudioSetPosition(vec3 position) {
|
||||
vec3_init(state.position, position);
|
||||
alListenerfv(AL_POSITION, position);
|
||||
}
|
||||
|
||||
void lovrAudioSetVelocity(float x, float y, float z) {
|
||||
vec3_set(state.velocity, x, y, z);
|
||||
alListener3f(AL_VELOCITY, x, y, z);
|
||||
void lovrAudioSetVelocity(vec3 velocity) {
|
||||
vec3_init(state.velocity, velocity);
|
||||
alListenerfv(AL_VELOCITY, velocity);
|
||||
}
|
||||
|
||||
void lovrAudioSetVolume(float volume) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "audio/source.h"
|
||||
#include "audio/microphone.h"
|
||||
#include "lib/math.h"
|
||||
#include "lib/vec/vec.h"
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
|
@ -29,9 +30,9 @@ void lovrAudioUpdate();
|
|||
void lovrAudioAdd(Source* source);
|
||||
void lovrAudioGetDopplerEffect(float* factor, float* speedOfSound);
|
||||
void lovrAudioGetMicrophoneNames(const char* names[MAX_MICROPHONES], uint8_t* count);
|
||||
void lovrAudioGetOrientation(float* angle, float* ax, float* ay, float* az);
|
||||
void lovrAudioGetPosition(float* x, float* y, float* z);
|
||||
void lovrAudioGetVelocity(float* x, float* y, float* z);
|
||||
void lovrAudioGetOrientation(quat orientation);
|
||||
void lovrAudioGetPosition(vec3 position);
|
||||
void lovrAudioGetVelocity(vec3 velocity);
|
||||
float lovrAudioGetVolume();
|
||||
bool lovrAudioHas(Source* source);
|
||||
bool lovrAudioIsSpatialized();
|
||||
|
@ -39,8 +40,8 @@ void lovrAudioPause();
|
|||
void lovrAudioResume();
|
||||
void lovrAudioRewind();
|
||||
void lovrAudioSetDopplerEffect(float factor, float speedOfSound);
|
||||
void lovrAudioSetOrientation(float angle, float ax, float ay, float az);
|
||||
void lovrAudioSetPosition(float x, float y, float z);
|
||||
void lovrAudioSetVelocity(float x, float y, float z);
|
||||
void lovrAudioSetOrientation(quat orientation);
|
||||
void lovrAudioSetPosition(vec3 position);
|
||||
void lovrAudioSetVelocity(vec3 velocity);
|
||||
void lovrAudioSetVolume(float volume);
|
||||
void lovrAudioStop();
|
||||
|
|
|
@ -308,16 +308,16 @@ void lovrGraphicsOrigin() {
|
|||
mat4_identity(state.transforms[state.transform]);
|
||||
}
|
||||
|
||||
void lovrGraphicsTranslate(float x, float y, float z) {
|
||||
mat4_translate(state.transforms[state.transform], x, y, z);
|
||||
void lovrGraphicsTranslate(vec3 translation) {
|
||||
mat4_translate(state.transforms[state.transform], translation[0], translation[1], translation[2]);
|
||||
}
|
||||
|
||||
void lovrGraphicsRotate(float angle, float ax, float ay, float az) {
|
||||
mat4_rotate(state.transforms[state.transform], angle, ax, ay, az);
|
||||
void lovrGraphicsRotate(quat rotation) {
|
||||
mat4_rotateQuat(state.transforms[state.transform], rotation);
|
||||
}
|
||||
|
||||
void lovrGraphicsScale(float x, float y, float z) {
|
||||
mat4_scale(state.transforms[state.transform], x, y, z);
|
||||
void lovrGraphicsScale(vec3 scale) {
|
||||
mat4_scale(state.transforms[state.transform], scale[0], scale[1], scale[2]);
|
||||
}
|
||||
|
||||
void lovrGraphicsMatrixTransform(mat4 transform) {
|
||||
|
@ -831,8 +831,8 @@ void lovrGraphicsPrint(const char* str, mat4 transform, float wrap, HorizontalAl
|
|||
|
||||
lovrGraphicsPush();
|
||||
lovrGraphicsMatrixTransform(transform);
|
||||
lovrGraphicsScale(scale, scale, scale);
|
||||
lovrGraphicsTranslate(0, offsety, 0);
|
||||
lovrGraphicsScale((float[3]) { scale, scale, scale });
|
||||
lovrGraphicsTranslate((float[3]) { 0, offsety, 0 });
|
||||
state.pipelines[state.pipeline].alphaCoverage = true;
|
||||
lovrGraphicsDraw(&(DrawCommand) {
|
||||
.shader = SHADER_FONT,
|
||||
|
|
|
@ -203,9 +203,9 @@ void lovrGraphicsSetWireframe(bool wireframe);
|
|||
void lovrGraphicsPush();
|
||||
void lovrGraphicsPop();
|
||||
void lovrGraphicsOrigin();
|
||||
void lovrGraphicsTranslate(float x, float y, float z);
|
||||
void lovrGraphicsRotate(float angle, float ax, float ay, float az);
|
||||
void lovrGraphicsScale(float x, float y, float z);
|
||||
void lovrGraphicsTranslate(vec3 translation);
|
||||
void lovrGraphicsRotate(quat rotation);
|
||||
void lovrGraphicsScale(vec3 scale);
|
||||
void lovrGraphicsMatrixTransform(mat4 transform);
|
||||
void lovrGraphicsSetProjection(mat4 projection);
|
||||
|
||||
|
|
Loading…
Reference in New Issue