浏览代码

HPCC-10047 Rename MakeStringException etc

Additional cleanup of inconsistent names

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 年之前
父节点
当前提交
3d520c2839
共有 3 个文件被更改,包括 53 次插入47 次删除
  1. 21 21
      system/jlib/jexcept.cpp
  2. 24 18
      system/jlib/jexcept.hpp
  3. 8 8
      system/jlib/jiface.hpp

+ 21 - 21
system/jlib/jexcept.cpp

@@ -118,7 +118,7 @@ void jlib_decl throwStringExceptionV(int code,const char *format, ...)
 {
     va_list args;
     va_start(args, format);
-    IException *ret = MakeStringExceptionVA(code, format, args);
+    IException *ret = makeStringExceptionVA(code, format, args);
     va_end(args);
     throw ret;
 }
@@ -248,7 +248,7 @@ IErrnoException *makeErrnoExceptionV(MessageAudience aud, const char *msg, ...)
     return new ErrnoException(-1, eStr.str(), aud);
 }
 
-const char* SerializeMessageAudience(MessageAudience ma)
+const char* serializeMessageAudience(MessageAudience ma)
 {
     const char* ret;
     switch(ma)
@@ -267,7 +267,7 @@ const char* SerializeMessageAudience(MessageAudience ma)
     return ret;
 }
 
-MessageAudience DeserializeMessageAudience(const char* text)
+MessageAudience deserializeMessageAudience(const char* text)
 {
     MessageAudience ma = MSGAUD_unknown;
     if (text && *text)
@@ -344,7 +344,7 @@ public:
                 StringBuffer msg;
                 msg.appendf("[%s] ",source);
                 e.errorMessage(msg);
-                array_.append(*MakeStringException(e.errorAudience(), e.errorCode(), "%s", msg.str()));
+                array_.append(*makeStringExceptionV(e.errorAudience(), e.errorCode(), "%s", msg.str()));
             }
             else
                 array_.append(*LINK(&e));
@@ -378,7 +378,7 @@ public:
             buffer.appendf("<Code>%d</Code>", exception.errorCode());
             
             if (indent) buffer.append("\n\t\t");
-            buffer.appendf("<Audience>%s</Audience>", SerializeMessageAudience( exception.errorAudience() ));
+            buffer.appendf("<Audience>%s</Audience>", serializeMessageAudience( exception.errorAudience() ));
             
             if (simplified)
             {
@@ -412,7 +412,7 @@ public:
             xml = wrapper.appendf("<Exceptions>%s</Exceptions>", xml).str();
         Owned<IPropertyTree> pTree = createPTreeFromXMLString(xml);
         if (!pTree)
-            throw MakeStringException(-1, "Failed to deserialize IMultiException!");
+            throw makeStringException(-1, "Failed to deserialize IMultiException!");
         Owned<IPropertyTreeIterator> i = pTree->getElements("Exception");
         
         if (pTree->hasProp("Source"))
@@ -431,10 +431,10 @@ public:
         {
             IPropertyTree* pNode = &i->query();
             IException* pException = 
-                MakeStringExceptionDirect(
-                DeserializeMessageAudience(pNode->queryProp("Audience")), 
-                pNode->getPropInt("Code", -1), 
-                pNode->queryProp("Message"));
+                makeStringException(
+                   deserializeMessageAudience(pNode->queryProp("Audience")),
+                   pNode->getPropInt("Code", -1),
+                   pNode->queryProp("Message"));
             array_.append(*pException);
         }
     }   
@@ -471,7 +471,7 @@ private:
     mutable Mutex        m_mutex;
 };
 
-IMultiException *MakeMultiException(const char* source/*=NULL*/)
+IMultiException *makeMultiException(const char* source/*=NULL*/)
 {
     return new CMultiException(source);
 }
@@ -497,9 +497,9 @@ void userBreakpoint()
 #endif
 }
 
-void RaiseAssertException(const char *assertion, const char *file, unsigned line)
+void raiseAssertException(const char *assertion, const char *file, unsigned line)
 {
-    PrintStackReport();
+    printStackReport();
     StringBuffer s;
     s.append("assert(");
     s.append(assertion);
@@ -525,12 +525,12 @@ void RaiseAssertException(const char *assertion, const char *file, unsigned line
 #endif
 #endif
 
-    throw MakeStringExceptionDirect(3000, s.toCharArray()); // 3000: internal error
+    throw makeStringException(3000, s.toCharArray()); // 3000: internal error
 }
 
-void RaiseAssertCore(const char *assertion, const char *file, unsigned line)
+void raiseAssertCore(const char *assertion, const char *file, unsigned line)
 {
-    PrintStackReport();
+    printStackReport();
     StringBuffer s;
     s.append("assert(");
     s.append(assertion);
@@ -1162,7 +1162,7 @@ void excsighandler(int signum, siginfo_t *info, void *extra)
 #endif
 
 #ifdef _EXECINFO_H
-    PrintStackReport();
+    printStackReport();
 #endif  
     StringBuffer threadlist;
     PROGLOG( "ThreadList:\n%s",getThreadList(threadlist).str());
@@ -1221,7 +1221,7 @@ void jlib_decl *setSEHtoExceptionHandler(IExceptionHandler *handler)
     return ret;
 }
 
-void jlib_decl EnableSEHtoExceptionMapping()
+void jlib_decl enableSEHtoExceptionMapping()
 {
 #ifdef NOSEH
     return;
@@ -1246,7 +1246,7 @@ void jlib_decl EnableSEHtoExceptionMapping()
 }
 
 
-void  jlib_decl DisableSEHtoExceptionMapping()
+void  jlib_decl disableSEHtoExceptionMapping()
 {
 #ifdef NOSEH
     return;
@@ -1311,7 +1311,7 @@ IException * deserializeException(MemoryBuffer & in)
     StringAttr text;
     in.read(code);
     in.read(text);
-    return MakeStringException(code, "%s", text.get());
+    return makeStringExceptionV(code, "%s", text.get());
 }
 
 void jlib_decl serializeException(IException * e, MemoryBuffer & out)
@@ -1328,7 +1328,7 @@ void jlib_decl serializeException(IException * e, MemoryBuffer & out)
 }
 
 
-void PrintStackReport()
+void printStackReport()
 {
 #ifdef _WIN32
     unsigned onstack=1234;

+ 24 - 18
system/jlib/jexcept.hpp

@@ -24,8 +24,8 @@
 #include "jlib.hpp"
 #include "errno.h"
 
-jlib_decl const char* SerializeMessageAudience(MessageAudience ma);
-jlib_decl MessageAudience DeserializeMessageAudience(const char* text);
+jlib_decl const char* serializeMessageAudience(MessageAudience ma);
+jlib_decl MessageAudience deserializeMessageAudience(const char* text);
 
 //the following interface to be thrown when a user command explicitly calls for a failure
 
@@ -59,7 +59,7 @@ interface jlib_thrown_decl IMultiException : extends IException
     virtual MessageAudience errorAudience() const = 0;
 };
 
-IMultiException jlib_decl *MakeMultiException(const char* source = NULL);
+IMultiException jlib_decl *makeMultiException(const char* source = NULL);
 
 interface IExceptionHandler
 {
@@ -76,6 +76,7 @@ void jlib_decl throwStringExceptionV(int code, const char *format, ...) __attrib
 
 // Macros for legacy names of above functions
 
+#define MakeMultiException makeMultiException
 #define MakeStringException makeStringExceptionV
 #define MakeStringExceptionVA makeStringExceptionVA
 #define MakeStringExceptionDirect makeStringException
@@ -111,31 +112,36 @@ interface jlib_thrown_decl IOutOfMemException: extends IException
 };
 
 
-void  jlib_decl EnableSEHtoExceptionMapping(); // return value can be used to disable
-void  jlib_decl DisableSEHtoExceptionMapping();         
+void  jlib_decl enableSEHtoExceptionMapping();
+void  jlib_decl disableSEHtoExceptionMapping();
 // NB only enables for current thread or threads started after call
 // requires /EHa option to be set in VC++ options (after /GX)
+// Macros for legacy names of above functions
+#define EnableSEHtoExceptionMapping enableSEHtoExceptionMapping
+#define DisableSEHtoExceptionMapping disableSEHtoExceptionMapping
 
 void jlib_decl *setSEHtoExceptionHandler(IExceptionHandler *handler); // sets handler and return old value
 
 
-void  jlib_decl setTerminateOnSEHInSystemDLLs(bool set=true);
+void jlib_decl setTerminateOnSEHInSystemDLLs(bool set=true);
 void jlib_decl setTerminateOnSEH(bool set=true);
 
 
-#define makeUnexpectedException()  MakeStringException(9999, "Internal Error at %s(%d)", __FILE__, __LINE__)
-#define throwUnexpected()          throw MakeStringException(9999, "Internal Error at %s(%d)", __FILE__, __LINE__)
-#define throwUnexpectedX(x)        throw MakeStringException(9999, "Internal Error '" x "' at %s(%d)", __FILE__, __LINE__)
+#define makeUnexpectedException()  makeStringExceptionV(9999, "Internal Error at %s(%d)", __FILE__, __LINE__)
+#define throwUnexpected()          throw makeStringExceptionV(9999, "Internal Error at %s(%d)", __FILE__, __LINE__)
+#define throwUnexpectedX(x)        throw makeStringExceptionV(9999, "Internal Error '" x "' at %s(%d)", __FILE__, __LINE__)
 #define assertThrow(x)             assertex(x)
 
-#define UNIMPLEMENTED throw MakeStringException(-1, "UNIMPLEMENTED feature at %s(%d)", __FILE__, __LINE__)
-#define UNIMPLEMENTED_X(reason) throw MakeStringException(-1, "UNIMPLEMENTED '" reason "' at %s(%d)", __FILE__, __LINE__)
-#define UNIMPLEMENTED_XY(a,b) throw MakeStringException(-1, "UNIMPLEMENTED " a " %s at %s(%d)", b, __FILE__, __LINE__)
+#define UNIMPLEMENTED throw makeStringExceptionV(-1, "UNIMPLEMENTED feature at %s(%d)", __FILE__, __LINE__)
+#define UNIMPLEMENTED_X(reason) throw makeStringExceptionV(-1, "UNIMPLEMENTED '" reason "' at %s(%d)", __FILE__, __LINE__)
+#define UNIMPLEMENTED_XY(a,b) throw makeStringExceptionV(-1, "UNIMPLEMENTED " a " %s at %s(%d)", b, __FILE__, __LINE__)
 
 IException jlib_decl * deserializeException(MemoryBuffer & in); 
 void jlib_decl serializeException(IException * e, MemoryBuffer & out); 
 
-void  jlib_decl PrintStackReport();
+void  jlib_decl printStackReport();
+// Macro for legacy name of above function
+#define PrintStackReport printStackReport
 
 #ifdef _DEBUG
 #define RELEASE_CATCH_ALL       int*********
@@ -145,11 +151,11 @@ void  jlib_decl PrintStackReport();
 
 //These are used in several places to wrap error reporting, to keep error numbers+text together.  E.g.,
 //#define XYZfail 99    #define XXZfail_Text "Failed"     throwError(XYZfail)
-#define throwError(x)                           ThrowStringException(x, (x ## _Text))
-#define throwError1(x,a)                        ThrowStringException(x, (x ## _Text), a)
-#define throwError2(x,a,b)                      ThrowStringException(x, (x ## _Text), a, b)
-#define throwError3(x,a,b,c)                    ThrowStringException(x, (x ## _Text), a, b, c)
-#define throwError4(x,a,b,c,d)                  ThrowStringException(x, (x ## _Text), a, b, c, d)
+#define throwError(x)                           throwStringExceptionV(x, (x ## _Text))
+#define throwError1(x,a)                        throwStringExceptionV(x, (x ## _Text), a)
+#define throwError2(x,a,b)                      throwStringExceptionV(x, (x ## _Text), a, b)
+#define throwError3(x,a,b,c)                    throwStringExceptionV(x, (x ## _Text), a, b, c)
+#define throwError4(x,a,b,c,d)                  throwStringExceptionV(x, (x ## _Text), a, b, c, d)
 
 #endif
 

+ 8 - 8
system/jlib/jiface.hpp

@@ -26,27 +26,27 @@
 #include "jscm.hpp"
 #include "jatomic.hpp"
 
-void jlib_decl RaiseAssertException(const char *assertion, const char *file, unsigned line);
-void jlib_decl RaiseAssertCore(const char *assertion, const char *file, unsigned line);
+void jlib_decl raiseAssertException(const char *assertion, const char *file, unsigned line);
+void jlib_decl raiseAssertCore(const char *assertion, const char *file, unsigned line);
 
 #undef assert
 #undef assertex
 
 #ifdef _PREFAST_
  #pragma warning (disable : 6244)   // generates too much noise at the moment
- #define assertex(p) ((p) ? ((void) 0) : (( (void) RaiseAssertException(#p, __FILE__, __LINE__), __analysis_assume(p))))
- #define assert(p) ((p) ? ((void) 0) : (( (void) RaiseAssertCore(#p, __FILE__, __LINE__), __analysis_assume(p))))
+ #define assertex(p) ((p) ? ((void) 0) : (( (void) raiseAssertException(#p, __FILE__, __LINE__), __analysis_assume(p))))
+ #define assert(p) ((p) ? ((void) 0) : (( (void) raiseAssertCore(#p, __FILE__, __LINE__), __analysis_assume(p))))
 #elif defined(_DEBUG)||defined(_TESTING)
- #define assertex(p) ((p) ? ((void) 0) : (( (void) RaiseAssertException(#p, __FILE__, __LINE__))))
- #define assert(p) ((p) ? ((void) 0) : (( (void) RaiseAssertCore(#p, __FILE__, __LINE__))))
+ #define assertex(p) ((p) ? ((void) 0) : (( (void) raiseAssertException(#p, __FILE__, __LINE__))))
+ #define assert(p) ((p) ? ((void) 0) : (( (void) raiseAssertCore(#p, __FILE__, __LINE__))))
 #else
  #define assertex(p)
  #define assert(p)
 #endif
 
 #if defined(_DEBUG)||defined(_TESTING)
-#define verifyex(p) ((p) ? ((void) 0) : (( (void) RaiseAssertException(#p, __FILE__, __LINE__))))
-#define verify(p) ((p) ? ((void) 0) : (( (void) RaiseAssertCore(#p, __FILE__, __LINE__))))
+#define verifyex(p) ((p) ? ((void) 0) : (( (void) raiseAssertException(#p, __FILE__, __LINE__))))
+#define verify(p) ((p) ? ((void) 0) : (( (void) raiseAssertCore(#p, __FILE__, __LINE__))))
 #else
 #define verifyex(p) ((void) (p))
 #define verify(p) ((void) (p))