summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-11-13 22:44:08 +0000
committerMarc Laukien <marc@zeroc.com>2001-11-13 22:44:08 +0000
commita7de18dc90494772595514a126df49766503ca68 (patch)
treeb72778f3a25de146e32d4267be28e09236e67ed2 /cpp/src
parentfixes (diff)
downloadice-a7de18dc90494772595514a126df49766503ca68.tar.bz2
ice-a7de18dc90494772595514a126df49766503ca68.tar.xz
ice-a7de18dc90494772595514a126df49766503ca68.zip
many, many fixes
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ThreadPool.cpp4
-rw-r--r--cpp/src/IcePack/Activator.cpp26
-rw-r--r--cpp/src/IcePack/Scanner.l122
3 files changed, 93 insertions, 59 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 880ee685a66..1d99565dbe8 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -281,8 +281,8 @@ IceInternal::ThreadPool::run()
{
assert(_timeout);
_timeout = 0;
- _instance->objectAdapterFactory()->shutdown();
- continue;
+ shutdown = true;
+ goto repeatSelect;
}
if (ret == SOCKET_ERROR)
diff --git a/cpp/src/IcePack/Activator.cpp b/cpp/src/IcePack/Activator.cpp
index 4ab6f4b9294..19ce84ca1f2 100644
--- a/cpp/src/IcePack/Activator.cpp
+++ b/cpp/src/IcePack/Activator.cpp
@@ -25,7 +25,9 @@ IcePack::Activator::Activator(const CommunicatorPtr& communicator) :
int fds[2];
if (pipe(fds) != 0)
{
- throw SystemException(__FILE__, __LINE__);
+ SystemException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
_fdIntrRead = fds[0];
_fdIntrWrite = fds[1];
@@ -127,12 +129,16 @@ IcePack::Activator::activate(const ServerDescription& desc)
int fds[2];
if (pipe(fds) != 0)
{
- throw SystemException(__FILE__, __LINE__);
+ SystemException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
pid_t pid = fork();
if (pid == -1)
{
- throw SystemException(__FILE__, __LINE__);
+ SystemException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
if (pid == 0) // Child process
{
@@ -168,6 +174,8 @@ IcePack::Activator::activate(const ServerDescription& desc)
// end of the pipe.
//
SystemException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
ostringstream s;
s << "can't execute `" << path << "':\n" << ex;
write(fds[1], s.str().c_str(), s.str().length());
@@ -234,7 +242,9 @@ IcePack::Activator::terminationListener()
goto repeatSelect;
}
- throw SystemException(__FILE__, __LINE__);
+ SystemException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
{
@@ -260,7 +270,9 @@ IcePack::Activator::terminationListener()
int ret = read(fd, &s, 16);
if (ret == -1)
{
- throw SystemException(__FILE__, __LINE__);
+ SystemException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
else if(ret == 0)
{
@@ -304,7 +316,9 @@ IcePack::Activator::terminationListener()
{
if (errno != ECHILD) // Ignore ECHILD
{
- throw SystemException(__FILE__, __LINE__);
+ SystemException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
}
}
diff --git a/cpp/src/IcePack/Scanner.l b/cpp/src/IcePack/Scanner.l
index d0d91199e44..24f255d361b 100644
--- a/cpp/src/IcePack/Scanner.l
+++ b/cpp/src/IcePack/Scanner.l
@@ -22,8 +22,8 @@ using namespace IcePack;
%}
-WS [ \t\v\f]
-NL [\n\r]
+WS [ \t\v\f\r]
+NL [\n]
%option noyywrap
@@ -88,8 +88,59 @@ NL [\n\r]
}
}
+"help" {
+ return ICE_PACK_HELP;
+}
+
+"quit"|"exit" {
+ return ICE_PACK_EXIT;
+}
+
+"add" {
+ return ICE_PACK_ADD;
+}
+
+"remove" {
+ return ICE_PACK_REMOVE;
+}
+
+"list" {
+ return ICE_PACK_LIST;
+}
+
+"shutdown" {
+ return ICE_PACK_SHUTDOWN;
+}
+
+{WS}*(\\{WS}*{NL})? {
+ int len = strlen(yytext);
+ for (int i = 0; i < len; ++i)
+ {
+ if (yytext[i] == '\\')
+ {
+ parser->continueLine();
+ }
+ else if (yytext[i] == '\n')
+ {
+ parser->nextLine();
+ }
+ }
+}
+
+{NL}|; {
+ int len = strlen(yytext);
+ for (int i = 0; i < len; ++i)
+ {
+ if (yytext[i] == '\n')
+ {
+ parser->nextLine();
+ }
+ }
+ return ';';
+}
+
\" {
- // "..."-type string
+ // "..."-type strings
string s;
while (true)
{
@@ -168,7 +219,7 @@ NL [\n\r]
}
\' {
- // '...'-type string
+ // '...'-type strings
string s;
while (true)
{
@@ -197,59 +248,28 @@ NL [\n\r]
return ICE_PACK_STRING;
}
-"help" {
- return ICE_PACK_HELP;
-}
-
-"quit"|"exit" {
- return ICE_PACK_EXIT;
-}
-
-"add" {
- return ICE_PACK_ADD;
-}
-
-"remove" {
- return ICE_PACK_REMOVE;
-}
-
-"list" {
- return ICE_PACK_LIST;
-}
-
-"shutdown" {
- return ICE_PACK_SHUTDOWN;
-}
-
-{WS}*(\\{WS}*{NL})? {
- int len = strlen(yytext);
- for (int i = 0; i < len; ++i)
+. {
+ // Simple strings
+ string s;
+ s += yytext[0];
+ while (true)
{
- if (yytext[i] == '\\')
- {
- parser->continueLine();
- }
- else if (yytext[i] == '\n')
+ char c = static_cast<char>(yyinput());
+ if (c == EOF)
{
- parser->nextLine();
+ break;
}
- }
-}
-
-{NL}|; {
- int len = strlen(yytext);
- for (int i = 0; i < len; ++i)
- {
- if (yytext[i] == '\n')
+ else if (isspace(c) || c == ';')
{
- parser->nextLine();
+ unput(c);
+ break;
}
+
+ s += c;
}
- return ';';
-}
-
-. {
- return yytext[0];
+ yylvalp->clear();
+ yylvalp->push_back(s);
+ return ICE_PACK_STRING;
}
%%