Beispiel #1
0
void    lay_abspref( lay_tag ltag )
{
    char            *   p;
    condcode            cc;
    int                 k;
    lay_att             curr;
    att_args            l_args;
    int                 cvterr;
    lay_sub             x_tag;
    abspref_lay_tag *   ap;

    p = scan_start;
    cvterr = false;

    if( !GlobalFlags.firstpass ) {
        scan_start = scan_stop;
        eat_lay_sub_tag();
        return;                         // process during first pass only
    }
    switch( ltag ) {
    case LAY_TAG_ABSTRACT:
        x_tag = el_abstract;
        ap = &layout_work.abstract;
        break;
    case LAY_TAG_PREFACE:
        x_tag = el_preface;
        ap = &layout_work.preface;
        break;
    default:
        out_msg( "WGML logic error glabsprf.c.\n");
        file_mac_info();
        err_count++;
        break;
    }
    if( ProcFlags.lay_xxx != x_tag ) {
        ProcFlags.lay_xxx = x_tag;
    }
    cc = get_lay_sub_and_value( &l_args );  // get att with value
    while( cc == pos ) {
        cvterr = -1;
        for( k = 0, curr = abspref_att[k]; curr > 0; k++, curr = abspref_att[k] ) {

            if( !strnicmp( att_names[curr], l_args.start[0], l_args.len[0] ) ) {
                p = l_args.start[1];

                switch( curr ) {
                case   e_post_skip:
                    cvterr = i_space_unit( p, curr, &(ap->post_skip) );
                    break;
                case   e_pre_top_skip:
                    cvterr = i_space_unit( p, curr, &(ap->pre_top_skip) );
                    break;
                case   e_font:
                    cvterr = i_font_number( p, curr, &(ap->font) );
                    if( ap->font >= wgml_font_cnt ) ap->font = 0;
                    break;
                case   e_spacing:
                    cvterr = i_int8( p, curr, &(ap->spacing) );
                    break;
                case   e_header:
                    cvterr = i_yes_no( p, curr, &(ap->header) );
                    break;
                case   e_abstract_string:
                    if( x_tag == el_abstract ) {
                        cvterr = i_xx_string( p, curr, ap->string );
                    }
                    break;
                case   e_preface_string:
                    if( x_tag == el_preface ) {
                        cvterr = i_xx_string( p, curr, ap->string );
                    }
                    break;
                case   e_page_eject:
                    cvterr = i_page_eject( p, curr, &(ap->page_eject) );
                    break;
                case   e_page_reset:
                    cvterr = i_yes_no( p, curr, &(ap->page_reset) );
                    break;
                case   e_columns:
                    cvterr = i_int8( p, curr, &(ap->columns) );
                    break;
                default:
                    out_msg( "WGML logic error.\n");
                    cvterr = true;
                    break;
                }
                if( cvterr ) {          // there was an error
                    err_count++;
                    g_err( err_att_val_inv );
                    file_mac_info();
                }
                break;                  // break out of for loop
            }
        }
        if( cvterr < 0 ) {
            err_count++;
            g_err( err_att_name_inv );
            file_mac_info();
        }
        cc = get_lay_sub_and_value( &l_args );  // get one with value
    }
    scan_start = scan_stop;
    return;
}
Beispiel #2
0
void    lay_tochx( const gmltag * entry )
{
    char        *   p;
    condcode        cc;
    int             k;
    lay_att         curr;
    att_args        l_args;
    int             cvterr;
    int             hx_l;

    p = scan_start;

    if( !GlobalFlags.firstpass ) {
        scan_start = scan_stop + 1;
        eat_lay_sub_tag();
        return;                         // process during first pass only
    }
    switch( entry->tagname[4] ) {
    case   '0':
        hx_l = el_toch0;
        break;
    case   '1':
        hx_l = el_toch1;
        break;
    case   '2':
        hx_l = el_toch2;
        break;
    case   '3':
        hx_l = el_toch3;
        break;
    case   '4':
        hx_l = el_toch4;
        break;
    case   '5':
        hx_l = el_toch5;
        break;
    case   '6':
        hx_l = el_toch6;
        break;
    default:
        hx_l = el_toch6;
        break;
    }
    if( ProcFlags.lay_xxx != hx_l ) {
        ProcFlags.lay_xxx = hx_l;
    }

    hx_l = entry->tagname[4] - '0';     // construct TOCHx level
    if( hx_l > 6 ) {
        hx_l = 6;
        out_msg( "WGML logic error in glhx.c\n" );
        err_count++;
    }

    cc = get_lay_sub_and_value( &l_args );  // get one with value
    while( cc == pos ) {
        cvterr = -1;
        for( k = 0, curr = tochx_att[k]; curr > 0; k++, curr = tochx_att[k] ) {

            if( !strnicmp( att_names[curr], l_args.start[0], l_args.len[0] ) ) {
                p = l_args.start[1];

                switch( curr ) {
                case   e_group:
                    cvterr = i_int8( p, curr, &layout_work.tochx[hx_l].group );
                    break;
                case   e_indent:
                    cvterr = i_space_unit( p, curr,
                                           &layout_work.tochx[hx_l].indent );
                    break;
                case   e_skip:
                    cvterr = i_space_unit( p, curr,
                                           &layout_work.tochx[hx_l].skip );
                    break;
                case   e_pre_skip:
                    cvterr = i_space_unit( p, curr,
                                           &layout_work.tochx[hx_l].pre_skip );
                    break;
                case   e_post_skip:
                    cvterr = i_space_unit( p, curr,
                                           &layout_work.tochx[hx_l].post_skip );
                    break;
                case   e_font:
                    cvterr = i_font_number( p, curr, &layout_work.tochx[hx_l].font );
                    if( layout_work.tochx[hx_l].font >= wgml_font_cnt ) {
                        layout_work.tochx[hx_l].font = 0;
                    }
                    break;
                case   e_align:
                    cvterr = i_space_unit( p, curr,
                                           &layout_work.tochx[hx_l].align );
                    break;
                case   e_display_in_toc:
                    cvterr = i_yes_no( p, curr,
                                     &layout_work.tochx[hx_l].display_in_toc );
                    break;
                default:
                    out_msg( "WGML logic error.\n");
                    cvterr = true;
                    break;
                }
                if( cvterr ) {          // there was an error
                    err_count++;
                    g_err( err_att_val_inv );
                    file_mac_info();
                }
                break;                  // break out of for loop
            }
        }
        if( cvterr < 0 ) {
            err_count++;
            g_err( err_att_name_inv );
            file_mac_info();
        }
        cc = get_lay_sub_and_value( &l_args );  // get one with value
    }
    scan_start = scan_stop + 1;
    return;
}
Beispiel #3
0
void    lay_appendix( const gmltag * entry )
{
    char            *   p;
    condcode            cc;
    int                 k;
    lay_att             curr;
    att_args            l_args;
    int                 cvterr;

    p = scan_start;
    cvterr = false;

    if( !GlobalFlags.firstpass ) {
        scan_start = scan_stop + 1;
        eat_lay_sub_tag();
        return;                         // process during first pass only
    }
    if( ProcFlags.lay_xxx != el_appendix ) {
        ProcFlags.lay_xxx = el_appendix;
    }
    cc = get_lay_sub_and_value( &l_args );  // get att with value
    while( cc == pos ) {
        cvterr = -1;
        for( k = 0, curr = appendix_att[k]; curr > 0; k++, curr = appendix_att[k] ) {

            if( !strnicmp( att_names[curr], l_args.start[0], l_args.len[0] ) ) {
                p = l_args.start[1];

                switch( curr ) {
                case   e_indent:
                    cvterr = i_space_unit( p, curr,
                                    &layout_work.hx.hx_head[hds_appendix].indent );
                    break;
                case   e_pre_top_skip:
                    cvterr = i_space_unit( p, curr,
                                &layout_work.hx.hx_sect[hds_appendix].pre_top_skip );
                    break;
                case   e_pre_skip:
                    cvterr = i_space_unit( p, curr,
                                    &layout_work.hx.hx_head[hds_appendix].pre_skip );
                    break;
                case   e_post_skip:
                    cvterr = i_space_unit( p, curr,
                                    &layout_work.hx.hx_sect[hds_appendix].post_skip );
                    break;
                case   e_spacing:
                    cvterr = i_int8( p, curr,
                                    &layout_work.hx.hx_sect[hds_appendix].spacing );
                    break;
                case   e_font:
                    cvterr = i_font_number( p, curr,
                                        &layout_work.hx.hx_sect[hds_appendix].text_font );
                    if( layout_work.hx.hx_sect[hds_appendix].text_font >= wgml_font_cnt ) {
                        layout_work.hx.hx_sect[hds_appendix].text_font = 0;
                    }
                    break;
                case   e_number_font:
                    cvterr = i_font_number( p, curr,
                                &layout_work.hx.hx_head[hds_appendix].number_font );
                    if( layout_work.hx.hx_head[hds_appendix].number_font >= wgml_font_cnt ) {
                        layout_work.hx.hx_head[hds_appendix].number_font = 0;
                    }
                    break;
                case   e_number_form:
                    cvterr = i_number_form( p, curr,
                                &layout_work.hx.hx_head[hds_appendix].number_form );
                    break;
                case   e_page_position:
                    cvterr = i_page_position( p, curr,
                                &layout_work.hx.hx_head[hds_appendix].line_position );
                    break;
                case   e_number_style:
                    cvterr = i_number_style( p, curr,
                                &layout_work.hx.hx_head[hds_appendix].number_style );
                    break;
                case   e_page_eject:
                    cvterr = i_page_eject( p, curr,
                                &layout_work.hx.hx_head[hds_appendix].page_eject );
                    break;
                case   e_line_break:
                    cvterr = i_yes_no( p, curr,
                                &layout_work.hx.hx_head[hds_appendix].line_break );
                    break;
                case   e_display_heading:
                    cvterr = i_yes_no( p, curr,
                            &layout_work.hx.hx_head[hds_appendix].display_heading );
                    break;
                case   e_number_reset:
                    cvterr = i_yes_no( p, curr,
                                &layout_work.hx.hx_head[hds_appendix].number_reset );
                    break;
                case   e_case:
                    cvterr = i_case( p, curr,
                                     &layout_work.hx.hx_head[hds_appendix].hd_case );
                    break;
                case   e_align:
                    cvterr = i_space_unit( p, curr,
                                        &layout_work.hx.hx_head[hds_appendix].align );
                    break;
                case   e_header:
                    cvterr = i_yes_no( p, curr,
                                       &layout_work.hx.hx_sect[hds_appendix].header );
                    break;
                case   e_appendix_string:
                    cvterr = i_xx_string( p, curr, &layout_work.appendix.string );
                    break;
                case   e_page_reset:
                    cvterr = i_yes_no( p, curr, &layout_work.appendix.page_reset );
                    break;
                case   e_section_eject:
                    cvterr = i_page_eject( p, curr,
                                                &layout_work.appendix.section_eject );
                    break;
                case   e_columns:
                    cvterr = i_int8( p, curr, &layout_work.appendix.columns );
                    break;
                default:
                    out_msg( "WGML logic error.\n");
                    cvterr = true;
                    break;
                }
                if( cvterr ) {          // there was an error
                    err_count++;
                    g_err( err_att_val_inv );
                    file_mac_info();
                }
                break;                  // break out of for loop
            }
        }
        if( cvterr < 0 ) {
            err_count++;
            g_err( err_att_name_inv );
            file_mac_info();
        }
        cc = get_lay_sub_and_value( &l_args );  // get att with value
    }
    scan_start = scan_stop + 1;
    return;
}
Beispiel #4
0
void    lay_banregion( const gmltag * entry )
{
    char        *   p;
    condcode        cc;
    int             k;
    lay_att         curr;
    att_args        l_args;
    bool            cvterr;

    p = scan_start;
    cvterr = false;

    if( !GlobalFlags.firstpass ) {
        scan_start = scan_stop + 1;
        eat_lay_sub_tag();
        return;                         // process during first pass only
    }
    if( ProcFlags.lay_xxx != el_banregion ) {
        if( ProcFlags.lay_xxx == el_banner ) {
            lay_banner_end_prepare();
        }
        ProcFlags.lay_xxx = el_banregion;

        init_banregion_wk( &wk );

    } else {
        if( !strnicmp( ":banregion", buff2, sizeof( ":banregion" ) ) ) {
            err_count++;
            g_err( err_nested_tag, entry->tagname );
            file_mac_info();

            while( !ProcFlags.reprocess_line  ) {
                eat_lay_sub_tag();
                if( strnicmp( ":ebanregion", buff2, sizeof( ":ebanregion" ) ) ) {
                    ProcFlags.reprocess_line = false;// not :ebanregion, go on
                }
            }
            return;
        }
    }
    cc = get_lay_sub_and_value( &l_args );              // get att with value
    while( cc == pos ) {
        cvterr = true;
        for( k = 0; k < att_count; k++ ) {
            curr = banregion_att[k];

            if( !strnicmp( att_names[curr], l_args.start[0], l_args.len[0] ) ) {
                p = l_args.start[1];

                if( count[k] ) {
                    cvterr = 1;                  // attribute specified twice
                } else {
                    count[k] += 1;
                    sum_count++;
                    switch( curr ) {
                    case   e_indent:
                        cvterr = i_space_unit( p, curr, &wk.indent );
                        break;
                    case   e_hoffset:
                        cvterr = i_space_unit( p, curr, &wk.hoffset );
                        break;
                    case   e_width:
                        cvterr = i_space_unit( p, curr, &wk.width );
                        break;
                    case   e_voffset:
                        cvterr = i_space_unit( p, curr, &wk.voffset );
                        break;
                    case   e_depth:
                        cvterr = i_space_unit( p, curr, &wk.depth );
                        break;
                    case   e_font:
                        cvterr = i_font_number( p, curr, &wk.font );
                        if( wk.font >= wgml_font_cnt )
                            wk.font = 0;
                        break;
                    case   e_refnum:
                        cvterr = i_int8( p, curr, &wk.refnum );
                        break;
                    case   e_region_position:
                        cvterr = i_page_position( p, curr, &wk.region_position );
                        break;
                    case   e_pouring:
                        cvterr = i_pouring( p, curr, &wk.pouring );
                        break;
                    case   e_script_format:
                        cvterr = i_yes_no( p, curr, &wk.script_format );
                        break;
                    case   e_contents:
                        if( l_args.quoted ) {
                            wk.contents.content_type = string_content;
                            cvterr = i_xx_string( p, curr, wk.contents.string );
                        } else {
                            cvterr = i_content( p, curr, &wk.contents );
                        }
                        break;
                    default:
                        out_msg( "WGML logic error.\n");
                        cvterr = true;
                        break;
                    }
                }
                if( cvterr ) {          // there was an error
                    err_count++;
                    g_err( err_att_val_inv );
                    file_mac_info();
                }
                break;                  // break out of for loop
            }
        }
        cc = get_lay_sub_and_value( &l_args );  // get att with value
    }
    scan_start = scan_stop + 1;
    return;
}