summaryrefslogtreecommitdiff
path: root/server/src/luaformatmapperutils.cc
diff options
context:
space:
mode:
authordeva <deva>2009-01-13 10:07:58 +0000
committerdeva <deva>2009-01-13 10:07:58 +0000
commitbcabb130408b5d52bb73f8404d3b4805047d86ff (patch)
treeee7b347f814c9728f24bc2f266fd1fb8e247bcdc /server/src/luaformatmapperutils.cc
parentf2710089a722fc55970813fab2d27ae3e23a9c97 (diff)
Changes for new multilist type... to be removed again in a minute.
Diffstat (limited to 'server/src/luaformatmapperutils.cc')
-rw-r--r--server/src/luaformatmapperutils.cc98
1 files changed, 3 insertions, 95 deletions
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 <string>
#include <vector>
@@ -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;