X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fspv%2Fspv.c;h=7a3dae4d3d4a733834bf534534a1483b9ae9772e;hb=df1d194af32e35739355981252785e768f21ebb0;hp=f37dff17f2173a455427afc6d3557ce715ba6e5b;hpb=507ebaea36737618ef8265a60cd3e9005d9f3457;p=pspp diff --git a/src/output/spv/spv.c b/src/output/spv/spv.c index f37dff17f2..7a3dae4d3d 100644 --- a/src/output/spv/spv.c +++ b/src/output/spv/spv.c @@ -282,17 +282,18 @@ decode_container_text (const struct spvsx_container_text *ct) { struct font_style *font_style = xmalloc (sizeof *font_style); char *text = decode_embedded_html (ct->html->node_.raw, font_style); + struct pivot_value *value = xmalloc (sizeof *value); *value = (struct pivot_value) { - .font_style = font_style, - .type = PIVOT_VALUE_TEXT, .text = { + .type = PIVOT_VALUE_TEXT, .local = text, .c = text, .id = text, .user_provided = true, }, }; + pivot_value_ex_rw (value)->font_style = font_style; struct output_item *item = text_item_create_value (TEXT_ITEM_LOG, value, NULL); @@ -320,6 +321,9 @@ decode_page_paragraph (const struct spvsx_page_paragraph *page_paragraph, { memset (ph, 0, sizeof *ph); + if (!page_paragraph) + return; + const struct spvsx_page_paragraph_text *page_paragraph_text = page_paragraph->page_paragraph_text; if (!page_paragraph_text) @@ -463,55 +467,6 @@ spv_read_xml_member (struct zip_reader *zip, const char *xml_member, return NULL; } -#if 0 -static const char * -identify_item (const struct output_item *item) -{ - return (item->label ? item->label - : item->command_id ? item->command_id - : spv_item_type_to_string (item->type)); -} - -void -spv_item_format_path (const struct spv_item *item, struct string *s) -{ - enum { MAX_STACK = 32 }; - const struct spv_item *stack[MAX_STACK]; - size_t n = 0; - - while (item != NULL && item->parent && n < MAX_STACK) - { - stack[n++] = item; - item = item->parent; - } - - while (n > 0) - { - item = stack[--n]; - ds_put_byte (s, '/'); - - const char *name = identify_item (item); - ds_put_cstr (s, name); - - if (item->parent) - { - size_t total = 1; - size_t index = 1; - for (size_t i = 0; i < item->parent->n_children; i++) - { - const struct spv_item *sibling = item->parent->children[i]; - if (sibling == item) - index = total; - else if (!strcmp (name, identify_item (sibling))) - total++; - } - if (total > 1) - ds_put_format (s, "[%zu]", index); - } - } -} -#endif - static char * WARN_UNUSED_RESULT pivot_table_open_legacy (struct zip_reader *zip, const char *bin_member, const char *xml_member, const char *subtype, @@ -722,6 +677,10 @@ spv_decode_children (struct zip_reader *zip, const char *structure_member, { const struct spvsx_container *container = spvsx_cast_container (node); + + if (container->page_break_before_present) + group_item_add_child (parent, page_break_item_create ()); + child = spv_decode_container (zip, container); } else if (spvsx_is_heading (node)) @@ -883,7 +842,6 @@ spv_read (const char *filename, struct output_item **outp, if (psp) *psp = NULL; - struct spv_reader *spv = xzalloc (sizeof *spv); struct zip_reader *zip; char *error = zip_reader_create (filename, &zip); if (error) @@ -927,15 +885,13 @@ spv_decode_fmt_spec (uint32_t u32, struct fmt_spec *out) uint8_t w = u32 >> 8; uint8_t d = u32; - msg_disable (); *out = (struct fmt_spec) { .type = FMT_F, .w = w, .d = d }; bool ok = raw_type >= 40 || fmt_from_io (raw_type, &out->type); if (ok) { fmt_fix_output (out); - ok = fmt_check_width_compat (out, 0); + ok = fmt_check_width_compat (*out, 0); } - msg_enable (); if (!ok) {