From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 00B476EC58; Wed, 23 Jun 2021 22:14:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 00B476EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1624475698; bh=H8ry4Dv9Ze6uwwGCqWR8kN/RrFcnuwXx/d74Y3s1xUs=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=so8d25f3vWhzmeNFTz+71MjGTD80iWNJ96zhyt8pBe6708ikqm9YYWBbCxdqSUK5f pENc0VRu7TXWTSunsKR8RwdL2u8Dhqir8o0ypxVF4z95H1N4SxJwug2tFzeSvrYh4L S7w3t6DfKEUVM5lob/IAuNgjdvKq3JtE1sl3qTPU= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 47DF46EC61 for ; Wed, 23 Jun 2021 22:13:14 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 47DF46EC61 Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1lw8JF-00086m-5o; Wed, 23 Jun 2021 22:13:13 +0300 To: Vladislav Shpilevoy , Cyrill Gorcunov , Roman Khabibov Cc: Alexander Turenko , tarantool-patches@dev.tarantool.org Date: Wed, 23 Jun 2021 22:12:41 +0300 Message-Id: <2d31db521fbf9af7f0c7a6207a27ea43d0ad085a.1624474915.git.alexander.turenko@tarantool.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD954DFF1DC42D673FB2F1AA0EB8A504C8721532AB396CDCF09182A05F538085040AF3AB0E0E041D6636BD5B9F89F81CC975C3D9CDA964E3582701F0EF8CB33EB85 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CEC4F91A22C5F5FEEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063754D7F012132A27898638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D81777EB82FDB53CF7041A2784999DA03A117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947CFD04FE2AD1523FDB302FCEF25BFAB3454AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C3F035437B6AEB70F476E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CB24F08513AFFAC7943847C11F186F3C59DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A23F051236DBC9DA634D097F901B7558688B39FA754255D0DFB8CCF60F6B7FD3948E1CD14B953EB46D47D3CF8C4D725EB5355D89D7DBCDD132 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CDFD85F345618D568110BCB71B6F605366F47CA8D30AA817F9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFF532FBFD8162E58C699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349A949488F6BF46DDBF76137657B3DBB18C37B8D0C160B07E3EE3E90650AEB63A9F254EEE8BBA44D81D7E09C32AA3244CCDAEAEAC9100F5A8811243B33BCB93CDC3B3ADDA61883BB583B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXgCFZEybMaxpNA1mp9sTSkI X-Mailru-Sender: FFAA8E4AEE17E37C3731A083A1A85ADE8F3328F600C0E7C44FCB6DA3B5A37DE7B7EA9FE7735C3DBFC664A44C781FCEA7C77752E0C033A69EDF9F2CE1E9CF805D8CD356D4F938FF726C18EFA0BB12DBB0 X-Mras: Ok Subject: [Tarantool-patches] [PATCH 3/4] lua: split serializer functions into sections X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Alexander Turenko via Tarantool-patches Reply-To: Alexander Turenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" And added a general comment about the compilation unit. Everything is to simplify reading. Part of #3228 --- src/lua/serializer.c | 8 ++++++++ src/lua/serializer.h | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/lua/serializer.c b/src/lua/serializer.c index 38b7dd8b9..8db6746a3 100644 --- a/src/lua/serializer.c +++ b/src/lua/serializer.c @@ -51,6 +51,8 @@ int luaL_array_metatable_ref = LUA_REFNIL; extern uint32_t CTID_UUID; extern uint32_t CTID_DECIMAL; +/* {{{ luaL_serializer manipulations */ + #define OPTION(type, name, defvalue) { #name, \ offsetof(struct luaL_serializer, name), type, defvalue} /** @@ -238,6 +240,10 @@ luaL_newserializer(struct lua_State *L, const char *modname, return serializer; } +/* }}} luaL_serializer manipulations */ + +/* {{{ Fill luaL_field */ + static int lua_gettable_wrapper(lua_State *L) { @@ -617,6 +623,8 @@ luaL_convertfield(struct lua_State *L, struct luaL_serializer *cfg, int idx, lua_typename(L, lua_type(L, idx))); } +/* }}} Fill luaL_field */ + int tarantool_lua_serializer_init(struct lua_State *L) { diff --git a/src/lua/serializer.h b/src/lua/serializer.h index e29d802bb..0c473c8da 100644 --- a/src/lua/serializer.h +++ b/src/lua/serializer.h @@ -31,6 +31,17 @@ * SUCH DAMAGE. */ +/** + * A set of helpers for converting Lua values into another + * representation. + * + * is the serializer object: options and + * options inheritance. + * + * is a Lua value descriptor, which + * characterizes the value. + */ + #if defined(__cplusplus) extern "C" { #endif /* defined(__cplusplus) */ @@ -56,6 +67,8 @@ struct tt_uuid; extern int luaL_map_metatable_ref; extern int luaL_array_metatable_ref; +/* {{{ luaL_serializer manipulations */ + /** * Common configuration options for Lua serializers (MsgPack, YAML, JSON) */ @@ -192,6 +205,10 @@ void luaL_serializer_parse_options(struct lua_State *l, struct luaL_serializer *cfg); +/* }}} luaL_serializer manipulations */ + +/* {{{ Fill luaL_field */ + /** A single value on the Lua stack. */ struct luaL_field { union { @@ -303,6 +320,10 @@ luaL_checkfield(struct lua_State *L, struct luaL_serializer *cfg, int idx, luaL_convertfield(L, cfg, idx, field); } +/* }}} Fill luaL_field */ + +/* {{{ Set map / array hint */ + /** * Push Lua Table with __serialize = 'map' hint onto the stack. * Tables with __serialize hint are properly handled by all serializers. @@ -335,6 +356,8 @@ luaL_setarrayhint(struct lua_State *L, int idx) lua_setmetatable(L, idx); } +/* }}} Set map / array hint */ + static inline void luaL_checkfinite(struct lua_State *L, struct luaL_serializer *cfg, lua_Number number) -- 2.31.1