summaryrefslogtreecommitdiff
path: root/comm
diff options
context:
space:
mode:
authorchatty1994-05-10 10:02:49 +0000
committerchatty1994-05-10 10:02:49 +0000
commit054510bddc1801d3900fb0c801a0169dd588b466 (patch)
tree94a7c0dcca84f341e2e373caa4c22caea6adcf7f /comm
parentcbb1752ce6b9b55130d355469111e3aaa1a58433 (diff)
downloadivy-league-054510bddc1801d3900fb0c801a0169dd588b466.zip
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.gz
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.bz2
ivy-league-054510bddc1801d3900fb0c801a0169dd588b466.tar.xz
replaced TRUE/FALSE by true/false
Diffstat (limited to 'comm')
-rw-r--r--comm/Multiplexer.cc37
-rw-r--r--comm/Multiplexer.h8
-rw-r--r--comm/OLD/PortServer.cc53
-rw-r--r--comm/OLD/ReqMgr.h4
4 files changed, 61 insertions, 41 deletions
diff --git a/comm/Multiplexer.cc b/comm/Multiplexer.cc
index d3e39cb..ec72cec 100644
--- a/comm/Multiplexer.cc
+++ b/comm/Multiplexer.cc
@@ -14,7 +14,7 @@
#include "Multiplexer.h"
#include "TimeOut.h"
-#include "Signal.h"
+#include "SignalHandler.h"
#include <signal.h> // for NSIG
#include <sys/errno.h>
@@ -32,6 +32,11 @@
#define FD_SET_TYPE(x) (x)
#endif
+#ifdef __osf__
+inline void bzero (char* s, int l) { memset (s, 0, l);}
+extern "C" int select (int, fd_set*, fd_set*, fd_set*, struct timeval*);
+#endif
+
extern int errno;
#ifndef FD_SET
@@ -82,8 +87,8 @@ UchBaseMultiplexer :: UchBaseMultiplexer ()
ReadCount (0),
WriteCount (0),
SelectCount (0),
- Looping (FALSE),
- SigFired (FALSE),
+ Looping (false),
+ SigFired (false),
Handlers (new UchBaseSignalHandler* [NSIG]),
NbSignals (new int [NSIG])
{
@@ -200,7 +205,7 @@ UchBaseMultiplexer :: HandleSignal (UchBaseSignalHandler& h)
{
if (!SigFired)
AddSignalHook ();
- SigFired = TRUE;
+ SigFired = true;
int sig = h.GetSignal () - 1;
/* We have to work with arrays, because we are in a signal
handler, and we cannot use lists */
@@ -289,7 +294,7 @@ void
UchBaseMultiplexer :: Close ()
{
RemoveAll ();
- Looping = FALSE;
+ Looping = false;
}
/*?
@@ -373,8 +378,8 @@ UchMultiplexer :: SetMasks (int fd, IOMODE mode)
/*?
This function calls the select handler of each channel of the set in select mode.
-It returns TRUE as soon as one select handler returns true,
-else it returns FALSE when the select handlers have been called.
+It returns true as soon as one select handler returns true,
+else it returns false when the select handlers have been called.
?*/
bool
UchMultiplexer :: HandleSelect ()
@@ -387,12 +392,12 @@ UchMultiplexer :: HandleSelect ()
if (! FD_ISSET (fd, &SelectMask))
continue;
if (Channels [fd] -> HandleSelect ())
- return TRUE;
+ return true;
nfd--;
if (! Looping)
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
@@ -472,16 +477,16 @@ UchMultiplexer :: Scan (bool nointr, bool poll)
Scan the channels in the set and call the channel's handlers.
First the select handler (\fun{UchChannel::HandleSelect}) of each channel with mode
\var{IOSelect} is called.
-If it returns TRUE, \fun{Scan} exits immediately, while \fun{LoopScan} loops immediately.
-If no select handler returns TRUE, the system call \fun{select} is used to poll or
+If it returns true, \fun{Scan} exits immediately, while \fun{LoopScan} loops immediately.
+If no select handler returns true, the system call \fun{select} is used to poll or
wait for the channels that are ready.
When the select returns normally, the write handlers \fun{HandleWrite} of the
channels in mode \var{IOWrite} that are ready to write are called, and
the read handlers (\fun{HandleRead}) of the channels in mode \fun{IORead}
that are ready to read are called.
-If \var{nointr} is TRUE, ignore the interrupted system calls, else return an error
+If \var{nointr} is true, ignore the interrupted system calls, else return an error
whenever the \fun{select} system call is interrupted.
-If \var{poll} is TRUE, the call is non-blocking, else it is blocking.
+If \var{poll} is true, the call is non-blocking, else it is blocking.
\fun{Scan} calls \fun{select} only once;
it returns -2 if a select handler returns, it returns 0 if the channel set has no active channels,
else it returns the return code of \fun{select}.
@@ -499,7 +504,7 @@ UchMultiplexer :: LoopScan (bool nointr)
{
fd_set rmsk, wmsk;
register int nfd, fd;
- Looping = TRUE;
+ Looping = true;
for (fd0 = 0; Looping; fd0 < NFILE ? fd0++ : (fd0 = 0)) {
@@ -524,7 +529,7 @@ UchMultiplexer :: LoopScan (bool nointr)
if (! Looping)
return isMpxTerminated;
}
- if (nfd) // a handler returned TRUE.
+ if (nfd) // a handler returned true.
continue;
rmsk = ReadMask;
diff --git a/comm/Multiplexer.h b/comm/Multiplexer.h
index 20c910e..b89344b 100644
--- a/comm/Multiplexer.h
+++ b/comm/Multiplexer.h
@@ -74,7 +74,7 @@ inline void Add (const UchChannel& ch) { Add (ch.Copy ()); }
void Close ();
};
-PointerClass (pUchBaseMultiplexer, UchBaseMultiplexer);
+PointerClass (pUchBaseMultiplexer, UchBaseMultiplexer)
class UchMultiplexer : public UchBaseMultiplexer {
protected:
@@ -95,9 +95,9 @@ public:
~UchMultiplexer ();
bool HandleSelect ();
- int Scan (bool nointr = TRUE, bool poll = FALSE);
- MPX_RES LoopScan (bool nointr = TRUE);
-inline void LoopEnd () { Looping = FALSE; }
+ int Scan (bool nointr = true, bool poll = false);
+ MPX_RES LoopScan (bool nointr = true);
+inline void LoopEnd () { Looping = false; }
char* StrRepr (char* = StrReprBuf);
};
diff --git a/comm/OLD/PortServer.cc b/comm/OLD/PortServer.cc
index dc4c334..d66f722 100644
--- a/comm/OLD/PortServer.cc
+++ b/comm/OLD/PortServer.cc
@@ -22,12 +22,27 @@
#include <string.h>
// sometimes, cuserid is declared in stdio.h ...
#include <stdio.h>
+#ifdef __osf__
+extern "C" {
+#endif
#include <netdb.h>
+#ifdef __osf__
+}
+#endif
+
+#ifdef __osf__
+extern "C" {
+ unsigned short htons (unsigned short);
+ unsigned short ntohs (unsigned short);
+ int gethostname (char*, int);
+}
+#endif
+
#define DEFKEY "%s:"
// *** horrible patch
-bool PortServerInquireSysError = FALSE;
+bool PortServerInquireSysError = false;
/*?class UchPortServer
The class \typ{UchPortServer} described here implements the communication with the port server.
@@ -57,7 +72,7 @@ UchPortServer :: UchPortServer (const char* serv, const char* host)
portno = atoi (port);
else
portno = 3003;
-// Error (ErrFatal, "getservbyname", "service not available");
+// ::Error (ErrFatal, "getservbyname", "service not available");
}
/* open datagram socket */
@@ -81,7 +96,7 @@ static void
SendRequest (UchDatagram* to, UchPortServerReq req)
{
UchMsgBuffer buf (256);
- buf.Append (req);
+ buf.WriteMsg (req);
to->Write (buf);
}
@@ -127,11 +142,11 @@ UchPortServer :: Remove (const char* key, UchInetAddress& addr, int id)
SendRequest (Serv, req);
}
-static bool expired = FALSE;
+static bool expired = false;
static void
Expire (Millisecond)
{
- expired = TRUE;
+ expired = true;
}
@@ -150,27 +165,27 @@ UchInetAddress*
UchPortServer :: Inquire (const char* key, int timeout)
{
// *** horrible patch
-PortServerInquireSysError = FALSE;
+PortServerInquireSysError = false;
UchPortServerReq req (PortServInquire, 0, 0, 0, MakeKey (key));
SendRequest (Serv, req);
UchMsgBuffer buf (256);
- expired = FALSE;
+ expired = false;
CcuTimer timer (timeout * 1000, Expire);
int n = Serv->Receive (buf);
if (expired) {
- Error (ErrWarn, "UchPortServer::Inquire", "timeout");
+ ::Error (ErrWarn, "UchPortServer::Inquire", "timeout");
return 0;
}
if (n <= 0) {
SysError (ErrWarn, "Inquire");
// *** horrible patch
-PortServerInquireSysError = TRUE;
+PortServerInquireSysError = true;
return 0;
}
- if (! buf.Get (req)) {
- Error (ErrWarn, "UchPortServer::Inquire", "could not read answer");
+ if (! buf.ReadMsg (req)) {
+ ::Error (ErrWarn, "UchPortServer::Inquire", "could not read answer");
return 0;
}
switch (req.Type) {
@@ -179,7 +194,7 @@ PortServerInquireSysError = TRUE;
case PortServFail :
return 0;
}
- Error (ErrWarn, "UchPortServer::Inquire", "unexpected answer type");
+ ::Error (ErrWarn, "UchPortServer::Inquire", "unexpected answer type");
return 0;
}
@@ -206,12 +221,12 @@ UchPortServer :: Match (const char* key, PortServMatchFun f, int timeout)
UchMsgBuffer buf (1024);
for (;;) {
buf.Flush ();
- expired = FALSE;
+ expired = false;
CcuTimer timer (timeout * 1000, Expire);
int n = Serv->Receive (buf);
if (expired) {
- Error (ErrWarn, "UchPortServer::Match", "timeout");
+ ::Error (ErrWarn, "UchPortServer::Match", "timeout");
return 0;
}
@@ -219,8 +234,8 @@ UchPortServer :: Match (const char* key, PortServMatchFun f, int timeout)
SysError (ErrWarn, "Match");
break;
}
- if (! buf.Get (req)) {
- Error (ErrWarn, "Match", "could not read message");
+ if (! buf.ReadMsg (req)) {
+ ::Error (ErrWarn, "Match", "could not read message");
continue;
}
switch (req.Type) {
@@ -231,10 +246,10 @@ UchPortServer :: Match (const char* key, PortServMatchFun f, int timeout)
break;
case PortServEndMatch:
if (nb != req.Ident)
- Error (ErrWarn, "Match", "lost answers");
+ ::Error (ErrWarn, "Match", "lost answers");
return req.Ident;
default:
- Error (ErrWarn, "Match", "unexpected answer type");
+ ::Error (ErrWarn, "Match", "unexpected answer type");
return -1;
}
}
@@ -298,7 +313,7 @@ UchPortServer :: MakeKey (const char* key)
if (! l)
l = cuserid (0);
if (! l) {
- Error (ErrWarn, "UchPortServer::MakeKey", "getlogin failed");
+ ::Error (ErrWarn, "UchPortServer::MakeKey", "getlogin failed");
strcpy (p, "???");
}
strcpy (p, l);
diff --git a/comm/OLD/ReqMgr.h b/comm/OLD/ReqMgr.h
index 811cca7..eeb10d9 100644
--- a/comm/OLD/ReqMgr.h
+++ b/comm/OLD/ReqMgr.h
@@ -62,10 +62,10 @@ protected:
public:
-inline MsgType (const char* n, msg_kind k) : Name (n), Kind (k), DefaultConstructor (FALSE) {}
+inline MsgType (const char* n, msg_kind k) : Name (n), Kind (k), DefaultConstructor (false) {}
inline void AddField (MsgField* f) { Fields.Append (f); }
inline void AddConstructor (MsgConstructor* f) { Constructors.Append (f); }
-inline void UseDefaultConstructor () { DefaultConstructor = TRUE; }
+inline void UseDefaultConstructor () { DefaultConstructor = true; }
inline const char* GetName () const { return Name; }
void DumpDecl (ofstream&, int);
void DumpCode (ofstream&, int);