--- imach/src/imach.c 2004/05/16 15:05:56 1.98 +++ imach/src/imach.c 2004/07/12 18:29:06 1.100 @@ -1,6 +1,12 @@ -/* $Id: imach.c,v 1.98 2004/05/16 15:05:56 brouard Exp $ +/* $Id: imach.c,v 1.100 2004/07/12 18:29:06 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.100 2004/07/12 18:29:06 brouard + Add version for Mac OS X. Just define UNIX in Makefile + + Revision 1.99 2004/06/05 08:57:40 brouard + *** empty log message *** + Revision 1.98 2004/05/16 15:05:56 brouard New version 0.97 . First attempt to estimate force of mortality directly from the data i.e. without the need of knowing the health @@ -196,7 +202,7 @@ #include #include -#include +/* #include */ #include #include "timeval.h" @@ -224,7 +230,7 @@ #define AGESUP 130 #define AGEBASE 40 #define AGEGOMP 10. /* Minimal age for Gompertz adjustment */ -#ifdef unix +#ifdef UNIX #define DIRSEPARATOR '/' #define ODIRSEPARATOR '\\' #else @@ -232,11 +238,11 @@ #define ODIRSEPARATOR '/' #endif -/* $Id: imach.c,v 1.98 2004/05/16 15:05:56 brouard Exp $ */ +/* $Id: imach.c,v 1.100 2004/07/12 18:29:06 brouard Exp $ */ /* $State: Exp $ */ -char version[]="Imach version 0.70, May 2004, INED-EUROREVES "; -char fullversion[]="$Revision: 1.98 $ $Date: 2004/05/16 15:05:56 $"; +char version[]="Imach version 0.97b, May 2004, INED-EUROREVES "; +char fullversion[]="$Revision: 1.100 $ $Date: 2004/07/12 18:29:06 $"; int erreur, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ int nvar; int cptcovn=0, cptcovage=0, cptcoveff=0,cptcov; @@ -356,6 +362,9 @@ double ftolhess; /* Tolerance for comput /**************** split *************************/ static int split( char *path, char *dirc, char *name, char *ext, char *finame ) { + /* From a file name with full path (either Unix or Windows) we extract the directory (dirc) + the name of the file (name), its extension only (ext) and its first part of the name (finame) + */ char *ss; /* pointer */ int l1, l2; /* length counters */ @@ -387,12 +396,14 @@ static int split( char *path, char *dirc #endif */ ss = strrchr( name, '.' ); /* find last / */ - ss++; - strcpy(ext,ss); /* save extension */ - l1= strlen( name); - l2= strlen(ss)+1; - strncpy( finame, name, l1-l2); - finame[l1-l2]= 0; + if (ss >0){ + ss++; + strcpy(ext,ss); /* save extension */ + l1= strlen( name); + l2= strlen(ss)+1; + strncpy( finame, name, l1-l2); + finame[l1-l2]= 0; + } return( 0 ); /* we're done */ } @@ -1050,57 +1061,57 @@ double **pmij(double **ps, double *cov, int i,j,j1, nc, ii, jj; for(i=1; i<= nlstate; i++){ - for(j=1; ji s1=%.17e, s2=%.17e %lx %lx\n",s1,s2,s1,s2);*/ + for(j=1; ji s1=%.17e, s2=%.17e %lx %lx\n",s1,s2,s1,s2); */ + } + ps[i][j]=s2; } - ps[i][j]=s2; } - } /*ps[3][2]=1;*/ - - for(i=1; i<= nlstate; i++){ - s1=0; - for(j=1; j