#include #include #include "structs.h" #define STRLEN 1000 struct fitpars *newobject (char *objtype); void del_highpars (struct fitpars *fpar, int type); void upcase (char *com); void wing_pars (char *string, struct fitpars *fpar) { int npars, i, mode, pa; char wtype[10], com[STRLEN]; struct fitpars *f, *ft; /*************************************************************\ * Check to see if the wing structure is already active. * * First, check the fitpar tree for higher order terms. * \*************************************************************/ f = fpar->high; sscanf (string, "%s %s", com, wtype); upcase (com); while (f!= NULL && (strncmp (f->objtype, "sers", 4) != 0 && strncmp (f->objtype, "power", 5) != 0)) f = f->next; /* No struct for outer wing profile, create new */ if (f == NULL && strncmp (wtype, "none", 4) != 0 && strncmp (wtype, "NONE", 4) != 0) { if (strncmp (wtype, "sers", 4) == 0) ft = newobject ("sersic"); else ft = newobject ("power"); if (fpar->high == NULL) /* First in the list */ fpar->high = ft; else{ /* Not the first in the list; must advance downward */ fpar = fpar->high; while (fpar->next != NULL) fpar = fpar->next; fpar->next = ft; }; f = ft; }; /********************************************\ * Now assign parameter values or delete W0 * \********************************************/ if (f != NULL) { if (strncmp (com, "W0", 2) == 0) { if (strncmp (wtype, "none", 4) == 0 || strncmp (wtype, "NONE", 4) ==0) del_highpars (fpar, 3); } else if (strncmp (com, "W1", 2) == 0) sscanf (string, " %s %f %d", com, &f->a[4], &f->ia[4]); else if (strncmp (com, "W2", 2) == 0) sscanf (string, " %s %f %d", com, &f->a[5], &f->ia[5]); }; }