summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-04-22 03:03:55 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-04-22 03:03:55 +0000
commit11e1e19799665a4cfb3cf68edd7aba6c868f4973 (patch)
treef1a36d7adee48e3780626412f4b3ccf167730784 /legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
parentb133ddcd0962b683defcdaa8b2f9b31f1a57a7e1 (diff)
shorne's cleanups
SVN revision: 14286
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h130
1 files changed, 65 insertions, 65 deletions
diff --git a/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h b/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
index 862c941ddb..3926bb5b55 100644
--- a/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
+++ b/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
@@ -58,46 +58,46 @@ extern "C" {
58/* 1, 2, 4 and 8 byte datatypes */ 58/* 1, 2, 4 and 8 byte datatypes */
59/* unpacking */ 59/* unpacking */
60#define ECORE_IPC_GET64(v)\ 60#define ECORE_IPC_GET64(v)\
61 { \ 61 { \
62 p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \ 62 p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \
63 ptr += 8; \ 63 ptr += 8; \
64 } 64 }
65#define ECORE_IPC_GET32(v)\ 65#define ECORE_IPC_GET32(v)\
66 { \ 66 { \
67 p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \ 67 p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \
68 ptr += 4; \ 68 ptr += 4; \
69 } 69 }
70#define ECORE_IPC_GET16(v)\ 70#define ECORE_IPC_GET16(v)\
71 { \ 71 { \
72 p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \ 72 p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \
73 ptr += 2; \ 73 ptr += 2; \
74 } 74 }
75#define ECORE_IPC_GET8(v) \ 75#define ECORE_IPC_GET8(v) \
76 { \ 76 { \
77 p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \ 77 p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \
78 ptr += 1; \ 78 ptr += 1; \
79 } 79 }
80/* packing */ 80/* packing */
81#define ECORE_IPC_PUT64(v)\ 81#define ECORE_IPC_PUT64(v)\
82 { \ 82 { \
83 *(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \ 83 *(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \
84 ptr += 8; \ 84 ptr += 8; \
85 } 85 }
86#define ECORE_IPC_PUT32(v)\ 86#define ECORE_IPC_PUT32(v)\
87 { \ 87 { \
88 *(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \ 88 *(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \
89 ptr += 4; \ 89 ptr += 4; \
90 } 90 }
91#define ECORE_IPC_PUT16(v)\ 91#define ECORE_IPC_PUT16(v)\
92 { \ 92 { \
93 *(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \ 93 *(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \
94 ptr += 2; \ 94 ptr += 2; \
95 } 95 }
96#define ECORE_IPC_PUT8(v) \ 96#define ECORE_IPC_PUT8(v) \
97 { \ 97 { \
98 *(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \ 98 *(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \
99 ptr += 1; \ 99 ptr += 1; \
100 } 100 }
101/* padding data */ 101/* padding data */
102#define ECORE_IPC_PAD8() ptr += 1 102#define ECORE_IPC_PAD8() ptr += 1
103#define ECORE_IPC_PAD16() ptr += 2 103#define ECORE_IPC_PAD16() ptr += 2
@@ -113,18 +113,18 @@ extern "C" {
113/* strings */ 113/* strings */
114#define ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0; 114#define ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0;
115#define ECORE_IPC_GETS(v) \ 115#define ECORE_IPC_GETS(v) \
116 { \ 116 { \
117 if (ptr < ((unsigned char *)d + s)) \ 117 if (ptr < ((unsigned char *)d + s)) \
118 { \ 118 { \
119 p->v = ptr; \ 119 p->v = ptr; \
120 ptr += strlen(p->v) + 1; \ 120 ptr += strlen(p->v) + 1; \
121 } \ 121 } \
122 } 122 }
123#define ECORE_IPC_PUTS(v, l)\ 123#define ECORE_IPC_PUTS(v, l)\
124 { \ 124 { \
125 strcpy(ptr, p->v); \ 125 strcpy(ptr, p->v); \
126 ptr += l + 1; \ 126 ptr += l + 1; \
127 } 127 }
128 128
129/* handy to calculate what sized block we need to alloc */ 129/* handy to calculate what sized block we need to alloc */
130#define ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1) 130#define ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1)
@@ -136,36 +136,36 @@ extern "C" {
136#define ECORE_IPC_DEC_EVAS_LIST_PROTO(x) static Evas_List *x(void *d, int s) 136#define ECORE_IPC_DEC_EVAS_LIST_PROTO(x) static Evas_List *x(void *d, int s)
137#define ECORE_IPC_ENC_EVAS_LIST_PROTO(x) static void *x(Evas_List *lp, int *s) 137#define ECORE_IPC_ENC_EVAS_LIST_PROTO(x) static void *x(Evas_List *lp, int *s)
138 138
139
139/* decoder setup - saves typing. requires data packet of exact size, or fail */ 140/* decoder setup - saves typing. requires data packet of exact size, or fail */
140#define ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x) \ 141#define ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x) \
141 typ *p; \ 142 typ *p; \
142 unsigned char *ptr; \ 143 unsigned char *ptr; \
143 p = (typ *)pp; \ 144 p = (typ *)pp; \
144 if (!d) return 0; \ 145 if (!d) return 0; if (s != (x)) return 0; \
145 if (s != (x)) return 0; \ 146 ptr = d;
146 ptr = d;
147/* decoder setup - saves typing. requires data packet of a minimum size */ 147/* decoder setup - saves typing. requires data packet of a minimum size */
148#define ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x) \ 148#define ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x) \
149 typ *p; \ 149 typ *p; \
150 unsigned char *ptr; \ 150 unsigned char *ptr; \
151 p = (typ *)pp; \ 151 p = (typ *)pp; \
152 if (!d) return 0; \ 152 if (!d) return 0; if (s < (x)) return 0; \
153 if (s < (x)) return 0; \ 153 ptr = d;
154 ptr = d;
155/* footer for the hell of it */ 154/* footer for the hell of it */
156#define ECORE_IPC_DEC_STRUCT_FOOT() return 1 155#define ECORE_IPC_DEC_STRUCT_FOOT() return 1
157/* header for encoder - gives native strct type and size of flattened packet */ 156/* header for encoder - gives native strct type and size of flattened packet */
158#define ECORE_IPC_ENC_STRUCT_HEAD(typ, sz) \ 157#define ECORE_IPC_ENC_STRUCT_HEAD(typ, sz) \
159 typ *p; \ 158 typ *p; \
160 unsigned char *d, *ptr; \ 159 unsigned char *d, *ptr; \
161 int len; \ 160 int len; \
162 p = (typ *)pp; \ 161 *s = 0; \
163 *s = 0; \ 162 if(!pp) return NULL; \
164 len = sz; \ 163 p = (typ *)pp; \
165 d = malloc(len); \ 164 len = sz; \
166 if (!d) return NULL; \ 165 d = malloc(len); \
167 *s = len; \ 166 if (!d) return NULL; \
168 ptr = d; 167 *s = len; \
168 ptr = d;
169/* footer for the hell of it */ 169/* footer for the hell of it */
170#define ECORE_IPC_ENC_STRUCT_FOOT() return d 170#define ECORE_IPC_ENC_STRUCT_FOOT() return d
171 171