str: New function ds_put_substring_multiple().
[pspp] / src / libpspp / str.h
index 57783e0ea57a7615aa31315f07160d91be978caf..91de05f395264f2d3231ef9d23c82eda9788602f 100644 (file)
@@ -103,6 +103,7 @@ void ss_dealloc (struct substring *);
 /* Mutators.
    Functions that advance the beginning of a string should not be
    used if a substring is to be deallocated. */
+void ss_swap (struct substring *, struct substring *);
 void ss_truncate (struct substring *, size_t);
 size_t ss_rtrim (struct substring *, struct substring trim_set);
 size_t ss_ltrim (struct substring *, struct substring trim_set);
@@ -118,7 +119,7 @@ bool ss_match_byte (struct substring *, char);
 int ss_match_byte_in (struct substring *, struct substring);
 bool ss_match_string (struct substring *, const struct substring);
 int ss_get_byte (struct substring *);
-size_t ss_get_bytes (struct substring *, size_t cnt, struct substring *);
+size_t ss_get_bytes (struct substring *, size_t n, struct substring *);
 bool ss_get_until (struct substring *, char delimiter, struct substring *);
 size_t ss_get_long (struct substring *, long *);
 
@@ -149,6 +150,8 @@ int ss_first_mblen (struct substring);
 ucs4_t ss_get_mb (struct substring *);
 ucs4_t ss_at_mb (struct substring, size_t ofs);
 int ss_at_mblen (struct substring, size_t ofs);
+size_t ss_utf8_count_columns (struct substring);
+struct substring ss_utf8_columns (struct substring, size_t start, size_t n);
 \f
 /* Variable length strings. */
 
@@ -229,7 +232,7 @@ char *ds_steal_cstr (struct string *);
 /* File input. */
 bool ds_read_line (struct string *, FILE *, size_t max_length);
 bool ds_read_config_line (struct string *, int *line_number, FILE *);
-bool ds_read_stream (struct string *, size_t size, size_t cnt, FILE *stream);
+bool ds_read_stream (struct string *, size_t size, size_t n, FILE *stream);
 
 /* Append. */
 void ds_put_byte (struct string *, int ch);
@@ -237,6 +240,7 @@ void ds_put_byte_multiple (struct string *, int ch, size_t);
 void ds_put_unichar (struct string *, ucs4_t uc);
 void ds_put_cstr (struct string *, const char *);
 void ds_put_substring (struct string *, struct substring);
+void ds_put_substring_multiple (struct string *, struct substring, size_t n);
 void ds_put_vformat (struct string *st, const char *, va_list)
      PRINTF_FORMAT (2, 0);
 void ds_put_c_vformat (struct string *st, const char *, va_list)
@@ -278,14 +282,14 @@ ss_cstr (const char *cstr)
   return ss_buffer (cstr, strlen (cstr));
 }
 
-/* Returns a substring whose contents are the CNT characters in
+/* Returns a substring whose contents are the N characters in
    BUFFER. */
 static inline struct substring
-ss_buffer (const char *buffer, size_t cnt)
+ss_buffer (const char *buffer, size_t n)
 {
   struct substring ss;
   ss.string = (char *) buffer;
-  ss.length = cnt;
+  ss.length = n;
   return ss;
 }