#include "structs.h" int istrunc (char *objtype); void count_pars (struct fitpars *fpar, int *nfree, int *nfixed, int *unused) { int i; static int k = 0; static int high = 0; struct fitpars *h; if (fpar != NULL) { if (high == 0 || (high == 1&& !istrunc(fpar->objtype))) { for (i = 1; i<= fpar->npars; i++) { if (fpar->ia[i] == 1) (*nfree)++; else if (fpar->ia[i] == 2) (*nfixed)++; else if (fpar->ia[i] == -1) (*unused)++; else { (*nfixed)++; fpar->ia[i] = 0; }; }; }; /* Go into high order list if high == 1 */ if (high == 1 && fpar->next != NULL) count_pars (fpar->next, nfree, nfixed, unused); /* Check to see if there are high order terms */ else if (fpar->high != NULL && high == 0) { high = 1; count_pars (fpar->high, nfree, nfixed, unused); high = 0; /* keep track of when we pop out of this list */ }; /* No high order terms or just exiting high order terms */ if (high == 0 && fpar->next != NULL) count_pars (fpar->next, nfree, nfixed, unused); }; }