• Patch: Elm ME+ 2.5 PLalpha64 -> Elm ME+ 2.5 PLalpha65 [1/2] (3/4)

    From Kari Hurtta@21:1/5 to All on Mon Dec 2 19:15:31 2024
    [continued from previous message]

    ! if (TAGFILTER_CMD_magic != stack[idx]->current_tag->magic) ! mime_panic(__FILE__,__LINE__,"new_html_item_hlp2",
    ! "Bad magic number (tagfilter_cmd,stack[idx]->current_tag)");
    ! cmd = stack[idx]->current_tag->ascii_command;
    ! cmd_code = stack[idx]->current_tag->code;
    ! }
    !
    ! if (html_item->list_depth > 0) {
    !
    ! list_depth = html_item->list_depth;
    ! next_item_number = html_item->next_item_number;
    ! type_item_number = html_item->type_item_number;
    ! list_code = cmd_code.html;
    !
    ! DPRINT(Debug,21,(&Debug,
    ! "new_html_item_hlp2: tfc_html_li: #%zu %s list_depth=%u",
    ! idx,
    ! cmd ? cmd : "",
    ! list_depth));
    ! if (next_item_number) {
    !
    ! if (html_item->reversed_item_number) {
    ! if (html_item->item_number_set)
    ! html_item->next_item_number--; /* Decrement for <ol> <li> */
    ! else
    ! bad = 1;
    ! } else
    ! html_item->next_item_number++; /* Increment for <ol> <li> */
    !
    ! DPRINT(Debug,21,(&Debug," net_item_number=%d",
    ! next_item_number));
    ! }
    ! if (list_code) {
    ! DPRINT(Debug,21,(&Debug," list_code=%d",
    ! list_code));
    !
    ! switch (list_code) {
    ! case tfc_html_unsupported:
    ! DPRINT(Debug,21,(&Debug," tfc_html_unsupported")); break;
    ! case tfc_html_none:
    ! DPRINT(Debug,21,(&Debug," tfc_html_none")); break;
    ! case tfc_html_br: DPRINT(Debug,21,(&Debug," tfc_html_br")); break;
    ! case tfc_html_hr: DPRINT(Debug,21,(&Debug," tfc_html_hr")); break;
    ! case tfc_html_p: DPRINT(Debug,21,(&Debug," tfc_html_p")); break;
    ! case tfc_html_pre:
    ! DPRINT(Debug,21,(&Debug," tfc_html_pre")); break;
    ! case tfc_html_q: DPRINT(Debug,21,(&Debug," tfc_html_q")); break;
    ! case tfc_html_li: DPRINT(Debug,21,(&Debug," tfc_html_li")); break;
    ! case tfc_html_ul: DPRINT(Debug,21,(&Debug," tfc_html_ul")); break;
    ! case tfc_html_ol: DPRINT(Debug,21,(&Debug," tfc_html_ol")); break;
    ! case tfc_html_img:
    ! DPRINT(Debug,21,(&Debug," tfc_html_img")); break;
    ! }
    ! }
    ! DPRINT(Debug,21,(&Debug,"\n"));
    !
    ! switch (list_code) {
    !
    ! case tfc_html_ul:
    !
    ! switch (list_depth) {
    ! case 0:
    ! break;
    ! case 1:
    ! state_puts("* ",state_out);
    ! break;
    ! case 2:
    ! state_puts("+ ",state_out);
    ! break;
    ! default:
    ! state_puts("- ",state_out);
    ! break;
    ! }
    !
    ! break;
    !
    ! case tfc_html_ol:
    ! /* need formatting */

    + if (tag_state) {
    + if (TAGFILTER_TAG_STATE_magic != tag_state->magic) + mime_panic(__FILE__,__LINE__,"new_html_item_hlp2",
    + "Bad magic number (tagfilter_tag_state)");
    +
    +
    + if (!tag_state->u.html)
    + tag_state->u.html = tagfilter_new_html_state(); +
    + if (TAGFILTER_HTML_STATE_magic != tag_state->u.html->magic)
    + mime_panic(__FILE__,__LINE__,"new_html_item_hlp2",
    + "Bad magic number (tagfilter_html_state)");
    +
    + if (tag_state->u.html->ol_stack)
    + tagfilter_free_stack_html_item(& (tag_state->u.html->ol_stack));
    +
    +
    + tag_state->u.html->ol_stack = html_item;
    + tagfilter_inc_stack_html_item_refcount(tag_state->u.html->ol_stack);
    + if (! bad) {
    + tag_state->u.html->li_value = next_item_number;
    + tag_state->u.html->ol_type_value = type_item_number;
    + tag_state->u.html->default_li_value = 1;
    + } else {
    + tag_state->u.html->bad_li_value = 1;
    + }
    +
    + } else {
    + goto html_li_fail;
    + }
    +
    + break;
    +
    + default:
    + case tfc_html_unsupported:
    + /* Not supported list type */
    + goto html_li_fail;
    + }
    + } else
    + goto html_li_fail;
    + } else
    + goto html_li_fail;
    + } else {
    + html_li_fail:
    + if (unsupport) {
    + DPRINT(Debug,21,(&Debug,
    + "new_html_item_hlp2: tfc_html_li: mark unsupported\n"));
    +
    +
    + *unsupport = 1;
    + }
    +
    + }
    +
    + break;
    + case tfc_html_ul:
    + next_item_number = 0;
    + type_item_number = atr_type_none;
    +
    + if (next_item_number) {
    + case tfc_html_ol:
    + next_item_number = 1;
    + type_item_number = atr_type_decimal;
    + }
    +
    + if (stack_item) {
    +
    + unsigned int list_depth = 0;
    + struct tagfilter_stack_html_item * html_item2;
    +
    + if (TAGFILTER_STACK_ITEM_magic != stack_item->magic)
    + mime_panic(__FILE__,__LINE__,"new_html_item_hlp2",
    + "Bad magic number (tagfilter_stack_item,stack_item)");
    +
    + /* stack_item is not yet added to stack */
    +
    + if (stack && stack_len) {
    + size_t idx = stack_len;
    +
    + DPRINT(Debug,21,(&Debug,
    + "new_html_item_hlp2: tfc_html_ul/ol: stack_len = %zu\n",
    + stack_len));
    +
    + while (idx > 0) {
    + char * cmd = NULL;
    +
    +
    + idx --;
    +
    + if (TAGFILTER_STACK_ITEM_magic != stack[idx]->magic)
    + mime_panic(__FILE__,__LINE__,"new_html_item_hlp2",
    + "Bad magic number (tagfilter_stack_item,stack[idx])");
    +
    + if (stack[idx]->current_tag) {
    + if (TAGFILTER_CMD_magic != stack[idx]->current_tag->magic)
    + mime_panic(__FILE__,__LINE__,"new_html_item_hlp2", + "Bad magic number (tagfilter_cmd,stack[idx]->current_tag)");
    + cmd = stack[idx]->current_tag->ascii_command;
    + }
    +
    + if (stack[idx]->u.html) {
    + struct tagfilter_stack_html_item * html_item;
    +
    + if (TAGFILTER_STACK_HTML_ITEM_magic != stack[idx]->u.html->magic)
    + mime_panic(__FILE__,__LINE__,
    + "new_html_item_hlp2",
    + "Bad magic number (tagfilter_stack_html_item)");
    +
    + html_item = stack[idx]->u.html;
    +
    + if (html_item->list_depth > 0) {
    +
    + list_depth = html_item->list_depth;
    +
    + DPRINT(Debug,21,(&Debug,
    + "new_html_item_hlp2: tfc_html_ul/ol: #%zu %s list_depth=%u\n",
    + idx,
    + cmd ? cmd : "",
    + list_depth));
    + break;
    + }
    + }
    + }
    + }
    +
    + list_depth++;
    +
    + html_item2 = tagfilter_give_stack_html_item(stack_item);
    +
    + if (TAGFILTER_STACK_HTML_ITEM_magic != html_item2->magic)
    + mime_panic(__FILE__,__LINE__,
    + "new_html_item_hlp2",
    + "Bad magic number (tagfilter_stack_html_item)");
    +
    +
    + DPRINT(Debug,21,(&Debug,
    + "new_html_item_hlp2: tfc_html_ul/ol: Setting list_depth %u\n",
    + list_depth));
    +
    + html_item2->list_depth = list_depth;
    +
    + if (next_item_number) {
    +
    + DPRINT(Debug,21,(&Debug,
    + "new_html_item_hlp2: tfc_html_ul/ol: Setting next_item_number %u\n",
    + next_item_number));
    +
    + html_item2->next_item_number = next_item_number;
    + /* Default value -- with reversed should be number of
    + list items -- that is not supported
    + */
    + }
    +
    + if (type_item_number) {
    + html_item2->type_item_number = type_item_number;
    + }
    +
    + } else {
    + DPRINT(Debug,21,(&Debug,
    + "new_html_item_hlp2: tfc_html_ul/ol: no current stack_item\n"));
    + }
    +
    + break;

    + case tfc_html_img:
    + break;
    }

    }
    ***************
    *** 2595,2601 ****
    struct tagfilter_tags * used_tags,
    int inherit_pg_flags,
    int text_visible,
    ! const struct decode_opts * decode_opt
    ));
    static struct tagfilter_stack_item *
    process_new_html_item2(current_tag,prev_range,
    --- 3076,3084 ----
    struct tagfilter_tags * used_tags,
    int inherit_pg_flags,
    int text_visible,
    ! const struct decode_opts * decode_opt,
    ! struct tagfilter_stack_item **stack,
    ! size_t stack_len
    ));
    static struct tagfilter_stack_item *
    process_new_html_item2(current_tag,prev_range,
    ***************
    *** 2605,2611 ****
    used_tags,
    inherit_pg_flags,
    text_visible,
    ! decode_opt
    )
    struct tagfilter_cmd * current_tag;
    struct pager_range * prev_range;
    --- 3088,3095 ----
    used_tags,
    inherit_pg_flags,
    text_visible,
    ! decode_opt,
    ! stack,stack_len
    )
    struct tagfilter_cmd * current_tag;
    struct pager_range * prev_range;
    ***************
    *** 2617,2626 ****
    --- 3101,3114 ----