Route ampif77 and ampif90 through ampiCC, factoring out duplicated code
[charm.git] / src / conv-core / conv-cpm.h
blob3b14ccbe2a99e1be1c367388c7f4912f09ef3dee
1 #ifndef _CONV_CPM_H
2 #define _CONV_CPM_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 /* For CmiMsgHeaderSizeBytes */
9 #include "converse.h"
11 /************************************************************************
13 * CpmDestination
15 * A CpmDestination structure enables the user of the Cpm module to tell
16 * the parameter-marshalling system what kind of envelope to put int the
17 * message, and what to do with it after it has been filled.
19 ***********************************************************************/
21 typedef struct CpmDestinationStruct *CpmDestination;
23 typedef void *(*CpmSender)(CpmDestination, int, void *);
25 struct CpmDestinationStruct
27 CpmSender sendfn;
28 int envsize;
31 #define CpmPE(n) n
32 #define CpmALL (-1)
33 #define CpmOTHERS (-2)
35 CpmDestination CpmSend(int pe);
36 CpmDestination CpmMakeThread(int pe);
37 CpmDestination CpmMakeThreadSize(int pe, int size);
38 CpmDestination CpmEnqueueFIFO(int pe);
39 CpmDestination CpmEnqueueLIFO(int pe);
40 CpmDestination CpmEnqueueIFIFO(int pe, int prio);
41 CpmDestination CpmEnqueueILIFO(int pe, int prio);
42 CpmDestination CpmEnqueueBFIFO(int pe, int priobits, unsigned int *prioptr);
43 CpmDestination CpmEnqueueBLIFO(int pe, int priobits, unsigned int *prioptr);
44 CpmDestination CpmEnqueueLFIFO(int pe, int priobits, unsigned int *prioptr);
45 CpmDestination CpmEnqueueLLIFO(int pe, int priobits, unsigned int *prioptr);
46 CpmDestination CpmEnqueue(int pe,int qs,int priobits,unsigned int *prioptr);
48 /***********************************************************************
50 * CPM macros
52 * CpmInvokable
53 * CpmDeclareSimple(x)
54 * CpmDeclarePointer(x)
56 * These macros expand into CPM ``declarations''. The CPM ``declarations''
57 * are actually C code that has no effect, but when the CPM scanner sees
58 * them, it recognizes them and understands them as declarations.
60 **********************************************************************/
62 typedef void CpmInvokable;
63 typedef int CpmDeclareSimple1;
64 typedef int CpmDeclarePointer1;
65 #define CpmDeclareSimple(c) typedef CpmDeclareSimple1 CpmType_##c
66 #define CpmDeclarePointer(c) typedef CpmDeclarePointer1 CpmType_##c
68 /***********************************************************************
70 * Accessing a CPM message:
72 ***********************************************************************/
74 struct CpmHeader
76 char convcore[CmiMsgHeaderSizeBytes];
77 int envpos;
79 #define CpmEnv(msg) (((char *)msg)+(((struct CpmHeader *)msg)->envpos))
80 #define CpmAlign(val, type) ((val+sizeof(type)-1)&(~(sizeof(type)-1)))
82 /***********************************************************************
84 * Built-in CPM types
86 **********************************************************************/
88 CpmDeclareSimple(char);
89 #define CpmPack_char(v) do{}while(0)
90 #define CpmUnpack_char(v) do{}while(0)
92 CpmDeclareSimple(short);
93 #define CpmPack_short(v) do{}while(0)
94 #define CpmUnpack_short(v) do{}while(0)
96 CpmDeclareSimple(int);
97 #define CpmPack_int(v) do{}while(0)
98 #define CpmUnpack_int(v) do{}while(0)
100 CpmDeclareSimple(long);
101 #define CpmPack_long(v) do{}while(0)
102 #define CpmUnpack_long(v) do{}while(0)
104 CpmDeclareSimple(float);
105 #define CpmPack_float(v) do{}while(0)
106 #define CpmUnpack_float(v) do{}while(0)
108 CpmDeclareSimple(double);
109 #define CpmPack_double(v) do{}while(0)
110 #define CpmUnpack_double(v) do{}while(0)
112 typedef int CpmDim;
113 CpmDeclareSimple(CpmDim);
114 #define CpmPack_CpmDim(v) do{}while(0)
115 #define CpmUnpack_CpmDim(v) do{}while(0)
117 CpmDeclareSimple(Cfuture);
118 #define CpmPack_Cfuture(v) do{}while(0)
119 #define CpmUnpack_Cfuture(v) do{}while(0)
121 typedef char *CpmStr;
122 CpmDeclarePointer(CpmStr);
123 #define CpmPtrSize_CpmStr(v) (strlen(v)+1)
124 #define CpmPtrPack_CpmStr(p, v) (strcpy(p, v))
125 #define CpmPtrUnpack_CpmStr(v) do{}while(0)
126 #define CpmPtrFree_CpmStr(v) do{}while(0)
128 #ifdef __cplusplus
130 #endif
132 #endif