Index: ./splus/script/spiralprintpar.S *** /TOIL-U4/fiasco/Fiasco5.1/splus/script/spiralprintpar.S Tue Feb 5 17:08:45 2002 --- ./splus/script/spiralprintpar.S Fri Mar 1 14:40:40 2002 *************** *** 13,43 **** # * Original programming by Bill Eddy * # ************************************************************/ # ! # $Id: spiralprintpar.S,v 1.6 2002/01/08 23:49:22 welling Exp $ # postscript("test.ps",horizontal=T); shift _ c("Spikes","Mean Adjustment","Outliers"); par(mfrow=c(inc,3)); ! if (!access("par/meancprm")) { ! mc _ matrix(scan("meancprm")); } ! else { ! mc _ matrix(0,nrow=images*nslice,ncol=1); } ! if (!access("par/spikeprm")) { spk _ matrix(scan("spikeprm"),ncol=3,byrow=T)[,3]; ! } ! else { ! spk _ matrix(0,nrow=images*nslice,ncol=1); } ! if (!access("par/outlierprm")) { ol _ matrix(scan("outlierprm")); ! } ! else { ! ol _ matrix(0,nrow=images*nslice,ncol=1); } lclimgcnt _ length(mc)/nslice --- 13,45 ---- # * Original programming by Bill Eddy * # ************************************************************/ # ! # $Id: spiralprintpar.S,v 1.7 2002/03/01 19:38:10 welling Exp $ # postscript("test.ps",horizontal=T); shift _ c("Spikes","Mean Adjustment","Outliers"); par(mfrow=c(inc,3)); ! if (exists("file.access")) { ! # This is R, not S ! access <- file.access; } ! ! if (!access("meancprm")) { ! mc _ matrix(scan("meancprm")); ! } else { ! mc _ matrix(0,nrow=nimage*nslice,ncol=1); } ! if (!access("spikeprm")) { spk _ matrix(scan("spikeprm"),ncol=3,byrow=T)[,3]; ! } else { ! spk _ matrix(0,nrow=nimage*nslice,ncol=1); } ! if (!access("outlierprm")) { ol _ matrix(scan("outlierprm")); ! } else { ! ol _ matrix(0,nrow=nimage*nslice,ncol=1); } lclimgcnt _ length(mc)/nslice Index: ./src/csh/calc_stats_brain.csh *** /TOIL-U4/fiasco/Fiasco5.1/src/csh/calc_stats_brain.csh Wed Feb 13 19:01:16 2002 --- ./src/csh/calc_stats_brain.csh Fri Mar 1 15:19:47 2002 *************** *** 28,34 **** # ************************************************************/ # echo '#'`date` $0 ! echo '# $Id: calc_stats_brain.csh,v 1.1 2001/12/06 00:07:52 welling Exp $' # # This script wants two inputs: the dataset to be analyzed (in image --- 28,34 ---- # ************************************************************/ # echo '#'`date` $0 ! echo '# $Id: calc_stats_brain.csh,v 1.2 2002/02/28 02:28:28 welling Exp $' # # This script wants two inputs: the dataset to be analyzed (in image *************** *** 57,64 **** echo '# ' $0 'Error: split file is missing!' exit -1 endif ! if (! -d ${F_SPLIT_NEW:h} ) mkdir ${F_SPLIT_NEW:h} ! if (! -d ${F_SPLIT_COND:h} ) mkdir ${F_SPLIT_COND:h} if (! -r $F_SPLIT_NEW || ! -r $F_SPLIT_COND ) then intsplit -input $data -splitin $F_SPLIT_FILE \ -code $F_SPLIT_COND -maxcpf $F_SPLIT_MAXCOND \ --- 57,66 ---- echo '# ' $0 'Error: split file is missing!' exit -1 endif ! set split_new = $F_SPLIT_NEW ! if (! -d ${split_new:h} ) mkdir ${split_new:h} ! set split_cond = $F_SPLIT_COND ! if (! -d ${split_cond:h} ) mkdir ${split_cond:h} if (! -r $F_SPLIT_NEW || ! -r $F_SPLIT_COND ) then intsplit -input $data -splitin $F_SPLIT_FILE \ -code $F_SPLIT_COND -maxcpf $F_SPLIT_MAXCOND \ Index: ./src/csh/calc_stats_classic.csh *** /TOIL-U4/fiasco/Fiasco5.1/src/csh/calc_stats_classic.csh Wed Feb 13 19:01:16 2002 --- ./src/csh/calc_stats_classic.csh Fri Mar 1 15:19:47 2002 *************** *** 28,34 **** # ************************************************************/ # echo '#'`date` $0 ! echo '# $Id: calc_stats_classic.csh,v 1.1 2001/11/21 23:51:09 welling Exp $' # # This script wants two inputs: the dataset to be analyzed (in image --- 28,34 ---- # ************************************************************/ # echo '#'`date` $0 ! echo '# $Id: calc_stats_classic.csh,v 1.2 2002/02/28 02:28:28 welling Exp $' # # This script wants two inputs: the dataset to be analyzed (in image *************** *** 57,64 **** echo '# ' $0 'Error: split file is missing!' exit -1 endif ! if (! -d ${F_SPLIT_NEW:h} ) mkdir ${F_SPLIT_NEW:h} ! if (! -d ${F_SPLIT_COND:h} ) mkdir ${F_SPLIT_COND:h} if (! -r $F_SPLIT_NEW || ! -r $F_SPLIT_COND ) then intsplit -input $data -splitin $F_SPLIT_FILE \ -code $F_SPLIT_COND -maxcpf $F_SPLIT_MAXCOND \ --- 57,66 ---- echo '# ' $0 'Error: split file is missing!' exit -1 endif ! set split_new = $F_SPLIT_NEW ! if (! -d ${split_new:h} ) mkdir ${split_new:h} ! set split_cond = $F_SPLIT_COND ! if (! -d ${split_cond:h} ) mkdir ${split_cond:h} if (! -r $F_SPLIT_NEW || ! -r $F_SPLIT_COND ) then intsplit -input $data -splitin $F_SPLIT_FILE \ -code $F_SPLIT_COND -maxcpf $F_SPLIT_MAXCOND \ Index: ./src/csh/FIASCO *** /TOIL-U4/fiasco/Fiasco5.1/src/csh/FIASCO Wed Feb 13 19:01:16 2002 --- ./src/csh/FIASCO Fri Mar 1 16:17:27 2002 *************** *** 45,58 **** echo '#BEGINNING NEW ANALYSIS' >>& $LOGFILE setenv F_STARTDATE "`date`" echo '#'$F_STARTDATE $0 >>& $LOGFILE ! echo '$Id: FIASCO,v 1.21 2002/02/01 00:53:51 welling Exp $'\ >>& $LOGFILE echo '#'`whoami`' '`hostname` >>& $LOGFILE echo '#'$1' Processing' >>& $LOGFILE # FIASCO_VERSION number setenv FIASCO_VERSION 5.1 ! setenv FIASCO_PATCHLVL 0 echo "#FIASCO Version "$FIASCO_VERSION" patch "$FIASCO_PATCHLVL\ >>& $LOGFILE if ($1 == 'spiral') then --- 45,58 ---- echo '#BEGINNING NEW ANALYSIS' >>& $LOGFILE setenv F_STARTDATE "`date`" echo '#'$F_STARTDATE $0 >>& $LOGFILE ! echo '$Id: FIASCO,v 1.22 2002/03/01 21:14:43 welling Exp $'\ >>& $LOGFILE echo '#'`whoami`' '`hostname` >>& $LOGFILE echo '#'$1' Processing' >>& $LOGFILE # FIASCO_VERSION number setenv FIASCO_VERSION 5.1 ! setenv FIASCO_PATCHLVL 1 echo "#FIASCO Version "$FIASCO_VERSION" patch "$FIASCO_PATCHLVL\ >>& $LOGFILE if ($1 == 'spiral') then Index: ./src/csh/mail_summary.csh *** /TOIL-U4/fiasco/Fiasco5.1/src/csh/mail_summary.csh Wed Feb 13 19:01:17 2002 --- ./src/csh/mail_summary.csh Fri Mar 1 15:19:50 2002 *************** *** 28,41 **** # ************************************************************/ # echo '#'`date` $0 ! echo '#$Id: mail_summary.csh,v 1.4 2001/11/22 00:02:52 welling Exp $' # Allow the user to avoid sending a summary if ( ${?F_NO_MAIL_SUMMARY} ) exit 0 set addr = "fiascosummaries@stat.cmu.edu" ! if (! -d ${F_SPLIT_NEW:h} ) mkdir ${F_SPLIT_NEW:h} ! if (! -d ${F_SPLIT_COND:h} ) mkdir ${F_SPLIT_COND:h} if (! -r $F_SPLIT_NEW || ! -r $F_SPLIT_COND ) then intsplit -input $1.mri -splitin $F_SPLIT_FILE \ -code $F_SPLIT_COND -maxcpf $F_SPLIT_MAXCOND \ --- 28,43 ---- # ************************************************************/ # echo '#'`date` $0 ! echo '#$Id: mail_summary.csh,v 1.5 2002/02/28 02:28:28 welling Exp $' # Allow the user to avoid sending a summary if ( ${?F_NO_MAIL_SUMMARY} ) exit 0 set addr = "fiascosummaries@stat.cmu.edu" ! set split_new = $F_SPLIT_NEW ! if (! -d ${split_new:h} ) mkdir ${split_new:h} ! set split_cond = $F_SPLIT_COND ! if (! -d ${split_cond:h} ) mkdir ${split_cond:h} if (! -r $F_SPLIT_NEW || ! -r $F_SPLIT_COND ) then intsplit -input $1.mri -splitin $F_SPLIT_FILE \ -code $F_SPLIT_COND -maxcpf $F_SPLIT_MAXCOND \ Index: ./src/csh/summary.csh *** /TOIL-U4/fiasco/Fiasco5.1/src/csh/summary.csh Wed Feb 13 19:01:19 2002 --- ./src/csh/summary.csh Fri Mar 1 15:19:53 2002 *************** *** 28,37 **** # ************************************************************/ # echo '#'`date` $0 ! echo '#$Id: summary.csh,v 1.6 2001/11/22 00:02:52 welling Exp $' if (! -d ps) mkdir ps ! if (! -d ${F_SPLIT_NEW:h} ) mkdir ${F_SPLIT_NEW:h} ! if (! -d ${F_SPLIT_COND:h} ) mkdir ${F_SPLIT_COND:h} if (! -r $F_SPLIT_NEW || ! -r $F_SPLIT_COND ) then intsplit -input $1.mri -splitin $F_SPLIT_FILE \ -code $F_SPLIT_COND -maxcpf $F_SPLIT_MAXCOND \ --- 28,39 ---- # ************************************************************/ # echo '#'`date` $0 ! echo '#$Id: summary.csh,v 1.7 2002/02/28 02:28:28 welling Exp $' if (! -d ps) mkdir ps ! set split_new = $F_SPLIT_NEW ! if (! -d ${split_new:h} ) mkdir ${split_new:h} ! set split_cond = $F_SPLIT_COND ! if (! -d ${split_cond:h} ) mkdir ${split_cond:h} if (! -r $F_SPLIT_NEW || ! -r $F_SPLIT_COND ) then intsplit -input $1.mri -splitin $F_SPLIT_FILE \ -code $F_SPLIT_COND -maxcpf $F_SPLIT_MAXCOND \ Index: ./src/libcdf/cdfbet.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdfbet.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/cdfbet.c Fri Mar 1 15:19:33 2002 *************** *** 7,34 **** /* Table of constant values */ ! static float c_b11 = 0.f; ! static float c_b12 = 1.f; ! static float c_b13 = 1e-4f; ! static float c_b20 = 1e-30f; ! static float c_b21 = 1e30f; ! static float c_b22 = .5f; ! static float c_b24 = 5.f; /*< SUBROUTINE cdfbet(which,p,x,a,b,status,bound) >*/ ! /* Subroutine */ void cdf_bet(long int *which, float *p, float *x, float *a, float * ! b, long int *status, float *bound) { ! extern /* Subroutine */ int cdf_invr(long int *, float *, float *, long int *, ! long int *), cdf_zror(long int *, float *, float *, float *, float *, long int *, long int *); static long int qleft; ! static float fx; ! extern double cdf_cumbet(float *, float *, float *); ! extern /* Subroutine */ int cdf_stinvr(float *, float *, float *, float *, float * ! , float *, float *), cdf_stzror(float *, float *, float *, float *); static long int qhi; ! static float xhi, xlo; /* ********************************************************************** */ --- 7,34 ---- /* Table of constant values */ ! static double c_b11 = 0.f; ! static double c_b12 = 1.f; ! static double c_b13 = 1e-4f; ! static double c_b20 = 1e-30f; ! static double c_b21 = 1e30f; ! static double c_b22 = .5f; ! static double c_b24 = 5.f; /*< SUBROUTINE cdfbet(which,p,x,a,b,status,bound) >*/ ! /* Subroutine */ void cdf_bet(long int *which, double *p, double *x, double *a, double * ! b, long int *status, double *bound) { ! extern /* Subroutine */ int cdf_invr(long int *, double *, double *, long int *, ! long int *), cdf_zror(long int *, double *, double *, double *, double *, long int *, long int *); static long int qleft; ! static double fx; ! extern double cdf_cumbet(double *, double *, double *); ! extern /* Subroutine */ int cdf_stinvr(double *, double *, double *, double *, double * ! , double *, double *), cdf_stzror(double *, double *, double *, double *); static long int qhi; ! static double xhi, xlo; /* ********************************************************************** */ Index: ./src/libcdf/cdfbin.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdfbin.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/cdfbin.c Fri Mar 1 15:19:33 2002 *************** *** 7,34 **** /* Table of constant values */ ! static float c_b11 = 0.f; ! static float c_b12 = .5f; ! static float c_b14 = 5.f; ! static float c_b15 = 1e-4f; ! static float c_b22 = 1e-30f; ! static float c_b23 = 1e30f; ! static float c_b35 = 1.f; /*< SUBROUTINE cdfbin(which,p,s,xn,pr,status,bound) >*/ ! /* Subroutine */ void cdf_bin(long int *which, float *p, float *s, float *xn, float ! *pr, long int *status, float *bound) { ! extern /* Subroutine */ int cdf_invr(long int *, float *, float *, long int *, ! long int *), cdf_zror(long int *, float *, float *, float *, float *, long int *, long int *); static long int qleft; ! static float fx; ! extern double cdf_cumbin(float *, float *, float *); ! extern /* Subroutine */ int cdf_stinvr(float *, float *, float *, float *, float * ! , float *, float *), cdf_stzror(float *, float *, float *, float *); static long int qhi; ! static float xhi, xlo; /* ********************************************************************** */ --- 7,34 ---- /* Table of constant values */ ! static double c_b11 = 0.f; ! static double c_b12 = .5f; ! static double c_b14 = 5.f; ! static double c_b15 = 1e-4f; ! static double c_b22 = 1e-30f; ! static double c_b23 = 1e30f; ! static double c_b35 = 1.f; /*< SUBROUTINE cdfbin(which,p,s,xn,pr,status,bound) >*/ ! /* Subroutine */ void cdf_bin(long int *which, double *p, double *s, double *xn, double ! *pr, long int *status, double *bound) { ! extern /* Subroutine */ int cdf_invr(long int *, double *, double *, long int *, ! long int *), cdf_zror(long int *, double *, double *, double *, double *, long int *, long int *); static long int qleft; ! static double fx; ! extern double cdf_cumbin(double *, double *, double *); ! extern /* Subroutine */ int cdf_stinvr(double *, double *, double *, double *, double * ! , double *, double *), cdf_stzror(double *, double *, double *, double *); static long int qhi; ! static double xhi, xlo; /* ********************************************************************** */ Index: ./src/libcdf/cdfchi.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdfchi.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cdfchi.c Fri Mar 1 15:19:30 2002 *************** *** 7,30 **** /* Table of constant values */ ! static float c_b9 = 0.f; ! static float c_b10 = 1e30f; ! static float c_b11 = .5f; ! static float c_b13 = 5.f; ! static float c_b14 = 1e-4f; ! static float c_b21 = 1e-30f; /*< SUBROUTINE cdfchi(which,p,x,df,status,bound) >*/ ! /* Subroutine */ void cdf_chi(long int *which, float *p, float *x, float *df, ! long int *status, float *bound) { ! extern /* Subroutine */ int cdf_invr(long int *, float *, float *, long int *, long int *); static long int qleft; ! static float fx; ! extern double cdf_cumchi(float *, float *); ! extern /* Subroutine */ int cdf_stinvr(float *, float *, float *, float *, float * ! , float *, float *); static long int qhi; /* ********************************************************************** --- 7,30 ---- /* Table of constant values */ ! static double c_b9 = 0.f; ! static double c_b10 = 1e30f; ! static double c_b11 = .5f; ! static double c_b13 = 5.f; ! static double c_b14 = 1e-4f; ! static double c_b21 = 1e-30f; /*< SUBROUTINE cdfchi(which,p,x,df,status,bound) >*/ ! /* Subroutine */ void cdf_chi(long int *which, double *p, double *x, double *df, ! long int *status, double *bound) { ! extern /* Subroutine */ int cdf_invr(long int *, double *, double *, long int *, long int *); static long int qleft; ! static double fx; ! extern double cdf_cumchi(double *, double *); ! extern /* Subroutine */ int cdf_stinvr(double *, double *, double *, double *, double * ! , double *, double *); static long int qhi; /* ********************************************************************** Index: ./src/libcdf/cdff.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdff.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cdff.c Fri Mar 1 15:19:31 2002 *************** *** 7,30 **** /* Table of constant values */ ! static float c_b11 = 0.f; ! static float c_b12 = 1e30f; ! static float c_b13 = .5f; ! static float c_b15 = 5.f; ! static float c_b16 = 1e-4f; ! static float c_b23 = 1e-30f; /*< SUBROUTINE cdff(which,p,f,dfn,dfd,status,bound) >*/ ! /* Subroutine */ void cdf_f(long int *which, float *p, float *f, float *dfn, float * ! dfd, long int *status, float *bound) { ! extern double cdf_cumf(float *, float *, float *); ! extern /* Subroutine */ int cdf_invr(long int *, float *, float *, long int *, long int *); static long int qleft; ! static float fx; ! extern /* Subroutine */ int cdf_stinvr(float *, float *, float *, float *, float * ! , float *, float *); static long int qhi; /* ********************************************************************** --- 7,30 ---- /* Table of constant values */ ! static double c_b11 = 0.f; ! static double c_b12 = 1e30f; ! static double c_b13 = .5f; ! static double c_b15 = 5.f; ! static double c_b16 = 1e-4f; ! static double c_b23 = 1e-30f; /*< SUBROUTINE cdff(which,p,f,dfn,dfd,status,bound) >*/ ! /* Subroutine */ void cdf_f(long int *which, double *p, double *f, double *dfn, double * ! dfd, long int *status, double *bound) { ! extern double cdf_cumf(double *, double *, double *); ! extern /* Subroutine */ int cdf_invr(long int *, double *, double *, long int *, long int *); static long int qleft; ! static double fx; ! extern /* Subroutine */ int cdf_stinvr(double *, double *, double *, double *, double * ! , double *, double *); static long int qhi; /* ********************************************************************** Index: ./src/libcdf/cdfgam.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdfgam.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/cdfgam.c Fri Mar 1 15:19:33 2002 *************** *** 8,38 **** /* Table of constant values */ static double c_b11 = -1.; ! static float c_b12 = 1e-30f; ! static float c_b13 = 1e30f; ! static float c_b14 = .5f; ! static float c_b16 = 5.f; ! static float c_b17 = 1e-4f; /*< SUBROUTINE cdfgam(which,p,x,shape,scale,status,bound) >*/ ! /* Subroutine */ void cdf_gam(long int *which, float *p, float *x, float *shape, ! float *scale, long int *status, float *bound) { /* System generated locals */ double d_1, d_2, d_3; /* Local variables */ static long int ierr; ! extern /* Subroutine */ int cdf_invr(long int *, float *, float *, long int *, long int *); static long int qleft; ! static float fx; ! extern double cdf_cumgam(float *, float *); ! static float xscale; static double xx; extern /* Subroutine */ int cdf_gaminv(double *, double *, double *, double *, double *, long int *), cdf_stinvr( ! float *, float *, float *, float *, float *, float *, float *); static long int qhi; /* ********************************************************************** --- 8,38 ---- /* Table of constant values */ static double c_b11 = -1.; ! static double c_b12 = 1e-30f; ! static double c_b13 = 1e30f; ! static double c_b14 = .5f; ! static double c_b16 = 5.f; ! static double c_b17 = 1e-4f; /*< SUBROUTINE cdfgam(which,p,x,shape,scale,status,bound) >*/ ! /* Subroutine */ void cdf_gam(long int *which, double *p, double *x, double *shape, ! double *scale, long int *status, double *bound) { /* System generated locals */ double d_1, d_2, d_3; /* Local variables */ static long int ierr; ! extern /* Subroutine */ int cdf_invr(long int *, double *, double *, long int *, long int *); static long int qleft; ! static double fx; ! extern double cdf_cumgam(double *, double *); ! static double xscale; static double xx; extern /* Subroutine */ int cdf_gaminv(double *, double *, double *, double *, double *, long int *), cdf_stinvr( ! double *, double *, double *, double *, double *, double *, double *); static long int qhi; /* ********************************************************************** *************** *** 300,306 **** d_3 = 1. - *p; cdf_gaminv(&d_1, &xx, &c_b11, &d_2, &d_3, &ierr); /*< IF (ierr.LT.0.0) THEN >*/ ! if ((float) ierr < 0.f) { /*< status = 10 >*/ *status = 10; /*< RETURN >*/ --- 300,306 ---- d_3 = 1. - *p; cdf_gaminv(&d_1, &xx, &c_b11, &d_2, &d_3, &ierr); /*< IF (ierr.LT.0.0) THEN >*/ ! if ((double) ierr < 0.f) { /*< status = 10 >*/ *status = 10; /*< RETURN >*/ *************** *** 382,388 **** d_3 = 1. - *p; cdf_gaminv(&d_1, &xx, &c_b11, &d_2, &d_3, &ierr); /*< IF (ierr.LT.0.0) THEN >*/ ! if ((float) ierr < 0.f) { /*< status = 10 >*/ *status = 10; /*< RETURN >*/ --- 382,388 ---- d_3 = 1. - *p; cdf_gaminv(&d_1, &xx, &c_b11, &d_2, &d_3, &ierr); /*< IF (ierr.LT.0.0) THEN >*/ ! if ((double) ierr < 0.f) { /*< status = 10 >*/ *status = 10; /*< RETURN >*/ Index: ./src/libcdf/cdflib.h *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdflib.h Wed Feb 13 19:01:08 2002 --- ./src/libcdf/cdflib.h Fri Mar 1 15:19:29 2002 *************** *** 1,20 **** extern int cdf_stop(char* string, long length); extern double cdf_d_sign(double *v1, double *v2); ! extern double cdf_r_sign(float *v1, float *v2); extern double cdf_pow_dd(double* v1, double *v2); ! extern void cdf_nor(long int *which, float *p, float *x, float *mean, float *sd, long int *status, float *bound); ! extern double cdf_cumnor(float *x); ! extern double cdf_invnor(float *p); extern double cdf_devlpl(double *a, long int *n, double *x); extern double cdf_dumnor(double *x); extern double cdf_dlanor(double *x); extern double cdf_dln1px(double *a); ! extern void cdf_chi(long int *which, float *p, float *x, float *df, long int *status, float *bound); ! extern double cdf_cumchi(float *x, float *df); ! extern double cdf_cumgam(float *xx, float *aa); extern int cdf_gratio(double *a, double *x, double *ans, double *qans, long int *ind); extern double cdf_spmpar(long int *i); extern double cdf_gam1(double *a); --- 1,20 ---- extern int cdf_stop(char* string, long length); extern double cdf_d_sign(double *v1, double *v2); ! extern double cdf_r_sign(double *v1, double *v2); extern double cdf_pow_dd(double* v1, double *v2); ! extern void cdf_nor(long int *which, double *p, double *x, double *mean, double *sd, long int *status, double *bound); ! extern double cdf_cumnor(double *x); ! extern double cdf_invnor(double *p); extern double cdf_devlpl(double *a, long int *n, double *x); extern double cdf_dumnor(double *x); extern double cdf_dlanor(double *x); extern double cdf_dln1px(double *a); ! extern void cdf_chi(long int *which, double *p, double *x, double *df, long int *status, double *bound); ! extern double cdf_cumchi(double *x, double *df); ! extern double cdf_cumgam(double *xx, double *aa); extern int cdf_gratio(double *a, double *x, double *ans, double *qans, long int *ind); extern double cdf_spmpar(long int *i); extern double cdf_gam1(double *a); *************** *** 25,37 **** extern double cdf_rexp(double *x); extern double cdf_erfc1(long int *ind, double *x); extern double cdf_erf(double *x); ! extern int cdf_stinvr(float *zsmall, float *zbig, float *zabsst, float *zrelst, float *zstpmu, float *zabsto, float *zrelto); ! extern int cdf_invr(long int *status, float *x, float *fx, long int *qleft, long int *qhi); ! extern int cdf_zror(long int *status, float *x, float *fx, float *xlo, float *xhi, long int *qleft, long int *qhi); ! extern double cdf_cumpoi(float *s, float *xlam); ! extern void cdf_f(long int *which, float *p, float *f, float *dfn, float *dfd, long int *status, float *bound); ! extern double cdf_cumf(float *f, float *dfn, float *dfd); extern int cdf_bratio(double *a, double *b, double *x, double *y, double *w, double *w1, long int *ierr); extern double cdf_fpser(double *a, double *b, double *x, double *eps); extern double cdf_apser(double *a, double *b, double *x, double *eps); --- 25,37 ---- extern double cdf_rexp(double *x); extern double cdf_erfc1(long int *ind, double *x); extern double cdf_erf(double *x); ! extern int cdf_stinvr(double *zsmall, double *zbig, double *zabsst, double *zrelst, double *zstpmu, double *zabsto, double *zrelto); ! extern int cdf_invr(long int *status, double *x, double *fx, long int *qleft, long int *qhi); ! extern int cdf_zror(long int *status, double *x, double *fx, double *xlo, double *xhi, long int *qleft, long int *qhi); ! extern double cdf_cumpoi(double *s, double *xlam); ! extern void cdf_f(long int *which, double *p, double *f, double *dfn, double *dfd, long int *status, double *bound); ! extern double cdf_cumf(double *f, double *dfn, double *dfd); extern int cdf_bratio(double *a, double *b, double *x, double *y, double *w, double *w1, long int *ierr); extern double cdf_fpser(double *a, double *b, double *x, double *eps); extern double cdf_apser(double *a, double *b, double *x, double *eps); *************** *** 43,49 **** extern double cdf_algdiv(double *a, double *b); extern double cdf_alnrel(double *a); extern double cdf_gsumln(double *a, double *b); ! extern int cdf_stzror(float *zxlo, float *zxhi, float *zabstl, float *zreltl); extern double cdf_bcorr(double *a0, double *b0); extern double cdf_bfrac(double *a, double *b, double *x, double *y, double *lambda, double *eps); extern double cdf_brcomp(double *a, double *b, double *x, double *y); --- 43,49 ---- extern double cdf_algdiv(double *a, double *b); extern double cdf_alnrel(double *a); extern double cdf_gsumln(double *a, double *b); ! extern int cdf_stzror(double *zxlo, double *zxhi, double *zabstl, double *zreltl); extern double cdf_bcorr(double *a0, double *b0); extern double cdf_bfrac(double *a, double *b, double *x, double *y, double *lambda, double *eps); extern double cdf_brcomp(double *a, double *b, double *x, double *y); *************** *** 55,115 **** extern int cdf_grat1(double *a, double *x, double *r, double *p, double *q, double *eps); extern double cdf_basym(double *a, double *b, double *lambda, double *eps); ! extern void cdf_t(long int *which, float *p, float *t, float *df, long int *status, float *bound); ! extern double cdf_cumt(float *t, float *df); extern double cdf_dumbet(double *xx, double *xa, double *xb); ! extern double cdf_t1(float *p, float *df); ! extern double cdf_revlpl(float *a, long int *n, float *x); ! extern void cdf_poi(long int *which, float *p, float *s, float *xlam, long int *status, float *bound); ! extern void cdf_bin(long int *which, float *p, float *s, float *xn, float *pr, long int *status, float *bound); ! extern double cdf_cumbin(float *s, float *xn, float *pr); ! extern void cdf_bet(long int *which, float *p, float *x, float *a, float *b, long int *status, float *bound); ! extern double cdf_cumbet(float *xx, float *xa, float *xb); ! extern void cdf_gam(long int *which, float *p, float *x, float *shape, float *scale, long int *status, float *bound); extern int cdf_gaminv(double *a, double *x, double *x0, double *p, double *q, long int *ierr); extern double cdf_rcomp(double *a, double *x); #ifdef never typedef double (*f2c_doublefp)(); ! extern double cdf_alngam(float *x); /*:ref: cdf_revlpl 4 3 4 3 4 */ extern double cdf_betacn(double *a, double *b, double *x, long int *iwhich); /*:ref: cdf_dlnbet 5 2 5 5 */ /*:ref: cdf_dln1mx 5 1 5 */ ! extern double cdf_binden(long int *ns, long int *n, float *p); /*:ref: cdf_xlfact 5 1 3 */ ! extern void cdf_chn(long int *which, float *p, float *x, float *df, float *pnonc, long int *status, float *bound); /*:ref: cdf_cumchn 4 3 4 4 4 */ /*:ref: cdf_stinvr 10 7 4 4 4 4 4 4 4 */ /*:ref: cdf_invr 10 5 3 4 4 8 8 */ ! extern void cdf_fnc(long int *which, float *p, float *f, float *dfn, float *dfd, float *phonc, long int *status, float *bound); /*:ref: cdf_cumfnc 4 4 4 4 4 4 */ /*:ref: cdf_stinvr 10 7 4 4 4 4 4 4 4 */ /*:ref: cdf_invr 10 5 3 4 4 8 8 */ ! extern void cdf_nbn(long int *which, float *p, float *s, float *xn, float *pr, long int *status, float *bound); /*:ref: cdf_cumnbn 4 3 4 4 4 */ /*:ref: cdf_stinvr 10 7 4 4 4 4 4 4 4 */ /*:ref: cdf_invr 10 5 3 4 4 8 8 */ /*:ref: cdf_stzror 10 4 4 4 4 4 */ /*:ref: cdf_zror 10 7 3 4 4 4 4 8 8 */ ! extern double cdf_cumchn(float *x, float *df, float *pnonc); /*:ref: cdf_cumchi 4 2 4 4 */ /*:ref: cdf_alngam 4 1 4 */ ! extern double cdf_cumfnc(float *x, float *dfn, float *dfd, float *pnonc); /*:ref: cdf_cumf 4 3 4 4 4 */ /*:ref: cdf_alngam 4 1 4 */ /*:ref: cdf_bratio 10 7 5 5 5 5 5 5 3 */ extern double cdf_cumhyp(long int *k, long int *n, long int *m, long int *l); /*:ref: cdf_lbico 4 2 3 3 */ ! extern double cdf_cumnbn(float *s, float *xn, float *pr); /*:ref: cdf_dumbet 5 3 5 5 5 */ ! extern double cdf_cxnchn(float *pnonc); ! extern double ctnchn_(float *xcs, float *xdf); /*:ref: cdf_cumchn 4 3 4 4 4 */ extern double cdf_dln1mx(double *x); /*:ref: cdf_dln1px 5 1 5 */ --- 55,115 ---- extern int cdf_grat1(double *a, double *x, double *r, double *p, double *q, double *eps); extern double cdf_basym(double *a, double *b, double *lambda, double *eps); ! extern void cdf_t(long int *which, double *p, double *t, double *df, long int *status, double *bound); ! extern double cdf_cumt(double *t, double *df); extern double cdf_dumbet(double *xx, double *xa, double *xb); ! extern double cdf_t1(double *p, double *df); ! extern double cdf_revlpl(double *a, long int *n, double *x); ! extern void cdf_poi(long int *which, double *p, double *s, double *xlam, long int *status, double *bound); ! extern void cdf_bin(long int *which, double *p, double *s, double *xn, double *pr, long int *status, double *bound); ! extern double cdf_cumbin(double *s, double *xn, double *pr); ! extern void cdf_bet(long int *which, double *p, double *x, double *a, double *b, long int *status, double *bound); ! extern double cdf_cumbet(double *xx, double *xa, double *xb); ! extern void cdf_gam(long int *which, double *p, double *x, double *shape, double *scale, long int *status, double *bound); extern int cdf_gaminv(double *a, double *x, double *x0, double *p, double *q, long int *ierr); extern double cdf_rcomp(double *a, double *x); #ifdef never typedef double (*f2c_doublefp)(); ! extern double cdf_alngam(double *x); /*:ref: cdf_revlpl 4 3 4 3 4 */ extern double cdf_betacn(double *a, double *b, double *x, long int *iwhich); /*:ref: cdf_dlnbet 5 2 5 5 */ /*:ref: cdf_dln1mx 5 1 5 */ ! extern double cdf_binden(long int *ns, long int *n, double *p); /*:ref: cdf_xlfact 5 1 3 */ ! extern void cdf_chn(long int *which, double *p, double *x, double *df, double *pnonc, long int *status, double *bound); /*:ref: cdf_cumchn 4 3 4 4 4 */ /*:ref: cdf_stinvr 10 7 4 4 4 4 4 4 4 */ /*:ref: cdf_invr 10 5 3 4 4 8 8 */ ! extern void cdf_fnc(long int *which, double *p, double *f, double *dfn, double *dfd, double *phonc, long int *status, double *bound); /*:ref: cdf_cumfnc 4 4 4 4 4 4 */ /*:ref: cdf_stinvr 10 7 4 4 4 4 4 4 4 */ /*:ref: cdf_invr 10 5 3 4 4 8 8 */ ! extern void cdf_nbn(long int *which, double *p, double *s, double *xn, double *pr, long int *status, double *bound); /*:ref: cdf_cumnbn 4 3 4 4 4 */ /*:ref: cdf_stinvr 10 7 4 4 4 4 4 4 4 */ /*:ref: cdf_invr 10 5 3 4 4 8 8 */ /*:ref: cdf_stzror 10 4 4 4 4 4 */ /*:ref: cdf_zror 10 7 3 4 4 4 4 8 8 */ ! extern double cdf_cumchn(double *x, double *df, double *pnonc); /*:ref: cdf_cumchi 4 2 4 4 */ /*:ref: cdf_alngam 4 1 4 */ ! extern double cdf_cumfnc(double *x, double *dfn, double *dfd, double *pnonc); /*:ref: cdf_cumf 4 3 4 4 4 */ /*:ref: cdf_alngam 4 1 4 */ /*:ref: cdf_bratio 10 7 5 5 5 5 5 5 3 */ extern double cdf_cumhyp(long int *k, long int *n, long int *m, long int *l); /*:ref: cdf_lbico 4 2 3 3 */ ! extern double cdf_cumnbn(double *s, double *xn, double *pr); /*:ref: cdf_dumbet 5 3 5 5 5 */ ! extern double cdf_cxnchn(double *pnonc); ! extern double ctnchn_(double *xcs, double *xdf); /*:ref: cdf_cumchn 4 3 4 4 4 */ extern double cdf_dln1mx(double *x); /*:ref: cdf_dln1px 5 1 5 */ *************** *** 130,139 **** /*:ref: cdf_devlpl 5 3 5 3 5 */ extern double cdf_lbico(long int *n, long int *s); /*:ref: cdf_xlfact 5 1 3 */ ! extern long int cdf_qrzero(f2c_doublefp f, float *y, float *xlo, float *xhi, float *abstol, float *reltol); ! extern long int cdf_qstinv(f2c_doublefp f, long int *qincr, float *x, float *y, float *small, float *big, float *absstp, float *relstp, float *abstol, float *reltol, long int *qleft, long int *qhi); /*:ref: cdf_qstzro 8 6 204 4 4 4 4 4 */ ! extern long int cdf_qstzro(f2c_doublefp f, float *y, float *xlo, float *xhi, float *abstol, float *reltol); extern double cdf_xlfact(long int *n); /*:ref: cdf_dlngam 5 1 5 */ #endif --- 130,139 ---- /*:ref: cdf_devlpl 5 3 5 3 5 */ extern double cdf_lbico(long int *n, long int *s); /*:ref: cdf_xlfact 5 1 3 */ ! extern long int cdf_qrzero(f2c_doublefp f, double *y, double *xlo, double *xhi, double *abstol, double *reltol); ! extern long int cdf_qstinv(f2c_doublefp f, long int *qincr, double *x, double *y, double *small, double *big, double *absstp, double *relstp, double *abstol, double *reltol, long int *qleft, long int *qhi); /*:ref: cdf_qstzro 8 6 204 4 4 4 4 4 */ ! extern long int cdf_qstzro(f2c_doublefp f, double *y, double *xlo, double *xhi, double *abstol, double *reltol); extern double cdf_xlfact(long int *n); /*:ref: cdf_dlngam 5 1 5 */ #endif Index: ./src/libcdf/cdfnor.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdfnor.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cdfnor.c Fri Mar 1 15:19:29 2002 *************** *** 6,16 **** #include "cdf_f2c.h" /*< SUBROUTINE cdfnor(which,p,x,mean,sd,status,bound) >*/ ! /* Subroutine */ void cdf_nor(long int *which, float *p, float *x, float *mean, ! float *sd, long int *status, float *bound) { ! static float z; ! extern double cdf_cumnor(float *), cdf_invnor(float *); /* ********************************************************************** */ --- 6,16 ---- #include "cdf_f2c.h" /*< SUBROUTINE cdfnor(which,p,x,mean,sd,status,bound) >*/ ! /* Subroutine */ void cdf_nor(long int *which, double *p, double *x, double *mean, ! double *sd, long int *status, double *bound) { ! static double z; ! extern double cdf_cumnor(double *), cdf_invnor(double *); /* ********************************************************************** */ Index: ./src/libcdf/cdfpoi.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdfpoi.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cdfpoi.c Fri Mar 1 15:19:30 2002 *************** *** 7,29 **** /* Table of constant values */ ! static float c_b9 = 0.f; ! static float c_b10 = 1e30f; ! static float c_b11 = .5f; ! static float c_b13 = 5.f; ! static float c_b14 = 1e-4f; /*< SUBROUTINE cdfpoi(which,p,s,xlam,status,bound) >*/ ! /* Subroutine */ void cdf_poi(long int *which, float *p, float *s, float *xlam, ! long int *status, float *bound) { ! extern /* Subroutine */ int cdf_invr(long int *, float *, float *, long int *, long int *); static long int qleft; ! static float fx; ! extern double cdf_cumpoi(float *, float *); ! extern /* Subroutine */ int cdf_stinvr(float *, float *, float *, float *, float * ! , float *, float *); static long int qhi; /* ********************************************************************** --- 7,29 ---- /* Table of constant values */ ! static double c_b9 = 0.f; ! static double c_b10 = 1e30f; ! static double c_b11 = .5f; ! static double c_b13 = 5.f; ! static double c_b14 = 1e-4f; /*< SUBROUTINE cdfpoi(which,p,s,xlam,status,bound) >*/ ! /* Subroutine */ void cdf_poi(long int *which, double *p, double *s, double *xlam, ! long int *status, double *bound) { ! extern /* Subroutine */ int cdf_invr(long int *, double *, double *, long int *, long int *); static long int qleft; ! static double fx; ! extern double cdf_cumpoi(double *, double *); ! extern /* Subroutine */ int cdf_stinvr(double *, double *, double *, double *, double * ! , double *, double *); static long int qhi; /* ********************************************************************** Index: ./src/libcdf/cdft.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdft.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/cdft.c Fri Mar 1 15:19:33 2002 *************** *** 7,31 **** /* Table of constant values */ ! static float c_b7 = -1e30f; ! static float c_b8 = 1e30f; ! static float c_b9 = .5f; ! static float c_b11 = 5.f; ! static float c_b12 = 1e-4f; ! static float c_b19 = 1e-30f; /*< SUBROUTINE cdft(which,p,t,df,status,bound) >*/ ! /* Subroutine */ void cdf_t(long int *which, float *p, float *t, float *df, ! long int *status, float *bound) { ! extern double cdf_cumt(float *, float *); ! extern /* Subroutine */ int cdf_invr(long int *, float *, float *, long int *, long int *); static long int qleft; ! extern double cdf_t1(float *, float *); ! static float fx; ! extern /* Subroutine */ int cdf_stinvr(float *, float *, float *, float *, float * ! , float *, float *); static long int qhi; /* ********************************************************************** --- 7,31 ---- /* Table of constant values */ ! static double c_b7 = -1e30f; ! static double c_b8 = 1e30f; ! static double c_b9 = .5f; ! static double c_b11 = 5.f; ! static double c_b12 = 1e-4f; ! static double c_b19 = 1e-30f; /*< SUBROUTINE cdft(which,p,t,df,status,bound) >*/ ! /* Subroutine */ void cdf_t(long int *which, double *p, double *t, double *df, ! long int *status, double *bound) { ! extern double cdf_cumt(double *, double *); ! extern /* Subroutine */ int cdf_invr(long int *, double *, double *, long int *, long int *); static long int qleft; ! extern double cdf_t1(double *, double *); ! static double fx; ! extern /* Subroutine */ int cdf_stinvr(double *, double *, double *, double *, double * ! , double *, double *); static long int qhi; /* ********************************************************************** Index: ./src/libcdf/cdftester.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cdftester.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/cdftester.c Fri Mar 1 15:19:33 2002 *************** *** 3,17 **** #include main(int argc, char* argv[]) { ! float df; ! float p, pout; ! float x, xout; int retval; long one= 1; long two= 2; ! float t1=0.0, t2=0.0, t3=0.0; long status; ! float bound; if (argc<2) { printf("usage: %s x p df [t1 [t2 [t3]]]\n",argv[0]); --- 3,17 ---- #include main(int argc, char* argv[]) { ! double df; ! double p, pout; ! double x, xout; int retval; long one= 1; long two= 2; ! double t1=0.0, t2=0.0, t3=0.0; long status; ! double bound; if (argc<2) { printf("usage: %s x p df [t1 [t2 [t3]]]\n",argv[0]); Index: ./src/libcdf/cumbet.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cumbet.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/cumbet.c Fri Mar 1 15:19:33 2002 *************** *** 6,15 **** #include "cdf_f2c.h" /*< REAL FUNCTION cumbet(xx,xa,xb) >*/ ! double cdf_cumbet(float *xx, float *xa, float *xb) { /* System generated locals */ ! float ret_val; double d_1, d_2, d_3; /* Local variables */ --- 6,15 ---- #include "cdf_f2c.h" /*< REAL FUNCTION cumbet(xx,xa,xb) >*/ ! double cdf_cumbet(double *xx, double *xa, double *xb) { /* System generated locals */ ! double ret_val; double d_1, d_2, d_3; /* Local variables */ Index: ./src/libcdf/cumbin.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cumbin.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/cumbin.c Fri Mar 1 15:19:33 2002 *************** *** 6,15 **** #include "cdf_f2c.h" /*< REAL FUNCTION cumbin(s,xn,pr) >*/ ! double cdf_cumbin(float *s, float *xn, float *pr) { /* System generated locals */ ! float ret_val; double d_1, d_2, d_3; /* Local variables */ --- 6,15 ---- #include "cdf_f2c.h" /*< REAL FUNCTION cumbin(s,xn,pr) >*/ ! double cdf_cumbin(double *s, double *xn, double *pr) { /* System generated locals */ ! double ret_val; double d_1, d_2, d_3; /* Local variables */ Index: ./src/libcdf/cumchi.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cumchi.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cumchi.c Fri Mar 1 15:19:30 2002 *************** *** 6,20 **** #include "cdf_f2c.h" /*< REAL FUNCTION cumchi(x,df) >*/ ! double cdf_cumchi(float *x, float *df) { /* System generated locals */ ! float ret_val; /* Local variables */ ! static float a; ! extern double cdf_cumgam(float *, float *); ! static float xx; /* ********************************************************************** */ --- 6,20 ---- #include "cdf_f2c.h" /*< REAL FUNCTION cumchi(x,df) >*/ ! double cdf_cumchi(double *x, double *df) { /* System generated locals */ ! double ret_val; /* Local variables */ ! static double a; ! extern double cdf_cumgam(double *, double *); ! static double xx; /* ********************************************************************** */ Index: ./src/libcdf/cumf.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cumf.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cumf.c Fri Mar 1 15:19:31 2002 *************** *** 6,15 **** #include "cdf_f2c.h" /*< REAL FUNCTION cumf(f,dfn,dfd) >*/ ! double cdf_cumf(float *f, float *dfn, float *dfd) { /* System generated locals */ ! float ret_val; double d_1, d_2; /* Local variables */ --- 6,15 ---- #include "cdf_f2c.h" /*< REAL FUNCTION cumf(f,dfn,dfd) >*/ ! double cdf_cumf(double *f, double *dfn, double *dfd) { /* System generated locals */ ! double ret_val; double d_1, d_2; /* Local variables */ Index: ./src/libcdf/cumgam.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cumgam.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cumgam.c Fri Mar 1 15:19:30 2002 *************** *** 10,19 **** static long int c__1 = 1; /*< REAL FUNCTION cumgam(xx,aa) >*/ ! double cdf_cumgam(float *xx, float *aa) { /* System generated locals */ ! float ret_val; double d_1, d_2; /* Local variables */ --- 10,19 ---- static long int c__1 = 1; /*< REAL FUNCTION cumgam(xx,aa) >*/ ! double cdf_cumgam(double *xx, double *aa) { /* System generated locals */ ! double ret_val; double d_1, d_2; /* Local variables */ Index: ./src/libcdf/cumnor.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cumnor.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cumnor.c Fri Mar 1 15:19:29 2002 *************** *** 6,15 **** #include "cdf_f2c.h" /*< REAL FUNCTION cumnor(x) >*/ ! double cdf_cumnor(float *x) { /* System generated locals */ ! float ret_val; double d_1; /* Local variables */ --- 6,15 ---- #include "cdf_f2c.h" /*< REAL FUNCTION cumnor(x) >*/ ! double cdf_cumnor(double *x) { /* System generated locals */ ! double ret_val; double d_1; /* Local variables */ Index: ./src/libcdf/cumpoi.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cumpoi.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/cumpoi.c Fri Mar 1 15:19:31 2002 *************** *** 6,20 **** #include "cdf_f2c.h" /*< REAL FUNCTION cumpoi(s,xlam) >*/ ! double cdf_cumpoi(float *s, float *xlam) { /* System generated locals */ ! float ret_val; /* Local variables */ ! static float df; ! extern double cdf_cumchi(float *, float *); ! static float chi; /* ********************************************************************** --- 6,20 ---- #include "cdf_f2c.h" /*< REAL FUNCTION cumpoi(s,xlam) >*/ ! double cdf_cumpoi(double *s, double *xlam) { /* System generated locals */ ! double ret_val; /* Local variables */ ! static double df; ! extern double cdf_cumchi(double *, double *); ! static double chi; /* ********************************************************************** Index: ./src/libcdf/cumt.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/cumt.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/cumt.c Fri Mar 1 15:19:33 2002 *************** *** 10,23 **** static double c_b2 = .5; /*< REAL FUNCTION cumt(t,df) >*/ ! double cdf_cumt(float *t, float *df) { /* System generated locals */ ! float ret_val; double d_1; /* Local variables */ ! static float a; static double xx; extern double cdf_dumbet(double *, double *, double *); --- 10,23 ---- static double c_b2 = .5; /*< REAL FUNCTION cumt(t,df) >*/ ! double cdf_cumt(double *t, double *df) { /* System generated locals */ ! double ret_val; double d_1; /* Local variables */ ! static double a; static double xx; extern double cdf_dumbet(double *, double *, double *); Index: ./src/libcdf/f2c_func.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/f2c_func.c Wed Feb 13 19:01:08 2002 --- ./src/libcdf/f2c_func.c Fri Mar 1 15:19:29 2002 *************** *** 14,20 **** return copysign(*v1, *v2); } ! double cdf_r_sign(float *v1, float *v2) { return copysign(*v1, *v2); } --- 14,20 ---- return copysign(*v1, *v2); } ! double cdf_r_sign(double *v1, double *v2) { return copysign(*v1, *v2); } Index: ./src/libcdf/invnor.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/invnor.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/invnor.c Fri Mar 1 15:19:29 2002 *************** *** 10,16 **** static long int c__5 = 5; /*< REAL FUNCTION invnor(p) >*/ ! double cdf_invnor(float *p) { /* Initialized data */ --- 10,16 ---- static long int c__5 = 5; /*< REAL FUNCTION invnor(p) >*/ ! double cdf_invnor(double *p) { /* Initialized data */ *************** *** 20,26 **** .10353775285,.0038560700634 }; /* System generated locals */ ! float ret_val; /* Builtin functions */ double log(double), sqrt(double); --- 20,26 ---- .10353775285,.0038560700634 }; /* System generated locals */ ! double ret_val; /* Builtin functions */ double log(double), sqrt(double); Index: ./src/libcdf/invr.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/invr.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/invr.c Fri Mar 1 15:19:30 2002 *************** *** 6,14 **** #include "cdf_f2c.h" /*< SUBROUTINE invr(status,x,fx,qleft,qhi) >*/ ! /* Subroutine */ int cdf_invr0_(int n__, long int *status, float *x, float *fx, ! long int *qleft, long int *qhi, float *zsmall, float *zbig, float *zabsst, ! float *zrelst, float *zstpmu, float *zabsto, float *zrelto) { /* Format strings */ static char fmt_10[] = ""; --- 6,14 ---- #include "cdf_f2c.h" /*< SUBROUTINE invr(status,x,fx,qleft,qhi) >*/ ! /* Subroutine */ int cdf_invr0_(int n__, long int *status, double *x, double *fx, ! long int *qleft, long int *qhi, double *zsmall, double *zbig, double *zabsst, ! double *zrelst, double *zstpmu, double *zabsto, double *zrelto) { /* Format strings */ static char fmt_10[] = ""; *************** *** 19,43 **** static char fmt_270[] = ""; /* System generated locals */ ! float r_1, r_2; /* Builtin functions */ /* Subroutine */ int cdf_stop(char *, long); /* Local variables */ ! static float fbig; static long int qbdd, qlim; ! static float step; ! extern /* Subroutine */ int cdf_zror(long int *, float *, float *, float *, float *, long int *, long int *); static long int qdum1, qdum2, qcond; ! static float small; static long int qincr; ! static float xsave, fsmall, yy, abstol, absstp, reltol, relstp, stpmul; ! extern /* Subroutine */ int cdf_stzror(float *, float *, float *, float *); ! static float big, xlb, xhi; static long int qok; ! static float xub, xlo; static long int qup; static long int i99999; --- 19,43 ---- static char fmt_270[] = ""; /* System generated locals */ ! double r_1, r_2; /* Builtin functions */ /* Subroutine */ int cdf_stop(char *, long); /* Local variables */ ! static double fbig; static long int qbdd, qlim; ! static double step; ! extern /* Subroutine */ int cdf_zror(long int *, double *, double *, double *, double *, long int *, long int *); static long int qdum1, qdum2, qcond; ! static double small; static long int qincr; ! static double xsave, fsmall, yy, abstol, absstp, reltol, relstp, stpmul; ! extern /* Subroutine */ int cdf_stzror(double *, double *, double *, double *); ! static double big, xlb, xhi; static long int qok; ! static double xub, xlo; static long int qup; static long int i99999; *************** *** 590,606 **** /*< END >*/ } /* cdf_invr */ ! /* Subroutine */ int cdf_invr(long int *status, float *x, float *fx, long int *qleft, long int *qhi) { ! return cdf_invr0_(0, status, x, fx, qleft, qhi, (float *)0, (float *)0, (float * ! )0, (float *)0, (float *)0, (float *)0, (float *)0); } ! /* Subroutine */ int cdf_stinvr(float *zsmall, float *zbig, float *zabsst, float * ! zrelst, float *zstpmu, float *zabsto, float *zrelto) { ! return cdf_invr0_(1, (long int *)0, (float *)0, (float *)0, (long int *)0, ( long int *)0, zsmall, zbig, zabsst, zrelst, zstpmu, zabsto, zrelto) ; } --- 590,606 ---- /*< END >*/ } /* cdf_invr */ ! /* Subroutine */ int cdf_invr(long int *status, double *x, double *fx, long int *qleft, long int *qhi) { ! return cdf_invr0_(0, status, x, fx, qleft, qhi, (double *)0, (double *)0, (double * ! )0, (double *)0, (double *)0, (double *)0, (double *)0); } ! /* Subroutine */ int cdf_stinvr(double *zsmall, double *zbig, double *zabsst, double * ! zrelst, double *zstpmu, double *zabsto, double *zrelto) { ! return cdf_invr0_(1, (long int *)0, (double *)0, (double *)0, (long int *)0, ( long int *)0, zsmall, zbig, zabsst, zrelst, zstpmu, zabsto, zrelto) ; } Index: ./src/libcdf/revlpl.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/revlpl.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/revlpl.c Fri Mar 1 15:19:33 2002 *************** *** 6,18 **** #include "cdf_f2c.h" /*< REAL FUNCTION revlpl(a,n,x) >*/ ! double cdf_revlpl(float *a, long int *n, float *x) { /* System generated locals */ ! float ret_val; /* Local variables */ ! static float term; static long int i; /* Parameter adjustments */ --- 6,18 ---- #include "cdf_f2c.h" /*< REAL FUNCTION revlpl(a,n,x) >*/ ! double cdf_revlpl(double *a, long int *n, double *x) { /* System generated locals */ ! double ret_val; /* Local variables */ ! static double term; static long int i; /* Parameter adjustments */ Index: ./src/libcdf/t1.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/t1.c Wed Feb 13 19:01:10 2002 --- ./src/libcdf/t1.c Fri Mar 1 15:19:33 2002 *************** *** 6,30 **** #include "cdf_f2c.h" /*< REAL FUNCTION t1(p,df) >*/ ! double cdf_t1(float *p, float *df) { /* Initialized data */ ! static float coef[20] /* was [5][4] */ = { 1.f,1.f,0.f,0.f,0.f,3.f, 16.f,5.f,0.f,0.f,-15.f,17.f,19.f,3.f,0.f,-945.f,-1920.f,1482.f, 776.f,79.f }; static long int ideg[4] = { 2,3,4,5 }; ! static float denom[4] = { 4.f,96.f,384.f,92160.f }; /* System generated locals */ ! float ret_val, r_1; /* Local variables */ ! static float term; static long int i; ! static float x, xp, xx, denpow; ! extern double cdf_revlpl(float *, long int *, float *), cdf_invnor(float *); ! static float sum; --- 6,30 ---- #include "cdf_f2c.h" /*< REAL FUNCTION t1(p,df) >*/ ! double cdf_t1(double *p, double *df) { /* Initialized data */ ! static double coef[20] /* was [5][4] */ = { 1.f,1.f,0.f,0.f,0.f,3.f, 16.f,5.f,0.f,0.f,-15.f,17.f,19.f,3.f,0.f,-945.f,-1920.f,1482.f, 776.f,79.f }; static long int ideg[4] = { 2,3,4,5 }; ! static double denom[4] = { 4.f,96.f,384.f,92160.f }; /* System generated locals */ ! double ret_val, r_1; /* Local variables */ ! static double term; static long int i; ! static double x, xp, xx, denpow; ! extern double cdf_revlpl(double *, long int *, double *), cdf_invnor(double *); ! static double sum; Index: ./src/libcdf/zror.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libcdf/zror.c Wed Feb 13 19:01:09 2002 --- ./src/libcdf/zror.c Fri Mar 1 15:19:31 2002 *************** *** 6,14 **** #include "cdf_f2c.h" /*< SUBROUTINE zror(status,x,fx,xlo,xhi,qleft,qhi) >*/ ! /* Subroutine */ int cdf_zror0_(int n__, long int *status, float *x, float *fx, ! float *xlo, float *xhi, long int *qleft, long int *qhi, float *zxlo, float * ! zxhi, float *zabstl, float *zreltl) { /* Format strings */ static char fmt_10[] = ""; --- 6,14 ---- #include "cdf_f2c.h" /*< SUBROUTINE zror(status,x,fx,xlo,xhi,qleft,qhi) >*/ ! /* Subroutine */ int cdf_zror0_(int n__, long int *status, double *x, double *fx, ! double *xlo, double *xhi, long int *qleft, long int *qhi, double *zxlo, double * ! zxhi, double *zabstl, double *zreltl) { /* Format strings */ static char fmt_10[] = ""; *************** *** 16,33 **** static char fmt_200[] = ""; /* System generated locals */ ! float r_1, r_2; /* Builtin functions */ ! double cdf_r_sign(float *, float *); /* Subroutine */ int cdf_stop(char *, long); /* Local variables */ ! static float xxhi, xxlo, a, b, c, d, m, p, q, w; static long int first; ! static float fa, fb, fc, fd, mb, abstol, reltol; static long int qrzero; ! static float fda, fdb, tol; static long int ext, i99999; /* Assigned format variables */ --- 16,33 ---- static char fmt_200[] = ""; /* System generated locals */ ! double r_1, r_2; /* Builtin functions */ ! double cdf_r_sign(double *, double *); /* Subroutine */ int cdf_stop(char *, long); /* Local variables */ ! static double xxhi, xxlo, a, b, c, d, m, p, q, w; static long int first; ! static double fa, fb, fc, fd, mb, abstol, reltol; static long int qrzero; ! static double fda, fdb, tol; static long int ext, i99999; /* Assigned format variables */ *************** *** 413,420 **** /* More Precise Description - */ ! /* Input condition. F is a float function of a single */ ! /* float argument and XLO and XHI are such that */ /* F(XLO)*F(XHI) .LE. 0.0 */ /* If the input condition is met, QRZERO returns .TRUE. */ --- 413,420 ---- /* More Precise Description - */ ! /* Input condition. F is a double function of a single */ ! /* double argument and XLO and XHI are such that */ /* F(XLO)*F(XHI) .LE. 0.0 */ /* If the input condition is met, QRZERO returns .TRUE. */ *************** *** 488,504 **** /*< END >*/ } /* cdf_zror */ ! /* Subroutine */ int cdf_zror(long int *status, float *x, float *fx, float *xlo, ! float *xhi, long int *qleft, long int *qhi) { ! return cdf_zror0_(0, status, x, fx, xlo, xhi, qleft, qhi, (float *)0, (float *) ! 0, (float *)0, (float *)0); } ! /* Subroutine */ int cdf_stzror(float *zxlo, float *zxhi, float *zabstl, float * zreltl) { ! return cdf_zror0_(1, (long int *)0, (float *)0, (float *)0, (float *)0, (float *) 0, (long int *)0, (long int *)0, zxlo, zxhi, zabstl, zreltl); } --- 488,504 ---- /*< END >*/ } /* cdf_zror */ ! /* Subroutine */ int cdf_zror(long int *status, double *x, double *fx, double *xlo, ! double *xhi, long int *qleft, long int *qhi) { ! return cdf_zror0_(0, status, x, fx, xlo, xhi, qleft, qhi, (double *)0, (double *) ! 0, (double *)0, (double *)0); } ! /* Subroutine */ int cdf_stzror(double *zxlo, double *zxhi, double *zabstl, double * zreltl) { ! return cdf_zror0_(1, (long int *)0, (double *)0, (double *)0, (double *)0, (double *) 0, (long int *)0, (long int *)0, zxlo, zxhi, zabstl, zreltl); } Index: ./src/libmri/libmri.c *** /TOIL-U4/fiasco/Fiasco5.1/src/libmri/libmri.c Wed Feb 13 19:01:08 2002 --- ./src/libmri/libmri.c Fri Mar 1 15:19:28 2002 *************** *** 42,47 **** --- 42,52 ---- #include #include #include + #ifdef AFS + #include + #include + #include + #endif #include "mri.h" #include "bio.h" *************** *** 72,78 **** MRI_Chunk *chunk; } CopyRequest; ! static char rcsid[] = "$Id: libmri.c,v 1.28 2002/01/24 23:51:31 welling Exp $"; char *mri_error = NULL; --- 77,83 ---- MRI_Chunk *chunk; } CopyRequest; ! static char rcsid[] = "$Id: libmri.c,v 1.29 2002/03/01 00:45:40 welling Exp $"; char *mri_error = NULL; *************** *** 142,147 **** --- 147,158 ---- static void CopyConvDoubleLonglong(double* float_buf, long long* longlong_buf, int size,int* error); + #ifdef AFS + static int MySystem( const char* command ); + static int CheckForAFS( const char* fname ); + static void FlushAFS( MRI_Dataset *ds ); + #endif + #ifdef DEBUG static void Log(char *fmt, ...); #endif *************** *** 230,236 **** ds->retained_buffers = NULL; #ifdef AFS ! system("fs flushvolume"); #endif if (!OpenFile(ds->header_file, ds->mode == MRI_WRITE || ds->mode == MRI_MODIFY)) --- 241,248 ---- ds->retained_buffers = NULL; #ifdef AFS ! ds->some_parts_in_afs= CheckForAFS(ds->name); ! if (ds->some_parts_in_afs) FlushAFS(ds); #endif if (!OpenFile(ds->header_file, ds->mode == MRI_WRITE || ds->mode == MRI_MODIFY)) *************** *** 258,263 **** --- 270,287 ---- DeallocateDataset(ds); return(NULL); } + + /* If this is a read-only file, we better have found some + * key-value pairs! + */ + if (mode==MRI_READ && ds->n_keys==0) + { + mri_report_error(ds, "mri_open_dataset: %s is unexpectedly empty\n", + ds->header_file->name); + DeallocateDataset(ds); + return(NULL); + } + /* build the associated chunk data structures */ for (i = 0; i < ds->hash_table_size; ++i) *************** *** 490,496 **** CleanFiles(ds); #ifdef AFS ! system("fs flushvolume"); #endif /* throw away stuff in memory */ --- 514,520 ---- CleanFiles(ds); #ifdef AFS ! if (ds->some_parts_in_afs) FlushAFS(ds); #endif /* throw away stuff in memory */ *************** *** 3938,3943 **** --- 3962,3970 ---- f->external = FALSE; f->writeable = FALSE; ds->files = f; + #ifdef AFS + ds->some_parts_in_afs |= CheckForAFS(filename); + #endif return(f); } *************** *** 4126,4128 **** --- 4153,4204 ---- #endif } #endif + + #ifdef AFS + + static int MySystem (const char *command) { + int pid, status; + extern char **environ; + extern int errno; + + if (command == 0) + return 1; + pid = fork(); + if (pid == -1) + return -1; + if (pid == 0) { + char *argv[4]; + argv[0] = "sh"; + argv[1] = "-c"; + argv[2] = (char*)command; + argv[3] = 0; + execve("/bin/sh", argv, environ); + exit(127); + } + do { + if (waitpid(pid, &status, 0) == -1) { + if (errno != EINTR) + return -1; + } else + return status; + } while(1); + } + + + static int CheckForAFS( const char* fname ) + { + char *cmd= "fs whereis"; + char buf[256]; + int retval; + snprintf(buf,sizeof(buf),"%s %s >/dev/null 2>&1",cmd,(char*)fname); + retval= MySystem(buf); + return retval; + } + + static void FlushAFS( MRI_Dataset* ds ) + { + MySystem("fs flushvolume >/dev/null 2>&1"); + } + + #endif + Index: ./src/libmri/mri.h *** /TOIL-U4/fiasco/Fiasco5.1/src/libmri/mri.h Wed Feb 13 19:01:08 2002 --- ./src/libmri/mri.h Fri Mar 1 15:19:28 2002 *************** *** 204,209 **** --- 204,214 ---- int std_image_vector_size; /* extent of the v dimension */ int std_image_size; /* the number of voxels in one image */ int std_n_slices; /* the number of slices for one time */ + + #ifdef AFS + /* Special support for AFS file system */ + int some_parts_in_afs; /* non-zero if header or a chunk is on afs */ + #endif } MRI_Dataset; typedef struct MRI_File { Index: ./src/mri_util/mri_permute.c *** /TOIL-U4/fiasco/Fiasco5.1/src/mri_util/mri_permute.c Wed Feb 13 19:01:22 2002 --- ./src/mri_util/mri_permute.c Fri Mar 1 15:20:09 2002 *************** *** 49,56 **** #include "misc.h" #include "tumble.h" ! static char rcsid[] = "$Id: mri_permute.c,v 1.1 2002/01/24 23:18:00 welling Exp $"; main( argc, argv ) int argc; --- 49,57 ---- #include "misc.h" #include "tumble.h" ! static char rcsid[] = "$Id: mri_permute.c,v 1.2 2002/02/25 20:46:44 welling Exp $"; + #define DEFAULT_MEMLIMIT 52428800 main( argc, argv ) int argc; *************** *** 65,71 **** long *cntr = NULL, *iorder = NULL, *oorder = NULL; long *ioffset = NULL, *ooffset = NULL; long k, j, match, done; ! long typesize, size, maxcp, numcp, extramem, maxstor; long ip, op, fip, fop; char *indata = NULL, *outdata = NULL; --- 66,73 ---- long *cntr = NULL, *iorder = NULL, *oorder = NULL; long *ioffset = NULL, *ooffset = NULL; long k, j, match, done; ! long typesize, maxcp, numcp, extramem, maxstor; ! long long size; long ip, op, fip, fop; char *indata = NULL, *outdata = NULL; *************** *** 90,97 **** cl_get( "dataout|d", "%option %s[%]", ".dat", outfile ); cl_get( "headerout|h", "%option %s[%]", "permute.mri", hdrfile ); cl_get( "input|i", "%option %s[%]", "input.mri", infile ); ! if (!cl_get( "memlimit|m", "%option %ld", &memlimit )) ! Abort("%s: required memlimit flag omitted.\n",argv[0]); cl_get( "chunk|c", "%option %s[%]", "images", chunkname ); cl_get( "order|o", "%option %s[%]", "vtxyz", outorder ); --- 92,98 ---- cl_get( "dataout|d", "%option %s[%]", ".dat", outfile ); cl_get( "headerout|h", "%option %s[%]", "permute.mri", hdrfile ); cl_get( "input|i", "%option %s[%]", "input.mri", infile ); ! cl_get( "memlimit|m", "%option %ld[%]", DEFAULT_MEMLIMIT, &memlimit ); cl_get( "chunk|c", "%option %s[%]", "images", chunkname ); cl_get( "order|o", "%option %s[%]", "vtxyz", outorder ); Index: ./src/mri_util/mri_permute_help.help *** /TOIL-U4/fiasco/Fiasco5.1/src/mri_util/mri_permute_help.help Wed Feb 13 19:01:23 2002 --- ./src/mri_util/mri_permute_help.help Fri Mar 1 15:20:13 2002 *************** *** 3,9 **** mri_permute is used to change the storage order of the dimensions of (a chunk of) a dataset ! mri_permute -memlimit N-bytes [-input Input-header-file] [-headerout Output-header-file] [-dataout Output-data-file] [-chunk Chunk-name] [-order Output-order] --- 3,9 ---- mri_permute is used to change the storage order of the dimensions of (a chunk of) a dataset ! mri_permute [-memlimit N-bytes] [-input Input-header-file] [-headerout Output-header-file] [-dataout Output-data-file] [-chunk Chunk-name] [-order Output-order] *************** *** 18,25 **** -memlimit N-bytes (-m N-bytes) - This flag is required. Specifies that N-bytes are available for RAM storage of data. Note: This does not include the (approximately) 5000 bytes of overhead storage required by the program itself. --- 18,28 ---- -memlimit N-bytes (-m N-bytes) Specifies that N-bytes are available for RAM storage of data. + The default is 52428800 bytes (50MB). Larger values can + significantly speed permutation of large files, but if too large + a value is used the program will swap excessively and things + will slow down. Note: This does not include the (approximately) 5000 bytes of overhead storage required by the program itself. Index: ./src/mri_util/mri_rpn_math.c *** /TOIL-U4/fiasco/Fiasco5.1/src/mri_util/mri_rpn_math.c Wed Feb 13 19:01:21 2002 --- ./src/mri_util/mri_rpn_math.c Fri Mar 1 15:20:05 2002 *************** *** 74,80 **** #define INITIAL_CODE_BLOCK_SIZE 100 #define KEYBUF_SIZE 512 ! static char rcsid[] = "$Id: mri_rpn_math.c,v 1.31 2002/02/12 21:50:59 welling Exp $"; typedef enum { OP_LOAD, OP_PLUS, OP_MINUS, OP_MULT, OP_DIV, OP_SQRT, OP_DUP, OP_SWAP, OP_POP, OP_CONST, OP_LN, OP_EXP, OP_ABS, --- 74,80 ---- #define INITIAL_CODE_BLOCK_SIZE 100 #define KEYBUF_SIZE 512 ! static char rcsid[] = "$Id: mri_rpn_math.c,v 1.32 2002/02/28 17:56:57 welling Exp $"; typedef enum { OP_LOAD, OP_PLUS, OP_MINUS, OP_MULT, OP_DIV, OP_SQRT, OP_DUP, OP_SWAP, OP_POP, OP_CONST, OP_LN, OP_EXP, OP_ABS, *************** *** 92,98 **** Op op; union { long l; ! float f; } param; } Instruction; --- 92,98 ---- Op op; union { long l; ! double f; } param; } Instruction; *************** *** 129,135 **** static char chunkname[512]; static unsigned char** missing= NULL; ! static float stack_block[MAX_STACK][CHUNKSIZE]; static int run_base_voxel= 0; static int verbose_flg= 0; --- 129,135 ---- static char chunkname[512]; static unsigned char** missing= NULL; ! static double stack_block[MAX_STACK][CHUNKSIZE]; static int run_base_voxel= 0; static int verbose_flg= 0; *************** *** 381,392 **** free( f->fname ); } ! static void ds_read(float* dest, MRIFile* f, int n) { int nread= 0; int thisblock; int i; ! float* inbuf; int offset; offset= f->offset; --- 381,392 ---- free( f->fname ); } ! static void ds_read(double* dest, MRIFile* f, int n) { int nread= 0; int thisblock; int i; ! double* inbuf; int offset; offset= f->offset; *************** *** 394,400 **** thisblock= (n-nread > f->length - offset) ? (f->length - offset) : n-nread; if (!(inbuf= mri_get_chunk(f->ds, f->chunk, ! thisblock, offset, MRI_FLOAT))) Abort("%s: bad mri_get_chunk on infile <%s>; length %d, offset %d", f->fname,thisblock,offset); for (i=0; i f->length - offset) ? (f->length - offset) : n-nread; if (!(inbuf= mri_get_chunk(f->ds, f->chunk, ! thisblock, offset, MRI_DOUBLE))) Abort("%s: bad mri_get_chunk on infile <%s>; length %d, offset %d", f->fname,thisblock,offset); for (i=0; iop= OP_CONST; ! if (sscanf(tok,"%g",&(inst->param.f)) != 1) Abort("%s: unable to recognize the token <%s>\n",progname,tok); /* fprintf(stderr,"OP_CONST %f\n",inst->param.f); */ } --- 521,529 ---- } else { /* This one must be last! */ ! /* Try to handle this as a double */ inst->op= OP_CONST; ! if (sscanf(tok,"%lg",&(inst->param.f)) != 1) Abort("%s: unable to recognize the token <%s>\n",progname,tok); /* fprintf(stderr,"OP_CONST %f\n",inst->param.f); */ } *************** *** 622,632 **** return result; } ! static float* run( Program* prog, Clock* clock, int length, int offset ) { ! float* stack_first= (float*)stack_block; ! float* stack_last= (float*)(&stack_block[MAX_STACK-1][0]); ! float* stack_top; Instruction* runner; int i; --- 622,632 ---- return result; } ! static double* run( Program* prog, Clock* clock, int length, int offset ) { ! double* stack_first= (double*)stack_block; ! double* stack_last= (double*)(&stack_block[MAX_STACK-1][0]); ! double* stack_top; Instruction* runner; int i; *************** *** 647,653 **** for (i=0; istrides[runner->param.l]) % clock->limits[runner->param.l]); ! *(stack_top+i)= (float)(loc); } } break; --- 647,653 ---- for (i=0; istrides[runner->param.l]) % clock->limits[runner->param.l]); ! *(stack_top+i)= (double)(loc); } } break; *************** *** 658,664 **** Abort("%s: stack overflow on push of dimension!\n",progname); stack_top += CHUNKSIZE; for (i=0; ilimits[runner->param.l]); } break; case OP_LOAD: --- 658,664 ---- Abort("%s: stack overflow on push of dimension!\n",progname); stack_top += CHUNKSIZE; for (i=0; ilimits[runner->param.l]); } break; case OP_LOAD: *************** *** 716,726 **** /* fprintf(stderr,"exec: OP_SQRT\n"); */ if (stack_topparam.f);*/ val= runner->param.f; if (stack_top>=stack_last) --- 953,959 ---- case OP_CONST: { int i; ! double val; /*fprintf(stderr,"exec: OP_CONST %f\n",runner->param.f);*/ val= runner->param.f; if (stack_top>=stack_last) *************** *** 1008,1015 **** int i; long one= 1; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_CT\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on ct!\n",progname); --- 968,975 ---- int i; long one= 1; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_CT\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on ct!\n",progname); *************** *** 1029,1036 **** int i; long two= 2; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_INV_CT\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on inv_ct!\n",progname); --- 989,996 ---- int i; long two= 2; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_INV_CT\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on inv_ct!\n",progname); *************** *** 1051,1058 **** int i; long one= 1; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_CPOISSON\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on cpoisson!\n",progname); --- 1011,1018 ---- int i; long one= 1; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_CPOISSON\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on cpoisson!\n",progname); *************** *** 1072,1079 **** int i; long two= 2; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_INV_CPOISSON\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on inv_cpoisson!\n",progname); --- 1032,1039 ---- int i; long two= 2; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_INV_CPOISSON\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on inv_cpoisson!\n",progname); *************** *** 1094,1101 **** int i; long one= 1; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_CF\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cf!\n",progname); --- 1054,1061 ---- int i; long one= 1; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_CF\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cf!\n",progname); *************** *** 1116,1123 **** int i; long two= 2; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_INV_CF\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cf!\n",progname); --- 1076,1083 ---- int i; long two= 2; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_INV_CF\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cf!\n",progname); *************** *** 1139,1146 **** int i; long one= 1; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_CCHISQR\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on cchisqr!\n",progname); --- 1099,1106 ---- int i; long one= 1; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_CCHISQR\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on cchisqr!\n",progname); *************** *** 1160,1167 **** int i; long two= 2; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_INV_CCHISQR\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on inv_cchisqr!\n",progname); --- 1120,1127 ---- int i; long two= 2; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_INV_CCHISQR\n"); */ if (stack_top < stack_first+CHUNKSIZE) Abort("%s: stack underflow on inv_cchisqr!\n",progname); *************** *** 1182,1189 **** int i; long one= 1; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_CBETA\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cbeta!\n",progname); --- 1142,1149 ---- int i; long one= 1; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_CBETA\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cbeta!\n",progname); *************** *** 1204,1211 **** int i; long two= 2; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_INV_CBETA\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cbeta!\n",progname); --- 1164,1171 ---- int i; long two= 2; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_INV_CBETA\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cbeta!\n",progname); *************** *** 1227,1234 **** int i; long one= 1; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_CBINOM\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cbinom!\n",progname); --- 1187,1194 ---- int i; long one= 1; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_CBINOM\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cbinom!\n",progname); *************** *** 1249,1256 **** int i; long two= 2; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_INV_CBINOM\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cbinom!\n",progname); --- 1209,1216 ---- int i; long two= 2; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_INV_CBINOM\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cbinom!\n",progname); *************** *** 1272,1279 **** int i; long one= 1; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_CGAMMA\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cgamma!\n",progname); --- 1232,1239 ---- int i; long one= 1; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_CGAMMA\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cgamma!\n",progname); *************** *** 1294,1301 **** int i; long two= 2; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_INV_CGAMMA\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cgamma!\n",progname); --- 1254,1261 ---- int i; long two= 2; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_INV_CGAMMA\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cgamma!\n",progname); *************** *** 1317,1324 **** int i; long one= 1; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_CNORMAL\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cnormal!\n",progname); --- 1277,1284 ---- int i; long one= 1; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_CNORMAL\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on cnormal!\n",progname); *************** *** 1339,1346 **** int i; long two= 2; long status; ! float bound; ! float val; /* fprintf(stderr,"exec: OP_INV_CNORMAL\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cnormal!\n",progname); --- 1299,1306 ---- int i; long two= 2; long status; ! double bound; ! double val; /* fprintf(stderr,"exec: OP_INV_CNORMAL\n"); */ if (stack_top < stack_first+(2*CHUNKSIZE)) Abort("%s: stack underflow on inv_cnormal!\n",progname); *************** *** 1360,1372 **** case OP_RANDOM: { int i; ! float val; /* fprintf(stderr,"exec: OP_RANDOM\n"); */ if (stack_top>=stack_last) Abort("%s: stack overflow on load random!\n",progname); stack_top += CHUNKSIZE; for (i=0; i=stack_last) Abort("%s: stack overflow on load random!\n",progname); stack_top += CHUNKSIZE; for (i=0; i0; j--) *(stack_top-(j*CHUNKSIZE)+i)= *(stack_top-((j-1)*CHUNKSIZE)+i); --- 1372,1378 ---- /* rotate forward */ for (i=0; i0; j--) *(stack_top-(j*CHUNKSIZE)+i)= *(stack_top-((j-1)*CHUNKSIZE)+i); *************** *** 1423,1429 **** /* rotate backward */ for (i=0; i0 && instr[i-1]==outstr[i-1]; i--) {}; ! *blk4_length= inlen-i; ! *blk4_offset= *blk4_out_offset= inlen - *blk4_length; ! ! ! for (i=*blk1_length; i<*blk4_out_offset; i++) if (outstr[i]==instr[*blk2_offset]) break; if (i<=outlen) *blk2_out_offset= i; else return 0; /* can't find block 2 in output */ ! *blk2_length= *blk4_out_offset - *blk2_out_offset; ! for (i=0; i<*blk4_out_offset-*blk2_out_offset; i++) { if (instr[i+*blk2_offset] != outstr[i+*blk2_out_offset]) return 0; /* block 2 is not contiguous in output */ } *blk3_offset= *blk2_offset + *blk2_length; *blk3_out_offset= *blk1_length; ! *blk3_length= inlen - (*blk1_length + *blk2_length + *blk4_length); for (i=0; i<*blk3_length; i++) { if (instr[i+*blk3_offset] != outstr[i+*blk3_out_offset]) *************** *** 102,135 **** int tumble_test(char* instr, char* outstr) { ! int blk1_length; ! int blk1_offset; ! int blk1_out_offset; ! int blk2_length; ! int blk2_offset; ! int blk2_out_offset; ! int blk3_length; ! int blk3_offset; ! int blk3_out_offset; if (!find_blocks(instr, outstr, &blk1_length, &blk1_offset, &blk1_out_offset, &blk2_length, &blk2_offset, &blk2_out_offset, ! &blk3_length, &blk3_offset, &blk3_out_offset)) { return 0; } return 1; } ! static int count_elements(MRI_Dataset* in, char* chunk, char* instr, ! int offset, int length) { if (length==0) return 1; else { int i; char buf[256]; ! int result= 1; for (i=0; i=240) Abort("permute: chunk name too long!\n"); if (!find_blocks(indims, outdims, &blk1_length, &blk1_offset, &blk1_out_offset, &blk2_length, &blk2_offset, &blk2_out_offset, ! &blk3_length, &blk3_offset, &blk3_out_offset)) { Abort("permute internal error: unexpectedly failed tumble test!\n"); return 0; } --- 173,220 ---- int blk3_length; int blk3_offset; int blk3_out_offset; ! int blk4_length; ! int blk4_offset; ! int blk4_out_offset; ! long long blk2_stride; ! long long blk3_stride; ! long long blk1_bytes; ! long long blk1_elements; ! long long blk2_elements; ! long long blk3_elements; ! long long blk4_elements; ! long long tot_size; ! long long buf_size; char buf[256]; /* for composing tag names */ char* obuf; char* ibuf= NULL; int blk2_loop; + int blk2_min; + int blk2_max; int blk3_loop; ! int blk3_min; ! int blk3_max; ! int blk4_loop; ! int blk4_min; ! int blk4_max; ! long long iframe; ! long long oframe; ! long long bytes_this_ichunk; ! long long bytes_this_ochunk; ! long long ioff; ! long long ooff; ! long long bytes_copied_from; ! long long bytes_copied_to; ! long long hits= 0; ! /* to avoid a barely conceivable error due to very long chunk names */ if (strlen(chunkname)>=240) Abort("permute: chunk name too long!\n"); if (!find_blocks(indims, outdims, &blk1_length, &blk1_offset, &blk1_out_offset, &blk2_length, &blk2_offset, &blk2_out_offset, ! &blk3_length, &blk3_offset, &blk3_out_offset, ! &blk4_length, &blk4_offset, &blk4_out_offset)) { Abort("permute internal error: unexpectedly failed tumble test!\n"); return 0; } *************** *** 187,194 **** --- 222,231 ---- blk1_elements= count_elements(in,chunkname,indims,blk1_offset,blk1_length); blk2_elements= count_elements(in,chunkname,indims,blk2_offset,blk2_length); blk3_elements= count_elements(in,chunkname,indims,blk3_offset,blk3_length); + blk4_elements= count_elements(in,chunkname,indims,blk4_offset,blk4_length); blk1_bytes= blk1_elements * get_typesize(in, chunkname); blk2_stride= blk1_bytes * blk2_elements; + blk3_stride= blk1_bytes * blk2_elements * blk3_elements; sprintf(buf,"%s.size",chunkname); if (mri_has(in,buf)) tot_size= mri_get_int(in,buf); *************** *** 203,237 **** } oframe= 0; ! bytes_this_ichunk= buf_size; do { ! bytes_this_ochunk= ! (tot_size-oframe > buf_size) ? buf_size : (tot_size-oframe); ! bytes_copied= 0; ! ! iframe= 0; do { ! iframe_ratio= iframe/blk1_bytes; /* should be integer */ ! bytes_this_ichunk= ! (tot_size-iframe > buf_size) ? buf_size : (tot_size-iframe); ! /* fprintf(stderr,"reading %d from %d\n",bytes_this_ichunk,iframe); */ ! if (ibuf) mri_discard_buffer(in,ibuf); /* free old memory */ ! ibuf= mri_get_chunk(in, chunkname, bytes_this_ichunk, iframe, MRI_RAW); ! ! /* copy everything appropriate in ichunk to ochunk */ ! for (blk3_loop=0; blk3_loop= 0) ! && (ooff-oframe >= 0) ! && (ioff-iframe < bytes_this_ichunk) && (ooff-oframe < bytes_this_ochunk)) { /* Accelerate a couple of common special cases */ if (blk1_bytes==sizeof(long)) { --- 240,284 ---- } oframe= 0; ! iframe= 0; ! bytes_copied_to= bytes_copied_from= 0; ! bytes_this_ichunk= bytes_this_ochunk= ! (tot_size > buf_size) ? buf_size : tot_size; do { ! /* copy everything appropriate in ichunk to ochunk */ ! blk4_min= oframe/blk3_stride; ! blk4_max= blk4_elements; ! blk4_loop= blk4_min; do { ! blk3_min= 0; ! blk3_max= blk3_elements; ! for (blk3_loop=blk3_min; blk3_loop=bytes_this_ichunk) { ! /* read the frame in which ioff resides */ ! iframe= ioff - (ioff % buf_size); ! bytes_this_ichunk= ! (tot_size-iframe > buf_size) ? buf_size : (tot_size-iframe); ! hits= 0; ! if (ibuf) mri_discard_buffer(in,ibuf); /* free old memory */ ! ibuf= mri_get_chunk(in, chunkname, bytes_this_ichunk, ! iframe, MRI_RAW); ! bytes_copied_from= 0; ! } ! ! if ((ooff-oframe >= 0) && (ooff-oframe < bytes_this_ochunk)) { /* Accelerate a couple of common special cases */ if (blk1_bytes==sizeof(long)) { *************** *** 245,268 **** else memcpy( obuf + (ooff-oframe), ibuf + (ioff-iframe), blk1_bytes ); ! bytes_copied += blk1_bytes; } - - if (ioff-iframe >= bytes_this_ichunk) break; if (ooff-oframe >= bytes_this_ochunk) break; - } - if (ioff-iframe >= bytes_this_ichunk) break; } ! iframe += bytes_this_ichunk; ! } while (bytes_copied < bytes_this_ochunk); ! ! /* fprintf(stderr,"writing %d to %d\n",bytes_this_ochunk,oframe); */ ! mri_set_chunk(out, chunkname, bytes_this_ochunk, oframe, MRI_RAW, obuf); ! oframe += bytes_this_ochunk; ! bytes_copied= 0; ! fprintf(stderr,"finished %d%%\n", ! (int)(100.0*((float)oframe)/(float)tot_size)); } while (oframe buf_size) ? ! buf_size : tot_size-oframe); ! fprintf(stderr,"finished %d%%\n", ! (int)(100.0*((float)oframe)/(float)tot_size)); ! } } if (ooff-oframe >= bytes_this_ochunk) break; } } ! blk4_loop += 1; ! } while (blk4_loop*blk3_stride < oframe+bytes_this_ochunk); } while (oframe #include #include + #ifdef AFS + #include + #include + #include + #endif #include "par.h" #include "bio.h" #include "array.h" *************** *** 147,153 **** #include "stdcrg.h" #include "spiral.h" ! static char rcsid[] = "$Id: spiral.c,v 1.16 2001/10/03 16:44:02 welling Exp $"; /* Defaults for several task parameters */ #define DEFAULT_OVER 2 --- 152,158 ---- #include "stdcrg.h" #include "spiral.h" ! static char rcsid[] = "$Id: spiral.c,v 1.17 2002/03/01 00:44:36 welling Exp $"; /* Defaults for several task parameters */ #define DEFAULT_OVER 2 *************** *** 188,193 **** --- 193,203 ---- static void LoadReferences (); static void UncompressFile (Filename out, const Filename in); static void RemoveFile (const Filename name); + #ifdef AFS + static int MySystem( const char* command ); + static int CheckForAFS( const char* fname ); + static void FlushAFS( const char* fname ); + #endif int *************** *** 1189,1199 **** sprintf(com, "zcat %s > %s", in, out); system(com); #ifdef AFS ! if (strncmp(out, "/afs", 4) == 0) ! { ! sprintf(com, "fs flushvolume -path %s", out); ! system(com); ! } #endif } --- 1199,1205 ---- sprintf(com, "zcat %s > %s", in, out); system(com); #ifdef AFS ! if (CheckForAFS(out)) FlushAFS(out); #endif } *************** *** 1205,1207 **** --- 1211,1261 ---- sprintf(com, "rm -f %s", name); system(com); } + + #ifdef AFS + + static int MySystem (const char *command) { + int pid, status; + extern char **environ; + extern int errno; + + if (command == 0) + return 1; + pid = fork(); + if (pid == -1) + return -1; + if (pid == 0) { + char *argv[4]; + argv[0] = "sh"; + argv[1] = "-c"; + argv[2] = (char*)command; + argv[3] = 0; + execve("/bin/sh", argv, environ); + exit(127); + } + do { + if (waitpid(pid, &status, 0) == -1) { + if (errno != EINTR) + return -1; + } else + return status; + } while(1); + } + + static int CheckForAFS( const char* fname ) + { + char buf[256]; + int retval; + snprintf(buf,sizeof(buf),"fs whereis %s >/dev/null 2>&1",(char*)fname); + retval= MySystem(buf); + return retval; + } + + static void FlushAFS( const char* path ) + { + char buf[256]; + snprintf(buf,sizeof(buf),"fs flushvolume -path %s >/dev/null 2>&1",path); + MySystem(buf); + } + + #endif Index: ./src/spiral/worker_utils.c *** /TOIL-U4/fiasco/Fiasco5.1/src/spiral/worker_utils.c Wed Feb 13 19:01:14 2002 --- ./src/spiral/worker_utils.c Fri Mar 1 15:19:44 2002 *************** *** 29,34 **** --- 29,40 ---- #include #include #include + #include + #ifdef AFS + #include + #include + #include + #endif #include "mri.h" #include "fmri.h" #include "par.h" *************** *** 42,48 **** #define NWEIGHTS 1024 /* # of times kaiser function is sampled */ #define SEGSIZE 3000 /* us */ ! static char rcsid[] = "$Id: worker_utils.c,v 1.2 2001/10/03 16:42:56 welling Exp $"; /* GLOBAL VARIABLES FOR WORKER_UTILS */ static float ***prd = NULL; /* [2][npr][ndat] projection data (input)*/ --- 48,54 ---- #define NWEIGHTS 1024 /* # of times kaiser function is sampled */ #define SEGSIZE 3000 /* us */ ! static char rcsid[] = "$Id: worker_utils.c,v 1.3 2002/03/01 00:44:36 welling Exp $"; /* GLOBAL VARIABLES FOR WORKER_UTILS */ static float ***prd = NULL; /* [2][npr][ndat] projection data (input)*/ *************** *** 103,108 **** --- 109,119 ---- static void WriteImagePhase (int coil_num); static float kaiser (float l, float b, float u); static float bessi0 (float x); + #ifdef AFS + static int MySystem( const char* command ); + static int CheckForAFS( const char* fname ); + static void FlushAFS( const char* fname ); + #endif void AllocWorkerMemory() { *************** *** 425,432 **** Acct(READOPEN); #ifdef AFS ! sprintf(com, "fs flushvolume"); ! system(com); #endif if ((f = fopen(t.filename, "r")) == NULL) Abort("Could not open input file %s\n", t.filename); --- 436,442 ---- Acct(READOPEN); #ifdef AFS ! if (CheckForAFS(".")) FlushAFS("."); #endif if ((f = fopen(t.filename, "r")) == NULL) Abort("Could not open input file %s\n", t.filename); *************** *** 491,500 **** Abort("Unable to allocate %d bytes!\n",2*c.ndat*sizeof(short)); Acct(READOPEN); - #ifdef AFS - sprintf(com, "fs flushvolume"); - system(com); - #endif if (!(ds= mri_open_dataset(t.filename, MRI_READ))) Abort("Could not open input file %s\n", t.filename); --- 501,506 ---- *************** *** 1419,1421 **** --- 1425,1475 ---- return(ans); } + #ifdef AFS + + static int MySystem (const char *command) { + int pid, status; + extern char **environ; + extern int errno; + + if (command == 0) + return 1; + pid = fork(); + if (pid == -1) + return -1; + if (pid == 0) { + char *argv[4]; + argv[0] = "sh"; + argv[1] = "-c"; + argv[2] = (char*)command; + argv[3] = 0; + execve("/bin/sh", argv, environ); + exit(127); + } + do { + if (waitpid(pid, &status, 0) == -1) { + if (errno != EINTR) + return -1; + } else + return status; + } while(1); + } + + + static int CheckForAFS( const char* fname ) + { + char buf[256]; + int retval; + snprintf(buf,sizeof(buf),"fs whereis %s >/dev/null 2>&1",(char*)fname); + retval= MySystem(buf); + return retval; + } + + static void FlushAFS( const char* path ) + { + char buf[256]; + snprintf(buf,sizeof(buf),"fs flushvolume -path %s >/dev/null 2>&1",path); + MySystem(buf); + } + + #endif