| 1 | /* ====================================================================== |
| 2 | ** memarray.c - Copyright (C) 2005-2006 Varol Kaptan |
| 3 | ** see LICENSE for more information |
| 4 | ** ====================================================================== |
| 5 | ** vim: set ts=3 et: */ |
| 6 | |
| 7 | #include <stdio.h> |
| 8 | #include <string.h> |
| 9 | #include <stdlib.h> |
| 10 | |
| 11 | #if defined(MEMARRAY_USE_OPENGLcxx . . $ `<built-in>:415:9`!) |
| 12 | #if defined(__APPLE__) && defined(__MACH__) |
| 13 | #include <OpenGL/gl.h> |
| 14 | #include <OpenGL/glext.h> |
| 15 | #else |
| 16 | #include <GL/gl.h> |
| 17 | #include <GL/glext.h> |
| 18 | #endif |
| 19 | #endif |
| 20 | |
| 21 | #include <lua.h> |
| 22 | #include <lauxlib.h> |
| 23 | |
| 24 | #define MYNAMEcxx . . $ `dokidoki-support/memarray.c:24:9`! "memarray" |
| 25 | #define MYTYPEcxx . . $ `dokidoki-support/memarray.c:25:9`! "memarray*" |
| 26 | #define VERSIONcxx . . $ `dokidoki-support/memarray.c:26:9`! "0.5" |
| 27 | |
| 28 | #define MEMARRAY_TCHARcxx . . $ `dokidoki-support/memarray.c:28:9`! 0 |
| 29 | #define MEMARRAY_TUCHARcxx . . $ `dokidoki-support/memarray.c:29:9`! 1 |
| 30 | #define MEMARRAY_TSHORTcxx . . $ `dokidoki-support/memarray.c:30:9`! 2 |
| 31 | #define MEMARRAY_TUSHORTcxx . . $ `dokidoki-support/memarray.c:31:9`! 3 |
| 32 | #define MEMARRAY_TINTcxx . . $ `dokidoki-support/memarray.c:32:9`! 4 |
| 33 | #define MEMARRAY_TUINTcxx . . $ `dokidoki-support/memarray.c:33:9`! 5 |
| 34 | #define MEMARRAY_TLONGcxx . . $ `dokidoki-support/memarray.c:34:9`! 6 |
| 35 | #define MEMARRAY_TULONGcxx . . $ `dokidoki-support/memarray.c:35:9`! 7 |
| 36 | #define MEMARRAY_TFLOATcxx . . $ `dokidoki-support/memarray.c:36:9`! 8 |
| 37 | #define MEMARRAY_TDOUBLEcxx . . $ `dokidoki-support/memarray.c:37:9`! 9 |
| 38 | #if !defined(MEMARRAY_USE_OPENGLcxx . . $ `<built-in>:415:9`!) |
| 39 | #define MEMARRAY_NUM_TYPES 10 |
| 40 | #else |
| 41 | #define MEMARRAY_TGLBOOLEANcxx . . $ `dokidoki-support/memarray.c:41:9`! 10 |
| 42 | #define MEMARRAY_TGLBYTEcxx . . $ `dokidoki-support/memarray.c:42:9`! 11 |
| 43 | #define MEMARRAY_TGLUBYTEcxx . . $ `dokidoki-support/memarray.c:43:9`! 12 |
| 44 | #define MEMARRAY_TGLSHORTcxx . . $ `dokidoki-support/memarray.c:44:9`! 13 |
| 45 | #define MEMARRAY_TGLUSHORTcxx . . $ `dokidoki-support/memarray.c:45:9`! 14 |
| 46 | #define MEMARRAY_TGLINTcxx . . $ `dokidoki-support/memarray.c:46:9`! 15 |
| 47 | #define MEMARRAY_TGLUINTcxx . . $ `dokidoki-support/memarray.c:47:9`! 16 |
| 48 | #define MEMARRAY_TGLSIZEIcxx . . $ `dokidoki-support/memarray.c:48:9`! 17 |
| 49 | #define MEMARRAY_TGLENUMcxx . . $ `dokidoki-support/memarray.c:49:9`! 18 |
| 50 | #define MEMARRAY_TGLBITFIELDcxx . . $ `dokidoki-support/memarray.c:50:9`! 19 |
| 51 | #define MEMARRAY_TGLFLOATcxx . . $ `dokidoki-support/memarray.c:51:9`! 20 |
| 52 | #define MEMARRAY_TGLDOUBLEcxx . . $ `dokidoki-support/memarray.c:52:9`! 21 |
| 53 | #define MEMARRAY_NUM_TYPEScxx . . $ `dokidoki-support/memarray.c:53:9`! 22 |
| 54 | #endif |
| 55 | |
| 56 | #define MEMARRAY_TYPE_MASKcxx . . $ `dokidoki-support/memarray.c:56:9`! 0x1F |
| 57 | #define MEMARRAY_INHERITEDcxx . . $ `dokidoki-support/memarray.c:57:9`! 0x20 |
| 58 | |
| 59 | #define mem_typecxx . . $ `dokidoki-support/memarray.c:59:9`!(m) ((m)->flags & MEMARRAY_TYPE_MASKcxx . . $ `dokidoki-support/memarray.c:56:9`!) |
| 60 | #define mem_inheritedcxx . . $ `dokidoki-support/memarray.c:60:9`!(m) ((m)->flags & MEMARRAY_INHERITEDcxx . . $ `dokidoki-support/memarray.c:57:9`!) |
| 61 | |
| 62 | typedef structcxx . . $ $anonymous_type_3f91908673c6477a_0# { |
| 63 | char *namecxx . . $ $anonymous_type_3f91908673c6477a_0#name.; |
| 64 | int sizecxx . . $ $anonymous_type_3f91908673c6477a_0#size.; |
| 65 | } typeinfocxx . . $ typeinfo#; |
| 66 | |
| 67 | const typeinfocxx . . $ typeinfo# m_typescxx . . $ m_types.[MEMARRAY_NUM_TYPEScxx . . $ `dokidoki-support/memarray.c:53:9`!] = { |
| 68 | { "char", sizeof(char) }, |
| 69 | { "uchar", sizeof(unsigned char) }, |
| 70 | { "short", sizeof(short) }, |
| 71 | { "ushort", sizeof(unsigned short) }, |
| 72 | { "int", sizeof(int) }, |
| 73 | { "uint", sizeof(unsigned int) }, |
| 74 | { "long", sizeof(long) }, |
| 75 | { "ulong", sizeof(unsigned long) }, |
| 76 | { "float", sizeof(float) }, |
| 77 | { "double", sizeof(double) }, |
| 78 | #if defined(MEMARRAY_USE_OPENGLcxx . . $ `<built-in>:415:9`!) |
| 79 | { "GLboolean", sizeof(GLbooleancxx . . $ GLboolean#) }, |
| 80 | { "GLbyte", sizeof(GLbytecxx . . $ GLbyte#) }, |
| 81 | { "GLubyte", sizeof(GLubytecxx . . $ GLubyte#) }, |
| 82 | { "GLshort", sizeof(GLshortcxx . . $ GLshort#) }, |
| 83 | { "GLushort", sizeof(GLushortcxx . . $ GLushort#) }, |
| 84 | { "GLint", sizeof(GLintcxx . . $ GLint#) }, |
| 85 | { "GLuint", sizeof(GLuintcxx . . $ GLuint#) }, |
| 86 | { "GLsizei", sizeof(GLsizeicxx . . $ GLsizei#) }, |
| 87 | { "GLenum", sizeof(GLenumcxx . . $ GLenum#) }, |
| 88 | { "GLbitfield",sizeof(GLbitfieldcxx . . $ GLbitfield#) }, |
| 89 | { "GLfloat", sizeof(GLfloatcxx . . $ GLfloat#) }, |
| 90 | { "GLdouble", sizeof(GLdoublecxx . . $ GLdouble#) }, |
| 91 | #endif |
| 92 | }; |
| 93 | |
| 94 | typedef struct memarraycxx . . $ memarray# { |
| 95 | size_t sizecxx . . $ memarray#size.; |
| 96 | size_t lengthcxx . . $ memarray#length.; |
| 97 | unsigned int flagscxx . . $ memarray#flags.; |
| 98 | void *datacxx . . $ memarray#data.; |
| 99 | } memarray_tcxx . . $ memarray_t#; |
| 100 | |
| 101 | /* we keep discovered endianness here (1 = little endian, 0 = big endian) */ |
| 102 | static int little_endiancxx . . $ little_endian. = 0; |
| 103 | |
| 104 | static int get_memtypecxx . . $ get_memtype(5c4306d8553b3696).(const char * typename) |
| 105 | { |
| 106 | int type; |
| 107 | |
| 108 | for (type = 0; type < MEMARRAY_NUM_TYPEScxx . . $ `dokidoki-support/memarray.c:53:9`!; ++type) { |
| 109 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(typename, m_typescxx . . $ m_types.[type].namecxx . . $ $anonymous_type_3f91908673c6477a_0#name.) == 0) |
| 110 | return type; |
| 111 | } |
| 112 | |
| 113 | return -1; |
| 114 | } |
| 115 | |
| 116 | static const void * check_lightuserdatacxx . . $ check_lightuserdata(b07b5f0208ac289b).(lua_Statecxx . . $ lua_State# *L, int n) |
| 117 | { |
| 118 | if (lua_typecxx . . $ lua_type(95e3aa3a3b4bb934).(L,n) != LUA_TLIGHTUSERDATAcxx . . $ `<external>/15848857005865937740/lua.h:76:9`!) |
| 119 | luaL_typerrorcxx . . $ luaL_typerror(6b3c0da94eb57ee2).(L, n, "lightuserdata"); |
| 120 | return (const void *) lua_touserdatacxx . . $ lua_touserdata(947e554955906b1c).(L, n); |
| 121 | } |
| 122 | |
| 123 | static memarray_tcxx . . $ memarray_t# *memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(lua_Statecxx . . $ lua_State# * L, int i) |
| 124 | { |
| 125 | if (luaL_checkudatacxx . . $ luaL_checkudata(ded294d5354abc01).(L, i, MYTYPEcxx . . $ `dokidoki-support/memarray.c:25:9`!) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 126 | luaL_typerrorcxx . . $ luaL_typerror(6b3c0da94eb57ee2).(L, i, MYTYPEcxx . . $ `dokidoki-support/memarray.c:25:9`!); |
| 127 | return lua_touserdatacxx . . $ lua_touserdata(947e554955906b1c).(L, i); |
| 128 | } |
| 129 | |
| 130 | static memarray_tcxx . . $ memarray_t# *memarray_newcxx . . $ memarray_new(c6e24cd88eb651d5).(lua_Statecxx . . $ lua_State# * L) |
| 131 | { |
| 132 | memarray_tcxx . . $ memarray_t# *m = lua_newuserdatacxx . . $ lua_newuserdata(bb92b2d7de290).(L, sizeof(memarray_tcxx . . $ memarray_t#)); |
| 133 | |
| 134 | m->datacxx . . $ memarray#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 135 | m->sizecxx . . $ memarray#size. = 0; |
| 136 | m->lengthcxx . . $ memarray#length. = 0; |
| 137 | m->flagscxx . . $ memarray#flags. = MEMARRAY_INHERITEDcxx . . $ `dokidoki-support/memarray.c:57:9`!; |
| 138 | |
| 139 | luaL_getmetatablecxx . . $ `<external>/18095755238171912061/lauxlib.h:117:9`!(L, MYTYPEcxx . . $ `dokidoki-support/memarray.c:25:9`!); |
| 140 | lua_setmetatablecxx . . $ lua_setmetatable(95e3aa3a3b4bb934).(L, -2); |
| 141 | /* fprintf(stderr, "memarray_new @ %p\n", (void *)m); */ |
| 142 | return m; |
| 143 | } |
| 144 | |
| 145 | static void memarray_deletecxx . . $ memarray_delete(bc8b4ba71278f0b7).(memarray_tcxx . . $ memarray_t# *m) |
| 146 | { |
| 147 | if (!mem_inheritedcxx . . $ `dokidoki-support/memarray.c:60:9`!(m)) |
| 148 | freecxx . . $ free(5d22bdacc48458e8).(m->datacxx . . $ memarray#data.); |
| 149 | |
| 150 | m->datacxx . . $ memarray#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 151 | m->sizecxx . . $ memarray#size. = 0; |
| 152 | m->lengthcxx . . $ memarray#length. = 0; |
| 153 | m->flagscxx . . $ memarray#flags. = MEMARRAY_INHERITEDcxx . . $ `dokidoki-support/memarray.c:57:9`!; |
| 154 | } |
| 155 | |
| 156 | /* self, 'type', n, [address] */ |
| 157 | static int Lrealloccxx . . $ Lrealloc(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# * L) |
| 158 | { |
| 159 | memarray_tcxx . . $ memarray_t# *m; |
| 160 | const char *typename; |
| 161 | int type; |
| 162 | size_t length; |
| 163 | size_t size; |
| 164 | void * data; |
| 165 | char errmsg[128]; |
| 166 | |
| 167 | m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 168 | typename = luaL_optstringcxx . . $ `<external>/18095755238171912061/lauxlib.h:103:9`!(L, 2, "uchar"); |
| 169 | |
| 170 | if ( (type = get_memtypecxx . . $ get_memtype(5c4306d8553b3696).(typename)) < 0 ) { |
| 171 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "memarray:realloc(): unknown type '%s'", typename); |
| 172 | return 0; |
| 173 | } |
| 174 | |
| 175 | length = (size_t) luaL_optnumbercxx . . $ luaL_optnumber(67a0f3e7bac8441f).(L, 3, 0); |
| 176 | size = length * m_typescxx . . $ m_types.[type].sizecxx . . $ $anonymous_type_3f91908673c6477a_0#size.; |
| 177 | |
| 178 | if (lua_gettopcxx . . $ lua_gettop(e4b172c3fcff213).(L) > 3) { |
| 179 | /* do not allocate memory, inherit something else */ |
| 180 | memarray_deletecxx . . $ memarray_delete(bc8b4ba71278f0b7).(m); |
| 181 | m->sizecxx . . $ memarray#size. = size; |
| 182 | m->lengthcxx . . $ memarray#length. = length; |
| 183 | m->flagscxx . . $ memarray#flags. = type | MEMARRAY_INHERITEDcxx . . $ `dokidoki-support/memarray.c:57:9`!; |
| 184 | m->datacxx . . $ memarray#data. = lua_touserdatacxx . . $ lua_touserdata(947e554955906b1c).(L, 4); |
| 185 | } else { |
| 186 | /* allocate memory */ |
| 187 | memarray_deletecxx . . $ memarray_delete(bc8b4ba71278f0b7).(m); |
| 188 | data = (void *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(size); |
| 189 | if ((size != 0) && (data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) { |
| 190 | m->flagscxx . . $ memarray#flags. = type | MEMARRAY_INHERITEDcxx . . $ `dokidoki-support/memarray.c:57:9`!; |
| 191 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(errmsg, "memarray:__call(): memory allocation failure " |
| 192 | "for %zd bytes (%s x %zd)\n", size, typename, length); |
| 193 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, errmsg); |
| 194 | } else { |
| 195 | m->flagscxx . . $ memarray#flags. = type; |
| 196 | m->sizecxx . . $ memarray#size. = size; |
| 197 | m->lengthcxx . . $ memarray#length. = length; |
| 198 | m->datacxx . . $ memarray#data. = data; |
| 199 | } |
| 200 | } |
| 201 | lua_settopcxx . . $ lua_settop(9637dd485cf22a1).(L, 1); |
| 202 | return 1; |
| 203 | } |
| 204 | |
| 205 | /* memarray, 'type', n, [address] */ |
| 206 | static int L__callcxx . . $ L__call(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# * L) |
| 207 | { |
| 208 | memarray_tcxx . . $ memarray_t# *m; |
| 209 | m = memarray_newcxx . . $ memarray_new(c6e24cd88eb651d5).(L); |
| 210 | lua_replacecxx . . $ lua_replace(9637dd485cf22a1).(L, 1); |
| 211 | return Lrealloccxx . . $ Lrealloc(e4b172c3fcff213).(L); |
| 212 | } |
| 213 | |
| 214 | /* 'type' */ |
| 215 | static int Lsizeofcxx . . $ Lsizeof(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# * L) |
| 216 | { |
| 217 | const char *typename; |
| 218 | int type; |
| 219 | |
| 220 | typename = luaL_checkstringcxx . . $ `<external>/18095755238171912061/lauxlib.h:102:9`!(L, 1); |
| 221 | |
| 222 | if ( (type = get_memtypecxx . . $ get_memtype(5c4306d8553b3696).(typename)) < 0 ) { |
| 223 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "memarray:sizeof(): unknown type '%s'", typename); |
| 224 | return 0; |
| 225 | } |
| 226 | |
| 227 | lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, m_typescxx . . $ m_types.[type].sizecxx . . $ $anonymous_type_3f91908673c6477a_0#size.); |
| 228 | |
| 229 | return 1; |
| 230 | } |
| 231 | |
| 232 | /* dst, src, size(in bytes) */ |
| 233 | static int Lmemcpycxx . . $ Lmemcpy(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# * L) |
| 234 | { |
| 235 | void * dst = (void *) check_lightuserdatacxx . . $ check_lightuserdata(b07b5f0208ac289b).(L, 1); |
| 236 | const void * src = check_lightuserdatacxx . . $ check_lightuserdata(b07b5f0208ac289b).(L, 2); |
| 237 | size_t size = (size_t) luaL_checknumbercxx . . $ luaL_checknumber(128e298513b4e6b3).(L, 3); |
| 238 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, src, size); |
| 239 | return 1; |
| 240 | } |
| 241 | |
| 242 | /* self, index */ |
| 243 | static int L__indexcxx . . $ L__index(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# * L) |
| 244 | { |
| 245 | memarray_tcxx . . $ memarray_t# *m; |
| 246 | size_t index; |
| 247 | |
| 248 | m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 249 | |
| 250 | switch (lua_typecxx . . $ lua_type(95e3aa3a3b4bb934).(L, 2)) { |
| 251 | case LUA_TNUMBERcxx . . $ `<external>/15848857005865937740/lua.h:77:9`!: |
| 252 | index = (size_t) lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).(L, 2); |
| 253 | if ( /*(index < 0) ||*/ (index >= m->lengthcxx . . $ memarray#length.) ) { |
| 254 | lua_pushnilcxx . . $ lua_pushnil(f6fa9609f70d70d8).(L); |
| 255 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "index out of range"); |
| 256 | } else switch (mem_typecxx . . $ `dokidoki-support/memarray.c:59:9`!(m)) { |
| 257 | case MEMARRAY_TCHARcxx . . $ `dokidoki-support/memarray.c:28:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((char *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 258 | case MEMARRAY_TUCHARcxx . . $ `dokidoki-support/memarray.c:29:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((unsigned char *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 259 | case MEMARRAY_TSHORTcxx . . $ `dokidoki-support/memarray.c:30:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((short *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 260 | case MEMARRAY_TUSHORTcxx . . $ `dokidoki-support/memarray.c:31:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((unsigned short *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 261 | case MEMARRAY_TINTcxx . . $ `dokidoki-support/memarray.c:32:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((int *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 262 | case MEMARRAY_TUINTcxx . . $ `dokidoki-support/memarray.c:33:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((unsigned int *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 263 | case MEMARRAY_TLONGcxx . . $ `dokidoki-support/memarray.c:34:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((long *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 264 | case MEMARRAY_TULONGcxx . . $ `dokidoki-support/memarray.c:35:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((unsigned long *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 265 | case MEMARRAY_TFLOATcxx . . $ `dokidoki-support/memarray.c:36:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((float *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 266 | case MEMARRAY_TDOUBLEcxx . . $ `dokidoki-support/memarray.c:37:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((double *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 267 | #if defined(MEMARRAY_USE_OPENGLcxx . . $ `<built-in>:415:9`!) |
| 268 | case MEMARRAY_TGLBOOLEANcxx . . $ `dokidoki-support/memarray.c:41:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLbooleancxx . . $ GLboolean# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 269 | case MEMARRAY_TGLBYTEcxx . . $ `dokidoki-support/memarray.c:42:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLbytecxx . . $ GLbyte# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 270 | case MEMARRAY_TGLUBYTEcxx . . $ `dokidoki-support/memarray.c:43:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLubytecxx . . $ GLubyte# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 271 | case MEMARRAY_TGLSHORTcxx . . $ `dokidoki-support/memarray.c:44:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLshortcxx . . $ GLshort# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 272 | case MEMARRAY_TGLUSHORTcxx . . $ `dokidoki-support/memarray.c:45:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLushortcxx . . $ GLushort# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 273 | case MEMARRAY_TGLINTcxx . . $ `dokidoki-support/memarray.c:46:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLintcxx . . $ GLint# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 274 | case MEMARRAY_TGLUINTcxx . . $ `dokidoki-support/memarray.c:47:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLuintcxx . . $ GLuint# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 275 | case MEMARRAY_TGLSIZEIcxx . . $ `dokidoki-support/memarray.c:48:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLsizeicxx . . $ GLsizei# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 276 | case MEMARRAY_TGLENUMcxx . . $ `dokidoki-support/memarray.c:49:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLenumcxx . . $ GLenum# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 277 | case MEMARRAY_TGLBITFIELDcxx . . $ `dokidoki-support/memarray.c:50:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLbitfieldcxx . . $ GLbitfield#*)(m->datacxx . . $ memarray#data.))[index]); break; |
| 278 | case MEMARRAY_TGLFLOATcxx . . $ `dokidoki-support/memarray.c:51:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLfloatcxx . . $ GLfloat# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 279 | case MEMARRAY_TGLDOUBLEcxx . . $ `dokidoki-support/memarray.c:52:9`!: lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, ((GLdoublecxx . . $ GLdouble# *)(m->datacxx . . $ memarray#data.))[index]); break; |
| 280 | #endif |
| 281 | default: lua_pushnilcxx . . $ lua_pushnil(f6fa9609f70d70d8).(L); break; |
| 282 | } |
| 283 | break; |
| 284 | |
| 285 | default: |
| 286 | lua_getmetatablecxx . . $ lua_getmetatable(95e3aa3a3b4bb934).(L, 1); |
| 287 | lua_replacecxx . . $ lua_replace(9637dd485cf22a1).(L, 1); |
| 288 | lua_rawgetcxx . . $ lua_rawget(9637dd485cf22a1).(L, 1); |
| 289 | break; |
| 290 | } |
| 291 | return 1; |
| 292 | } |
| 293 | |
| 294 | /* self, index, value */ |
| 295 | static int L__newindexcxx . . $ L__newindex(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# * L) |
| 296 | { |
| 297 | memarray_tcxx . . $ memarray_t# *m; |
| 298 | size_t index; |
| 299 | lua_Numbercxx . . $ lua_Number# value; |
| 300 | |
| 301 | m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 302 | |
| 303 | switch (lua_typecxx . . $ lua_type(95e3aa3a3b4bb934).(L, 2)) { |
| 304 | case LUA_TNUMBERcxx . . $ `<external>/15848857005865937740/lua.h:77:9`!: |
| 305 | index = (size_t) lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).(L, 2); |
| 306 | value = lua_tonumbercxx . . $ lua_tonumber(128e298513b4e6b3).(L, 3); |
| 307 | if ( /*(index < 0) ||*/ (index >= m->lengthcxx . . $ memarray#length.) ) { |
| 308 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "index out of range"); |
| 309 | } else switch (mem_typecxx . . $ `dokidoki-support/memarray.c:59:9`!(m)) { |
| 310 | case MEMARRAY_TCHARcxx . . $ `dokidoki-support/memarray.c:28:9`!: ((char *)m->datacxx . . $ memarray#data.)[index] = (char) value; break; |
| 311 | case MEMARRAY_TUCHARcxx . . $ `dokidoki-support/memarray.c:29:9`!: ((unsigned char *)m->datacxx . . $ memarray#data.)[index] = (unsigned char) value; break; |
| 312 | case MEMARRAY_TSHORTcxx . . $ `dokidoki-support/memarray.c:30:9`!: ((short *)m->datacxx . . $ memarray#data.)[index] = (short) value; break; |
| 313 | case MEMARRAY_TUSHORTcxx . . $ `dokidoki-support/memarray.c:31:9`!: ((unsigned short *)m->datacxx . . $ memarray#data.)[index] = (unsigned short) value; break; |
| 314 | case MEMARRAY_TINTcxx . . $ `dokidoki-support/memarray.c:32:9`!: ((int *)m->datacxx . . $ memarray#data.)[index] = (int) value; break; |
| 315 | case MEMARRAY_TUINTcxx . . $ `dokidoki-support/memarray.c:33:9`!: ((unsigned int *)m->datacxx . . $ memarray#data.)[index] = (unsigned int) value; break; |
| 316 | case MEMARRAY_TLONGcxx . . $ `dokidoki-support/memarray.c:34:9`!: ((long *)m->datacxx . . $ memarray#data.)[index] = (long) value; break; |
| 317 | case MEMARRAY_TULONGcxx . . $ `dokidoki-support/memarray.c:35:9`!: ((unsigned long *)m->datacxx . . $ memarray#data.)[index] = (unsigned long) value; break; |
| 318 | case MEMARRAY_TFLOATcxx . . $ `dokidoki-support/memarray.c:36:9`!: ((float *)m->datacxx . . $ memarray#data.)[index] = (float) value; break; |
| 319 | case MEMARRAY_TDOUBLEcxx . . $ `dokidoki-support/memarray.c:37:9`!: ((double *)m->datacxx . . $ memarray#data.)[index] = (double) value; break; |
| 320 | #if defined(MEMARRAY_USE_OPENGLcxx . . $ `<built-in>:415:9`!) |
| 321 | case MEMARRAY_TGLBOOLEANcxx . . $ `dokidoki-support/memarray.c:41:9`!: ((GLbooleancxx . . $ GLboolean# *)(m->datacxx . . $ memarray#data.))[index] = (GLbooleancxx . . $ GLboolean# ) value; break; |
| 322 | case MEMARRAY_TGLBYTEcxx . . $ `dokidoki-support/memarray.c:42:9`!: ((GLbytecxx . . $ GLbyte# *)(m->datacxx . . $ memarray#data.))[index] = (GLbytecxx . . $ GLbyte# ) value; break; |
| 323 | case MEMARRAY_TGLUBYTEcxx . . $ `dokidoki-support/memarray.c:43:9`!: ((GLubytecxx . . $ GLubyte# *)(m->datacxx . . $ memarray#data.))[index] = (GLubytecxx . . $ GLubyte# ) value; break; |
| 324 | case MEMARRAY_TGLSHORTcxx . . $ `dokidoki-support/memarray.c:44:9`!: ((GLshortcxx . . $ GLshort# *)(m->datacxx . . $ memarray#data.))[index] = (GLshortcxx . . $ GLshort# ) value; break; |
| 325 | case MEMARRAY_TGLUSHORTcxx . . $ `dokidoki-support/memarray.c:45:9`!: ((GLushortcxx . . $ GLushort# *)(m->datacxx . . $ memarray#data.))[index] = (GLushortcxx . . $ GLushort# ) value; break; |
| 326 | case MEMARRAY_TGLINTcxx . . $ `dokidoki-support/memarray.c:46:9`!: ((GLintcxx . . $ GLint# *)(m->datacxx . . $ memarray#data.))[index] = (GLintcxx . . $ GLint# ) value; break; |
| 327 | case MEMARRAY_TGLUINTcxx . . $ `dokidoki-support/memarray.c:47:9`!: ((GLuintcxx . . $ GLuint# *)(m->datacxx . . $ memarray#data.))[index] = (GLuintcxx . . $ GLuint# ) value; break; |
| 328 | case MEMARRAY_TGLSIZEIcxx . . $ `dokidoki-support/memarray.c:48:9`!: ((GLsizeicxx . . $ GLsizei# *)(m->datacxx . . $ memarray#data.))[index] = (GLsizeicxx . . $ GLsizei# ) value; break; |
| 329 | case MEMARRAY_TGLENUMcxx . . $ `dokidoki-support/memarray.c:49:9`!: ((GLenumcxx . . $ GLenum# *)(m->datacxx . . $ memarray#data.))[index] = (GLenumcxx . . $ GLenum# ) value; break; |
| 330 | case MEMARRAY_TGLBITFIELDcxx . . $ `dokidoki-support/memarray.c:50:9`!: ((GLbitfieldcxx . . $ GLbitfield#*)(m->datacxx . . $ memarray#data.))[index] = (GLbitfieldcxx . . $ GLbitfield#) value; break; |
| 331 | case MEMARRAY_TGLFLOATcxx . . $ `dokidoki-support/memarray.c:51:9`!: ((GLfloatcxx . . $ GLfloat# *)(m->datacxx . . $ memarray#data.))[index] = (GLfloatcxx . . $ GLfloat# ) value; break; |
| 332 | case MEMARRAY_TGLDOUBLEcxx . . $ `dokidoki-support/memarray.c:52:9`!: ((GLdoublecxx . . $ GLdouble# *)(m->datacxx . . $ memarray#data.))[index] = (GLdoublecxx . . $ GLdouble# ) value; break; |
| 333 | #endif |
| 334 | default: lua_pushnilcxx . . $ lua_pushnil(f6fa9609f70d70d8).(L); break; |
| 335 | } |
| 336 | break; |
| 337 | |
| 338 | default: |
| 339 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "memarray*:__newindex key must be number"); |
| 340 | break; |
| 341 | } |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | /* self */ |
| 346 | static int L__tostringcxx . . $ L__tostring(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# * L) |
| 347 | { |
| 348 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 349 | char s[256]; |
| 350 | |
| 351 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(s, |
| 352 | mem_inheritedcxx . . $ `dokidoki-support/memarray.c:60:9`!(m) ? "memarray(%s,%zd,%p,inherited)@%p": "memarray(%s,%zd,%p)@%p" , |
| 353 | m_typescxx . . $ m_types.[mem_typecxx . . $ `dokidoki-support/memarray.c:59:9`!(m)].namecxx . . $ $anonymous_type_3f91908673c6477a_0#name., m->lengthcxx . . $ memarray#length., (void *)m->datacxx . . $ memarray#data., (void *)m); |
| 354 | |
| 355 | lua_pushstringcxx . . $ lua_pushstring(2c01a949aef328b).(L, s); |
| 356 | return 1; |
| 357 | } |
| 358 | |
| 359 | /* self */ |
| 360 | static int Lsizecxx . . $ Lsize(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# *L) |
| 361 | { |
| 362 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 363 | lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, m->sizecxx . . $ memarray#size.); |
| 364 | return 1; |
| 365 | } |
| 366 | |
| 367 | /* self */ |
| 368 | static int Llengthcxx . . $ Llength(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# *L) |
| 369 | { |
| 370 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 371 | lua_pushnumbercxx . . $ lua_pushnumber(7d033ffc6f828456).(L, m->lengthcxx . . $ memarray#length.); |
| 372 | return 1; |
| 373 | } |
| 374 | |
| 375 | /* self, [index] */ |
| 376 | static int Lptrcxx . . $ Lptr(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# *L) |
| 377 | { |
| 378 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 379 | size_t index = (size_t) luaL_optnumbercxx . . $ luaL_optnumber(67a0f3e7bac8441f).(L, 2, 0); |
| 380 | |
| 381 | if ( /*(index < 0) ||*/ (index >= m->lengthcxx . . $ memarray#length.) ) { |
| 382 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "index out of range"); |
| 383 | return 0; |
| 384 | } else { |
| 385 | char *ptr = m->datacxx . . $ memarray#data.; |
| 386 | lua_pushlightuserdatacxx . . $ lua_pushlightuserdata(d31ab38dfa259598).(L, (void *)(ptr + index * m_typescxx . . $ m_types.[mem_typecxx . . $ `dokidoki-support/memarray.c:59:9`!(m)].sizecxx . . $ $anonymous_type_3f91908673c6477a_0#size.)); |
| 387 | return 1; |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | /* self */ |
| 392 | static int L__gccxx . . $ L__gc(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# *L) |
| 393 | { |
| 394 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 395 | /* |
| 396 | fprintf(stderr, "invoking __gc for "); |
| 397 | fprintf(stderr, |
| 398 | mem_inherited(m) ? "memarray(%s,%zd,%p,inherited)@%p\n": "memarray(%s,%zd,%p)@%p\n" , |
| 399 | m_types[mem_type(m)].name, m->length, (void *)m->data, (void *)m); |
| 400 | */ |
| 401 | memarray_deletecxx . . $ memarray_delete(bc8b4ba71278f0b7).(m); |
| 402 | return 0; |
| 403 | } |
| 404 | |
| 405 | /* self */ |
| 406 | static int Lto_strcxx . . $ Lto_str(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# *L) |
| 407 | { |
| 408 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 409 | luaL_Buffercxx . . $ luaL_Buffer# b; |
| 410 | |
| 411 | luaL_buffinitcxx . . $ luaL_buffinit(b8099834900ea409).(L, &b); |
| 412 | luaL_addlstringcxx . . $ luaL_addlstring(1860c27b3c39f4a5).(&b, m->datacxx . . $ memarray#data., m->sizecxx . . $ memarray#size.); |
| 413 | luaL_pushresultcxx . . $ luaL_pushresult(87c4f6f6b4b7feab).(&b); |
| 414 | |
| 415 | return 1; |
| 416 | } |
| 417 | |
| 418 | /* self, str */ |
| 419 | static int Lfrom_strcxx . . $ Lfrom_str(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# *L) |
| 420 | { |
| 421 | size_t len; |
| 422 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 423 | const char *str = luaL_checklstringcxx . . $ luaL_checklstring(b7fc0e19ca28968a).(L, 2, &len); |
| 424 | |
| 425 | if (m->sizecxx . . $ memarray#size. != len) { |
| 426 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "memarray:to_str size mismatch"); |
| 427 | return 0; |
| 428 | } else { |
| 429 | memcpycxx . . $ memcpy(cc817cb175f282d).(m->datacxx . . $ memarray#data., str, len); |
| 430 | } |
| 431 | return 0; |
| 432 | } |
| 433 | |
| 434 | #define PUT_SWAP_2cxx . . $ `dokidoki-support/memarray.c:434:9`!(B, src) \ |
| 435 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[1]); \ |
| 436 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[0]); |
| 437 | |
| 438 | #define PUT_SWAP_4cxx . . $ `dokidoki-support/memarray.c:438:9`!(B, src) \ |
| 439 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[3]); \ |
| 440 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[2]); \ |
| 441 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[1]); \ |
| 442 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[0]); |
| 443 | |
| 444 | #define PUT_SWAP_8cxx . . $ `dokidoki-support/memarray.c:444:9`!(B, src) \ |
| 445 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[7]); \ |
| 446 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[6]); \ |
| 447 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[5]); \ |
| 448 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[4]); \ |
| 449 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[3]); \ |
| 450 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[2]); \ |
| 451 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[1]); \ |
| 452 | luaL_putcharcxx . . $ `<external>/18095755238171912061/lauxlib.h:141:9`!((B), (src)[0]); |
| 453 | |
| 454 | /* self */ |
| 455 | static int Lto_netstrcxx . . $ Lto_netstr(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# *L) |
| 456 | { |
| 457 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 458 | luaL_Buffercxx . . $ luaL_Buffer# b; |
| 459 | size_t item_size; |
| 460 | unsigned char *src, *end; |
| 461 | |
| 462 | luaL_buffinitcxx . . $ luaL_buffinit(b8099834900ea409).(L, &b); |
| 463 | item_size = m->sizecxx . . $ memarray#size. / m->lengthcxx . . $ memarray#length.; |
| 464 | |
| 465 | if (little_endiancxx . . $ little_endian. && (item_size != 1)) { |
| 466 | src = (unsigned char *) m->datacxx . . $ memarray#data.; |
| 467 | end = src + m->sizecxx . . $ memarray#size.; |
| 468 | switch (item_size) { |
| 469 | case 2: |
| 470 | while (src < end) { PUT_SWAP_2cxx . . $ `dokidoki-support/memarray.c:434:9`!(&b, src); src += 2; } |
| 471 | break; |
| 472 | |
| 473 | case 4: |
| 474 | while (src < end) { PUT_SWAP_4cxx . . $ `dokidoki-support/memarray.c:438:9`!(&b, src); src += 4; } |
| 475 | break; |
| 476 | |
| 477 | case 8: |
| 478 | while (src < end) { PUT_SWAP_8cxx . . $ `dokidoki-support/memarray.c:444:9`!(&b, src); src += 8; } |
| 479 | break; |
| 480 | |
| 481 | default: |
| 482 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "memarray:to_netstr(): unsupported item_size"); |
| 483 | break; |
| 484 | } |
| 485 | } else { |
| 486 | luaL_addlstringcxx . . $ luaL_addlstring(1860c27b3c39f4a5).(&b, m->datacxx . . $ memarray#data., m->sizecxx . . $ memarray#size.); |
| 487 | } |
| 488 | |
| 489 | luaL_pushresultcxx . . $ luaL_pushresult(87c4f6f6b4b7feab).(&b); |
| 490 | |
| 491 | return 1; |
| 492 | } |
| 493 | |
| 494 | #define COPY_SWAP_2cxx . . $ `dokidoki-support/memarray.c:494:9`!(src,dst) \ |
| 495 | dst[0] = src[1]; \ |
| 496 | dst[1] = src[0]; |
| 497 | |
| 498 | #define COPY_SWAP_4cxx . . $ `dokidoki-support/memarray.c:498:9`!(src, dst) \ |
| 499 | dst[0] = src[3]; \ |
| 500 | dst[1] = src[2]; \ |
| 501 | dst[2] = src[1]; \ |
| 502 | dst[3] = src[0]; |
| 503 | |
| 504 | #define COPY_SWAP_8cxx . . $ `dokidoki-support/memarray.c:504:9`!(src, dst) \ |
| 505 | dst[0] = src[7]; \ |
| 506 | dst[1] = src[6]; \ |
| 507 | dst[2] = src[5]; \ |
| 508 | dst[3] = src[4]; \ |
| 509 | dst[4] = src[3]; \ |
| 510 | dst[5] = src[2]; \ |
| 511 | dst[6] = src[1]; \ |
| 512 | dst[7] = src[0]; |
| 513 | |
| 514 | /* self, str */ |
| 515 | static int Lfrom_netstrcxx . . $ Lfrom_netstr(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# *L) |
| 516 | { |
| 517 | size_t len; |
| 518 | memarray_tcxx . . $ memarray_t# *m = memarray_getcxx . . $ memarray_get(82c743d242ef4c39).(L, 1); |
| 519 | const char *str = luaL_checklstringcxx . . $ luaL_checklstring(b7fc0e19ca28968a).(L, 2, &len); |
| 520 | size_t item_size; |
| 521 | unsigned char *src, *end, *dst; |
| 522 | |
| 523 | if (m->sizecxx . . $ memarray#size. != len) { |
| 524 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "memarray:to_netstr size mismatch"); |
| 525 | return 0; |
| 526 | } else { |
| 527 | item_size = m->sizecxx . . $ memarray#size. / m->lengthcxx . . $ memarray#length.; |
| 528 | |
| 529 | if (little_endiancxx . . $ little_endian. && (item_size != 1)) { |
| 530 | src = (unsigned char *) str; |
| 531 | end = src + m->sizecxx . . $ memarray#size.; |
| 532 | dst = (unsigned char *) m->datacxx . . $ memarray#data.; |
| 533 | switch (item_size) { |
| 534 | case 2: |
| 535 | while (src < end) { COPY_SWAP_2cxx . . $ `dokidoki-support/memarray.c:494:9`!(src, dst); src += 2; dst += 2; } |
| 536 | break; |
| 537 | |
| 538 | case 4: |
| 539 | while (src < end) { COPY_SWAP_4cxx . . $ `dokidoki-support/memarray.c:498:9`!(src, dst); src += 4; dst += 4; } |
| 540 | break; |
| 541 | |
| 542 | case 8: |
| 543 | while (src < end) { COPY_SWAP_8cxx . . $ `dokidoki-support/memarray.c:504:9`!(src, dst); src += 8; dst += 8; } |
| 544 | break; |
| 545 | |
| 546 | default: |
| 547 | luaL_errorcxx . . $ luaL_error(5a39ce5ac465c74d).(L, "memarray:from_netstr(): unsupported item_size"); |
| 548 | break; |
| 549 | } |
| 550 | } else { |
| 551 | memcpycxx . . $ memcpy(cc817cb175f282d).(m->datacxx . . $ memarray#data., str, len); |
| 552 | } |
| 553 | } |
| 554 | return 0; |
| 555 | } |
| 556 | |
| 557 | static const luaL_regcxx . . $ `<external>/18095755238171912061/lauxlib.h:170:9`! reg_memarraycxx . . $ reg_memarray.[] = |
| 558 | { |
| 559 | { "__call", L__callcxx . . $ L__call(e4b172c3fcff213). }, |
| 560 | { "sizeof", Lsizeofcxx . . $ Lsizeof(e4b172c3fcff213). }, |
| 561 | { "memcpy", Lmemcpycxx . . $ Lmemcpy(e4b172c3fcff213). }, |
| 562 | { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! } |
| 563 | }; |
| 564 | |
| 565 | static const luaL_regcxx . . $ `<external>/18095755238171912061/lauxlib.h:170:9`! reg_memarray_ptrcxx . . $ reg_memarray_ptr.[] = |
| 566 | { |
| 567 | { "__index", L__indexcxx . . $ L__index(e4b172c3fcff213). }, |
| 568 | { "__newindex", L__newindexcxx . . $ L__newindex(e4b172c3fcff213). }, |
| 569 | { "__tostring", L__tostringcxx . . $ L__tostring(e4b172c3fcff213). }, |
| 570 | { "__gc", L__gccxx . . $ L__gc(e4b172c3fcff213). }, |
| 571 | { "size", Lsizecxx . . $ Lsize(e4b172c3fcff213). }, |
| 572 | { "length", Llengthcxx . . $ Llength(e4b172c3fcff213). }, |
| 573 | { "ptr", Lptrcxx . . $ Lptr(e4b172c3fcff213). }, |
| 574 | { "to_str", Lto_strcxx . . $ Lto_str(e4b172c3fcff213). }, |
| 575 | { "from_str", Lfrom_strcxx . . $ Lfrom_str(e4b172c3fcff213). }, |
| 576 | { "to_netstr", Lto_netstrcxx . . $ Lto_netstr(e4b172c3fcff213). }, |
| 577 | { "from_netstr", Lfrom_netstrcxx . . $ Lfrom_netstr(e4b172c3fcff213).}, |
| 578 | { "realloc", Lrealloccxx . . $ Lrealloc(e4b172c3fcff213). }, |
| 579 | { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! } |
| 580 | }; |
| 581 | |
| 582 | LUALIB_APIcxx . . $ `<external>/16272292605055568894/luaconf.h:180:9`! int luaopen_memarraycxx . . $ luaopen_memarray(e4b172c3fcff213).(lua_Statecxx . . $ lua_State# * L) |
| 583 | { |
| 584 | /* we discover endianness here */ |
| 585 | int one = 1; |
| 586 | little_endiancxx . . $ little_endian. = (*(char *)&one == 1); |
| 587 | |
| 588 | luaL_newmetatablecxx . . $ luaL_newmetatable(ac61bb1a0c4e7605).(L, MYTYPEcxx . . $ `dokidoki-support/memarray.c:25:9`!); |
| 589 | luaL_openlibcxx . . $ luaL_openlib(bd96f0990c536604).(L, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, reg_memarray_ptrcxx . . $ reg_memarray_ptr., 0); |
| 590 | |
| 591 | lua_newtablecxx . . $ `<external>/15848857005865937740/lua.h:256:9`!(L); |
| 592 | lua_pushliteralcxx . . $ `<external>/15848857005865937740/lua.h:273:9`!(L, "VERSION"); |
| 593 | lua_pushliteralcxx . . $ `<external>/15848857005865937740/lua.h:273:9`!(L, VERSIONcxx . . $ `dokidoki-support/memarray.c:26:9`!); |
| 594 | lua_settablecxx . . $ lua_settable(9637dd485cf22a1).(L, -3); |
| 595 | |
| 596 | lua_pushliteralcxx . . $ `<external>/15848857005865937740/lua.h:273:9`!(L, MYNAMEcxx . . $ `dokidoki-support/memarray.c:24:9`!); |
| 597 | lua_pushvaluecxx . . $ lua_pushvalue(9637dd485cf22a1).(L, -2); |
| 598 | lua_settablecxx . . $ lua_settable(9637dd485cf22a1).(L, LUA_GLOBALSINDEXcxx . . $ `<external>/15848857005865937740/lua.h:38:9`!); |
| 599 | |
| 600 | lua_pushvaluecxx . . $ lua_pushvalue(9637dd485cf22a1).(L, -1); |
| 601 | luaL_openlibcxx . . $ luaL_openlib(bd96f0990c536604).(L, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, reg_memarraycxx . . $ reg_memarray., 0); |
| 602 | |
| 603 | lua_setmetatablecxx . . $ lua_setmetatable(95e3aa3a3b4bb934).(L, -2); |
| 604 | return 1; |
| 605 | } |