=================================================================== RCS file: /home/cvs/OpenXM/src/phc/phc6.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -r1.5 -r1.6 --- OpenXM/src/phc/phc6.c 2002/05/02 11:54:33 1.5 +++ OpenXM/src/phc/phc6.c 2019/01/01 07:17:52 1.6 @@ -1,5 +1,5 @@ /* phc6.c , yama:1999/sm1-prog/phc6.c */ -/* $OpenXM: OpenXM/src/phc/phc6.c,v 1.4 2002/05/02 02:51:37 takayama Exp $ */ +/* $OpenXM: OpenXM/src/phc/phc6.c,v 1.5 2002/05/02 11:54:33 takayama Exp $ */ /* This is a simple C interface to the black-box solver of phc. ** Requirements: ** 1) executable version of phc will be searched in the following order: @@ -14,6 +14,8 @@ #include #include #include +#include +#include "gc.h" /* Definition of class identifiers. */ #define Snull 0 @@ -37,7 +39,8 @@ struct phc_object{ /* Memory allocation function. Use your favorite memory allocation function. I recommend not to use malloc and to use gc4.14 for large applications. */ -#define sGC_malloc(n) malloc(n) +//#define sGC_malloc(n) malloc(n) +#define sGC_malloc(n) GC_malloc(n) /********** macros to use Sarray **************/ /* put to Object Array */ @@ -61,15 +64,17 @@ struct phc_object phc_complexTo(double r, double i); int phc_scan_for_string(FILE *fp, char str[]); struct phc_object phc_scan_solutions(FILE *fp, int npaths, int dim ); -struct phc_object phc_scan_output_of_phc(char *fname); +struct phc_object phc_scan_output_of_phc(FILE *fp); struct phc_object phc_call_phc(char *sys); int phc_verbose = 0; int phc_overwrite = 1; /* Always use tmp.input.0 and tmp.output.0 for work files. */ -main(int argc, char *argv[]) { +int main(int argc, char *argv[]) { struct phc_object ob; + struct phc_object ob2; + int n2; int n,i,dim; #define INPUTSIZE 4096 char input[INPUTSIZE]; @@ -77,6 +82,7 @@ main(int argc, char *argv[]) { #define A_SIZE 1024 char a[A_SIZE]; int message = 0; + FILE *fp; for (i=1; i 0)) printf(" ,\n"); else printf(" \n"); } + for (i=0; i npaths) { @@ -272,25 +295,26 @@ struct phc_object phc_scan_solutions(FILE *fp, int npa exit(-1); } } + */ fnd = phc_scan_for_string(fp,"the solution for t :"); + res_list[nsols-1] = res; for (i=0;i= npaths) break; } } + if (nsols < npaths) { + fprintf(stderr,"Warning: nsols < npaths. Check tmp.output.*\n"); + } if(phc_verbose) fprintf(stderr," number of solutions = %i\n",nsols); rob = phc_newObjectArray(nsols); for (i=0;i