X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fctables.c;h=a69e8d56593a035aad6e6fba5c249681a8c45387;hb=49c7604863a430c263b6a21440849bf61db6764a;hp=3b7dc24d1051daded14b47a9fc25fc6f6c42263f;hpb=a8104edb824e61d70ed2b7314be80e860a5f2002;p=pspp diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index 3b7dc24d10..a69e8d5659 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -4261,7 +4261,6 @@ ctables_pcexpr_evaluate (const struct ctables_pcexpr_evaluate_ctx *ctx, } case CTPO_CAT_NUMBER: - case CTPO_CAT_STRING: case CTPO_CAT_MISSING: case CTPO_CAT_OTHERNM: case CTPO_CAT_SUBTOTAL: @@ -4275,6 +4274,25 @@ ctables_pcexpr_evaluate (const struct ctables_pcexpr_evaluate_ctx *ctx, return ctables_pcexpr_evaluate_category (ctx, &cv); } + case CTPO_CAT_STRING: + { + int width = var_get_width (ctx->section->nests[ctx->pc_a]->vars[ctx->pc_a_idx]); + char *s = NULL; + if (width > e->string.length) + { + s = xmalloc (width); + buf_copy_rpad (s, width, e->string.string, e->string.length, ' '); + } + struct ctables_cell_value cv = { + .category = ctables_find_category_for_postcompute (ctx->section->table->ctables->dict, ctx->cats, ctx->parse_format, e), + .value = { .s = CHAR_CAST (uint8_t *, s ? s : e->string.string) }, + }; + assert (cv.category != NULL); + double retval = ctables_pcexpr_evaluate_category (ctx, &cv); + free (s); + return retval; + } + case CTPO_ADD: return ctables_pcexpr_evaluate_nonterminal (ctx, e, 2, ctpo_add);