X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fdata-in.c;h=45ff609975225bb399827b3401db67192b45d462;hb=28bebf0851bac332b55cdc03e55165dcc8e713c2;hp=d36aefb5e8144bb1e2207fb613d2ec6d897b63c2;hpb=3da49359c52cb783db907cc197847bbd5e721c97;p=pspp-builds.git diff --git a/src/data/data-in.c b/src/data/data-in.c index d36aefb5..45ff6099 100644 --- a/src/data/data-in.c +++ b/src/data/data-in.c @@ -301,44 +301,44 @@ parse_number (struct data_in *i) /* Prefix character may precede sign. */ if (!ss_is_empty (style->prefix)) { - ss_match_char (&i->input, ss_first (style->prefix)); + ss_match_byte (&i->input, ss_first (style->prefix)); ss_ltrim (&i->input, ss_cstr (CC_SPACES)); } /* Sign. */ - if (ss_match_char (&i->input, '-')) + if (ss_match_byte (&i->input, '-')) { - ds_put_char (&tmp, '-'); + ds_put_byte (&tmp, '-'); ss_ltrim (&i->input, ss_cstr (CC_SPACES)); } else { - ss_match_char (&i->input, '+'); + ss_match_byte (&i->input, '+'); ss_ltrim (&i->input, ss_cstr (CC_SPACES)); } /* Prefix character may follow sign. */ if (!ss_is_empty (style->prefix)) { - ss_match_char (&i->input, ss_first (style->prefix)); + ss_match_byte (&i->input, ss_first (style->prefix)); ss_ltrim (&i->input, ss_cstr (CC_SPACES)); } /* Digits before decimal point. */ while (c_isdigit (ss_first (i->input))) { - ds_put_char (&tmp, ss_get_char (&i->input)); + ds_put_byte (&tmp, ss_get_byte (&i->input)); if (style->grouping != 0) - ss_match_char (&i->input, style->grouping); + ss_match_byte (&i->input, style->grouping); } /* Decimal point and following digits. */ - if (ss_match_char (&i->input, style->decimal)) + if (ss_match_byte (&i->input, style->decimal)) { explicit_decimals = true; - ds_put_char (&tmp, '.'); + ds_put_byte (&tmp, '.'); while (c_isdigit (ss_first (i->input))) - ds_put_char (&tmp, ss_get_char (&i->input)); + ds_put_byte (&tmp, ss_get_byte (&i->input)); } /* Exponent. */ @@ -347,28 +347,28 @@ parse_number (struct data_in *i) && strchr ("eEdD-+", ss_first (i->input))) { explicit_decimals = true; - ds_put_char (&tmp, 'e'); + ds_put_byte (&tmp, 'e'); if (strchr ("eEdD", ss_first (i->input))) { ss_advance (&i->input, 1); - ss_match_char (&i->input, ' '); + ss_match_byte (&i->input, ' '); } if (ss_first (i->input) == '-' || ss_first (i->input) == '+') { - if (ss_get_char (&i->input) == '-') - ds_put_char (&tmp, '-'); - ss_match_char (&i->input, ' '); + if (ss_get_byte (&i->input) == '-') + ds_put_byte (&tmp, '-'); + ss_match_byte (&i->input, ' '); } while (c_isdigit (ss_first (i->input))) - ds_put_char (&tmp, ss_get_char (&i->input)); + ds_put_byte (&tmp, ss_get_byte (&i->input)); } /* Suffix character. */ if (!ss_is_empty (style->suffix)) - ss_match_char (&i->input, ss_first (style->suffix)); + ss_match_byte (&i->input, ss_first (style->suffix)); if (!ss_is_empty (i->input)) { @@ -420,7 +420,7 @@ parse_N (struct data_in *i) int c; i->output->f = 0; - while ((c = ss_get_char (&i->input)) != EOF) + while ((c = ss_get_byte (&i->input)) != EOF) { if (!c_isdigit (c)) return xstrdup (_("All characters in field must be digits.")); @@ -439,7 +439,7 @@ parse_PIBHEX (struct data_in *i) n = 0.0; - while ((c = ss_get_char (&i->input)) != EOF) + while ((c = ss_get_byte (&i->input)) != EOF) { if (!c_isxdigit (c)) return xstrdup (_("Unrecognized character in field.")); @@ -460,8 +460,8 @@ parse_RBHEX (struct data_in *i) memset (&d, 0, sizeof d); for (j = 0; !ss_is_empty (i->input) && j < sizeof d; j++) { - int hi = ss_get_char (&i->input); - int lo = ss_get_char (&i->input); + int hi = ss_get_byte (&i->input); + int lo = ss_get_byte (&i->input); if (lo == EOF) return xstrdup (_("Field must have even length.")); else if (!c_isxdigit (hi) || !c_isxdigit (lo)) @@ -520,22 +520,22 @@ parse_Z (struct data_in *i) ds_init_empty (&tmp); ds_extend (&tmp, 64); - ds_put_char (&tmp, '+'); + ds_put_byte (&tmp, '+'); while (!ss_is_empty (i->input)) { - int c = ss_get_char (&i->input); + int c = ss_get_byte (&i->input); if (c_isdigit (c) && !got_final_digit) - ds_put_char (&tmp, c); + ds_put_byte (&tmp, c); else if (is_z_digit (c) && !got_final_digit) { - ds_put_char (&tmp, z_digit_value (c) + '0'); + ds_put_byte (&tmp, z_digit_value (c) + '0'); if (is_negative_z_digit (c)) ds_data (&tmp)[0] = '-'; got_final_digit = true; } else if (c == '.' && !got_dot) { - ds_put_char (&tmp, '.'); + ds_put_byte (&tmp, '.'); got_dot = true; } else @@ -623,7 +623,7 @@ parse_PIB (struct data_in *i) static void get_nibbles (struct substring *s, int *high_nibble, int *low_nibble) { - int c = ss_get_char (s); + int c = ss_get_byte (s); assert (c != EOF); *high_nibble = (c >> 4) & 15; *low_nibble = c & 15; @@ -721,8 +721,8 @@ parse_AHEX (struct data_in *i) for (j = 0; ; j++) { - int hi = ss_get_char (&i->input); - int lo = ss_get_char (&i->input); + int hi = ss_get_byte (&i->input); + int lo = ss_get_byte (&i->input); if (hi == EOF) break; else if (lo == EOF) @@ -799,11 +799,11 @@ parse_time_units (struct data_in *i, double seconds_per_unit, if (*time_sign == SIGN_NO_TIME) { - if (ss_match_char (&i->input, '-')) + if (ss_match_byte (&i->input, '-')) *time_sign = SIGN_NEGATIVE; else { - ss_match_char (&i->input, '+'); + ss_match_byte (&i->input, '+'); *time_sign = SIGN_POSITIVE; } } @@ -839,7 +839,7 @@ static struct substring parse_name_token (struct data_in *i) { struct substring token; - ss_get_chars (&i->input, ss_span (i->input, ss_cstr (CC_LETTERS)), &token); + ss_get_bytes (&i->input, ss_span (i->input, ss_cstr (CC_LETTERS)), &token); return token; } @@ -949,7 +949,7 @@ parse_yday (struct data_in *i, long *yday) struct substring num_s; long num; - ss_get_chars (&i->input, 3, &num_s); + ss_get_bytes (&i->input, 3, &num_s); if (ss_span (num_s, ss_cstr (CC_DIGITS)) != 3) return xstrdup (_("Julian day must have exactly three digits.")); else if (!ss_get_long (&num_s, &num) || num < 1 || num > 366) @@ -1041,11 +1041,11 @@ parse_minute_second (struct data_in *i, double *time) /* Parse seconds. */ cp = buf; while (c_isdigit (ss_first (i->input))) - *cp++ = ss_get_char (&i->input); - if (ss_match_char (&i->input, settings_get_decimal_char (FMT_F))) + *cp++ = ss_get_byte (&i->input); + if (ss_match_byte (&i->input, settings_get_decimal_char (FMT_F))) *cp++ = '.'; while (c_isdigit (ss_first (i->input))) - *cp++ = ss_get_char (&i->input); + *cp++ = ss_get_byte (&i->input); *cp = '\0'; *time += strtod (buf, NULL); @@ -1192,8 +1192,8 @@ parse_date (struct data_in *i) break; default: assert (count == 1); - if (!ss_match_char (&i->input, c_toupper (ch)) - && !ss_match_char (&i->input, c_tolower (ch))) + if (!ss_match_byte (&i->input, c_toupper (ch)) + && !ss_match_byte (&i->input, c_tolower (ch))) error = xasprintf (_("`%c' expected in date field."), ch); else error = NULL;