| |
| |
|
|
| |
| |
| |
|
|
| #include <stdlib.h> |
| #include <string.h> |
| |
| #include <stddef.h> |
| #include <ctype.h> |
| #include "fitsio2.h" |
| |
| int ffgcvs( fitsfile *fptr, |
| int colnum, |
| LONGLONG firstrow, |
| LONGLONG firstelem, |
| LONGLONG nelem, |
| char *nulval, |
| char **array, |
| int *anynul, |
| int *status) |
| |
| |
| |
| |
| |
| { |
| char cdummy[2]; |
|
|
| ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1, nulval, |
| array, cdummy, anynul, status); |
| return(*status); |
| } |
| |
| int ffgcfs( fitsfile *fptr, |
| int colnum, |
| LONGLONG firstrow, |
| LONGLONG firstelem, |
| LONGLONG nelem, |
| char **array, |
| char *nularray, |
| int *anynul, |
| int *status) |
| |
| |
| |
| |
| |
| { |
| char dummy[2]; |
|
|
| ffgcls(fptr, colnum, firstrow, firstelem, nelem, 2, dummy, |
| array, nularray, anynul, status); |
| return(*status); |
| } |
| |
| int ffgcls( fitsfile *fptr, |
| int colnum, |
| LONGLONG firstrow, |
| LONGLONG firstelem, |
| LONGLONG nelem, |
| int nultyp, |
| |
| |
| char *nulval, |
| char **array, |
| char *nularray, |
| int *anynul, |
| int *status) |
| |
| |
| |
| |
| { |
| int tcode, hdutype, tstatus, scaled, intcol, dwidth, nulwidth, ll, dlen; |
| int equivtype; |
| long ii, jj; |
| tcolumn *colptr; |
| char message[FLEN_ERRMSG], *carray, keyname[FLEN_KEYWORD]; |
| char cform[20], dispfmt[20], tmpstr[400], *flgarray, tmpnull[80]; |
| unsigned char byteval; |
| float *earray; |
| double *darray, tscale = 1.0; |
| LONGLONG *llarray; |
| ULONGLONG *ullarray; |
|
|
| if (*status > 0 || nelem == 0) |
| return(*status); |
|
|
| |
| if (fptr->HDUposition != (fptr->Fptr)->curhdu) |
| ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); |
|
|
| |
| else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) |
| if ( ffrdef(fptr, status) > 0) |
| return(*status); |
|
|
| if (colnum < 1 || colnum > (fptr->Fptr)->tfield) |
| { |
| snprintf(message, FLEN_ERRMSG,"Specified column number is out of range: %d", |
| colnum); |
| ffpmsg(message); |
| return(*status = BAD_COL_NUM); |
| } |
|
|
| |
| ffeqtyll(fptr, colnum, &equivtype, NULL, NULL, status); |
| if (equivtype < 0) equivtype = abs(equivtype); |
| |
| colptr = (fptr->Fptr)->tableptr; |
| colptr += (colnum - 1); |
| tcode = abs(colptr->tdatatype); |
|
|
| if (tcode == TSTRING) |
| { |
| |
| ffgcls2(fptr, colnum, firstrow, firstelem, nelem, nultyp, nulval, |
| array, nularray, anynul, status); |
| } |
| else if (tcode == TLOGICAL) |
| { |
| |
| carray = (char *) malloc((size_t) nelem); |
|
|
| |
| ffgcll(fptr, colnum, firstrow, firstelem, nelem, nultyp, *nulval, |
| carray, nularray, anynul, status); |
|
|
| if (*status <= 0) |
| { |
| |
| for (ii = 0; ii < nelem; ii++) |
| { |
| if (carray[ii] == 1) |
| strcpy(array[ii], "T"); |
| else if (carray[ii] == 0) |
| strcpy(array[ii], "F"); |
| else |
| strcpy(array[ii],"N"); |
| } |
| } |
|
|
| free(carray); |
| } |
| else if (tcode == TCOMPLEX) |
| { |
| |
| earray = (float *) calloc((size_t) (nelem * 2), sizeof(float) ); |
| |
| ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, |
| 1, 1, FLOATNULLVALUE, earray, nularray, anynul, status); |
|
|
| if (*status <= 0) |
| { |
|
|
| |
|
|
| ffgcdw(fptr, colnum, &dwidth, status); |
| dwidth = (dwidth - 3) / 2; |
| |
| |
| ffkeyn("TDISP", colnum, keyname, status); |
| tstatus = 0; |
| cform[0] = '\0'; |
|
|
| if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0) |
| { |
| |
| ffcdsp(dispfmt, cform); |
| } |
|
|
| if (!cform[0]) |
| strcpy(cform, "%14.6E"); |
|
|
| |
| jj = 0; |
| for (ii = 0; ii < nelem; ii++) |
| { |
| strcpy(array[ii], "("); |
|
|
| |
| if (earray[jj] == FLOATNULLVALUE) |
| { |
| strcpy(tmpstr, "NULL"); |
| if (nultyp == 2) |
| nularray[ii] = 1; |
| } |
| else |
| snprintf(tmpstr, 400,cform, earray[jj]); |
|
|
| strncat(array[ii], tmpstr, dwidth); |
| strcat(array[ii], ","); |
| jj++; |
|
|
| |
| if (earray[jj] == FLOATNULLVALUE) |
| { |
| strcpy(tmpstr, "NULL"); |
| if (nultyp == 2) |
| nularray[ii] = 1; |
| } |
| else |
| snprintf(tmpstr, 400,cform, earray[jj]); |
|
|
| strncat(array[ii], tmpstr, dwidth); |
| strcat(array[ii], ")"); |
| jj++; |
| } |
| } |
|
|
| free(earray); |
| } |
| else if (tcode == TDBLCOMPLEX) |
| { |
| |
| darray = (double *) calloc((size_t) (nelem * 2), sizeof(double) ); |
| |
| ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, |
| 1, 1, DOUBLENULLVALUE, darray, nularray, anynul, status); |
|
|
| if (*status <= 0) |
| { |
| |
|
|
| ffgcdw(fptr, colnum, &dwidth, status); |
| dwidth = (dwidth - 3) / 2; |
|
|
| |
| ffkeyn("TDISP", colnum, keyname, status); |
| tstatus = 0; |
| cform[0] = '\0'; |
| |
| if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0) |
| { |
| |
| ffcdsp(dispfmt, cform); |
| } |
|
|
| if (!cform[0]) |
| strcpy(cform, "%23.15E"); |
|
|
| |
| jj = 0; |
| for (ii = 0; ii < nelem; ii++) |
| { |
| strcpy(array[ii], "("); |
|
|
| |
| if (darray[jj] == DOUBLENULLVALUE) |
| { |
| strcpy(tmpstr, "NULL"); |
| if (nultyp == 2) |
| nularray[ii] = 1; |
| } |
| else |
| snprintf(tmpstr, 400,cform, darray[jj]); |
|
|
| strncat(array[ii], tmpstr, dwidth); |
| strcat(array[ii], ","); |
| jj++; |
|
|
| |
| if (darray[jj] == DOUBLENULLVALUE) |
| { |
| strcpy(tmpstr, "NULL"); |
| if (nultyp == 2) |
| nularray[ii] = 1; |
| } |
| else |
| snprintf(tmpstr, 400,cform, darray[jj]); |
|
|
| strncat(array[ii], tmpstr, dwidth); |
| strcat(array[ii], ")"); |
| jj++; |
| } |
| } |
|
|
| free(darray); |
| } |
| else if (tcode == TLONGLONG && equivtype == TLONGLONG) |
| { |
| |
| llarray = (LONGLONG *) calloc((size_t) nelem, sizeof(LONGLONG) ); |
| flgarray = (char *) calloc((size_t) nelem, sizeof(char) ); |
| dwidth = 20; |
|
|
| if (ffgcfjj(fptr, colnum, firstrow, firstelem, nelem, |
| llarray, flgarray, anynul, status) > 0) |
| { |
| free(flgarray); |
| free(llarray); |
| return(*status); |
| } |
|
|
| |
| if (nulval) { |
| strncpy(tmpnull, nulval,79); |
| tmpnull[79]='\0'; |
| nulwidth = strlen(tmpnull); |
| } else { |
| strcpy(tmpnull, " "); |
| nulwidth = 1; |
| } |
|
|
| for (ii = 0; ii < nelem; ii++) |
| { |
| if ( flgarray[ii] ) |
| { |
| *array[ii] = '\0'; |
| if (dwidth < nulwidth) |
| strncat(array[ii], tmpnull, dwidth); |
| else |
| sprintf(array[ii],"%*s",dwidth,tmpnull); |
| |
| if (nultyp == 2) |
| nularray[ii] = 1; |
| } |
| else |
| { |
|
|
| #if defined(_MSC_VER) |
| |
| snprintf(tmpstr, 400,"%20I64d", llarray[ii]); |
| #elif (USE_LL_SUFFIX == 1) |
| snprintf(tmpstr, 400,"%20lld", llarray[ii]); |
| #else |
| snprintf(tmpstr, 400,"%20ld", llarray[ii]); |
| #endif |
| *array[ii] = '\0'; |
| strncat(array[ii], tmpstr, 20); |
| } |
| } |
|
|
| free(flgarray); |
| free(llarray); |
|
|
| } |
| else if (tcode == TLONGLONG && equivtype == TULONGLONG) |
| { |
| |
| ullarray = (ULONGLONG *) calloc((size_t) nelem, sizeof(ULONGLONG) ); |
| flgarray = (char *) calloc((size_t) nelem, sizeof(char) ); |
| dwidth = 20; |
|
|
| if (ffgcfujj(fptr, colnum, firstrow, firstelem, nelem, |
| ullarray, flgarray, anynul, status) > 0) |
| { |
| free(flgarray); |
| free(ullarray); |
| return(*status); |
| } |
|
|
| |
| if (nulval) { |
| strncpy(tmpnull, nulval, 79); |
| tmpnull[79]='\0'; |
| nulwidth = strlen(tmpnull); |
| } else { |
| strcpy(tmpnull, " "); |
| nulwidth = 1; |
| } |
|
|
| for (ii = 0; ii < nelem; ii++) |
| { |
| if ( flgarray[ii] ) |
| { |
| *array[ii] = '\0'; |
| if (dwidth < nulwidth) |
| strncat(array[ii], tmpnull, dwidth); |
| else |
| sprintf(array[ii],"%*s",dwidth,tmpnull); |
| |
| if (nultyp == 2) |
| nularray[ii] = 1; |
| } |
| else |
| { |
|
|
| #if defined(_MSC_VER) |
| |
| snprintf(tmpstr, 400, "%20I64u", ullarray[ii]); |
| #elif (USE_LL_SUFFIX == 1) |
| snprintf(tmpstr, 400, "%20llu", ullarray[ii]); |
| #else |
| snprintf(tmpstr, 400, "%20lu", ullarray[ii]); |
| #endif |
| *array[ii] = '\0'; |
| strncat(array[ii], tmpstr, 20); |
| } |
| } |
|
|
| free(flgarray); |
| free(ullarray); |
|
|
| } |
| else |
| { |
| |
| darray = (double *) calloc((size_t) nelem, sizeof(double) ); |
| |
| |
| if (ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, nultyp, |
| DOUBLENULLVALUE, darray, nularray, anynul, status) > 0) |
| { |
| free(darray); |
| return(*status); |
| } |
|
|
| |
|
|
| ffgcdw(fptr, colnum, &dwidth, status); |
|
|
| |
| ffkeyn("TSCAL", colnum, keyname, status); |
| tstatus = 0; |
| scaled = 0; |
| if (ffgkyd(fptr, keyname, &tscale, NULL, &tstatus) == 0) |
| { |
| if (tscale != 1.0) |
| scaled = 1; |
| } |
|
|
| intcol = 0; |
| if (tcode <= TLONG && !scaled) |
| intcol = 1; |
|
|
| |
| ffkeyn("TDISP", colnum, keyname, status); |
| tstatus = 0; |
| cform[0] = '\0'; |
|
|
| if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0) |
| { |
| |
| ffcdsp(dispfmt, cform); |
| } |
|
|
| if (!cform[0]) |
| { |
| |
|
|
| ffkeyn("TFORM", colnum, keyname, status); |
| ffgkys(fptr, keyname, dispfmt, NULL, status); |
|
|
| if (scaled && tcode <= TSHORT) |
| { |
| |
| strcpy(cform, "%#14.6G"); |
| } |
| else if (scaled && tcode == TLONG) |
| { |
| |
| strcpy(cform, "%#23.15G"); |
| } |
| else if (scaled && tcode == TLONGLONG) |
| { |
| |
| strcpy(cform, "%#23.15G"); |
| } |
| else |
| { |
| ffghdt(fptr, &hdutype, status); |
| if (hdutype == ASCII_TBL) |
| { |
| |
| ffcdsp(dispfmt, cform); |
| } |
| else |
| { |
| |
| if (tcode == TBIT) { |
| strcpy(cform, "%4d"); |
| } else if (tcode == TBYTE) { |
| strcpy(cform, "%4d"); |
| } else if (tcode == TSHORT) { |
| strcpy(cform, "%6d"); |
| } else if (tcode == TLONG) { |
| strcpy(cform, "%11.0f"); |
| intcol = 0; |
| } else if (tcode == TFLOAT) { |
| strcpy(cform, "%#14.6G"); |
| } else if (tcode == TDOUBLE) { |
| strcpy(cform, "%#23.15G"); |
| } |
| } |
| } |
| } |
|
|
| if (nulval) { |
| strncpy(tmpnull, nulval,79); |
| tmpnull[79]='\0'; |
| nulwidth = strlen(tmpnull); |
| } else { |
| strcpy(tmpnull, " "); |
| nulwidth = 1; |
| } |
|
|
| |
| for (ii = 0; ii < nelem; ii++) |
| { |
| if (tcode == TBIT) |
| { |
| byteval = (char) darray[ii]; |
|
|
| for (ll=0; ll < 8; ll++) |
| { |
| if ( ((unsigned char) (byteval << ll)) >> 7 ) |
| *(array[ii] + ll) = '1'; |
| else |
| *(array[ii] + ll) = '0'; |
| } |
| *(array[ii] + 8) = '\0'; |
| } |
| |
| else if ( (nultyp == 1 && darray[ii] == DOUBLENULLVALUE) || |
| (nultyp == 2 && nularray[ii]) ) |
| { |
| *array[ii] = '\0'; |
| if (dwidth < nulwidth) |
| strncat(array[ii], tmpnull, dwidth); |
| else |
| sprintf(array[ii],"%*s",dwidth,tmpnull); |
| } |
| else |
| { |
| if (intcol) { |
| snprintf(tmpstr, 400,cform, (int) darray[ii]); |
| } else { |
| snprintf(tmpstr, 400,cform, darray[ii]); |
| } |
| |
| |
| dlen = strlen(tmpstr); |
| if (dlen > dwidth) { |
| memset(tmpstr, '*', dwidth); |
| } |
|
|
| *array[ii] = '\0'; |
| strncat(array[ii], tmpstr, dwidth); |
| } |
| } |
|
|
| free(darray); |
| } |
| return(*status); |
| } |
| |
| int ffgcdw( fitsfile *fptr, |
| int colnum, |
| int *width, |
| int *status) |
| |
| |
| |
| { |
| tcolumn *colptr; |
| char *cptr; |
| char message[FLEN_ERRMSG], keyname[FLEN_KEYWORD], dispfmt[20]; |
| int tcode, hdutype, tstatus, scaled; |
| double tscale; |
|
|
| if (*status > 0) |
| return(*status); |
|
|
| if (fptr->HDUposition != (fptr->Fptr)->curhdu) |
| ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); |
|
|
| if (colnum < 1 || colnum > (fptr->Fptr)->tfield) |
| { |
| snprintf(message, FLEN_ERRMSG,"Specified column number is out of range: %d", |
| colnum); |
| ffpmsg(message); |
| return(*status = BAD_COL_NUM); |
| } |
|
|
| colptr = (fptr->Fptr)->tableptr; |
| colptr += (colnum - 1); |
| tcode = abs(colptr->tdatatype); |
|
|
| |
| ffkeyn("TDISP", colnum, keyname, status); |
|
|
| *width = 0; |
| tstatus = 0; |
| if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0) |
| { |
| |
| cptr = dispfmt; |
| while(*cptr == ' ') |
| cptr++; |
|
|
| if (*cptr == 'A' || *cptr == 'a' || |
| *cptr == 'I' || *cptr == 'i' || |
| *cptr == 'O' || *cptr == 'o' || |
| *cptr == 'Z' || *cptr == 'z' || |
| *cptr == 'F' || *cptr == 'f' || |
| *cptr == 'E' || *cptr == 'e' || |
| *cptr == 'D' || *cptr == 'd' || |
| *cptr == 'G' || *cptr == 'g') |
| { |
|
|
| while(!isdigit((int) *cptr) && *cptr != '\0') |
| cptr++; |
|
|
| *width = atoi(cptr); |
| if (tcode >= TCOMPLEX) |
| *width = (2 * (*width)) + 3; |
| } |
| } |
|
|
| if (*width == 0) |
| { |
| |
|
|
| ffkeyn("TFORM", colnum, keyname, status); |
| ffgkys(fptr, keyname, dispfmt, NULL, status); |
|
|
| |
| ffkeyn("TSCAL", colnum, keyname, status); |
| tstatus = 0; |
| scaled = 0; |
|
|
| if (ffgkyd(fptr, keyname, &tscale, NULL, &tstatus) == 0) |
| { |
| if (tscale != 1.0) |
| scaled = 1; |
| } |
|
|
| if (scaled && tcode <= TSHORT) |
| { |
| |
| *width = 14; |
| } |
| else if (scaled && tcode == TLONG) |
| { |
| |
| *width = 23; |
| } |
| else if (scaled && tcode == TLONGLONG) |
| { |
| |
| *width = 23; |
| } |
|
|
| else |
| { |
| ffghdt(fptr, &hdutype, status); |
| if (hdutype == ASCII_TBL) |
| { |
| |
| cptr = dispfmt; |
| while(!isdigit((int) *cptr) && *cptr != '\0') |
| cptr++; |
|
|
| *width = atoi(cptr); |
| } |
| else |
| { |
| |
| if (tcode == TBIT) |
| *width = 8; |
| else if (tcode == TBYTE) |
| *width = 4; |
| else if (tcode == TSHORT) |
| *width = 6; |
| else if (tcode == TLONG) |
| *width = 11; |
| else if (tcode == TLONGLONG) |
| *width = 20; |
| else if (tcode == TFLOAT) |
| *width = 14; |
| else if (tcode == TDOUBLE) |
| *width = 23; |
| else if (tcode == TCOMPLEX) |
| *width = 31; |
| else if (tcode == TDBLCOMPLEX) |
| *width = 49; |
| else if (tcode == TLOGICAL) |
| *width = 1; |
| else if (tcode == TSTRING) |
| { |
| int typecode; |
| long int repeat = 0, rwidth = 0; |
| int gstatus = 0; |
|
|
| |
| |
| if (ffgtcl(fptr, colnum, &typecode, &repeat, &rwidth, &gstatus) == 0 && |
| rwidth >= 1 && rwidth < repeat) { |
| *width = rwidth; |
|
|
| } else { |
| |
| |
| |
| cptr = dispfmt; |
| while(!isdigit((int) *cptr) && *cptr != '\0') |
| cptr++; |
| |
| *width = atoi(cptr); |
| } |
|
|
| if (*width < 1) |
| *width = 1; |
| } |
| } |
| } |
| } |
| return(*status); |
| } |
| |
| int ffgcls2 ( fitsfile *fptr, |
| int colnum, |
| LONGLONG firstrow, |
| LONGLONG firstelem, |
| LONGLONG nelem, |
| int nultyp, |
| |
| |
| char *nulval, |
| char **array, |
| char *nularray, |
| int *anynul, |
| int *status) |
| |
| |
| |
| { |
| double dtemp; |
| long nullen; |
| int tcode, maxelem, hdutype, nulcheck; |
| long twidth, incre; |
| long ii, jj, ntodo; |
| LONGLONG repeat, startpos, elemnum, readptr, tnull, rowlen, rownum, remain, next; |
| double scale, zero; |
| char tform[20]; |
| char message[FLEN_ERRMSG]; |
| char snull[20]; |
| tcolumn *colptr; |
|
|
| double cbuff[DBUFFSIZE / sizeof(double)]; |
| char *buffer, *arrayptr; |
|
|
| if (*status > 0 || nelem == 0) |
| return(*status); |
|
|
| if (fptr->HDUposition != (fptr->Fptr)->curhdu) |
| ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); |
|
|
| if (anynul) |
| *anynul = 0; |
|
|
| if (nultyp == 2) |
| memset(nularray, 0, (size_t) nelem); |
|
|
| |
| |
| |
| if (colnum < 1 || colnum > (fptr->Fptr)->tfield) |
| { |
| snprintf(message, FLEN_ERRMSG,"Specified column number is out of range: %d", |
| colnum); |
| ffpmsg(message); |
| return(*status = BAD_COL_NUM); |
| } |
|
|
| colptr = (fptr->Fptr)->tableptr; |
| colptr += (colnum - 1); |
| tcode = colptr->tdatatype; |
|
|
| if (tcode == -TSTRING) |
| { |
| |
|
|
| if (ffgcprll( fptr, colnum, firstrow, 1, 1, 0, &scale, &zero, |
| tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, |
| &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) |
| return(*status); |
|
|
| remain = 1; |
| twidth = (long) repeat; |
| } |
| else if (tcode == TSTRING) |
| { |
| if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero, |
| tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, |
| &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) |
| return(*status); |
|
|
| |
| |
| |
| if (twidth > IOBUFLEN) { |
| maxelem = 1; |
| incre = twidth; |
| repeat = 1; |
| } |
|
|
| remain = nelem; |
| } |
| else |
| return(*status = NOT_ASCII_COL); |
|
|
| nullen = strlen(snull); |
| if (nullen == 0) |
| nullen = 1; |
| |
| |
| |
| |
| nulcheck = nultyp; |
|
|
| if (nultyp == 1 && nulval == 0) |
| nulcheck = 0; |
|
|
| else if (nultyp == 1 && nulval && nulval[0] == 0) |
| nulcheck = 0; |
|
|
| else if (snull[0] == ASCII_NULL_UNDEFINED) |
| nulcheck = 0; |
|
|
| else if (nullen > twidth) |
| nulcheck = 0; |
| |
|
|
| |
| |
| |
| next = 0; |
| rownum = 0; |
|
|
| while (remain) |
| { |
| |
| |
| |
| |
| ntodo = (long) minvalue(remain, maxelem); |
| ntodo = (long) minvalue(ntodo, (repeat - elemnum)); |
|
|
| readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); |
| ffmbyt(fptr, readptr, REPORT_EOF, status); |
|
|
| |
|
|
| if (incre == twidth) |
| ffgbyt(fptr, ntodo * twidth, cbuff, status); |
| else |
| ffgbytoff(fptr, twidth, ntodo, incre - twidth, cbuff, status); |
|
|
| |
| |
|
|
| buffer = ((char *) cbuff) + (ntodo * twidth) - 1; |
|
|
| for (ii = (long) (next + ntodo - 1); ii >= next; ii--) |
| { |
| arrayptr = array[ii] + twidth - 1; |
|
|
| for (jj = twidth - 1; jj > 0; jj--) |
| { |
| if (*buffer == ' ') |
| { |
| buffer--; |
| arrayptr--; |
| } |
| else |
| break; |
| } |
| *(arrayptr + 1) = 0; |
| |
| for (; jj >= 0; jj--) |
| { |
| *arrayptr = *buffer; |
| buffer--; |
| arrayptr--; |
| } |
|
|
| |
| |
| if (nulcheck && !strncmp(snull, array[ii], nullen) ) |
| { |
| *anynul = 1; |
| if (nultyp == 1) { |
| |
| if (nulval) |
| strcpy(array[ii], nulval); |
| else |
| strcpy(array[ii], " "); |
| |
| } else |
| nularray[ii] = 1; |
| } |
| } |
| |
| if (*status > 0) |
| { |
| dtemp = (double) next; |
| snprintf(message,FLEN_ERRMSG, |
| "Error reading elements %.0f thru %.0f of data array (ffpcls).", |
| dtemp+1., dtemp+ntodo); |
|
|
| ffpmsg(message); |
| return(*status); |
| } |
|
|
| |
| |
| |
| next += ntodo; |
| remain -= ntodo; |
| if (remain) |
| { |
| elemnum += ntodo; |
| if (elemnum == repeat) |
| { |
| elemnum = 0; |
| rownum++; |
| } |
| } |
| } |
|
|
| return(*status); |
| } |
|
|
|
|