version 1.5, 2021/12/31 07:43:48 |
version 1.7, 2022/01/02 02:54:00 |
|
|
/* $OpenXM: OpenXM/src/ox_python/ox_python.c,v 1.4 2019/03/22 00:14:50 takayama Exp $ |
/* $OpenXM: OpenXM/src/ox_python/ox_python.c,v 1.6 2022/01/02 00:23:25 takayama Exp $ |
*/ |
*/ |
|
|
#include <stdio.h> |
#include <stdio.h> |
Line 152 cmo *make_error2(const char *reason,const char *fname, |
|
Line 152 cmo *make_error2(const char *reason,const char *fname, |
|
cmo **argv; |
cmo **argv; |
int n; |
int n; |
char *s; |
char *s; |
|
char s_tmp[256]; |
|
s = s_tmp; |
n = 5; |
n = 5; |
argv = (cmo **) GC_malloc(sizeof(cmo *)*n); |
argv = (cmo **) GC_malloc(sizeof(cmo *)*n); |
ms = (cmo *)new_cmo_string("Error"); argv[0] = ms; |
ms = (cmo *)new_cmo_string("error"); argv[0] = ms; |
if (reason != NULL) {s = (char *)GC_malloc(strlen(reason)+1); strcpy(s,reason); |
if (reason != NULL) {s = (char *)GC_malloc(strlen(reason)+3); |
}else strcpy(s,""); |
strcpy(s,"\"");strcat(s,reason);strcat(s,"\""); |
|
}else strcpy(s,"0"); |
ms = (cmo *) new_cmo_string(s); argv[1] = ms; |
ms = (cmo *) new_cmo_string(s); argv[1] = ms; |
if (fname != NULL) {s = (char *)GC_malloc(strlen(fname)+1); strcpy(s,fname); |
if (fname != NULL) {s = (char *)GC_malloc(strlen(fname)+3); |
}else strcpy(s,""); |
strcpy(s,"\"");strcat(s,fname);strcat(s,"\""); |
|
}else strcpy(s,"0"); |
ms = (cmo *) new_cmo_string(s); argv[2] = ms; |
ms = (cmo *) new_cmo_string(s); argv[2] = ms; |
err = (cmo *)new_cmo_int32(line); argv[3] = err; |
err = (cmo *)new_cmo_int32(line); argv[3] = err; |
err = (cmo *)new_cmo_int32(code); argv[4] = err; |
err = (cmo *)new_cmo_int32(code); argv[4] = err; |
Line 390 int sm_executeStringByLocalParser() |
|
Line 394 int sm_executeStringByLocalParser() |
|
push(make_error2("sm_executeStringByLocalParser, not CMO_STRING",NULL,0,-1)); |
push(make_error2("sm_executeStringByLocalParser, not CMO_STRING",NULL,0,-1)); |
return -1; |
return -1; |
} |
} |
|
/*** {FILE *fp; fp=fopen("tmp-debug.txt","a"); fprintf(fp,"strlen=%d\n%s\n",strlen(cmd->s),cmd->s);fclose(fp); } ***/ |
status=PyRun_SimpleString(cmd->s); |
status=PyRun_SimpleString(cmd->s); |
// push(make_error2("sm_executeStringByLocalParser",NULL,0,-1)); |
// push(make_error2("sm_executeStringByLocalParser",NULL,0,-1)); |
push((cmo *)new_cmo_int32(status)); |
push((cmo *)new_cmo_int32(status)); |
Line 477 void push_error_from_file() { |
|
Line 482 void push_error_from_file() { |
|
FILE *fp; |
FILE *fp; |
#define BUF_SIZE 1024 |
#define BUF_SIZE 1024 |
char logname[BUF_SIZE]; |
char logname[BUF_SIZE]; |
char cmd[BUF_SIZE]; |
char cmd[BUF_SIZE+256]; |
char file[BUF_SIZE]; |
char file[BUF_SIZE]; |
char reason[BUF_SIZE]; |
char reason[BUF_SIZE]; |
int gsl_errno, line; |
int gsl_errno, line; |