Example #1
0
void    free_some_mem( void )
{

    if( token_buf != NULL ) {
        mem_free( token_buf );
    }
    if( alt_ext != NULL ) {
        mem_free( alt_ext );
    }
    if( def_ext != NULL ) {
        mem_free( def_ext );
    }
    if( master_fname != NULL ) {
        mem_free( master_fname );
    }
    if( master_fname_attr != NULL ) {
        mem_free( master_fname_attr );
    }
    if( dev_name != NULL ) {
        mem_free( dev_name );
    }
    if( lay_files != NULL ) {
        laystack * lwk;

        while( lay_files != NULL ) {
            lwk = lay_files->next;
            mem_free( lay_files );
            lay_files = lwk;
        }
    }
    if( out_file != NULL ) {
        mem_free( out_file );
    }
    if( out_file_attr != NULL ) {
        mem_free( out_file_attr );
    }
    if( global_dict != NULL ) {
        free_dict( &global_dict );
    }
    if( macro_dict != NULL ) {
        free_macro_dict( &macro_dict );
    }
    if( ref_dict != NULL ) {
        free_ref_dict( &ref_dict );
    }
    if( fig_dict != NULL ) {
        free_ref_dict( &fig_dict );
    }
    if( fn_dict != NULL ) {
        free_ref_dict( &fn_dict );
    }
    if( tag_dict != NULL ) {
        free_tag_dict( &tag_dict );
    }
    if( index_dict != NULL ) {
        free_index_dict( &index_dict );
    }
    if( buff2 != NULL ) {
        mem_free( buff2 );
    }
    if( workbuf != NULL ) {
        mem_free( workbuf );
    }
    if( t_line != NULL ) {
        add_text_chars_to_pool( t_line );
        add_text_line_to_pool( t_line );
    }
    if( t_element != NULL ) {
        clear_doc_element( t_element );
    }
    if( t_page.top_ban != NULL ) {
        if( t_page.top_ban->first != NULL ) {
            clear_doc_element( t_page.top_ban->first );
            add_doc_el_to_pool( t_page.top_ban->first );
        }
        add_ban_col_to_pool( t_page.top_ban );
    }
    if( t_page.page_width != NULL ) {
        clear_doc_element( t_page.page_width );
        add_doc_el_to_pool( t_page.page_width );
    }
    if( t_page.main != NULL ) {
        if( t_page.main->main != NULL ) {
            clear_doc_element( t_page.main->main );
            add_doc_el_to_pool( t_page.main->main );
        }
        if( t_page.main->bot_fig != NULL ) {
            clear_doc_element( t_page.main->bot_fig );
            add_doc_el_to_pool( t_page.main->bot_fig );
        }
        if( t_page.main->footnote != NULL ) {
            clear_doc_element( t_page.main->footnote );
            add_doc_el_to_pool( t_page.main->footnote );
        }
        add_doc_col_to_pool( t_page.main );
    }
    if( t_page.bot_ban != NULL ) {
        if( t_page.bot_ban->first != NULL ) {
            clear_doc_element( t_page.bot_ban->first );
            add_doc_el_to_pool( t_page.bot_ban->first );
        }
        add_ban_col_to_pool( t_page.bot_ban );
    }
    if( n_page.col_top != NULL ) {
        clear_doc_element( n_page.col_top );
        add_doc_el_to_pool( n_page.col_top );
    }
    if( n_page.col_main != NULL ) {
        clear_doc_element( n_page.col_main );
        add_doc_el_to_pool( n_page.col_main );
    }
    if( n_page.col_bot != NULL ) {
        clear_doc_element( n_page.col_bot );
        add_doc_el_to_pool( n_page.col_bot );
    }
    if( n_page.col_fn != NULL ) {
        clear_doc_element( n_page.col_fn );
        add_doc_el_to_pool( n_page.col_fn );
    }

    free_layout_banner();

    free_pool_storage();

}
Example #2
0
void do_page_out( void )
{
// these were in document_top_banner()
    uint32_t    hs;
    uint32_t    hl;

    /* Set up for the new page */

    if( apage && GlobalFlags.lastpass ) {   // don't do before first page
       fb_document_page();                  // NEWPAGE is interpreted here
    }
    apage++;
    page++;

    /* Get the banner text into the proper sections */

// this was document_top_banner()
    if( ProcFlags.keep_left_margin ) {
        hs = g_cur_h_start;
        hl = g_cur_left;
    }
    g_cur_h_start = g_page_left_org;
    g_cur_left    = g_page_left_org;

    if( t_page.top_banner != NULL ) {
        out_ban_top();
    }

    if( ProcFlags.keep_left_margin ) {
        g_cur_h_start = hs;
        g_cur_left = hl;
    }
// end of former document_top_banner()

    if( t_page.bottom_banner != NULL ) {
        out_ban_bot();
    }

    /* Output the page section by section */

    ProcFlags.page_started = false;
    if( t_page.top_ban != NULL ) {
        do_ban_column_out( t_page.top_ban, g_page_top_org );
        add_ban_col_to_pool( t_page.top_ban );
        t_page.top_ban = NULL;
    }

    if( t_page.page_width != NULL ) {
        set_v_positions( t_page.page_width, g_page_top );
        do_el_list_out( t_page.page_width, 1 );
        t_page.page_width = NULL;
    }

    if( t_page.main != NULL ) {
        do_doc_column_out( t_page.main, t_page.main_top );
        add_doc_col_to_pool( t_page.main );
        t_page.main = NULL;
    }

    if( t_page.bot_ban != NULL ) {
        do_ban_column_out( t_page.bot_ban, g_page_bottom );
        add_ban_col_to_pool( t_page.bot_ban );
        t_page.bot_ban = NULL;
    }

    return;
}