version 1.1.2.5, 2011/09/08 07:02:22
|
version 1.2.4.1, 2012/05/23 15:14:41
|
Line 3
|
Line 3
|
#include <aitsess.h> |
#include <aitsess.h> |
#include <aitio.h> |
#include <aitio.h> |
|
|
|
|
int main(int argc, char **argv) |
int main(int argc, char **argv) |
{ |
{ |
tagSess *n = NULL; | ait_sess_t *n = NULL; |
array_t *inp; |
array_t *inp; |
ait_val_t *v; |
ait_val_t *v; |
int i; |
int i; |
|
|
inp = io_arrayInit(argc); |
inp = io_arrayInit(argc); |
for (i = 0; i < argc; i++) { |
for (i = 0; i < argc; i++) { |
v = malloc(sizeof(ait_val_t)); | v = io_allocVar(); |
AIT_SET_STR(v, argv[i]); |
AIT_SET_STR(v, argv[i]); |
io_arraySet(inp, i, v); |
io_arraySet(inp, i, v); |
} |
} |
Line 43 int main(int argc, char **argv)
|
Line 44 int main(int argc, char **argv)
|
freeSession(NULL, &n); |
freeSession(NULL, &n); |
*/ |
*/ |
|
|
if (ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n) == -1) { | sess_initSession(SHARED_IPC, "/tmp/abra-kadabra-321", &n); |
| if (ALLOC_MEMORY(1003, 4096, n) == -1) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
return 2; |
return 2; |
} |
} |
if (sess_commitSession(n, inp) == -1) { |
if (sess_commitSession(n, inp) == -1) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
DESTROY_SESSION("/tmp/abra-kadabra-321", &n); | FREE_MEMORY(n); |
| sess_freeSession(&n); |
return 2; |
return 2; |
} |
} |
freeSession(NULL, &n); | sess_freeSession(&n); |
| for (i = 0; i < io_arraySize(inp); i++) |
| AIT_FREE_VAL(io_arrayGet(inp, i)); |
io_arrayFree(inp); |
io_arrayFree(inp); |
io_arrayDestroy(&inp); |
io_arrayDestroy(&inp); |
printf("set session"); |
printf("set session"); |
getchar(); |
getchar(); |
ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n); | sess_initSession(SHARED_IPC, "/tmp/abra-kadabra-321", &n); |
| ALLOC_MEMORY(1003, 4096, n); |
if (sess_GetErrno()) { |
if (sess_GetErrno()) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
return 3; |
return 3; |
} |
} |
if (!(inp = sess_prepareSession(n, 42))) { |
if (!(inp = sess_prepareSession(n, 42))) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
DESTROY_SESSION("/tmp/abra-kadabra-321", &n); | FREE_MEMORY(n); |
| sess_freeSession(&n); |
return 3; |
return 3; |
} |
} |
for (i = 0; i < io_arraySize(inp); i++) |
for (i = 0; i < io_arraySize(inp); i++) |
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*))); |
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*))); |
sess_doneSession(n, &inp); |
sess_doneSession(n, &inp); |
freeSession(NULL, &n); | sess_freeSession(&n); |
getchar(); |
getchar(); |
ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n); | sess_initSession(SHARED_IPC, "/tmp/abra-kadabra-321", &n); |
| ALLOC_MEMORY(1003, 4096, n); |
if (sess_GetErrno()) { |
if (sess_GetErrno()) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
return 4; |
return 4; |
} |
} |
if (!(inp = sess_prepareSession(n, 0))) { |
if (!(inp = sess_prepareSession(n, 0))) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
DESTROY_SESSION("/tmp/abra-kadabra-321", &n); | FREE_MEMORY(n); |
| sess_freeSession(&n); |
return 4; |
return 4; |
} |
} |
AIT_FREE_VAL(io_array(inp, 2, ait_val_t*)); |
AIT_FREE_VAL(io_array(inp, 2, ait_val_t*)); |
Line 87 int main(int argc, char **argv)
|
Line 96 int main(int argc, char **argv)
|
for (i = 0; i < io_arraySize(inp); i++) |
for (i = 0; i < io_arraySize(inp); i++) |
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*))); |
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*))); |
sess_commitSession(n, inp); |
sess_commitSession(n, inp); |
|
for (i = 0; i < io_arraySize(inp); i++) |
|
AIT_FREE_VAL(io_arrayGet(inp, i)); |
sess_doneSession(n, &inp); |
sess_doneSession(n, &inp); |
freeSession(NULL, &n); | sess_freeSession(&n); |
getchar(); |
getchar(); |
ipc_createSession("/tmp/abra-kadabra-321", 1003, 4096, &n); | sess_initSession(SHARED_IPC, "/tmp/abra-kadabra-321", &n); |
| ALLOC_MEMORY(1003, 4096, n); |
if (sess_GetErrno()) { |
if (sess_GetErrno()) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
return 3; |
return 3; |
} |
} |
if (!(inp = sess_prepareSession(n, 42))) { |
if (!(inp = sess_prepareSession(n, 42))) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
DESTROY_SESSION("/tmp/abra-kadabra-321", &n); | FREE_MEMORY(n); |
| sess_freeSession(&n); |
return 3; |
return 3; |
} |
} |
for (i = 0; i < io_arraySize(inp); i++) |
for (i = 0; i < io_arraySize(inp); i++) |
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*))); |
printf("i=%d->%s\n", i, AIT_GET_STR(io_array(inp, i, ait_val_t*))); |
|
/* |
|
for (i = 0; i < io_arraySize(inp); i++) |
|
AIT_FREE_VAL(io_arrayGet(inp, i)); |
|
*/ |
sess_doneSession(n, &inp); |
sess_doneSession(n, &inp); |
DESTROY_SESSION("/tmp/abra-kadabra-321", &n); | FREE_MEMORY(n); |
| sess_freeSession(&n); |
| |
return 0; |
return 0; |
} |
} |