From bcabb130408b5d52bb73f8404d3b4805047d86ff Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 13 Jan 2009 10:07:58 +0000 Subject: Changes for new multilist type... to be removed again in a minute. --- server/src/luaformatmapperutils.cc | 98 ++------------------------------------ 1 file changed, 3 insertions(+), 95 deletions(-) (limited to 'server/src/luaformatmapperutils.cc') diff --git a/server/src/luaformatmapperutils.cc b/server/src/luaformatmapperutils.cc index 228c9f5..b163477 100644 --- a/server/src/luaformatmapperutils.cc +++ b/server/src/luaformatmapperutils.cc @@ -26,6 +26,7 @@ */ #include "luaformatmapperutils.h" #include "luaformatmapper.h" +#include "mltokenizer.h" #include #include @@ -88,97 +89,6 @@ void setGlobal(lua_State *L, const char *name, void *p) } } -typedef enum { - MLTT_VALUE, - MLTT_TEXT, - MLTT_ENDOFITEM, // newline - MLTT_UNDEFINED -} mltokentype_t; - -typedef struct { - mltokentype_t type; - std::string name; - std::string value; -} mltoken_t; - -std::vector< mltoken_t > mltokenize(std::string mlvalue) -{ - std::vector< mltoken_t > tokens; - /* - mltoken_t token; - token = MLTT_UNDEFINED; - for(size_t i = 0; i < mlvalue.length(); i++) { - switch(mlvalue[i]) { - case '$': - case '[': - case ']': - case '\n': - default: - } - } - */ - { - mltoken_t token; - token.type = MLTT_TEXT; - token.value = "noget tekst "; - tokens.push_back(token); - } - - { - mltoken_t token; - token.type = MLTT_VALUE; - token.name = "myname"; - token.value = "myvalue"; - tokens.push_back(token); - } - - { - mltoken_t token; - token.type = MLTT_TEXT; - token.value = " noget mere tekst"; - tokens.push_back(token); - } - - { - mltoken_t token; - token.type = MLTT_ENDOFITEM; - token.value = "\n"; - tokens.push_back(token); - } - - // en entry mere... - { - mltoken_t token; - token.type = MLTT_TEXT; - token.value = "yet another "; - tokens.push_back(token); - } - - { - mltoken_t token; - token.type = MLTT_VALUE; - token.name = "myname"; - token.value = "another value"; - tokens.push_back(token); - } - - { - mltoken_t token; - token.type = MLTT_TEXT; - token.value = " and thats final!"; - tokens.push_back(token); - } - - { - mltoken_t token; - token.type = MLTT_ENDOFITEM; - token.value = "\n"; - tokens.push_back(token); - } - - return tokens; -} - typedef struct { std::string prefix; std::string postfix; @@ -207,20 +117,18 @@ int printfmlval(lua_State *L) std::string bullet = lua_tostring(L, lua_gettop(L) - (n - 2)); bool usetext = lua_toboolean(L, lua_gettop(L) - (n - 3)); - printf("[%s], [%s], [%d]\n", mlvalue.c_str(), bullet.c_str(), usetext); fflush(stdout); + // printf("[%s], [%s], [%d]\n", mlvalue.c_str(), bullet.c_str(), usetext); fflush(stdout); // Read in the (prefix, name, postfix) 3-tuples int m = 4; while(m < lua_gettop(L)) { - printf("!\n"); fflush(stdout); - transform_params_t p; p.prefix = lua_tostring(L, lua_gettop(L) - (n - m)); std::string name = lua_tostring(L, lua_gettop(L) - (n - (m + 1))); p.postfix = lua_tostring(L, lua_gettop(L) - (n - (m + 2))); - printf("[%s], [%s], [%s]\n", p.prefix.c_str(), name.c_str(), p.postfix.c_str()); fflush(stdout); + // printf("[%s], [%s], [%s]\n", p.prefix.c_str(), name.c_str(), p.postfix.c_str()); fflush(stdout); transforms[name] = p; -- cgit v1.2.3