Esempio n. 1
0
extern void gml_titlep( const gmltag * entry )
{
    if( ProcFlags.doc_sect_nxt == doc_sect_egdoc ) {
        xx_line_err( err_eof_expected, tok_start );
        return;
    }
    if( !ProcFlags.frontm_seen ) {
        xx_line_err( err_doc_sec_expected_1, tok_start );
        return;
    }
    scr_process_break();
    gml_doc_xxx( doc_sect_titlep );

    add_symvar( &global_dict, "$stitle", "", no_subscript, 0 );// set nullstring
    add_symvar( &global_dict, "$title", "", no_subscript, 0 );// set nullstring

    rs_loc = titlep_tag;
    if( input_cbs->fmflags & II_file ) {    // save line number
        titlep_lineno = input_cbs->s.f->lineno;
    } else if( input_cbs->fmflags & II_tag_mac ) {
        titlep_lineno = input_cbs->s.m->lineno;
    } else {
        titlep_lineno = 0;                  // not clear what to do here
    }
    save_indent = g_indent;
    save_indentr = g_indentr;
    g_indent = 0;
    g_indentr = 0;
    set_h_start();
}
Esempio n. 2
0
extern void gml_index( const gmltag * entry )
{
    if( ProcFlags.doc_sect_nxt == doc_sect_egdoc ) {
        xx_line_err( err_eof_expected, tok_start );
        return;
    }

    if( ProcFlags.doc_sect_nxt == doc_sect_index ) {// duplicate :INDEX tag
        scan_start = scan_stop + 1;     // ignore this call
        return;                         // wgml4 OS/2 crashes with page fault
    }

    if( !((ProcFlags.doc_sect == doc_sect_backm) ||
          (ProcFlags.doc_sect_nxt == doc_sect_backm)) ) {
        xx_line_err( err_doc_sec_expected_1, tok_start );
        return;
    }
    if( !GlobalFlags.index ) {          // index option not active
        return;
    }

    scr_process_break();
    gml_doc_xxx( doc_sect_index );

    /* When gen_index() is finalized, the resets may need to be moved */

    g_indent = 0;
    g_indentr = 0;
    set_h_start();

/// I suspect start_doc_sect() will be needed here!

    gen_index();                        // output the formatted index
}
Esempio n. 3
0
extern void gml_abstract( const gmltag * entry )
{
    if( ProcFlags.doc_sect_nxt == doc_sect_egdoc ) {
        xx_line_err( err_eof_expected, tok_start );
        return;
    }
    if( !ProcFlags.frontm_seen ) {
        xx_line_err( err_doc_sec_expected_1, tok_start );
        return;
    }
    if( blank_lines > 0 ) {
        set_skip_vars( NULL, NULL, NULL, 0, 0 );    // set g_blank_lines
    }
    scr_process_break();
    gml_doc_xxx( doc_sect_abstract );
    g_cur_left = g_page_left;
    g_cur_h_start = g_page_left;

    if( layout_work.hx.hx_sect[hds_abstract].header ) {
        start_doc_sect();                           // a header is enough
    }
    g_indent = 0;
    g_indentr = 0;
    set_h_start();
}
Esempio n. 4
0
void    start_line_with_string( char * text, uint8_t font_num )
{
    text_chars          *   n_char;     // new text char
    size_t                  count;

    count = strlen( text );
    if( count == 0 ) {
        return;
    }
    post_space = 0;
    while( *(text + count - 1) == ' ' ) {   // strip trailing spaces
        post_space++;
        if( --count == 0 ) {
            break;
        }
    }

    n_char = alloc_text_chars( text, count, font_num );

    n_char->x_address = g_cur_h_start;
    ju_x_start = g_cur_h_start;
    input_cbs->fmflags &= ~II_sol;      // no longer start of line

    n_char->width = cop_text_width( n_char->text, n_char->count, font_num );
    /***********************************************************/
    /*  Test if word hits right margin                         */
    /***********************************************************/

    if( n_char->x_address + n_char->width > g_page_right ) {
        process_line_full( t_line, ProcFlags.concat );
        t_line = alloc_text_line();
        set_h_start();
        n_char->x_address = g_cur_h_start;
    }

    if( t_line == NULL ) {
        t_line = alloc_text_line();
    }

    if( t_line->first == NULL ) {        // first element in output line
        t_line->first = n_char;
        t_line->line_height = wgml_fonts[font_num].line_height;
        ju_x_start = n_char->x_address;
        ProcFlags.line_started = true;
    } else {
        t_line->last->next = n_char;
        n_char->prev = t_line->last;
    }
    t_line->last  = n_char;

    g_cur_h_start = n_char->x_address + n_char->width;
    post_space = post_space * wgml_fonts[layout_work.defaults.font].spc_width;
}
Esempio n. 5
0
extern void gml_appendix( const gmltag * entry )
{
    if( blank_lines > 0 ) {
        set_skip_vars( NULL, NULL, NULL, 0, 0 );    // set g_blank_lines
    }
    scr_process_break();
    gml_doc_xxx( doc_sect_appendix );
    ProcFlags.frontm_seen = false;  // no longer in FRONTM section
    if( !ProcFlags.fb_document_done ) { // the very first section/page
        do_layout_end_processing();
    }
    g_indent = 0;
    g_indentr = 0;
    set_h_start();
}
Esempio n. 6
0
extern void gml_etitlep( const gmltag * entry )
{
    tag_cb  *   wk;

    scr_process_break();
    gml_doc_xxx( doc_sect_etitlep );
    rs_loc = 0;
    titlep_lineno = 0;

    if( nest_cb != NULL ) { // guard against no FRONTM, empty TITLEP section
        g_indent = save_indent;
        g_indentr = save_indentr;
        set_h_start();
        wk = nest_cb;
        nest_cb = nest_cb->prev;
        add_tag_cb_to_pool( wk );
    }
}
Esempio n. 7
0
extern void gml_body( const gmltag * entry )
{
    if( blank_lines > 0 ) {
        set_skip_vars( NULL, NULL, NULL, 0, 0 );    // set g_blank_lines
    }
    scr_process_break();
    gml_doc_xxx( doc_sect_body );

    ProcFlags.just_override = true;     // justify for first line ?? TBD
    g_cur_left = g_page_left;
    g_cur_h_start = g_page_left
                    + conv_hor_unit( &layout_work.p.line_indent, g_curr_font );

    ProcFlags.frontm_seen = false;      // no longer in FRONTM section
    if( !ProcFlags.fb_document_done ) { // the very first section/page
        do_layout_end_processing();
    }
    if( layout_work.hx.hx_sect[hds_body].header ) {
        start_doc_sect();                           // a header is enough
    }
    g_indent = 0;
    g_indentr = 0;
    set_h_start();
}
Esempio n. 8
0
void    scr_in( void )
{
    char        *   pa;
    char        *   p;
    int             len;
    char            cwcurr[4];
    bool            scanerr;
    su              indentwork;
    int32_t         newindent;
    int32_t         newindentr;

    cwcurr[0] = SCR_char;
    cwcurr[1] = 'i';
    cwcurr[2] = 'n';
    cwcurr[3] = '\0';

    p = scan_start;
    while( *p && *p == ' ' ) {          // next word start
        p++;
    }
    pa = p;
    while( *p && *p != ' ' ) {          // end of word
        p++;
    }
    len = p - pa;
    if( len == 0 ) {                    // omitted means reset to default
        newindent = 0;
        newindentr = 0;
    } else {
        newindent  = g_indent;          // prepare keeping old values
        newindentr = g_indentr;
        if( *pa == '*' ) {              // keep old indent value
            p = pa + 1;
        } else {

            p = pa;
            scanerr = cw_val_to_su( &p, &indentwork );
            if( scanerr ) {
                g_err( err_miss_inv_opt_value, cwcurr, pa );
                err_count++;
                show_include_stack();
            } else {
                newindent = round_indent( &indentwork );
                if( indentwork.su_relative ) {
                    newindent += g_indent;
                }
                if( newindent < 0 ) {
                    newindent = 0;      // minimum value
                }
            }
        }
        while( *p == ' ' ) {
            p++;
        }
        if( *p == '*' ) {               // keep old indentr value
            p++;
        } else {
            pa = p;
            scanerr = cw_val_to_su( &p, &indentwork );
            if( scanerr ) {
                g_err( err_miss_inv_opt_value, cwcurr, pa );
                err_count++;
                show_include_stack();
            } else {

            /***************************************************************/
            /*  indent right is always relative or 0 for reset to default  */
            /***************************************************************/

                if( indentwork.su_whole + indentwork.su_dec != 0) {
                    newindentr = g_indentr + round_indent( &indentwork );
                } else {
                    newindentr = 0;
                }
            }
        }
    }
    g_indent = newindent;
    g_indentr = newindentr;

    g_page_right = g_page_right_org + g_indentr;
    ProcFlags.keep_left_margin = false;
    set_h_start();                      // apply new values
    scan_restart = p;
    return;
}