|
|
| version 1.157, 2014/08/27 16:26:55 | version 1.160, 2014/09/02 09:24:05 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ | /* $Id$ |
| $State$ | $State$ |
| $Log$ | $Log$ |
| 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 | Revision 1.157 2014/08/27 16:26:55 brouard |
| Summary: Preparing windows Visual studio version | Summary: Preparing windows Visual studio version |
| Author: Brouard | Author: Brouard |
| Line 475 | Line 485 |
| #include <stdio.h> | #include <stdio.h> |
| #include <stdlib.h> | #include <stdlib.h> |
| #include <string.h> | #include <string.h> |
| #ifdef _WIN32 | |
| #include <io.h> | |
| #else | |
| #include <unistd.h> | #include <unistd.h> |
| #endif | |
| #include <limits.h> | #include <limits.h> |
| #include <sys/types.h> | #include <sys/types.h> |
| #include <sys/stat.h> | #include <sys/stat.h> |
| #include <errno.h> | #include <errno.h> |
| extern int errno; | /* extern int errno; */ |
| /* #ifdef LINUX */ | /* #ifdef LINUX */ |
| /* #include <time.h> */ | /* #include <time.h> */ |
| Line 774 char *cutl(char *blocc, char *alocc, cha | Line 789 char *cutl(char *blocc, char *alocc, cha |
| gives blocc="abcdef2ghi" and alocc="j". | gives blocc="abcdef2ghi" and alocc="j". |
| If occ is not found blocc is null and alocc is equal to in. Returns blocc | 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; | t=in;s=in; |
| while ((*in != occ) && (*in != '\0')){ | while ((*in != occ) && (*in != '\0')){ |
| *alocc++ = *in++; | *alocc++ = *in++; |
| Line 858 int nbocc(char *s, char occ) | Line 873 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 ********************/ | /********************** nrerror ********************/ |
| void nrerror(char error_text[]) | void nrerror(char error_text[]) |
| Line 1080 double brent(double ax, double bx, doubl | Line 1113 double brent(double ax, double bx, doubl |
| { | { |
| int iter; | int iter; |
| double a,b,d,etemp; | double a,b,d,etemp; |
| double fu,fv,fw,fx; | double fu=0,fv,fw,fx; |
| double ftemp; | double ftemp; |
| double p,q,r,tol1,tol2,u,v,w,x,xm; | double p,q,r,tol1,tol2,u,v,w,x,xm; |
| double e=0.0; | double e=0.0; |
| Line 6696 Interval (in months) between two waves: | Line 6729 Interval (in months) between two waves: |
| sprintf(plotcmd,"\"%sgnuplot.exe\"",pathimach); | sprintf(plotcmd,"\"%sgnuplot.exe\"",pathimach); |
| #endif | #endif |
| if(!stat(plotcmd,&info)){ | 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)){ | 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 | }else |
| strcpy(pplotcmd,plotcmd); | strcpy(pplotcmd,plotcmd); |
| #ifdef __unix | #ifdef __unix |
| strcpy(plotcmd,GNUPLOTPROGRAM); | strcpy(plotcmd,GNUPLOTPROGRAM); |
| if(!stat(plotcmd,&info)){ | 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 | }else |
| strcpy(pplotcmd,plotcmd); | strcpy(pplotcmd,plotcmd); |
| #endif | #endif |
| Line 6712 Interval (in months) between two waves: | Line 6745 Interval (in months) between two waves: |
| strcpy(pplotcmd,plotcmd); | strcpy(pplotcmd,plotcmd); |
| sprintf(plotcmd,"%s %s",pplotcmd, optionfilegnuplot); | 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){ | 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"); | printf("\n Trying if gnuplot resides on the same directory that IMaCh\n"); |
| sprintf(plotcmd,"%sgnuplot %s", pathimach, optionfilegnuplot); | sprintf(plotcmd,"%sgnuplot %s", pathimach, optionfilegnuplot); |
| if((outcmd=system(plotcmd)) != 0) | if((outcmd=system(plotcmd)) != 0) |
| printf("\n Still a problem with gnuplot command %s, err=%d\n", plotcmd, outcmd); | 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') { | while (z[0] != 'q') { |
| /* chdir(path); */ | /* chdir(path); */ |
| printf("\nType e to edit results with your browser, g to graph again and q for exit: "); | printf("\nType e to edit results with your browser, g to graph again and q for exit: "); |
| scanf("%s",z); | scanf("%s",z); |
| /* if (z[0] == 'c') system("./imach"); */ | /* if (z[0] == 'c') system("./imach"); */ |
| if (z[0] == 'e') { | if (z[0] == 'e') { |
| #ifdef _APPLE_ | #ifdef __APPLE__ |
| sprintf(pplotcmd, "open %s", optionfilehtm); | sprintf(pplotcmd, "open %s", optionfilehtm); |
| #elif __linux | #elif __linux |
| sprintf(pplotcmd, "xdg-open %s", optionfilehtm); | sprintf(pplotcmd, "xdg-open %s", optionfilehtm); |
| Line 6747 Interval (in months) between two waves: | Line 6780 Interval (in months) between two waves: |
| scanf("%s",z); | scanf("%s",z); |
| } | } |
| } | } |