parent
b133ddcd09
commit
11e1e19799
|
@ -58,46 +58,46 @@ extern "C" {
|
||||||
/* 1, 2, 4 and 8 byte datatypes */
|
/* 1, 2, 4 and 8 byte datatypes */
|
||||||
/* unpacking */
|
/* unpacking */
|
||||||
#define ECORE_IPC_GET64(v)\
|
#define ECORE_IPC_GET64(v)\
|
||||||
{ \
|
{ \
|
||||||
p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \
|
p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \
|
||||||
ptr += 8; \
|
ptr += 8; \
|
||||||
}
|
}
|
||||||
#define ECORE_IPC_GET32(v)\
|
#define ECORE_IPC_GET32(v)\
|
||||||
{ \
|
{ \
|
||||||
p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \
|
p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \
|
||||||
ptr += 4; \
|
ptr += 4; \
|
||||||
}
|
}
|
||||||
#define ECORE_IPC_GET16(v)\
|
#define ECORE_IPC_GET16(v)\
|
||||||
{ \
|
{ \
|
||||||
p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \
|
p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \
|
||||||
ptr += 2; \
|
ptr += 2; \
|
||||||
}
|
}
|
||||||
#define ECORE_IPC_GET8(v) \
|
#define ECORE_IPC_GET8(v) \
|
||||||
{ \
|
{ \
|
||||||
p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \
|
p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \
|
||||||
ptr += 1; \
|
ptr += 1; \
|
||||||
}
|
}
|
||||||
/* packing */
|
/* packing */
|
||||||
#define ECORE_IPC_PUT64(v)\
|
#define ECORE_IPC_PUT64(v)\
|
||||||
{ \
|
{ \
|
||||||
*(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \
|
*(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \
|
||||||
ptr += 8; \
|
ptr += 8; \
|
||||||
}
|
}
|
||||||
#define ECORE_IPC_PUT32(v)\
|
#define ECORE_IPC_PUT32(v)\
|
||||||
{ \
|
{ \
|
||||||
*(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \
|
*(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \
|
||||||
ptr += 4; \
|
ptr += 4; \
|
||||||
}
|
}
|
||||||
#define ECORE_IPC_PUT16(v)\
|
#define ECORE_IPC_PUT16(v)\
|
||||||
{ \
|
{ \
|
||||||
*(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \
|
*(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \
|
||||||
ptr += 2; \
|
ptr += 2; \
|
||||||
}
|
}
|
||||||
#define ECORE_IPC_PUT8(v) \
|
#define ECORE_IPC_PUT8(v) \
|
||||||
{ \
|
{ \
|
||||||
*(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \
|
*(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \
|
||||||
ptr += 1; \
|
ptr += 1; \
|
||||||
}
|
}
|
||||||
/* padding data */
|
/* padding data */
|
||||||
#define ECORE_IPC_PAD8() ptr += 1
|
#define ECORE_IPC_PAD8() ptr += 1
|
||||||
#define ECORE_IPC_PAD16() ptr += 2
|
#define ECORE_IPC_PAD16() ptr += 2
|
||||||
|
@ -113,18 +113,18 @@ extern "C" {
|
||||||
/* strings */
|
/* strings */
|
||||||
#define ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0;
|
#define ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0;
|
||||||
#define ECORE_IPC_GETS(v) \
|
#define ECORE_IPC_GETS(v) \
|
||||||
{ \
|
{ \
|
||||||
if (ptr < ((unsigned char *)d + s)) \
|
if (ptr < ((unsigned char *)d + s)) \
|
||||||
{ \
|
{ \
|
||||||
p->v = ptr; \
|
p->v = ptr; \
|
||||||
ptr += strlen(p->v) + 1; \
|
ptr += strlen(p->v) + 1; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define ECORE_IPC_PUTS(v, l)\
|
#define ECORE_IPC_PUTS(v, l)\
|
||||||
{ \
|
{ \
|
||||||
strcpy(ptr, p->v); \
|
strcpy(ptr, p->v); \
|
||||||
ptr += l + 1; \
|
ptr += l + 1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handy to calculate what sized block we need to alloc */
|
/* handy to calculate what sized block we need to alloc */
|
||||||
#define ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1)
|
#define ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1)
|
||||||
|
@ -136,36 +136,36 @@ extern "C" {
|
||||||
#define ECORE_IPC_DEC_EVAS_LIST_PROTO(x) static Evas_List *x(void *d, int s)
|
#define ECORE_IPC_DEC_EVAS_LIST_PROTO(x) static Evas_List *x(void *d, int s)
|
||||||
#define ECORE_IPC_ENC_EVAS_LIST_PROTO(x) static void *x(Evas_List *lp, int *s)
|
#define ECORE_IPC_ENC_EVAS_LIST_PROTO(x) static void *x(Evas_List *lp, int *s)
|
||||||
|
|
||||||
|
|
||||||
/* decoder setup - saves typing. requires data packet of exact size, or fail */
|
/* decoder setup - saves typing. requires data packet of exact size, or fail */
|
||||||
#define ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x) \
|
#define ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x) \
|
||||||
typ *p; \
|
typ *p; \
|
||||||
unsigned char *ptr; \
|
unsigned char *ptr; \
|
||||||
p = (typ *)pp; \
|
p = (typ *)pp; \
|
||||||
if (!d) return 0; \
|
if (!d) return 0; if (s != (x)) return 0; \
|
||||||
if (s != (x)) return 0; \
|
ptr = d;
|
||||||
ptr = d;
|
|
||||||
/* decoder setup - saves typing. requires data packet of a minimum size */
|
/* decoder setup - saves typing. requires data packet of a minimum size */
|
||||||
#define ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x) \
|
#define ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x) \
|
||||||
typ *p; \
|
typ *p; \
|
||||||
unsigned char *ptr; \
|
unsigned char *ptr; \
|
||||||
p = (typ *)pp; \
|
p = (typ *)pp; \
|
||||||
if (!d) return 0; \
|
if (!d) return 0; if (s < (x)) return 0; \
|
||||||
if (s < (x)) return 0; \
|
ptr = d;
|
||||||
ptr = d;
|
|
||||||
/* footer for the hell of it */
|
/* footer for the hell of it */
|
||||||
#define ECORE_IPC_DEC_STRUCT_FOOT() return 1
|
#define ECORE_IPC_DEC_STRUCT_FOOT() return 1
|
||||||
/* header for encoder - gives native strct type and size of flattened packet */
|
/* header for encoder - gives native strct type and size of flattened packet */
|
||||||
#define ECORE_IPC_ENC_STRUCT_HEAD(typ, sz) \
|
#define ECORE_IPC_ENC_STRUCT_HEAD(typ, sz) \
|
||||||
typ *p; \
|
typ *p; \
|
||||||
unsigned char *d, *ptr; \
|
unsigned char *d, *ptr; \
|
||||||
int len; \
|
int len; \
|
||||||
p = (typ *)pp; \
|
*s = 0; \
|
||||||
*s = 0; \
|
if(!pp) return NULL; \
|
||||||
len = sz; \
|
p = (typ *)pp; \
|
||||||
d = malloc(len); \
|
len = sz; \
|
||||||
if (!d) return NULL; \
|
d = malloc(len); \
|
||||||
*s = len; \
|
if (!d) return NULL; \
|
||||||
ptr = d;
|
*s = len; \
|
||||||
|
ptr = d;
|
||||||
/* footer for the hell of it */
|
/* footer for the hell of it */
|
||||||
#define ECORE_IPC_ENC_STRUCT_FOOT() return d
|
#define ECORE_IPC_ENC_STRUCT_FOOT() return d
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue