version 1.8, 2008/09/19 10:55:40 |
version 1.9, 2013/10/18 01:28:52 |
|
|
/* $OpenXM: OpenXM/src/ox_ntl/oxserv.c,v 1.7 2004/07/11 00:32:17 iwane Exp $ */ |
/* $OpenXM: OpenXM/src/ox_ntl/oxserv.c,v 1.8 2008/09/19 10:55:40 iwane Exp $ */ |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
|
|
#include "oxserv.h" |
#include "oxserv.h" |
#include "oxstack.h" |
#include "oxstack.h" |
|
|
#include "gmp.h" |
|
#include "gc/gc.h" |
#include "gc/gc.h" |
|
|
#define DPRINTF(x) printf x; (void)fflush(stdout) |
#define DPRINTF(x) printf x; (void)fflush(stdout) |
|
|
if (C != NULL) { \ |
if (C != NULL) { \ |
if ((C)->c) { FREE((C)->c); } \ |
if ((C)->c) { FREE((C)->c); } \ |
oxserv_delete_cmo_usr(((C)->p)); \ |
oxserv_delete_cmo_usr(((C)->p)); \ |
free(C); \ |
oxserv_free(C, 0); \ |
C = NULL; \ |
C = NULL; \ |
} \ |
} \ |
} while (0) |
} while (0) |
Line 482 oxserv_sm_executeFunction(void) |
|
Line 481 oxserv_sm_executeFunction(void) |
|
int total; |
int total; |
oxstack_node **arg; |
oxstack_node **arg; |
|
|
|
|
if (G_userExecuteFunction == NULL) { |
if (G_userExecuteFunction == NULL) { |
oxserv_push_errormes("G_userExecuteFunction not defined"); |
oxserv_push_errormes("G_userExecuteFunction not defined"); |
return ; |
return ; |
} |
} |
|
|
|
|
p1 = oxstack_pop(); |
p1 = oxstack_pop(); |
p2 = oxstack_pop(); |
p2 = oxstack_pop(); |
|
|
Line 518 printf("command name=%s\n", name->s); |
|
Line 515 printf("command name=%s\n", name->s); |
|
|
|
total = cnt->i; |
total = cnt->i; |
|
|
printf("command name=%s, i=%d\n", name->s, total); |
arg = (oxstack_node **)oxserv_malloc(total * sizeof(oxstack_node *)); |
arg = (oxstack_node **)malloc(total * sizeof(oxstack_node *)); |
|
for (i = 0; i < total; i++) { |
for (i = 0; i < total; i++) { |
arg[i] = oxstack_pop(); |
arg[i] = oxstack_pop(); |
if (arg[i] == NULL) { |
if (arg[i] == NULL) { |
oxserv_push_errormes("stack underflow in executeFunction"); |
oxserv_push_errormes("stack underflow in executeFunction"); |
|
|
for (i--; i >= 0; i--) |
for (i--; i >= 0; i--) { |
oxserv_delete_cmo(arg[i]); |
oxserv_delete_cmo(arg[i]); |
free(arg); |
} |
|
oxserv_free(arg, 0); |
return ; |
return ; |
} |
} |
} |
} |
Line 542 printf("command name=%s, i=%d\n", name->s, total); |
|
Line 539 printf("command name=%s, i=%d\n", name->s, total); |
|
|
|
oxserv_delete_cmo(p1); |
oxserv_delete_cmo(p1); |
oxserv_delete_cmo(p2); |
oxserv_delete_cmo(p2); |
free(arg); |
oxserv_free(arg, 0); |
} |
} |
|
|
/***************************************************************************** |
/***************************************************************************** |
Line 688 oxserv_execute_sm_command(OXFILE *fd, int code) |
|
Line 685 oxserv_execute_sm_command(OXFILE *fd, int code) |
|
oxstack_pop(); |
oxstack_pop(); |
break; |
break; |
case SM_executeFunction: /* 269 */ |
case SM_executeFunction: /* 269 */ |
if (G_userExecuteFunction) |
oxserv_sm_executeFunction(); |
oxserv_sm_executeFunction(); |
|
break; |
break; |
case SM_pushCMOtag: /* 277 */ |
case SM_pushCMOtag: /* 277 */ |
oxserv_sm_pushCMOtag(); |
oxserv_sm_pushCMOtag(); |
|
|
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
int fd = 10; |
int fd = 10; |
int i; |
|
int ret; |
|
|
|
dfp = fopen("/tmp/oxserv,log", "w"); |
dfp = fopen("/tmp/oxserv,log", "w"); |
OXFILE *oxfp = oxf_open(fd); |
OXFILE *oxfp = oxf_open(fd); |
Line 918 main(int argc, char *argv[]) |
|
Line 912 main(int argc, char *argv[]) |
|
ox_stderr_init(dfp); |
ox_stderr_init(dfp); |
|
|
fprintf(dfp, "set start\n"); fflush(dfp); |
fprintf(dfp, "set start\n"); fflush(dfp); |
oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, oxserv_executeFunction, NULL); |
oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, oxserv_executeFunction, NULL); |
|
|
fprintf(df10p, "init start\n"); fflush(dfp); |
fprintf(dfp, "init start\n"); fflush(dfp); |
oxserv_init(oxfp, 0, "$Date$", "oxserv", NULL, NULL); |
oxserv_init(oxfp, 0, "$Date$", "oxserv", NULL, NULL); |
|
|
fprintf(dfp, "recv start\n"); fflush(dfp); |
fprintf(dfp, "recv start\n"); fflush(dfp); |
ret = oxserv_receive(oxfp); |
oxserv_receive(oxfp); |
|
|
oxserv_dest(); |
oxserv_dest(); |
oxf_close(oxfp); |
oxf_close(oxfp); |