Revised packlib to work with dumb compilers that don't support C++-style
authorcheckout <checkout>
Fri, 29 Oct 1999 22:39:28 +0000 (22:39 +0000)
committercheckout <checkout>
Fri, 29 Oct 1999 22:39:28 +0000 (22:39 +0000)
type casting.

45 files changed:
src/arch/exemplar/conv-mach.h
src/arch/mpi-exemplar/conv-mach.h
src/arch/mpi-linux/conv-mach.h
src/arch/mpi-origin/conv-mach.h
src/arch/ncube2/conv-mach.h
src/arch/net-aix-ppc/conv-mach.h
src/arch/net-axp-cc/conv-mach.h
src/arch/net-hp-acc/conv-mach.h
src/arch/net-hp-cc/conv-mach.h
src/arch/net-hp/conv-mach.h
src/arch/net-irix-64/conv-mach.h
src/arch/net-irix/conv-mach.h
src/arch/net-linux-kcc/conv-mach.h
src/arch/net-linux-smp/conv-mach.h
src/arch/net-linux/conv-mach.h
src/arch/net-sol-cc/conv-mach.h
src/arch/net-sol-smp/conv-mach.h
src/arch/net-sol-x86/conv-mach.h
src/arch/net-sol/conv-mach.h
src/arch/net-sun/conv-mach.h
src/arch/origin-pthreads/conv-mach.h
src/arch/origin2000/conv-mach.h
src/arch/paragon-red/conv-mach.h
src/arch/sim-hp/conv-mach.h
src/arch/sim-irix-64/conv-mach.h
src/arch/sim-irix/conv-mach.h
src/arch/sim-linux/conv-mach.h
src/arch/sim-rs6k/conv-mach.h
src/arch/sim-sol/conv-mach.h
src/arch/sim-sun/conv-mach.h
src/arch/sp3/conv-mach.h
src/arch/t3e/conv-mach.h
src/arch/uth-axp-cc/conv-mach.h
src/arch/uth-hp-cc/conv-mach.h
src/arch/uth-hp/conv-mach.h
src/arch/uth-irix-64/conv-mach.h
src/arch/uth-irix/conv-mach.h
src/arch/uth-linux/conv-mach.h
src/arch/uth-rs6k/conv-mach.h
src/arch/uth-sol-cc/conv-mach.h
src/arch/uth-sol-x86/conv-mach.h
src/arch/uth-sol/conv-mach.h
src/libs/conv-libs/packlib/PackLib.h
src/libs/conv-libs/packlib/packc.C
src/libs/conv-libs/packlib/packf77.C

index 45df0eab8684353c482efda9b6ac32d121c4aa8c..da25acbb1d26b30716e41fec1c22b5adc96b0860 100644 (file)
 
 #define CPP_LOCATION "/lib/cpp"
 
+#define CMK_CPP_CAST_ILLEGAL                              0
+#define CMK_CPP_CAST_LEGAL                                1
+
 #endif
 
index 7c186389d9b5a5a6058a6704dd0f25cc674f062a..06a922fc5c143616921590b3e2d0722f4d87536d 100644 (file)
 
 #define CPP_LOCATION "/lib/cpp"
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index aeaccdcc7845b42087e21a5b5d0b0b6f287d9bd2..30396a47e5f53c5c45d8008c52095cc82cad09e9 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index e4d0500b4855884c10d301dbbe5f08801192ef80..53e491f97c6da5ef8708fb580eee0d16ceaf15b1 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 855189c2ea0f8028137883119481217d5680d36d..e121be622f920aab769faf18e4e34a3d36052604 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 8693cea8f4c2fb5b50c35da98869f8564df4a0bc..d6bda5499955f623b46bc85e2f3d152f6d7cc49d 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 2ac357572e085a8c3968858edd542c97e33ec755..c298c4ad82211435698730b3dc21c1bfd2188abb 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 144ecf13808675a843c60ffbe4328ef1131f196a..8785573a8af6c2861f62f06e4ffafa44abe5b3f2 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 9c245988bd57b4b3f77e61f7cbfd443f4b74ed30..a18cf17b56251cdeb53644bbfb2a82fc54ec5896 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               1
+#define CMK_CPP_CAST_LEGAL                                 0
+
 #endif
 
index 8d18cb48b643d08d0d11fae64ff5f75bf17b12e6..e7ecc2b5db20c8d60196ed68d25502e363387281 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 4cced6bb3b646483e2c3e0f20252a49b6e0d7deb..f79c0d89032349647a7442e02164969c48d1ae90 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 4cced6bb3b646483e2c3e0f20252a49b6e0d7deb..f79c0d89032349647a7442e02164969c48d1ae90 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index d21dba8ab27ce37ed6fe404ea78f65dcfda39e45..1dbcbca4fede98d49c1c59e1498722be6cff2e23 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index bb63897a83eb58c6df1250f5b451b839f5e602ed..05720ee0e9d0d3109737fc3b7c0d9a0a00e579e2 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index e88364be66bc309a77faa3f81d8f6744b373b725..eb372e0133343e587cad1372fb9437c158a23ea7 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
 
index 61de53320d4d82d9f4408ce45a8d4085a3ee6c79..73dc859cbd3016ffd2ceaada8939003d625a97e4 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 6aa3fed1383a62d168f5b5f3739a6a200b355716..3eae93389d7291c47ce896578b7aec92adcfa870 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 23c62a411da93def745c2f830474ae9b585f9cb5..518de01e5d113b8f0b49d0f0f6faa51a0269ae18 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 33efcd1cdf6f13fb0cd53eccc46026b169af6391..af5d26179bab230baeab8ab9822e3ed107049ca3 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 192fc9de491744869c0b93e6e43b56935511f1dd..479494eb591988cdc86f8d2958c8a56c7589605b 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 71077989e985077fc826490d2a1efc28d13644c5..2ea522ba897eeb3f5c73c11cb9614a3e7342b026 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index bcbccc7d55806ddbfa95cfd86b052fcec3078fdb..061bbc05fc211af7a3a531d9f7432ca7d52882db 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index b3dc1492e3eba648cafbfba8933ddddb7b9040b8..b2f5899a2d773f392564b817ced0515725502fdc 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index d79104cd79983de341955e3cff2a071290ded69f..0a9b1b73dfc72952d978d3acad19e703879ea144 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index b59cf2d1ad948108b6af7bcda883577bf9eccbb0..4631bab2ce4158392f0bd11c6712a4748a859105 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index ea73dee5e6c1301695ddbc8dd678b5c37a077753..a0f505f083fbf8bf81337a2940253162d525b143 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 7807fb51b7de10ee992974f91b0902889a9419f7..3220d9fe7c7c4f5209b7cbc88302ebcf78ecd079 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 0b3a4b21721d3749525a0f8b7598bded34481f57..6254a961e974b58a3396a02c5e660428ac45aceb 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 874f95c8f534ad609ade8efd86662ca318d924cf..150c892238c15b21394185edcedf53b308f69258 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index a40ac0a91f351e33950ee50370961bb364bceadd..f2ae10e9b2a503dfa85bc44c047a38262e0745bf 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index ac7d344d70ece2fa07d5fbe7805f659bdaac515b..d4f9f23a906e0552d789b718a6683a3802f06632 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index e0e7110a0ce99ceef6637686b63bdb3897d0770a..50cbf95e90fd9570fa2e19eb4b7c5b674fb8dc72 100644 (file)
 #define CMK_BOOL_DEFINED                                  1
 #define CMK_BOOL_UNDEFINED                                0
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 9367bd89dae8c824566c6645de09df92bceb3c59..daf7c08700760ce40cf6bbd2c77da83ec2d4380f 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index b5b38b5dbfa54766151aa633ff81e36bd5d8c92b..3b62ea958e9b5214fb40da9b88f98faa10fe4097 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index bfe0700ea7c4c7df76e397c754a2afeba1b211ef..fc0277dec2593a0ecfe920b4c2e1a0d0ec6e15cd 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index b4a076cb8910e84de1e931cd87885bf9e467313b..a48461c818e0040615433146685bbd9fd325cda3 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 3ae22ab8c07ec63c27fcc91225da7b6c0f539974..a687db51f74515cec3f05cee04ccd9a7abd13ba8 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 8dcbb7bebe3e70185404255d7685a4ddb1841894..d802c96bc0fa7ded9cd7bb97cf48b10db5fa160f 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 58020953849cded07db278963afcacf13468745f..aa1f4c56003e5f3d2d85b173b3ec841ab0ae1ccb 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 412da84a893f232e1fcbcb7b2b5c0814956cbbd9..531a29487c492f3084e7c048e119a93057f71f1b 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 197ae4a380c3e176c49c68dec3616f5899a847f2..10d02d4ea7d4027f8f01ed3114a1fafde8d34c1b 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index 46d8a3e4739d4865c93e3f3525c645bb9979c91e..de5e284cd4f58a215d5287ede63d629b42bc86ea 100644 (file)
 #define CMK_BOOL_DEFINED                                  0
 #define CMK_BOOL_UNDEFINED                                1
 
+#define CMK_CPP_CAST_ILLEGAL                               0
+#define CMK_CPP_CAST_LEGAL                                 1
+
 #endif
 
index af10949af7eec28358dbf1f9013bdaa4a1f174a2..f775de86f39cc1afd7e06661b2f0dadfac8bde53 100644 (file)
@@ -60,9 +60,16 @@ public:
   int buffer_size() const { return bytes + sizeof(int); };
 
   PackErr fill_buffer(void *const buffer, int buf_bytes) {
+#if CMK_CPP_CAST_LEGAL
     char* buf_ptr = static_cast<char*>(buffer);
     if (buf_bytes >= sizeof(int))
       *(static_cast<int*>(buffer)) = buf_bytes;
+#else
+    char* buf_ptr = (char*)buffer;
+    if (buf_bytes >= sizeof(int))
+      *((int*)buffer) = buf_bytes;
+#endif
+
     buf_ptr += sizeof(int);
     buf_bytes -= sizeof(int);
       
@@ -70,6 +77,7 @@ public:
     while (cur_item = dequeue()) {
       const void* item_ptr;
 
+#if CMK_CPP_CAST_LEGAL
       if (cur_item->type == t_char) {
        item_ptr = static_cast<const void*>(&cur_item->cdat);
       } else if (cur_item->type == t_uchar) {
@@ -89,16 +97,45 @@ public:
       } else if (cur_item->type == t_voidp) {
        item_ptr = static_cast<const void*>(cur_item->arr);
       } else return EType;
+#else
+      if (cur_item->type == t_char) {
+       item_ptr = (const void*)(&cur_item->cdat);
+      } else if (cur_item->type == t_uchar) {
+       item_ptr = (const void*)(&cur_item->ucdat);
+      } else if (cur_item->type == t_int) {
+       item_ptr = (const void*)(&cur_item->idat);
+      } else if (cur_item->type == t_uint) {
+       item_ptr = (const void*)(&cur_item->uidat);
+      } else if (cur_item->type == t_long) {
+       item_ptr = (const void*)(&cur_item->ldat);
+      } else if (cur_item->type == t_ulong) {
+       item_ptr = (const void*)(&cur_item->uldat);
+      } else if (cur_item->type == t_float) {
+       item_ptr = (const void*)(&cur_item->fdat);
+      } else if (cur_item->type == t_double) {
+       item_ptr = (const void*)(&cur_item->ddat);
+      } else if (cur_item->type == t_voidp) {
+       item_ptr = (const void*)(cur_item->arr);
+      } else return EType;
+#endif
 
       const int ibytes = cur_item->size;
       if (debug && buf_bytes >= sizeof(int)) {
+#if CMK_CPP_CAST_LEGAL
        const char* cptr = reinterpret_cast<const char*>(&ibytes);
+#else
+       const char* cptr = (const char*)(&ibytes);
+#endif
        for(int i=0; i < sizeof(int); i++)
          *buf_ptr++ = *cptr++;
        buf_bytes -= sizeof(int);
       }
       
+#if CMK_CPP_CAST_LEGAL
       const char* cptr = static_cast<const char*>(item_ptr);
+#else
+      const char* cptr = (const char*)(item_ptr);
+#endif
       if (buf_bytes >= ibytes) {
        for(int i=0; i < ibytes; i++) {
          *buf_ptr++ = *cptr++;
@@ -173,56 +210,88 @@ private:
     item(const char *i, const int _size) { 
       size = _size * sizeof(char);
       type = t_voidp;
+#if CMK_CPP_CAST_LEGAL
       arr = static_cast<const void*>(i); 
+#else
+      arr = (const void*)(i); 
+#endif
       nxt = 0; 
     };
 
     item(const unsigned char *i, const int _size) { 
       size = _size * sizeof(unsigned char);
       type = t_voidp;
+#if CMK_CPP_CAST_LEGAL
       arr = static_cast<const void*>(i); 
+#else
+      arr = (const void*)(i); 
+#endif
       nxt = 0; 
     };
 
     item(const int *i, const int _size) { 
       size = _size * sizeof(int);
       type = t_voidp;
+#if CMK_CPP_CAST_LEGAL
       arr = static_cast<const void*>(i); 
+#else
+      arr = (const void*)(i); 
+#endif
       nxt = 0; 
     };
 
     item(const unsigned int *i, const int _size) { 
       size = _size * sizeof(unsigned int);
       type = t_voidp;
+#if CMK_CPP_CAST_LEGAL
       arr = static_cast<const void*>(i); 
+#else
+      arr = (const void*)(i); 
+#endif
       nxt = 0; 
     };
 
     item(const long *i, const int _size) { 
       size = _size * sizeof(long);
       type = t_voidp;
+#if CMK_CPP_CAST_LEGAL
       arr = static_cast<const void*>(i); 
+#else
+      arr = (const void*)(i); 
+#endif
       nxt = 0; 
     };
 
     item(const unsigned long *i, const int _size) { 
       size = _size * sizeof(unsigned long);
       type = t_voidp;
+#if CMK_CPP_CAST_LEGAL
       arr = static_cast<const void*>(i); 
+#else
+      arr = (const void*)(i); 
+#endif
       nxt = 0; 
     };
 
     item(const float *i, const int _size) { 
       size = _size * sizeof(float);
       type = t_voidp;
+#if CMK_CPP_CAST_LEGAL
       arr = static_cast<const void*>(i); 
+#else
+      arr = (const void*)(i); 
+#endif
       nxt = 0; 
     };
 
     item(const double *i, const int _size) { 
       size = _size * sizeof(double);
       type = t_voidp;
+#if CMK_CPP_CAST_LEGAL
       arr = static_cast<const void*>(i); 
+#else
+      arr = (const void*)(i); 
+#endif
       nxt = 0; 
     };
 
@@ -273,12 +342,18 @@ class Unpacker {
 public:
   Unpacker(const void *const _buffer, CmiBool _debug = CmiFalse) {
     buffer = _buffer;
+#if CMK_CPP_CAST_LEGAL
     bufsz = *(static_cast<const int*>(buffer)) - sizeof(int);
     buf_ptr = static_cast<const char*>(buffer) + sizeof(int);
+#else
+    bufsz = *((const int*)(buffer)) - sizeof(int);
+    buf_ptr = (const char*)(buffer) + sizeof(int);
+#endif
     unpacked = sizeof(int);
     debug = _debug;
   };
 
+#if CMK_CPP_CAST_LEGAL
   PackErr unpack(char *i) { 
     return unpack_item(static_cast<void*>(i), sizeof(char));
   };
@@ -330,14 +405,70 @@ public:
   PackErr unpack(double *i,const int items) {
     return unpack_item(static_cast<void*>(i), sizeof(double)*items);
   };
-
+#else
+  PackErr unpack(char *i) { 
+    return unpack_item((void*)(i), sizeof(char));
+  };
+  PackErr unpack(unsigned char *i) { 
+    return unpack_item((void*)(i), sizeof(unsigned char));
+  };
+  PackErr unpack(int *i) { 
+    return unpack_item((void*)(i), sizeof(int));
+  };
+  PackErr unpack(unsigned int *i) {
+    return unpack_item((void*)(i), sizeof(unsigned int));
+  };
+  PackErr unpack(long *i) { 
+    return unpack_item((void*)(i), sizeof(long));
+  };
+  PackErr unpack(unsigned long *i) {
+    return unpack_item((void*)(i), sizeof(unsigned long));
+  };
+  PackErr unpack(float *i) {
+    return unpack_item((void*)(i), sizeof(float));
+  };
+  PackErr unpack(double *i) {
+    return unpack_item((void*)(i), sizeof(double));
+  };
+  PackErr unpack(char *i,const int items) { 
+    return unpack_item((void*)(i), sizeof(char)*items);
+  };
+  PackErr unpack(unsigned char *i,const int items) { 
+    return unpack_item((void*)(i), 
+                      sizeof(unsigned char)*items);
+  };
+  PackErr unpack(int *i,const int items) { 
+    return unpack_item((void*)(i), sizeof(int)*items);
+  };
+  PackErr unpack(unsigned int *i,const int items) {
+    return unpack_item((void*)(i), 
+                      sizeof(unsigned int)*items);
+  };
+  PackErr unpack(long *i,const int items) { 
+    return unpack_item((void*)(i), sizeof(long)*items);
+  };
+  PackErr unpack(unsigned long *i,const int items) {
+    return unpack_item((void*)(i),
+                      sizeof(unsigned long)*items);
+  };
+  PackErr unpack(float *i,const int items) {
+    return unpack_item((void*)(i), sizeof(float)*items);
+  };
+  PackErr unpack(double *i,const int items) {
+    return unpack_item((void*)(i), sizeof(double)*items);
+  };
+#endif
   int bytes_unpacked() { return unpacked; };
 
  private:
   PackErr unpack_item(void *item, int bytes) {
     if (debug) {
       int item_sz;
+#if CMK_CPP_CAST_LEGAL
       char* item_ptr = reinterpret_cast<char*>(&item_sz);
+#else
+      char* item_ptr = (char*)(&item_sz);
+#endif
       if (bufsz >= sizeof(int)) {
        for(int i=0; i<sizeof(int); i++)
          *item_ptr++ = *buf_ptr++;
@@ -349,8 +480,12 @@ public:
        while (1) ;
       }
     }
-    
+
+#if CMK_CPP_CAST_LEGAL    
     char* item_ptr = static_cast<char*>(item);
+#else
+    char* item_ptr = (char*)(item);
+#endif
     if (bufsz >= bytes) {
       for(int i=0; i<bytes; i++)
        *item_ptr++ = *buf_ptr++;
index c911f02c5cb5715896d1f449a0c541dc145738bd..0bb8ed94c5eea23deb7d594d81dd8ccfbc520d56 100644 (file)
 
 extern "C" void* new_packer()
 {
-  return static_cast<void*>(new Packer);
+  return (void*)(new Packer);
 }
 
 extern "C" void delete_packer(void* me)
 {
-  delete static_cast<Packer*>(me);
+  delete (Packer*)(me);
 }
 
 extern "C" void pack_char(void* me, char i)
 {
-  static_cast<Packer*>(me)->pack(i);
+  ((Packer*)me)->pack(i);
 }
 
 extern "C" void pack_uchar(void* me, unsigned char i)
 {
-  static_cast<Packer*>(me)->pack(i);
+  ((Packer*)me)->pack(i);
 }
 
 extern "C" void pack_int(void* me, int i)
 {
-  static_cast<Packer*>(me)->pack(i);
+  ((Packer*)me)->pack(i);
 }
 
 extern "C" void pack_uint(void* me, unsigned int i)
 {
-  static_cast<Packer*>(me)->pack(i);
+  ((Packer*)me)->pack(i);
 }
 
 extern "C" void pack_long(void* me, long i)
 {
-  static_cast<Packer*>(me)->pack(i);
+  ((Packer*)me)->pack(i);
 }
 
 extern "C" void pack_ulong(void* me, unsigned long i)
 {
-  static_cast<Packer*>(me)->pack(i);
+  ((Packer*)me)->pack(i);
 }
 
 extern "C" void pack_float(void* me, float i)
 {
-  static_cast<Packer*>(me)->pack(i);
+  ((Packer*)me)->pack(i);
 }
 
 extern "C" void pack_double(void* me, double i)
 {
-  static_cast<Packer*>(me)->pack(i);
+  ((Packer*)me)->pack(i);
 }
 
 extern "C" void pack_chars(void* me, char* i, int count)
 {
-  static_cast<Packer*>(me)->pack(i,count);
+  ((Packer*)me)->pack(i,count);
 }
 
 extern "C" void pack_uchars(void* me, unsigned char* i, int count)
 {
-  static_cast<Packer*>(me)->pack(i,count);
+  ((Packer*)me)->pack(i,count);
 }
 
 extern "C" void pack_ints(void* me, int* i, int count)
 {
-  static_cast<Packer*>(me)->pack(i,count);
+  ((Packer*)me)->pack(i,count);
 }
 
 extern "C" void pack_uints(void* me, unsigned int* i, int count)
 {
-  static_cast<Packer*>(me)->pack(i,count);
+  ((Packer*)me)->pack(i,count);
 }
 
 extern "C" void pack_longs(void* me, long* i, int count)
 {
-  static_cast<Packer*>(me)->pack(i,count);
+  ((Packer*)me)->pack(i,count);
 }
 
 extern "C" void pack_ulongs(void* me, unsigned long* i, int count)
 {
-  static_cast<Packer*>(me)->pack(i,count);
+  ((Packer*)me)->pack(i,count);
 }
 
 extern "C" void pack_floats(void* me, float* i, int count)
 {
-  static_cast<Packer*>(me)->pack(i,count);
+  ((Packer*)me)->pack(i,count);
 }
 
 extern "C" void pack_doubles(void* me, double* i, int count)
 {
-  static_cast<Packer*>(me)->pack(i,count);
+  ((Packer*)me)->pack(i,count);
 }
 
 extern "C" int pack_buffer_size(void* me)
 {
-  return static_cast<Packer*>(me)->buffer_size();
+  return ((Packer*)me)->buffer_size();
 }
 
 extern "C" int pack_fill_buffer(void* me, void* buffer, int bytes)
 {
-  return static_cast<Packer*>(me)->fill_buffer(buffer,bytes);
+  return ((Packer*)me)->fill_buffer(buffer,bytes);
 }
   
 extern "C" void* new_unpacker(void* buffer)
 {
-  return static_cast<void*>(new Unpacker(buffer));
+  return (void*)(new Unpacker(buffer));
 }
 
 extern "C" void delete_unpacker(void* me)
 {
-  delete static_cast<Unpacker*>(me);
+  delete ((Unpacker*)me);
 }
 
 extern "C" int unpack_char(void* me, char* i)
 {
-  return static_cast<Unpacker*>(me)->unpack(i);
+  return ((Unpacker*)me)->unpack(i);
 }
 
 extern "C" int unpack_uchar(void* me, unsigned char* i)
 {
-  return static_cast<Unpacker*>(me)->unpack(i);
+  return ((Unpacker*)me)->unpack(i);
 }
 
 extern "C" int unpack_int(void* me, int* i)
 {
-  return static_cast<Unpacker*>(me)->unpack(i);
+  return ((Unpacker*)me)->unpack(i);
 }
 
 extern "C" int unpack_uint(void* me, unsigned int* i)
 {
-  return static_cast<Unpacker*>(me)->unpack(i);
+  return ((Unpacker*)me)->unpack(i);
 }
 
 extern "C" int unpack_long(void* me, long* i)
 {
-  return static_cast<Unpacker*>(me)->unpack(i);
+  return ((Unpacker*)me)->unpack(i);
 }
 
 extern "C" int unpack_ulong(void* me, unsigned long* i)
 {
-  return static_cast<Unpacker*>(me)->unpack(i);
+  return ((Unpacker*)me)->unpack(i);
 }
 
 extern "C" int unpack_float(void* me, float* i)
 {
-  return static_cast<Unpacker*>(me)->unpack(i);
+  return ((Unpacker*)me)->unpack(i);
 }
 
 extern "C" int unpack_double(void* me, double* i)
 {
-  return static_cast<Unpacker*>(me)->unpack(i);
+  return ((Unpacker*)me)->unpack(i);
 }
 
 extern "C" int unpack_chars(void* me, char* i, int count)
 {
-  return static_cast<Unpacker*>(me)->unpack(i,count);
+  return ((Unpacker*)me)->unpack(i,count);
 }
 
 extern "C" int unpack_uchars(void* me, unsigned char* i, int count)
 {
-  return static_cast<Unpacker*>(me)->unpack(i,count);
+  return ((Unpacker*)me)->unpack(i,count);
 }
 
 extern "C" int unpack_ints(void* me, int* i, int count)
 {
-  return static_cast<Unpacker*>(me)->unpack(i,count);
+  return ((Unpacker*)me)->unpack(i,count);
 }
 
 extern "C" int unpack_uints(void* me, unsigned int* i, int count)
 {
-  return static_cast<Unpacker*>(me)->unpack(i,count);
+  return ((Unpacker*)me)->unpack(i,count);
 }
 
 extern "C" int unpack_longs(void* me, long* i, int count)
 {
-  return static_cast<Unpacker*>(me)->unpack(i,count);
+  return ((Unpacker*)me)->unpack(i,count);
 }
 
 extern "C" int unpack_ulongs(void* me, unsigned long* i, int count)
 {
-  return static_cast<Unpacker*>(me)->unpack(i,count);
+  return ((Unpacker*)me)->unpack(i,count);
 }
 
 extern "C" int unpack_floats(void* me, float* i, int count)
 {
-  return static_cast<Unpacker*>(me)->unpack(i,count);
+  return ((Unpacker*)me)->unpack(i,count);
 }
 
 extern "C" int unpack_doubles(void* me, double* i, int count)
 {
-  return static_cast<Unpacker*>(me)->unpack(i,count);
+  return ((Unpacker*)me)->unpack(i,count);
 }
 
index 82b224d4dcecfa78669f75ac7b3628a434c45771..1287bdb662a1ad94e386406b573f6cad7f8b5fa3 100644 (file)
 
 extern "C" void new_packer_(long* me)
 {
-  *me = reinterpret_cast<long>(new Packer);
+  *me = (long)(new Packer);
 }
 
 extern "C" void delete_packer_(long* me)
 {
-  delete reinterpret_cast<Packer*>(*me);
+  delete ((Packer*)(*me));
 }
 
 extern "C" void pack_char_(long* me, char* i)
 {
-  reinterpret_cast<Packer*>(*me)->pack(*i);
+  ((Packer*)(*me))->pack(*i);
 }
 
 extern "C" void pack_int_(long* me, int* i)
 {
-  reinterpret_cast<Packer*>(*me)->pack(*i);
+  ((Packer*)(*me))->pack(*i);
 }
 
 extern "C" void pack_long_(long* me, long* i)
 {
-  reinterpret_cast<Packer*>(*me)->pack(*i);
+  ((Packer*)(*me))->pack(*i);
 }
 
 extern "C" void pack_float_(long* me, float* i)
 {
-  reinterpret_cast<Packer*>(*me)->pack(*i);
+  ((Packer*)(*me))->pack(*i);
 }
 
 extern "C" void pack_double_(long* me, double* i)
 {
-  reinterpret_cast<Packer*>(*me)->pack(*i);
+  ((Packer*)(*me))->pack(*i);
 }
 
 extern "C" void pack_chars_(long* me, char* i, int* count)
 {
-  reinterpret_cast<Packer*>(*me)->pack(i,*count);
+  ((Packer*)(*me))->pack(i,*count);
 }
 
 extern "C" void pack_ints_(long* me, int* i, int* count)
 {
-  reinterpret_cast<Packer*>(*me)->pack(i,*count);
+  ((Packer*)(*me))->pack(i,*count);
 }
 
 extern "C" void pack_longs_(long* me, long* i, int* count)
 {
-  reinterpret_cast<Packer*>(*me)->pack(i,*count);
+  ((Packer*)(*me))->pack(i,*count);
 }
 
 extern "C" void pack_floats_(long* me, float* i, int* count)
 {
-  reinterpret_cast<Packer*>(*me)->pack(i,*count);
+  ((Packer*)(*me))->pack(i,*count);
 }
 
 extern "C" void pack_doubles_(long* me, double* i, int* count)
 {
-  reinterpret_cast<Packer*>(*me)->pack(i,*count);
+  ((Packer*)(*me))->pack(i,*count);
 }
 
 extern "C" int pack_buffer_size(long* me)
 {
-  return reinterpret_cast<Packer*>(*me)->buffer_size();
+  return ((Packer*)(*me))->buffer_size();
 }
 
 extern "C" void pack_fill_buffer(long* me, char* buffer, int* bytes)
 {
-  reinterpret_cast<Packer*>(*me)->fill_buffer(buffer,*bytes);
+  ((Packer*)(*me))->fill_buffer(buffer,*bytes);
 }
   
 extern "C" void new_unpacker_(long* me, char* buffer)
 {
-  *me = reinterpret_cast<long>(new Unpacker(static_cast<void*>(buffer)));
+  *me = (long)(new Unpacker((void*)(buffer)));
 }
 
 extern "C" void delete_unpacker_(long* me)
 {
-  delete reinterpret_cast<Unpacker*>(*me);
+  delete ((Unpacker*)(*me));
 }
 
 extern "C" void unpack_char_(long* me, char* i)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i);
+  ((Unpacker*)(*me))->unpack(i);
 }
 
 extern "C" void unpack_int_(long* me, int* i)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i);
+  ((Unpacker*)(*me))->unpack(i);
 }
 
 extern "C" void unpack_long_(long* me, long* i)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i);
+  ((Unpacker*)(*me))->unpack(i);
 }
 
 extern "C" void unpack_float_(long* me, float* i)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i);
+  ((Unpacker*)(*me))->unpack(i);
 }
 
 extern "C" void unpack_double_(long* me, double* i)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i);
+  ((Unpacker*)(*me))->unpack(i);
 }
 
 extern "C" void unpack_chars_(long* me, char* i, int *count)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i,*count);
+  ((Unpacker*)(*me))->unpack(i,*count);
 }
 
 extern "C" void unpack_ints_(long* me, int* i, int *count)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i,*count);
+  ((Unpacker*)(*me))->unpack(i,*count);
 }
 
 extern "C" void unpack_longs_(long* me, long* i, int *count)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i,*count);
+  ((Unpacker*)(*me))->unpack(i,*count);
 }
 
 extern "C" void unpack_floats_(long* me, float* i, int *count)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i,*count);
+  ((Unpacker*)(*me))->unpack(i,*count);
 }
 
 extern "C" void unpack_doubles_(long* me, double* i, int *count)
 {
-  reinterpret_cast<Unpacker*>(*me)->unpack(i,*count);
+  ((Unpacker*)(*me))->unpack(i,*count);
 }