?? esig_asc.c
字號(hào):
} while (++j < length && ReadSpace(file)); } break; case ULONG: { unsigned long *data = (unsigned long *) datap; do { if (fscanf(file, "%lu", &data[j]) != 1) return j; } while (++j < length && ReadSpace(file)); } break; case SHORT: { short *data = (short *) datap; do { if (fscanf(file, "%hd", &data[j]) != 1) return j; } while (++j < length && ReadSpace(file)); } break; case USHORT: { unsigned short *data = (unsigned short *) datap; do { if (fscanf(file, "%hu", &data[j]) != 1) return j; } while (++j < length && ReadSpace(file)); } break; case SCHAR: { Schar *data = (Schar *) datap; int n; do { if (fscanf(file, "%d", &n) != 1) return j; data[j] = n; } while (++j < length && ReadSpace(file)); } break; case UCHAR: { Uchar *data = (Uchar *) datap; unsigned u; do { if (fscanf(file, "%u", &u) != 1) return j; data[j] = u; } while (++j < length && ReadSpace(file)); } break; case BOOL: { Bool *data = (Bool *) datap; do { switch (getc(file)) { case '0': data[j] = 0; break; case '1': data[j] = 1; break; default: return j; } } while (++j < length && ReadOptSpace(file)); } break; case DOUBLE_COMPLEX: { DoubleComplex *data = (DoubleComplex *) datap; double re, im; do { if (fscanf(file, "%lf", &re) == 1) { if (!ReadSpace(file) || fscanf(file, "%lf", &im) != 1) { return j; } } else { ch = getc(file); if (ch != '(') return j; if (!ReadOptSpace(file) || fscanf(file, "%lf", &re) != 1) { return j; } ch = GetNonSpace(file); if (ch != ',') return j; if (!ReadOptSpace(file) || fscanf(file, "%lf", &im) != 1) { return j; } ch = GetNonSpace(file); if (ch != ')') return j; } data[j].real = re; data[j].imag = im; } while (++j < length && ReadSpace(file)); } break; case FLOAT_COMPLEX: { FloatComplex *data = (FloatComplex *) datap; float re, im; do { if (fscanf(file, "%f", &re) == 1) { if (!ReadSpace(file) || fscanf(file, "%f", &im) != 1) { return j; } } else { ch = getc(file); if (ch != '(') return j; if (!ReadOptSpace(file) || fscanf(file, "%f", &re) != 1) { return j; } ch = GetNonSpace(file); if (ch != ',') return j; if (!ReadOptSpace(file) || fscanf(file, "%f", &im) != 1) { return j; } ch = GetNonSpace(file); if (ch != ')') return j; } data[j].real = re; data[j].imag = im; } while (++j < length && ReadSpace(file)); } break; case LONG_COMPLEX: { LongComplex *data = (LongComplex *) datap; long re, im; do { if (fscanf(file, "%ld", &re) == 1) { if (!ReadSpace(file) || fscanf(file, "%ld", &im) != 1) { return j; } } else { ch = getc(file); if (ch != '(') return j; if (!ReadOptSpace(file) || fscanf(file, "%ld", &re) != 1) { return j; } ch = GetNonSpace(file); if (ch != ',') return j; if (!ReadOptSpace(file) || fscanf(file, "%ld", &im) != 1) { return j; } ch = GetNonSpace(file); if (ch != ')') return j; } data[j].real = re; data[j].imag = im; } while (++j < length && ReadSpace(file)); } break; case SHORT_COMPLEX: { ShortComplex *data = (ShortComplex *) datap; short re, im; do { if (fscanf(file, "%hd", &re) == 1) { if (!ReadSpace(file) || fscanf(file, "%hd", &im) != 1) { return j; } } else { ch = getc(file); if (ch != '(') return j; if (!ReadOptSpace(file) || fscanf(file, "%hd", &re) != 1) { return j; } ch = GetNonSpace(file); if (ch != ',') return j; if (!ReadOptSpace(file) || fscanf(file, "%hd", &im) != 1) { return j; } ch = GetNonSpace(file); if (ch != ')') return j; } data[j].real = re; data[j].imag = im; } while (++j < length && ReadSpace(file)); } break; case SCHAR_COMPLEX: { ScharComplex *data = (ScharComplex *) datap; int re, im; do { if (fscanf(file, "%d", &re) == 1) { if (!ReadSpace(file) || fscanf(file, "%d", &im) != 1) { return j; } } else { ch = getc(file); if (ch != '(') return j; if (!ReadOptSpace(file) || fscanf(file, "%d", &re) != 1) { return j; } ch = GetNonSpace(file); if (ch != ',') return j; if (!ReadOptSpace(file) || fscanf(file, "%d", &im) != 1) { return j; } ch = GetNonSpace(file); if (ch != ')') return j; } data[j].real = re; data[j].imag = im; } while (++j < length && ReadSpace(file)); } break; case CHAR: { char *data = (char *) datap; unsigned long val; ch = getc(file); if (ch == '"') { for (j = 0; j < length; j++) { ch = getc(file); if (ch == '"') { if (j == 0) return j; ch = GetNonSpace(file); if (ch != '"') return j; ch = getc(file); } if (ch == '\\') { if (ReadAsciiEscape(&val, file) && val <= UCHAR_MAX) { data[j] = val; } else } else if (ch == '"') return j; else if (isprint(ch)) data[j] = ch; else return j; } ch = getc(file); if (ch != '"') return j; } else if (length > 0) return j; else if (ch != EOF) ungetc(ch, file); } break; case WCHAR: { Wchar *data = (Wchar *) datap; unsigned long val; ch = getc(file); if (ch == '"') { for (j = 0; j < length; j++) { ch = getc(file); if (ch == '"') { if (j == 0) return j; ch = GetNonSpace(file); if (ch != '"') return j; ch = getc(file); } if (ch == '\\') { if (ReadAsciiEscape(&val, file) && val <= USHRT_MAX) data[j] = val; else return j; } else if (ch == '"') return j; else if (isprint(ch)) data[j] = ch; else return j; } ch = getc(file); if (ch != '"') return j; } else if (length > 0) return j; else if (ch != EOF) ungetc(ch, file); } break; default: return 0; } return j;}/* * Read from file an escape sequence like those in C character constants * and string literals and the Esignal Ascii representations of CHAR * and WCHAR data. The initial backslash (\) is assumed to have already * been read; this function reads the rest of the construct. The backslash * can be followed by various single characters, by an octal number with * up to three digits, or by an "x" followed by a hexadecimal number with * any number of digits. Assign the corresponding Ascii numeric value * to the variable whose address is val (which must not be NULL). */static intReadAsciiEscape(unsigned long *val, FILE *file){ int ch; ch = getc(file); switch (ch) { case '\\': case '?': case '\'': case '"': *val = ch; break; case 'a': *val = '\a'; break; case 'b': *val = '\b'; break; case 'f': *val = '\f'; break; case 'n': *val = '\n'; break; case 'r': *val = '\r'; break; case 't': *val = '\t'; break; case 'v': *val = '\v'; break; case 'x': { const unsigned long chkval = ULONG_MAX >> 4; unsigned long xval; ch = getc(file); if (!isxdigit(ch)) return FALSE; xval = 0; do { if (isdigit(ch)) ch -= '0'; else switch (ch) { case 'A': case 'a':
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -