aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/itoserver.cpp3
-rw-r--r--src/minimacro.cpp33
-rw-r--r--src/minimacro.h3
3 files changed, 37 insertions, 2 deletions
diff --git a/src/itoserver.cpp b/src/itoserver.cpp
index 8bdd894..7426e8a 100644
--- a/src/itoserver.cpp
+++ b/src/itoserver.cpp
@@ -64,11 +64,12 @@ void Bu::ItoServer::addClient( int nSocket, int nPort )
64{ 64{
65 ItoClient *pC = new ItoClient( *this, nSocket, nPort, nTimeoutSec, 65 ItoClient *pC = new ItoClient( *this, nSocket, nPort, nTimeoutSec,
66 nTimeoutUSec ); 66 nTimeoutUSec );
67 pC->start();
68 67
69 imClients.lock(); 68 imClients.lock();
70 hClients.insert( nSocket, pC ); 69 hClients.insert( nSocket, pC );
71 imClients.unlock(); 70 imClients.unlock();
71
72 pC->start();
72} 73}
73 74
74void *Bu::ItoServer::run() 75void *Bu::ItoServer::run()
diff --git a/src/minimacro.cpp b/src/minimacro.cpp
index 2bd156c..1d2abf8 100644
--- a/src/minimacro.cpp
+++ b/src/minimacro.cpp
@@ -20,8 +20,9 @@ Bu::MiniMacro::~MiniMacro()
20 20
21Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn ) 21Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn )
22{ 22{
23 bContinue = true;
23 Bu::FString sOut; 24 Bu::FString sOut;
24 for( sCur = sIn.getStr(); *sCur; sCur++ ) 25 for( sCur = sIn.getStr(); *sCur && bContinue; sCur++ )
25 { 26 {
26 if( *sCur == '{' ) 27 if( *sCur == '{' )
27 { 28 {
@@ -53,6 +54,8 @@ Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn )
53 } 54 }
54 } 55 }
55 56
57 iLastPos = (int)sCur - (int)sIn.getStr();
58
56 return sOut; 59 return sOut;
57} 60}
58 61
@@ -101,6 +104,29 @@ Bu::FString Bu::MiniMacro::parseCond()
101Bu::FString Bu::MiniMacro::parseCmd() 104Bu::FString Bu::MiniMacro::parseCmd()
102{ 105{
103 Bu::FString sOut; 106 Bu::FString sOut;
107 const char *sNext = sCur;
108 for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ );
109 if( *sNext != '\0' )
110 {
111 Bu::FString sName( sCur, (int)sNext-(int)sCur );
112 if( sName == "end" )
113 {
114 sCur = sNext;
115 bContinue = false;
116 return sOut;
117 }
118 else
119 {
120 throw Bu::ExceptionBase("Unknown command '%s'.",
121 sName.getStr()
122 );
123 }
124 }
125 else
126 {
127 printf("Uh...?\n");
128 }
129
104 printf("%20s\n", sCur ); 130 printf("%20s\n", sCur );
105 return sOut; 131 return sOut;
106} 132}
@@ -142,3 +168,8 @@ const Bu::FString &Bu::MiniMacro::getvar( const Bu::FString &sName )
142 return hVars.get( sName ); 168 return hVars.get( sName );
143} 169}
144 170
171int Bu::MiniMacro::getPosition()
172{
173 return iLastPos;
174}
175
diff --git a/src/minimacro.h b/src/minimacro.h
index 4349b19..f278666 100644
--- a/src/minimacro.h
+++ b/src/minimacro.h
@@ -70,6 +70,7 @@ namespace Bu
70 void addVar( const Bu::FString &sName, const Bu::FString &sValue ); 70 void addVar( const Bu::FString &sName, const Bu::FString &sValue );
71 bool hasVar( const Bu::FString &sName ); 71 bool hasVar( const Bu::FString &sName );
72 const Bu::FString &getvar( const Bu::FString &sName ); 72 const Bu::FString &getvar( const Bu::FString &sName );
73 int getPosition();
73 74
74 private: 75 private:
75 const char *sCur; 76 const char *sCur;
@@ -80,6 +81,8 @@ namespace Bu
80 const Bu::FString &sIn, const Bu::FString &sFunc ); 81 const Bu::FString &sIn, const Bu::FString &sFunc );
81 82
82 StrHash hVars; 83 StrHash hVars;
84 bool bContinue;
85 int iLastPos;
83 86
84 public: 87 public:
85 typedef Bu::List<Bu::FString> StrList; 88 typedef Bu::List<Bu::FString> StrList;