From f949546b3f58c852edf08bd6fc0be97831d04fef Mon Sep 17 00:00:00 2001 From: TitanSnow Date: Mon, 8 May 2017 10:38:11 +0800 Subject: features -> build_configuration --- core/src/xmake/machine.c | 4 +- core/src/xmake/makefile | 2 +- core/src/xmake/os/build_configuration.c | 71 +++++++++++++++++++++++++++++++++ core/src/xmake/os/features.c | 64 ----------------------------- 4 files changed, 74 insertions(+), 67 deletions(-) create mode 100644 core/src/xmake/os/build_configuration.c delete mode 100644 core/src/xmake/os/features.c diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c index 16c3176f6..09ed217f0 100644 --- a/core/src/xmake/machine.c +++ b/core/src/xmake/machine.c @@ -80,7 +80,7 @@ tb_int_t xm_os_getenv(lua_State* lua); tb_int_t xm_os_emptydir(lua_State* lua); tb_int_t xm_os_strerror(lua_State* lua); tb_int_t xm_os_getwinsize(lua_State* lua); -tb_int_t xm_os_features(lua_State* lua); +tb_int_t xm_os_build_configuration(lua_State* lua); // the path functions tb_int_t xm_path_relative(lua_State* lua); @@ -132,7 +132,7 @@ static luaL_Reg const g_os_functions[] = , { "emptydir", xm_os_emptydir } , { "strerror", xm_os_strerror } , { "getwinsize", xm_os_getwinsize} -, { "features", xm_os_features } +, { "build_configuration", xm_os_build_configuration} , { tb_null, tb_null } }; diff --git a/core/src/xmake/makefile b/core/src/xmake/makefile index 67f648a01..b3b90f965 100644 --- a/core/src/xmake/makefile +++ b/core/src/xmake/makefile @@ -36,7 +36,7 @@ xmake_C_FILES += \ os/emptydir \ os/strerror \ os/getwinsize \ - os/features \ + os/build_configuration \ path/relative \ path/absolute \ path/translate \ diff --git a/core/src/xmake/os/build_configuration.c b/core/src/xmake/os/build_configuration.c new file mode 100644 index 000000000..55dc837c4 --- /dev/null +++ b/core/src/xmake/os/build_configuration.c @@ -0,0 +1,71 @@ +/*!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 build_configuration.c + * + */ + +/* ////////////////////////////////////////////////////////////////////////////////////// + * trace + */ +#define TB_TRACE_MODULE_NAME "build_configuration" +#define TB_TRACE_MODULE_DEBUG (0) + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "prefix.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ + +// get build_configuration +tb_int_t xm_os_build_configuration(lua_State* lua) +{ + // features + const char* features_table[] = { +# ifdef XM_CONFIG_API_HAVE_READLINE + "readline", +# endif + tb_null + }; + + // configuration table + lua_newtable(lua); + lua_pushstring(lua, "features"); + + // array for features + lua_newtable(lua); + + // insert + for (const char** p = features_table; *p; ++p) + { + lua_pushstring(lua, *p); + lua_rawseti(lua, -2, p - features_table + 1); + } + + // set back to table + lua_settable(lua, -3); + + // ok + return 1; +} diff --git a/core/src/xmake/os/features.c b/core/src/xmake/os/features.c deleted file mode 100644 index 33bd9ba75..000000000 --- a/core/src/xmake/os/features.c +++ /dev/null @@ -1,64 +0,0 @@ -/*!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 features.c - * - */ - -/* ////////////////////////////////////////////////////////////////////////////////////// - * trace - */ -#define TB_TRACE_MODULE_NAME "features" -#define TB_TRACE_MODULE_DEBUG (0) - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "prefix.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * implementation - */ - -// get features -tb_int_t xm_os_features(lua_State* lua) -{ - // features - const char* features_table[] = { -# ifdef XM_CONFIG_API_HAVE_READLINE - "readline", -# endif - tb_null - }; - - // new array - lua_newtable(lua); - - // insert - for (const char** p = features_table; *p; ++p) - { - lua_pushstring(lua, *p); - lua_rawseti(lua, -2, p - features_table + 1); - } - - // ok - return 1; -} -- cgit v1.3.1