X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fctables.c;h=2611bfebb3a53cbc21fb18e9ce9f546790b2c0e7;hp=25908eb65d5fa14626fd3b34e771ef7f2b909645;hb=c8c6f68d798526347916230cae33aafb149dd044;hpb=9574a6c2bf65ddc8ef13d4e942833bc5d4b0d2e0 diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index 25908eb65d..2611bfebb3 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -4283,11 +4283,21 @@ ctables_pcexpr_evaluate (const struct ctables_pcexpr_evaluate_ctx *ctx, 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); + + const struct ctables_category *category + = ctables_find_category_for_postcompute ( + ctx->section->table->ctables->dict, + ctx->cats, ctx->parse_format, e); + assert (category != NULL); + + struct ctables_cell_value cv = { .category = category }; + if (category->type == CCT_NUMBER) + cv.value.f = category->number; + else if (category->type == CCT_STRING) + cv.value.s = CHAR_CAST (uint8_t *, s ? s : e->string.string); + else + NOT_REACHED (); + double retval = ctables_pcexpr_evaluate_category (ctx, &cv); free (s); return retval;