webmcp
diff libraries/mondelefant/mondelefant_native.c @ 374:11ef7ab67e43
Added mutability state handlers in mondelefant_atom_connector.lua and prepare its usage in mondelefant_native.c
author | jbe |
---|---|
date | Sat Nov 14 14:15:31 2015 +0100 (2015-11-14) |
parents | a533ab6d7337 |
children | fb98b17056e5 |
line diff
1.1 --- a/libraries/mondelefant/mondelefant_native.c Sat Nov 14 02:11:44 2015 +0100 1.2 +++ b/libraries/mondelefant/mondelefant_native.c Sat Nov 14 14:15:31 2015 +0100 1.3 @@ -1140,68 +1140,70 @@ 1.4 lua_replace(L, 3); 1.5 // get output converter to stack position 4: 1.6 lua_getfield(L, 1, "output_converter"); 1.7 + // get mutability state saver to stack position 5: 1.8 + lua_getfield(L, 1, "save_mutability_state"); 1.9 // apply output converters and fill "_data" table according to column names: 1.10 for (command_idx = 0; command_idx < command_count; command_idx++) { 1.11 int mode; 1.12 mode = modes[command_idx]; 1.13 - lua_rawgeti(L, 3, command_idx+1); // raw result at stack position 5 1.14 - if (lua_toboolean(L, 5)) { 1.15 - lua_getfield(L, 5, "_column_info"); // column_info list at position 6 1.16 + lua_rawgeti(L, 3, command_idx+1); // raw result at stack position 6 1.17 + if (lua_toboolean(L, 6)) { 1.18 + lua_getfield(L, 6, "_column_info"); // column_info list at position 7 1.19 #if LUA_VERSION_NUM >= 502 1.20 - cols = lua_rawlen(L, 6); 1.21 + cols = lua_rawlen(L, 7); 1.22 #else 1.23 - cols = lua_objlen(L, 6); 1.24 + cols = lua_objlen(L, 7); 1.25 #endif 1.26 if (mode == MONDELEFANT_QUERY_MODE_LIST) { 1.27 #if LUA_VERSION_NUM >= 502 1.28 - rows = lua_rawlen(L, 5); 1.29 + rows = lua_rawlen(L, 6); 1.30 #else 1.31 - rows = lua_objlen(L, 5); 1.32 + rows = lua_objlen(L, 6); 1.33 #endif 1.34 for (row = 0; row < rows; row++) { 1.35 - lua_rawgeti(L, 5, row+1); // row at stack position 7 1.36 - lua_getfield(L, 7, "_data"); // _data table at stack position 8 1.37 + lua_rawgeti(L, 6, row+1); // row at stack position 8 1.38 + lua_getfield(L, 8, "_data"); // _data table at stack position 9 1.39 for (col = 0; col < cols; col++) { 1.40 - lua_rawgeti(L, 6, col+1); // this column info at position 9 1.41 - lua_getfield(L, 9, "field_name"); // 10 1.42 + lua_rawgeti(L, 7, col+1); // this column info at position 10 1.43 + lua_getfield(L, 10, "field_name"); // 11 1.44 if (lua_toboolean(L, 4)) { 1.45 lua_pushvalue(L, 4); // output-converter 1.46 lua_pushvalue(L, 1); // connection 1.47 - lua_rawgeti(L, 7, col+1); // raw-value 1.48 - lua_pushvalue(L, 9); // this column info 1.49 - lua_call(L, 3, 1); // converted value at position 11 1.50 + lua_rawgeti(L, 8, col+1); // raw-value 1.51 + lua_pushvalue(L, 10); // this column info 1.52 + lua_call(L, 3, 1); // converted value at position 12 1.53 } else { 1.54 - lua_rawgeti(L, 7, col+1); // raw-value at position 11 1.55 + lua_rawgeti(L, 8, col+1); // raw-value at position 12 1.56 } 1.57 - lua_pushvalue(L, 11); // 12 1.58 - lua_rawseti(L, 7, col+1); 1.59 - lua_rawset(L, 8); 1.60 - lua_settop(L, 8); 1.61 + lua_pushvalue(L, 12); // 13 1.62 + lua_rawseti(L, 8, col+1); 1.63 + lua_rawset(L, 9); 1.64 + lua_settop(L, 9); 1.65 } 1.66 - lua_settop(L, 6); 1.67 + lua_settop(L, 7); 1.68 } 1.69 } else { 1.70 - lua_getfield(L, 5, "_data"); // _data table at stack position 7 1.71 + lua_getfield(L, 6, "_data"); // _data table at stack position 8 1.72 for (col = 0; col < cols; col++) { 1.73 - lua_rawgeti(L, 6, col+1); // this column info at position 8 1.74 - lua_getfield(L, 8, "field_name"); // 9 1.75 + lua_rawgeti(L, 7, col+1); // this column info at position 9 1.76 + lua_getfield(L, 9, "field_name"); // 10 1.77 if (lua_toboolean(L, 4)) { 1.78 lua_pushvalue(L, 4); // output-converter 1.79 lua_pushvalue(L, 1); // connection 1.80 - lua_rawgeti(L, 5, col+1); // raw-value 1.81 - lua_pushvalue(L, 8); // this column info 1.82 - lua_call(L, 3, 1); // converted value at position 10 1.83 + lua_rawgeti(L, 6, col+1); // raw-value 1.84 + lua_pushvalue(L, 9); // this column info 1.85 + lua_call(L, 3, 1); // converted value at position 11 1.86 } else { 1.87 - lua_rawgeti(L, 5, col+1); // raw-value at position 10 1.88 + lua_rawgeti(L, 6, col+1); // raw-value at position 11 1.89 } 1.90 - lua_pushvalue(L, 10); // 11 1.91 - lua_rawseti(L, 5, col+1); 1.92 - lua_rawset(L, 7); 1.93 - lua_settop(L, 7); 1.94 + lua_pushvalue(L, 11); // 12 1.95 + lua_rawseti(L, 6, col+1); 1.96 + lua_rawset(L, 8); 1.97 + lua_settop(L, 8); 1.98 } 1.99 } 1.100 } 1.101 - lua_settop(L, 4); 1.102 + lua_settop(L, 5); 1.103 } 1.104 // return nil as first result value, followed by result lists/objects: 1.105 lua_settop(L, 3);