=================================================================== RCS file: /home/cvs/OpenXM/src/hgm/mh/src/wmain.c,v retrieving revision 1.4 retrieving revision 1.18 diff -u -p -r1.4 -r1.18 --- OpenXM/src/hgm/mh/src/wmain.c 2013/02/20 05:20:49 1.4 +++ OpenXM/src/hgm/mh/src/wmain.c 2014/03/14 02:21:40 1.18 @@ -1,12 +1,13 @@ /* -$OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.3 2013/02/20 01:06:38 takayama Exp $ -License: LGPL - */ + $OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.17 2014/03/12 07:50:37 takayama Exp $ + License: LGPL +*/ #include #include #include #include #include "sfile.h" +#include "mh.h" #define SMAX 4096 #define inci(i) { i++; if (i >= argc) { fprintf(stderr,"Option argument is not given.\n"); return(NULL); }} int MH_deallocate=0; @@ -32,12 +33,14 @@ int MH_RawName = 0; static int Testrank=0; extern int MH_Verbose; + extern int MH_P95; /* 95 % points */ int mh_gopen_file(void); static int setParamTest(void); static int setParamDefault(void); static int setParam(char *fname); static int showParam(void); +static int next(struct SFILE *fp,char *s, char *msg); /* #define DEBUG */ #ifdef DEBUG @@ -55,33 +58,37 @@ void mh_freeWorkArea(void) { mh_rf(0.0, NULL, 0, NULL, 0); MH_deallocate=0; /* switch to the normal mode. */ } -void *mh_malloc(int s) { - void *p; - p = (void*)malloc(s); - if (p == NULL) { - fprintf(stderr,"No memory.\n"); mh_exit(-1); - } - return(p); -} -mh_free(void *p) { - free(p); - return(0); -} -static mypower(int x,int n) { +static int mypower(int x,int n) { int a,i; a = 1; for (i=0; imessage = NULL; *rp=mh_rkmain(x0,y0,xn); return(rp); } -mh_usage() { +int mh_usage() { fprintf(stderr,"Usages:\n"); - fprintf(stderr,"w-m [--idata input_data_file --gnuplotf gnuplot_file_name\n"); + fprintf(stderr,"hgm_w-n [--idata input_data_file --gnuplotf gnuplot_file_name\n"); fprintf(stderr," --dataf output_data_file --raw --xmax xmax --test m --step h]\n"); fprintf(stderr,"[ --95 --verbose] \n"); + fprintf(stderr,"[ --strategy s --abserr ae --relerr re] \n"); + fprintf(stderr,"s:0 rk, s:1 adaptive, s:2 adaptive&multiply, see rk.c for the default value of ae and re.\n"); fprintf(stderr,"--raw does not add data parameters to the output_data_file.\n"); - fprintf(stderr,"\nThe command w-m [options] evaluates Pr({y | yt.txt\n"); + fprintf(stderr," ./hgm_w-n --idata t.txt --gnuplotf test-g\n"); + fprintf(stderr," gnuplot -persist