X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcase.h;h=190073973a72ec831ff9e7f4906c65c0592311bb;hb=80938eea690eaded701078c65f1fdae956c76233;hp=4b20d477d6a2b66b1e6cf98a99ed820dc547e3f4;hpb=771599745cfe2a306dc45f2f299b9bfbfa19601b;p=pspp diff --git a/src/data/case.h b/src/data/case.h index 4b20d477d6..190073973a 100644 --- a/src/data/case.h +++ b/src/data/case.h @@ -23,6 +23,7 @@ #include #include "libpspp/compiler.h" +#include "libpspp/str.h" #include "data/caseproto.h" struct variable; @@ -66,7 +67,7 @@ struct ccase *case_ref (const struct ccase *) WARN_UNUSED_RESULT; static inline void case_unref (struct ccase *); static inline bool case_is_shared (const struct ccase *); -static inline size_t case_get_value_cnt (const struct ccase *); +static inline size_t case_get_n_values (const struct ccase *); static inline const struct caseproto *case_get_proto (const struct ccase *); size_t case_get_cost (const struct caseproto *); @@ -81,7 +82,7 @@ void case_set_missing (struct ccase *); void case_copy (struct ccase *dst, size_t dst_idx, const struct ccase *src, size_t src_idx, - size_t cnt); + size_t n_values); void case_copy_out (const struct ccase *, size_t start_idx, union value *, size_t n_values); void case_copy_in (struct ccase *, @@ -94,9 +95,13 @@ union value *case_data_rw_idx (struct ccase *, size_t idx); double case_num (const struct ccase *, const struct variable *); double case_num_idx (const struct ccase *, size_t idx); +double *case_num_rw (struct ccase *, const struct variable *); +double *case_num_rw_idx (struct ccase *, size_t idx); const uint8_t *case_str (const struct ccase *, const struct variable *); const uint8_t *case_str_idx (const struct ccase *, size_t idx); +struct substring case_ss (const struct ccase *, const struct variable *); +struct substring case_ss_idx (const struct ccase *, size_t width, size_t idx); uint8_t *case_str_rw (struct ccase *, const struct variable *); uint8_t *case_str_rw_idx (struct ccase *, size_t idx); @@ -121,7 +126,7 @@ void case_unref__ (struct ccase *); This function should be used before attempting to modify any of the data in a case that might be shared, e.g.: c = case_unshare (c); // Make sure that C is not shared. - case_data_rw (c, myvar)->f = 1; // Modify data in C. + *case_num_rw (c, myvar) = 1; // Modify data in C. */ static inline struct ccase * case_unshare (struct ccase *c) @@ -153,7 +158,7 @@ case_is_shared (const struct ccase *c) /* Returns the number of union values in C. */ static inline size_t -case_get_value_cnt (const struct ccase *c) +case_get_n_values (const struct ccase *c) { return caseproto_get_n_widths (c->proto); }