--- imach/src/imach.c 2014/08/27 16:26:55 1.157 +++ imach/src/imach.c 2014/09/02 09:24:05 1.160 @@ -1,6 +1,16 @@ -/* $Id: imach.c,v 1.157 2014/08/27 16:26:55 brouard Exp $ +/* $Id: imach.c,v 1.160 2014/09/02 09:24:05 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.160 2014/09/02 09:24:05 brouard + *** empty log message *** + + Revision 1.159 2014/09/01 10:34:10 brouard + Summary: WIN32 + Author: Brouard + + Revision 1.158 2014/08/27 17:11:51 brouard + *** empty log message *** + Revision 1.157 2014/08/27 16:26:55 brouard Summary: Preparing windows Visual studio version Author: Brouard @@ -475,13 +485,18 @@ #include #include #include + +#ifdef _WIN32 +#include +#else #include +#endif #include #include #include #include -extern int errno; +/* extern int errno; */ /* #ifdef LINUX */ /* #include */ @@ -532,11 +547,11 @@ extern int errno; #define ODIRSEPARATOR '\\' #endif -/* $Id: imach.c,v 1.157 2014/08/27 16:26:55 brouard Exp $ */ +/* $Id: imach.c,v 1.160 2014/09/02 09:24:05 brouard Exp $ */ /* $State: Exp $ */ char version[]="Imach version 0.98nX, August 2014,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121)"; -char fullversion[]="$Revision: 1.157 $ $Date: 2014/08/27 16:26:55 $"; +char fullversion[]="$Revision: 1.160 $ $Date: 2014/09/02 09:24:05 $"; char strstart[80]; char optionfilext[10], optionfilefiname[FILENAMELENGTH]; int erreur=0, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ @@ -774,7 +789,7 @@ char *cutl(char *blocc, char *alocc, cha gives blocc="abcdef2ghi" and alocc="j". If occ is not found blocc is null and alocc is equal to in. Returns blocc */ - char *s, *t, *bl; + char *s, *t; t=in;s=in; while ((*in != occ) && (*in != '\0')){ *alocc++ = *in++; @@ -858,6 +873,24 @@ int nbocc(char *s, char occ) /* } */ /* } */ +#ifdef _WIN32 +char * strsep(char **pp, const char *delim) +{ + char *p, *q; + + if ((p = *pp) == NULL) + return 0; + if ((q = strpbrk (p, delim)) != NULL) + { + *pp = q + 1; + *q = '\0'; + } + else + *pp = 0; + return p; +} +#endif + /********************** nrerror ********************/ void nrerror(char error_text[]) @@ -1080,7 +1113,7 @@ double brent(double ax, double bx, doubl { int iter; double a,b,d,etemp; - double fu,fv,fw,fx; + double fu=0,fv,fw,fx; double ftemp; double p,q,r,tol1,tol2,u,v,w,x,xm; double e=0.0; @@ -6696,15 +6729,15 @@ Interval (in months) between two waves: sprintf(plotcmd,"\"%sgnuplot.exe\"",pathimach); #endif if(!stat(plotcmd,&info)){ - printf("Error or gnuplot program not found: %s\n",plotcmd);fflush(stdout); + printf("Error or gnuplot program not found: '%s'\n",plotcmd);fflush(stdout); if(!stat(getenv("GNUPLOTBIN"),&info)){ - printf("Error or gnuplot program not found: %s Environment GNUPLOTBIN not set.\n",plotcmd);fflush(stdout); + printf("Error or gnuplot program not found: '%s' Environment GNUPLOTBIN not set.\n",plotcmd);fflush(stdout); }else strcpy(pplotcmd,plotcmd); #ifdef __unix strcpy(plotcmd,GNUPLOTPROGRAM); if(!stat(plotcmd,&info)){ - printf("Error gnuplot program not found: %s\n",plotcmd);fflush(stdout); + printf("Error gnuplot program not found: '%s'\n",plotcmd);fflush(stdout); }else strcpy(pplotcmd,plotcmd); #endif @@ -6712,23 +6745,23 @@ Interval (in months) between two waves: strcpy(pplotcmd,plotcmd); sprintf(plotcmd,"%s %s",pplotcmd, optionfilegnuplot); - printf("Starting graphs with: %s\n",plotcmd);fflush(stdout); + printf("Starting graphs with: '%s'\n",plotcmd);fflush(stdout); if((outcmd=system(plotcmd)) != 0){ - printf("gnuplot command might not be in your path: %s, err=%d\n", plotcmd, outcmd); + printf("gnuplot command might not be in your path: '%s', err=%d\n", plotcmd, outcmd); printf("\n Trying if gnuplot resides on the same directory that IMaCh\n"); sprintf(plotcmd,"%sgnuplot %s", pathimach, optionfilegnuplot); if((outcmd=system(plotcmd)) != 0) printf("\n Still a problem with gnuplot command %s, err=%d\n", plotcmd, outcmd); } - printf(" Successul, please wait..."); + printf(" Successful, please wait..."); while (z[0] != 'q') { /* chdir(path); */ printf("\nType e to edit results with your browser, g to graph again and q for exit: "); scanf("%s",z); /* if (z[0] == 'c') system("./imach"); */ if (z[0] == 'e') { -#ifdef _APPLE_ +#ifdef __APPLE__ sprintf(pplotcmd, "open %s", optionfilehtm); #elif __linux sprintf(pplotcmd, "xdg-open %s", optionfilehtm); @@ -6747,6 +6780,3 @@ Interval (in months) between two waves: scanf("%s",z); } } - - -