mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
support cmake
This commit is contained in:
parent
46a78d383d
commit
4a6c45f7cd
@ -2,15 +2,12 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(servant)
|
||||
|
||||
|
||||
if(_USE_OPENTRACKING)
|
||||
include_directories(${util_SOURCE_DIR}/include ${OPENTRACKING_INC})
|
||||
else()
|
||||
include_directories(${util_SOURCE_DIR}/include)
|
||||
endif()
|
||||
|
||||
# link_libraries(pthread)
|
||||
|
||||
#调用tars2cpp, 生成tars对应的文件
|
||||
macro(complice_tars OUT_DEPENDS_LIST HEADER TARS_DIR)
|
||||
set(DEPENDS_LIST)
|
||||
@ -40,7 +37,7 @@ macro(complice_tars OUT_DEPENDS_LIST HEADER TARS_DIR)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${TARS_H}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS tars2cpp
|
||||
DEPENDS tars2cpp ${TARS_IN}
|
||||
COMMAND ${TARS2CPP} --with-tars ${INCLUDE} ${TARS_IN}
|
||||
COMMENT "${TARS2CPP} --with-tars ${INCLUDE} ${TARS_IN}")
|
||||
|
||||
@ -65,10 +62,11 @@ add_subdirectory(protocol/servant)
|
||||
add_subdirectory(tup)
|
||||
add_subdirectory(libservant)
|
||||
|
||||
|
||||
install(DIRECTORY servant DESTINATION include)
|
||||
install(DIRECTORY tup DESTINATION include)
|
||||
install(DIRECTORY jmem DESTINATION include)
|
||||
install(DIRECTORY script DESTINATION .)
|
||||
install(DIRECTORY script DESTINATION .
|
||||
PATTERN "*.sh"
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
|
||||
install(DIRECTORY makefile DESTINATION .)
|
||||
|
||||
|
@ -194,7 +194,10 @@ void Application::waitForShutdown()
|
||||
|
||||
destroyApp();
|
||||
|
||||
TarsRemoteNotify::getInstance()->report("stop", true);
|
||||
TarsRemoteNotify::getInstance()->report("stop");
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); //稍微休息一下, 让当前处理包能够回复
|
||||
|
||||
}
|
||||
|
||||
void Application::terminate()
|
||||
@ -717,7 +720,9 @@ void Application::main(const TC_Option &option)
|
||||
{
|
||||
keepActiving.detach();
|
||||
TarsRemoteNotify::getInstance()->report("exit: " + string(ex.what()));
|
||||
cout << "[init exception]:" << ex.what() << endl;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); //稍微休息一下, 让当前处理包能够回复
|
||||
|
||||
cout << "[init exception]:" << ex.what() << endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
@ -803,8 +808,10 @@ void Application::main(const TC_Option &option)
|
||||
cout << "[main exception]:" << ex.what() << endl;
|
||||
|
||||
TarsRemoteNotify::getInstance()->report("exit: " + string(ex.what()));
|
||||
|
||||
exit(-1);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); //稍微休息一下, 让当前处理包能够回复
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//初始化完毕后, 日志再修改为异步
|
||||
@ -1330,8 +1337,9 @@ void Application::checkServantNameValid(const string& servant, const string& sPr
|
||||
|
||||
TarsRemoteNotify::getInstance()->report("exit:" + os.str());
|
||||
|
||||
cout << os.str() << endl;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); //稍微休息一下, 让当前处理包能够回复
|
||||
|
||||
cout << os.str() << endl;
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ bool TarsRemoteConfig::addConfig(const string & sFileName, string &buffer, bool
|
||||
|
||||
try
|
||||
{
|
||||
string sFullFileName = _basePath + "/" + sFileName;
|
||||
string sFullFileName = _basePath + FILE_SEP + sFileName;
|
||||
|
||||
string newFile = getRemoteFile(sFileName, bAppConfigOnly);
|
||||
|
||||
@ -168,12 +168,12 @@ string TarsRemoteConfig::index2file(const string & sFullFileName, int index)
|
||||
|
||||
void TarsRemoteConfig::localRename(const string& oldFile, const string& newFile)
|
||||
{
|
||||
#if TARGET_PLATFORM_WINDOWS
|
||||
//by goodenpei,windows下面先remove后rename,否则rename会失败
|
||||
if (TC_File::isFileExist(oldFile) && TC_File::isFileExist(newFile))
|
||||
{
|
||||
::remove(newFile.c_str());
|
||||
}
|
||||
#if TARGET_PLATFORM_WINDOWS
|
||||
//by goodenpei,windows下面先remove后rename,否则rename会失败
|
||||
if (TC_File::isFileExist(oldFile) && TC_File::isFileExist(newFile))
|
||||
{
|
||||
::remove(newFile.c_str());
|
||||
}
|
||||
#endif
|
||||
if (::rename(oldFile.c_str(), newFile.c_str()) != 0)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 504ebee584ac972943a9ffef7b738114300793e4
|
||||
Subproject commit ba7008c400802efbe6860d7c172efdb0595e314c
|
@ -1 +1 @@
|
||||
c:\\taf\\cpp\\script\\busybox.exe bash c:\\taf\\cpp\\script\\win_create.bat %1 %2 %3
|
||||
c:\\tars\\cpp\\script\\busybox.exe bash c:\\tars\\cpp\\script\\win_create.bat %1 %2 %3
|
||||
|
31
servant/script/create_tars_server.sh
Normal file → Executable file
31
servant/script/create_tars_server.sh
Normal file → Executable file
@ -10,27 +10,31 @@ APP=$1
|
||||
SERVER=$2
|
||||
SERVANT=$3
|
||||
|
||||
echo "APP:$APP, SERVER:$SERVER, SERVANT:$SERVANT"
|
||||
|
||||
if [ "$SERVER" == "$SERVANT" ]
|
||||
then
|
||||
echo "Error!(ServerName == ServantName)"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ ! -d $APP/$SERVER ]
|
||||
if [ ! -d $SERVER ]
|
||||
then
|
||||
echo "[mkdir: $APP/$SERVER]"
|
||||
mkdir -p $APP/$SERVER
|
||||
echo "[mkdir: $SERVER]"
|
||||
mkdir -p $SERVER
|
||||
fi
|
||||
|
||||
echo "[create server: $APP.$SERVER ...]"
|
||||
|
||||
DEMO_PATH=/usr/local/tars/cpp/script/demo
|
||||
|
||||
cp $DEMO_PATH/* $APP/$SERVER/
|
||||
#make cleanall -C $DEMO_PATH
|
||||
|
||||
cd $APP/$SERVER/
|
||||
cp -rf $DEMO_PATH/* $SERVER/
|
||||
|
||||
SRC_FILE="DemoServer.h DemoServer.cpp DemoServantImp.h DemoServantImp.cpp DemoServant.tars makefile"
|
||||
cd $SERVER/src
|
||||
|
||||
SRC_FILE="DemoServer.h DemoServer.cpp DemoServantImp.h DemoServantImp.cpp DemoServant.tars CMakeLists.txt"
|
||||
|
||||
for FILE in $SRC_FILE
|
||||
do
|
||||
@ -39,14 +43,21 @@ do
|
||||
|
||||
cat $FILE | sed "s/DemoApp/$APP/g" > $FILE.tmp
|
||||
mv $FILE.tmp $FILE
|
||||
|
||||
|
||||
cat $FILE | sed "s/DemoServant/$SERVANT/g" > $FILE.tmp
|
||||
mv $FILE.tmp $FILE
|
||||
done
|
||||
|
||||
rename "DemoServer" "$SERVER" $SRC_FILE
|
||||
rename "DemoServant" "$SERVANT" $SRC_FILE
|
||||
mv DemoServer.h ${SERVER}.h
|
||||
mv DemoServer.cpp ${SERVER}.cpp
|
||||
mv DemoServantImp.h ${SERVANT}Imp.h
|
||||
mv DemoServantImp.cpp ${SERVANT}Imp.cpp
|
||||
mv DemoServant.tars ${SERVANT}.tars
|
||||
|
||||
cd ../../
|
||||
cd ..
|
||||
mkdir build; cd build
|
||||
cmake ..; make
|
||||
|
||||
#cd ../../
|
||||
|
||||
echo "[done.]"
|
||||
|
@ -1,10 +0,0 @@
|
||||
|
||||
module DemoApp
|
||||
{
|
||||
|
||||
interface DemoServant
|
||||
{
|
||||
int test();
|
||||
};
|
||||
|
||||
};
|
@ -1,19 +0,0 @@
|
||||
#include "DemoServantImp.h"
|
||||
#include "servant/Application.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
void DemoServantImp::initialize()
|
||||
{
|
||||
//initialize servant here:
|
||||
//...
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
void DemoServantImp::destroy()
|
||||
{
|
||||
//destroy servant here:
|
||||
//...
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
#ifndef _DemoServantImp_H_
|
||||
#define _DemoServantImp_H_
|
||||
|
||||
#include "servant/Application.h"
|
||||
#include "DemoServant.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
class DemoServantImp : public DemoApp::DemoServant
|
||||
{
|
||||
public:
|
||||
/**
|
||||
*
|
||||
*/
|
||||
virtual ~DemoServantImp() {}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
virtual void initialize();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
virtual void destroy();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
virtual int test(tars::TarsCurrentPtr current) { return 0;};
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
#include "DemoServer.h"
|
||||
#include "DemoServantImp.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
DemoServer g_app;
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void
|
||||
DemoServer::initialize()
|
||||
{
|
||||
//initialize application here:
|
||||
//...
|
||||
|
||||
addServant<DemoServantImp>(ServerConfig::Application + "." + ServerConfig::ServerName + ".DemoServantObj");
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void
|
||||
DemoServer::destroyApp()
|
||||
{
|
||||
//destroy application here:
|
||||
//...
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
g_app.main(argc, argv);
|
||||
g_app.waitForShutdown();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
cerr << "std::exception:" << e.what() << std::endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cerr << "unknown exception." << std::endl;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////
|
@ -1,34 +0,0 @@
|
||||
#ifndef _DemoServer_H_
|
||||
#define _DemoServer_H_
|
||||
|
||||
#include <iostream>
|
||||
#include "servant/Application.h"
|
||||
|
||||
using namespace tars;
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
class DemoServer : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
*
|
||||
**/
|
||||
virtual ~DemoServer() {};
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
virtual void initialize();
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
virtual void destroyApp();
|
||||
};
|
||||
|
||||
extern DemoServer g_app;
|
||||
|
||||
////////////////////////////////////////////
|
||||
#endif
|
@ -1,17 +0,0 @@
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
APP := DemoApp
|
||||
TARGET := DemoServer
|
||||
CONFIG :=
|
||||
STRIP_FLAG:= N
|
||||
TARS2CPP_FLAG:=
|
||||
|
||||
INCLUDE +=
|
||||
LIB +=
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
include /usr/local/tars/cpp/makefile/makefile.tars
|
||||
|
||||
#-----------------------------------------------------------------------
|
@ -5,44 +5,6 @@ using namespace std;
|
||||
|
||||
DemoServer g_app;
|
||||
|
||||
struct HttpProtocol
|
||||
{
|
||||
/**
|
||||
* 解析http请求
|
||||
* @param in
|
||||
* @param out
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
static int parseHttp(string &in, string &out)
|
||||
{
|
||||
try
|
||||
{
|
||||
//判断请求是否是HTTP请求
|
||||
bool b = TC_HttpRequest ::checkRequest(in.c_str(), in.length());
|
||||
//完整的HTTP请求
|
||||
if(b)
|
||||
{
|
||||
out = in;
|
||||
in = "";
|
||||
//TLOGDEBUG("out size: " << out.size() << endl);
|
||||
return TC_EpollServer::PACKET_FULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TC_EpollServer::PACKET_LESS;
|
||||
}
|
||||
}
|
||||
catch(exception &ex)
|
||||
{
|
||||
return TC_EpollServer::PACKET_ERR;
|
||||
}
|
||||
|
||||
return TC_EpollServer::PACKET_LESS; //表示收到的包不完全
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void
|
||||
DemoServer::initialize()
|
||||
@ -51,7 +13,7 @@ DemoServer::initialize()
|
||||
//...
|
||||
|
||||
addServant<DemoServantImp>(ServerConfig::Application + "." + ServerConfig::ServerName + ".DemoServantObj");
|
||||
addServantProtocol(ServerConfig::Application + "." + ServerConfig::ServerName + ".DemoServantObj", &HttpProtocol::parseHttp);
|
||||
addServantProtocol(ServerConfig::Application + "." + ServerConfig::ServerName + ".DemoServantObj", &TC_NetWorkBuffer::parseHttp);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void
|
||||
|
@ -1,17 +0,0 @@
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
APP := DemoApp
|
||||
TARGET := DemoServer
|
||||
CONFIG :=
|
||||
STRIP_FLAG:= N
|
||||
TARS2CPP_FLAG:=
|
||||
|
||||
INCLUDE +=
|
||||
LIB +=
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
include /usr/local/tars/cpp/makefile/makefile.tars
|
||||
|
||||
#-----------------------------------------------------------------------
|
@ -28,7 +28,7 @@ echo "[create server: $APP.$SERVER ...]"
|
||||
|
||||
DEMO_PATH=c:\\taf\\cpp\\script\\demo
|
||||
|
||||
SRC_FILE="DemoServer.h DemoServer.cpp DemoServantImp.h DemoServantImp.cpp DemoServant.jce makefile CMakeLists.txt"
|
||||
SRC_FILE="DemoServer.h DemoServer.cpp DemoServantImp.h DemoServantImp.cpp DemoServant.tars makefile CMakeLists.txt"
|
||||
|
||||
for FILE in $SRC_FILE
|
||||
do
|
||||
|
@ -231,7 +231,6 @@ public:
|
||||
void addServant(const string &id)
|
||||
{
|
||||
ServantHelperManager::getInstance()->addServant<T>(id, this, true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,81 +21,6 @@ function(tars2language TARGET)
|
||||
endfunction()
|
||||
|
||||
IF(UNIX)
|
||||
|
||||
macro(complice_lex OUT_DEPENDS_LEX_LIST)
|
||||
set(DEPENDS_LIST)
|
||||
|
||||
FILE(GLOB SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/*.l")
|
||||
|
||||
# set(CLEAN_LIST)
|
||||
|
||||
foreach (FILE ${SRC_LIST})
|
||||
|
||||
get_filename_component(NAME_WE ${FILE} NAME_WE)
|
||||
|
||||
set(LEX_IN ${FILE})
|
||||
set(LEX_CPP ${NAME_WE}.lex.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${LEX_CPP}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${LEX_IN}
|
||||
COMMAND flex --nounist ${LEX_IN}
|
||||
COMMENT "flex --nounist ${LEX_IN}")
|
||||
|
||||
list(APPEND DEPENDS_LIST ${CMAKE_CURRENT_SOURCE_DIR}/${LEX_CPP})
|
||||
|
||||
get_filename_component(PATH ${FILE} PATH)
|
||||
# list(APPEND CLEAN_LIST ${PATH}/${LEX_CPP})
|
||||
|
||||
endforeach (FILE)
|
||||
|
||||
set(OUT_DEPENDS_LEX_LIST ${DEPENDS_LIST})
|
||||
|
||||
# set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_LIST}")
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(complice_yacc OUT_DEPENDS_YACC_LIST)
|
||||
set(DEPENDS_LIST)
|
||||
|
||||
FILE(GLOB SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/*.y")
|
||||
|
||||
# set(CLEAN_LIST)
|
||||
|
||||
foreach (FILE ${SRC_LIST})
|
||||
|
||||
get_filename_component(NAME_WE ${FILE} NAME_WE)
|
||||
|
||||
set(YACC_IN ${FILE})
|
||||
set(YACC_H ${NAME_WE}.tab.hpp)
|
||||
set(YACC_CPP ${NAME_WE}.tab.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${YACC_H}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${YACC_IN}
|
||||
COMMAND bison ${YACC_IN} -o ${YACC_CPP}
|
||||
COMMENT "bison ${YACC_IN} -o ${YACC_CPP}")
|
||||
|
||||
list(APPEND DEPENDS_LIST ${CMAKE_CURRENT_SOURCE_DIR}/${YACC_H})
|
||||
|
||||
get_filename_component(PATH ${FILE} PATH)
|
||||
|
||||
# list(APPEND CLEAN_LIST ${PATH}/${YACC_H})
|
||||
# list(APPEND CLEAN_LIST ${PATH}/${YACC_CPP})
|
||||
#if (EXISTS ${PATH}/${NAME_WE}.tab.cpp)
|
||||
# list(APPEND CLEAN_LIST ${PATH}/${NAME_WE}.tab.cpp)
|
||||
#endif (EXISTS ${PATH}/${NAME_WE}.tab.cpp)
|
||||
|
||||
endforeach (FILE)
|
||||
|
||||
# set(OUT_DEPENDS_YACC_LIST ${DEPENDS_LIST})
|
||||
|
||||
# set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_LIST}")
|
||||
|
||||
endmacro()
|
||||
|
||||
add_subdirectory(tarsgrammar)
|
||||
ENDIF(UNIX)
|
||||
|
||||
|
@ -117,7 +117,8 @@ int main(int argc, char* argv[])
|
||||
#undef ALLOW_USE_RESERVED_NAMESPACE
|
||||
#undef ALLOW_USE_RESERVED_NAMESPACE_BASE
|
||||
#undef ALLOW_USE_RESERVED_NAMESPACE_V
|
||||
|
||||
|
||||
g_parse->setTars(option.hasParam("with-tars"));
|
||||
g_parse->setUseCurrentPath(option.hasParam("relative"));
|
||||
|
||||
CodeGenerator generator;
|
||||
|
@ -1,4 +1,78 @@
|
||||
|
||||
macro(complice_lex OUT_DEPENDS_LEX_LIST)
|
||||
set(DEPENDS_LIST)
|
||||
|
||||
FILE(GLOB SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/*.l")
|
||||
|
||||
# set(CLEAN_LIST)
|
||||
|
||||
foreach (FILE ${SRC_LIST})
|
||||
|
||||
get_filename_component(NAME_WE ${FILE} NAME_WE)
|
||||
|
||||
set(LEX_IN ${FILE})
|
||||
set(LEX_CPP ${NAME_WE}.lex.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${LEX_CPP}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${LEX_IN}
|
||||
COMMAND flex --nounist ${LEX_IN}
|
||||
COMMENT "flex --nounist ${LEX_IN}")
|
||||
|
||||
list(APPEND DEPENDS_LIST ${CMAKE_CURRENT_SOURCE_DIR}/${LEX_CPP})
|
||||
|
||||
get_filename_component(PATH ${FILE} PATH)
|
||||
# list(APPEND CLEAN_LIST ${PATH}/${LEX_CPP})
|
||||
|
||||
endforeach (FILE)
|
||||
|
||||
set(OUT_DEPENDS_LEX_LIST ${DEPENDS_LIST})
|
||||
|
||||
# set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_LIST}")
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(complice_yacc OUT_DEPENDS_YACC_LIST)
|
||||
set(DEPENDS_LIST)
|
||||
|
||||
FILE(GLOB SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/*.y")
|
||||
|
||||
# set(CLEAN_LIST)
|
||||
|
||||
foreach (FILE ${SRC_LIST})
|
||||
|
||||
get_filename_component(NAME_WE ${FILE} NAME_WE)
|
||||
|
||||
set(YACC_IN ${FILE})
|
||||
set(YACC_H ${NAME_WE}.tab.hpp)
|
||||
set(YACC_CPP ${NAME_WE}.tab.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${YACC_H}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${YACC_IN}
|
||||
COMMAND bison ${YACC_IN} -o ${YACC_CPP}
|
||||
COMMENT "bison ${YACC_IN} -o ${YACC_CPP}")
|
||||
|
||||
list(APPEND DEPENDS_LIST ${CMAKE_CURRENT_SOURCE_DIR}/${YACC_H})
|
||||
|
||||
get_filename_component(PATH ${FILE} PATH)
|
||||
|
||||
# list(APPEND CLEAN_LIST ${PATH}/${YACC_H})
|
||||
# list(APPEND CLEAN_LIST ${PATH}/${YACC_CPP})
|
||||
#if (EXISTS ${PATH}/${NAME_WE}.tab.cpp)
|
||||
# list(APPEND CLEAN_LIST ${PATH}/${NAME_WE}.tab.cpp)
|
||||
#endif (EXISTS ${PATH}/${NAME_WE}.tab.cpp)
|
||||
|
||||
endforeach (FILE)
|
||||
|
||||
# set(OUT_DEPENDS_YACC_LIST ${DEPENDS_LIST})
|
||||
|
||||
# set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_LIST}")
|
||||
|
||||
endmacro()
|
||||
|
||||
##########################################################################################
|
||||
#生成.l和.y文件生成的代码文件copy到tarsparse目录下
|
||||
|
||||
|
@ -513,7 +513,7 @@ int yy_flex_debug = 0;
|
||||
#define YY_MORE_ADJ 0
|
||||
#define YY_RESTORE_YY_MORE_OFFSET
|
||||
char *yytext;
|
||||
#line 1 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 1 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
/**
|
||||
* Tencent is pleased to support the open source community by making Tars available.
|
||||
*
|
||||
@ -529,7 +529,7 @@ char *yytext;
|
||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
#line 20 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 20 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@ -742,7 +742,7 @@ YY_DECL
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 67 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 67 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
|
||||
|
||||
#line 749 "tars.lex.cpp"
|
||||
@ -840,12 +840,12 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 69 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 69 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{ BEGIN(INCL); }
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 71 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 71 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
if ( include_file_stack_ptr >= MAX_INCLUDE_DEPTH )
|
||||
{
|
||||
@ -878,7 +878,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(INCL):
|
||||
#line 101 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 101 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
--include_file_stack_ptr;
|
||||
if ( include_file_stack_ptr < 0 )
|
||||
@ -897,14 +897,14 @@ case YY_STATE_EOF(INCL):
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 117 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 117 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
return TARS_SCOPE_DELIMITER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 121 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 121 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
// C++ comment
|
||||
bool e = false;
|
||||
@ -925,7 +925,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 139 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 139 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
// C comment
|
||||
bool e = false;
|
||||
@ -976,7 +976,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 187 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 187 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
StringGrammarPtr ident = new StringGrammar;
|
||||
ident->v = yytext;
|
||||
@ -987,7 +987,7 @@ YY_RULE_SETUP
|
||||
case 7:
|
||||
/* rule 7 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 194 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 194 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
StringGrammarPtr ident = new StringGrammar;
|
||||
ident->v = yytext;
|
||||
@ -1000,7 +1000,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 204 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 204 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
StringGrammarPtr str = new StringGrammar;
|
||||
bool e = false;
|
||||
@ -1115,7 +1115,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 316 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 316 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
errno = 0;
|
||||
IntergerGrammarPtr ptr = new IntergerGrammar;
|
||||
@ -1140,7 +1140,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 338 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 338 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
errno = 0;
|
||||
FloatGrammarPtr ptr = new FloatGrammar;
|
||||
@ -1175,7 +1175,7 @@ YY_RULE_SETUP
|
||||
case 11:
|
||||
/* rule 11 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 369 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 369 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
if(yytext[0] == '\n')
|
||||
{
|
||||
@ -1185,7 +1185,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 376 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 376 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
if(yytext[0] < 32 || yytext[0] > 126)
|
||||
{
|
||||
@ -1204,7 +1204,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 392 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 392 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1211 "tars.lex.cpp"
|
||||
@ -2214,7 +2214,7 @@ void yyfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 392 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 392 "/Volumes/MyData/centos/TarsCloud/framework/tarscpp/tools/tarsgrammar/tars.l"
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -383,7 +383,7 @@ string TC_ConfigDomain::tostr(int i) const
|
||||
string sTab;
|
||||
for(int k = 0; k < i; ++k)
|
||||
{
|
||||
sTab += "\t";
|
||||
sTab += " ";
|
||||
}
|
||||
|
||||
ostringstream buf;
|
||||
@ -399,11 +399,11 @@ string TC_ConfigDomain::tostr(int i) const
|
||||
//值为空, 则不打印出=
|
||||
if(it->second.empty())
|
||||
{
|
||||
buf << "\t" << sTab << reverse_parse(_key[n]) << endl;
|
||||
buf << " " << sTab << reverse_parse(_key[n]) << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf << "\t" << sTab << reverse_parse(_key[n]) << "=" << reverse_parse(it->second) << endl;
|
||||
buf << " " << sTab << reverse_parse(_key[n]) << "=" << reverse_parse(it->second) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user