00001 #ifndef _MIDDLE_CONV_H_
00002 #define _MIDDLE_CONV_H_
00003 
00004 #include "converse.h"
00005 
00006 #define CkpvDeclare     CpvDeclare
00007 #define CkpvExtern  CpvExtern
00008 #define CkpvStaticDeclare  CpvStaticDeclare
00009 #define CkpvInitialize  CpvInitialize
00010 #define CkpvInitialized CpvInitialized
00011 #define CkpvAccess  CpvAccess
00012 #define CkpvAccessOther CpvAccessOther
00013 
00014 #define CksvDeclare        CsvDeclare
00015 #define CksvExtern     CsvExtern
00016 #define CksvStaticDeclare  CsvStaticDeclare
00017 #define CksvInitialize     CsvInitialize
00018 #define CksvAccess     CsvAccess
00019 
00020 #define CkReduce    CmiReduce
00021 
00022 #undef CkMyPe
00023 #undef CkNumPes
00024 
00025 #define CkRegisterHandler(x)          CmiRegisterHandler((CmiHandler)x)
00026 #define CkRegisterHandlerEx(x, p)     CmiRegisterHandlerEx((CmiHandlerEx)x, p)
00027 #define CkNumberHandler(n, x)         CmiNumberHandler(n, (CmiHandler)x)
00028 #define CkNumberHandlerEx(n, x, p)    CmiNumberHandlerEx(n, (CmiHandlerEx)x, p)
00029 
00030 #undef CmiSyncSend
00031 #undef CmiSyncSendAndFree
00032 #undef CmiSyncBroadcast
00033 #undef CmiSyncBroadcastAndFree
00034 #undef CmiSyncBroadcastAll
00035 #undef CmiSyncBroadcastAllAndFree
00036 #undef CmiSyncListSend
00037 #undef CmiSyncListSendAndFree
00038 #undef CmiSyncMulticast
00039 #undef CmiSyncMulticastAndFree
00040 
00041 #define CksdScheduler           CsdScheduler
00042 #define CksdExitScheduler       CsdExitScheduler
00043 #define CkDeliverMsgs           CmiDeliverMsgs
00044 
00045 #define CkVTimer(x)       0
00046 #define CkElapse(x)   
00047 
00048 #if CMK_CHARMDEBUG
00049 int ConverseDeliver(int pe);
00050 #else
00051 #define ConverseDeliver(pe)   1
00052 #endif
00053 
00054 namespace Converse {
00055 
00056 static inline int CkMyPe() { return CmiMyPe(); }
00057 static inline int CkNumPes() { return CmiNumPes(); }
00058 
00059 static inline void CmiSyncSend(int x, int y, char *z) 
00060 {
00061   if (ConverseDeliver(x)) CmiSyncSendFn(x, y, z);
00062 }
00063 static inline void CmiSyncSendAndFree(int x, int y, char *z)
00064 {
00065   if (ConverseDeliver(x)) CmiFreeSendFn(x, y, z);
00066 }
00067 static inline void CmiSyncBroadcast(int x, char *y)
00068 {
00069   if (ConverseDeliver(x)) CmiSyncBroadcastFn(x, y);
00070 }
00071 static inline void CmiSyncBroadcastAndFree(int x, char *y)
00072 {
00073   if (ConverseDeliver(x)) CmiFreeBroadcastFn(x, y);
00074 }
00075 static inline void CmiSyncBroadcastAll(int x, char *y)
00076 {
00077   if (ConverseDeliver(x)) CmiSyncBroadcastAllFn(x, y);
00078 }
00079 static inline void CmiSyncBroadcastAllAndFree(int x, char *y)
00080 {
00081   if (ConverseDeliver(x)) CmiFreeBroadcastAllFn(x, y);
00082 }
00083 static inline void CmiSyncListSend(int x, const int *y, int w, char *z)
00084 {
00085   if (ConverseDeliver(-1)) CmiSyncListSendFn(x, y, w, z);
00086 }
00087 static inline void CmiSyncListSendAndFree(int x, const int *y, int w, char *z)
00088 {
00089   if (ConverseDeliver(-1)) CmiFreeListSendFn(x, y, w, z);
00090 }
00091 static inline void CmiSyncMulticast(CmiGroup x, int y, char *z)
00092 {
00093   if (ConverseDeliver(-1)) CmiSyncMulticastFn(x, y, z);
00094 }
00095 static inline void CmiSyncMulticastAndFree(CmiGroup x, int y, char *z)
00096 {
00097   if (ConverseDeliver(-1)) CmiFreeMulticastFn(x, y, z);
00098 }
00099 
00100 #if 0
00101 template <class d>
00102 class Cpv {
00103 public:
00104 #if CMK_SHARED_VARS_UNAVAILABLE
00105   d data;
00106 #else
00107   d *data;
00108 #endif
00109 public:
00110   void init(void) {
00111   }
00112   d& operator = (d& val) {data = val.data;}
00113 };
00114 #endif
00115 
00116 }
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125 
00126 
00127 
00128 
00129 #endif