summaryrefslogtreecommitdiff
path: root/include/Exceptions.h
diff options
context:
space:
mode:
authorPixel <Pixel>2002-06-01 00:45:34 +0000
committerPixel <Pixel>2002-06-01 00:45:34 +0000
commit6be21a3b278d3bb3f8ac4176f923d42dfb9b1e12 (patch)
tree885d79500dfa392e950dba743aa13f1433174151 /include/Exceptions.h
parent718469e240675b161006ee4f2d5d52de9ad14f2f (diff)
gcc-3.0.1 fixing.
Diffstat (limited to 'include/Exceptions.h')
-rw-r--r--include/Exceptions.h115
1 files changed, 71 insertions, 44 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h
index 1b98598..85451f0 100644
--- a/include/Exceptions.h
+++ b/include/Exceptions.h
@@ -8,55 +8,25 @@
#include <string.h>
#include <stdlib.h>
-class GeneralException;
-
-char * xstrdup(const char *);
-void * xmalloc(size_t) throw (GeneralException);
-void xfree(void *&);
-void xfree(char *&);
-void * xrealloc(void *, size_t);
-int xpipe(int *, int = 0) throw (GeneralException);
-pid_t xfork() throw (GeneralException);
-
-class String;
+#define INLINE __inline__
class Base {
public:
- static char * strdup(const char * s) {
- return xstrdup(s);
- }
- static void * malloc(ssize_t s) {
- return xmalloc(s);
- }
- static void * realloc(void * p, size_t s) {
- return xrealloc(p, s);
- }
- static void * calloc(size_t n, size_t s) {
- return xmalloc(n * s);
- }
- void * operator new(size_t s) {
- return xmalloc(s);
- }
- void * operator new(size_t s, void * p) {
- return memset(p, 0, s);
- }
- void operator delete(void * p) {
- xfree(p);
- }
- static void free(void *& p) {
- xfree(p);
- }
- static void free(char *& p) {
- xfree(p);
- }
- static int pipe(int * p, int flag = 0) {
- return xpipe(p, flag);
- }
- static pid_t fork() {
- return xfork();
- }
+ static char * strdup(const char * s);
+ static void * malloc(ssize_t s);
+ static void * realloc(void * p, size_t s);
+ static void * calloc(size_t n, size_t s);
+ void * operator new(size_t s);
+ void * operator new(size_t s, void * p);
+ void operator delete(void * p);
+ static void free(void *& p);
+ static void free(char *& p);
+ static int pipe(int * p, int flag = 0);
+ static pid_t fork();
};
+class String;
+
class GeneralException : public Base {
public:
GeneralException(String);
@@ -70,11 +40,68 @@ class GeneralException : public Base {
static char t[BUFSIZ];
};
+char * xstrdup(const char *);
+void * xmalloc(size_t) throw (GeneralException);
+void xfree(void *&);
+void xfree(char *&);
+void * xrealloc(void *, size_t);
+int xpipe(int *, int = 0) throw (GeneralException);
+pid_t xfork() throw (GeneralException);
+
+INLINE char * Base::strdup(const char * s) {
+ return xstrdup(s);
+}
+
+INLINE void * Base::malloc(ssize_t s) {
+ return xmalloc(s);
+}
+
+INLINE void * Base::realloc(void * p, size_t s) {
+ return xrealloc(p, s);
+}
+
+INLINE void * Base::calloc(size_t n, size_t s) {
+ return xmalloc(n * s);
+}
+
+INLINE void * Base::operator new(size_t s) {
+ return xmalloc(s);
+}
+
+INLINE void * Base::operator new(size_t s, void * p) {
+ return memset(p, 0, s);
+}
+
+INLINE void Base::operator delete(void * p) {
+ xfree(p);
+}
+
+INLINE void Base::free(void *& p) {
+ xfree(p);
+}
+
+INLINE void Base::free(char *& p) {
+ xfree(p);
+}
+
+INLINE int Base::pipe(int * p, int flag = 0) {
+ return xpipe(p, flag);
+}
+
+INLINE pid_t Base::fork() {
+ return xfork();
+}
+
class MemoryException : public GeneralException {
public:
MemoryException(ssize_t);
};
+class TaskNotFound : public GeneralException {
+ public:
+ TaskNotFound();
+};
+
enum op_t {
IO_WRITE = 1,
IO_READ