diff options
| author | ruki <[email protected]> | 2017-05-08 16:41:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-08 16:41:02 +0800 |
| commit | cd28c287fbbcc4901a864623d6c1ef92f1487234 (patch) | |
| tree | 30bf6b8ea740ab517ba761a847f1a6b059dc52ab | |
| parent | 5da5e37eed97e96247ff198c411793f32e5c9916 (diff) | |
format versioninfo code style
| -rw-r--r-- | core/detect/readline.c | 11 | ||||
| -rw-r--r-- | core/src/xmake/machine.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/os/versioninfo.c | 59 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/versioninfo.lua | 28 |
4 files changed, 70 insertions, 30 deletions
diff --git a/core/detect/readline.c b/core/detect/readline.c index 13452bd84..346a07e09 100644 --- a/core/detect/readline.c +++ b/core/detect/readline.c @@ -1,3 +1,8 @@ -#include<stdio.h> -#include<readline/readline.h> -int main(){readline(0);return 0;} +#include <stdio.h> +#include <readline/readline.h> + +int main() +{ + readline(0); + return 0; +} diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c index b0e86fd00..b9977d92a 100644 --- a/core/src/xmake/machine.c +++ b/core/src/xmake/machine.c @@ -132,7 +132,7 @@ static luaL_Reg const g_os_functions[] = , { "emptydir", xm_os_emptydir } , { "strerror", xm_os_strerror } , { "getwinsize", xm_os_getwinsize} -, { "versioninfo", xm_os_versioninfo} +, { "versioninfo", xm_os_versioninfo} , { tb_null, tb_null } }; diff --git a/core/src/xmake/os/versioninfo.c b/core/src/xmake/os/versioninfo.c index f9e3fe890..ea75049c3 100644 --- a/core/src/xmake/os/versioninfo.c +++ b/core/src/xmake/os/versioninfo.c @@ -35,10 +35,10 @@ #include "prefix.h" /* ////////////////////////////////////////////////////////////////////////////////////// - * implementation + * private implementation */ -static void xm_os_insert_set(lua_State* lua, const char** p) +static tb_void_t xm_os_insert_set(lua_State* lua, tb_char_t const** p) { for (; *p; ++p) { @@ -48,15 +48,20 @@ static void xm_os_insert_set(lua_State* lua, const char** p) } } +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ + // get versioninfo tb_int_t xm_os_versioninfo(lua_State* lua) { // features - const char* features_table[] = { -# ifdef XM_CONFIG_API_HAVE_READLINE - "readline", -# endif - tb_null + static tb_char_t const* features_table[] = + { +#ifdef XM_CONFIG_API_HAVE_READLINE + "readline", +#endif + tb_null }; // configuration table @@ -177,14 +182,15 @@ tb_int_t xm_os_versioninfo(lua_State* lua) lua_settable(lua, -3); // mode table - const char* mode_table[] = { -# ifdef __xm_small__ - "small", -# endif -# ifdef __xm_debug__ - "debug", -# endif - tb_null + static tb_char_t const* mode_table[] = + { +#ifdef __xm_small__ + "small", +#endif +#ifdef __xm_debug__ + "debug", +#endif + tb_null }; // table for mode @@ -198,17 +204,18 @@ tb_int_t xm_os_versioninfo(lua_State* lua) lua_settable(lua, -3); // packages table - const char* packages_table[] = { -# ifdef XM_CONFIG_PACKAGE_HAVE_TBOX - "tbox", -# endif -# ifdef XM_CONFIG_PACKAGE_HAVE_LUAJIT - "luajit", -# endif -# ifdef XM_CONFIG_PACKAGE_HAVE_BASE - "base", -# endif - tb_null + tb_char_t const* packages_table[] = + { +#ifdef XM_CONFIG_PACKAGE_HAVE_TBOX + "tbox", +#endif +#ifdef XM_CONFIG_PACKAGE_HAVE_LUAJIT + "luajit", +#endif +#ifdef XM_CONFIG_PACKAGE_HAVE_BASE + "base", +#endif + tb_null }; // table for packages diff --git a/xmake/plugins/lua/scripts/versioninfo.lua b/xmake/plugins/lua/scripts/versioninfo.lua index c6d01667b..accb1f471 100644 --- a/xmake/plugins/lua/scripts/versioninfo.lua +++ b/xmake/plugins/lua/scripts/versioninfo.lua @@ -1,3 +1,31 @@ +--!The Make-like Build Utility based on Lua +-- +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015 - 2017, TBOOX Open Source Group. +-- +-- @author TitanSnow +-- @file versioninfo.lua +-- + +-- dump version info +-- +-- $ xmake lua versionversion +-- function main() table.dump(os.versioninfo()) end |
