Changeset 3136 for proto/PDF


Ignore:
Timestamp:
May 13, 2013, 4:54:51 PM (6 years ago)
Author:
lindanl
Message:

use continuous output stream.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/cb_template.cpp

    r3130 r3136  
    247247}
    248248
    249 static inline void Postprocessing(char* cb, int cb_size, char* cb_new, Marker * marker, ubitblock * unitsums_per_reg, int & at_start, int & at_optr, int & base_pos){   
     249static inline void Postprocessing(char* cb, int cb_size, char* cb_new, BitBlock * marker_starts, BitBlock * marker_ends, ubitblock * unitsums_per_reg, int & at_start, int & at_optr, int & base_pos){   
    250250     
    251251  int pos = 0;
     
    268268  int block_pos = base_pos;
    269269  for(int i=0; i<BLOCKS; i++){
    270     if(bitblock::any(simd_or(marker[i].starts,marker[i].ends))){
     270    if(bitblock::any(simd_or(marker_starts[i],marker_ends[i]))){
    271271      BitBlockForwardIteratorWithBaseCounts16 iter_start;
    272272      BitBlockForwardIteratorWithBaseCounts16 iter_end;
    273       iter_start.init(&(marker[i].starts), unitsums_per_reg[i]._128);
    274       iter_end.init(&(marker[i].ends), unitsums_per_reg[i]._128);
     273      iter_start.init(&(marker_starts[i]), unitsums_per_reg[i]._128);
     274      iter_end.init(&(marker_ends[i]), unitsums_per_reg[i]._128);
    275275      BitBlockForwardIteratorWithBaseCounts16 end;
    276276      while(*iter_start != -1 || *iter_end != -1) {
     
    351351
    352352  struct Out_Callouts out_Callouts;
    353 
    354   struct Marker * marker = (struct Marker *)malloc(sizeof(struct Marker)*BLOCKS);
     353 
     354  struct Marker marker;
     355
     356  BitBlock * marker_starts = (BitBlock *)malloc(sizeof(BitBlock)*BLOCKS);
     357 
     358  BitBlock * marker_ends = (BitBlock *)malloc(sizeof(BitBlock)*BLOCKS);
    355359
    356360  int block_base = 0;
     
    391395    for (int i = 0; i < BLOCKS-1; i++){
    392396      parse_Escaped.do_block(lex[i], parity, escape_Callouts, out_Callouts, lex[i+1]);
    393       match_Parens_With_Comments.do_block(lex[i], escape_Callouts, marker[i], out_Callouts);
    394       parse_HexStrings.do_block(lex[i], marker[i], out_Callouts);
    395       parse_Names.do_block(lex[i], marker[i], out_Callouts, lex[i+1]);
    396       parse_Numeric.do_block(lex[i], marker[i], out_Callouts);
    397       parse_Keywords.do_block(lex[i], marker[i], out_Callouts);
    398       prepare_content_buffer.do_block(basis_bits[i], lex[i], marker[i], parity, escape_Callouts, out_Callouts, lex[i+1]);
    399       Build_ContentBuffer(out_Callouts, marker[i], &content_buf_ptr, unitsums_per_reg, i);
     397      match_Parens_With_Comments.do_block(lex[i], escape_Callouts, marker, out_Callouts);
     398      parse_HexStrings.do_block(lex[i], marker, out_Callouts);
     399      parse_Names.do_block(lex[i], marker, out_Callouts, lex[i+1]);
     400      parse_Numeric.do_block(lex[i], marker, out_Callouts);
     401      parse_Keywords.do_block(lex[i], marker, out_Callouts);
     402      prepare_content_buffer.do_block(basis_bits[i], lex[i], marker, parity, escape_Callouts, out_Callouts, lex[i+1]);
     403      Build_ContentBuffer(out_Callouts, marker, &content_buf_ptr, unitsums_per_reg, i);
     404      marker_starts[i] = marker.starts;
     405      marker_ends[i] = marker.ends;
    400406    }
    401407       
     
    404410    classify_bytes.do_block(basis_bits[0], lex[0]);   
    405411    parse_Escaped.do_block(lex[BLOCKS-1], parity, escape_Callouts, out_Callouts, lex[0]);
    406     match_Parens_With_Comments.do_block(lex[BLOCKS-1], escape_Callouts, marker[BLOCKS-1], out_Callouts);
    407     parse_HexStrings.do_block(lex[BLOCKS-1], marker[BLOCKS-1], out_Callouts);
    408     parse_Names.do_block(lex[BLOCKS-1], marker[BLOCKS-1], out_Callouts, lex[0]);
    409     parse_Numeric.do_block(lex[BLOCKS-1], marker[BLOCKS-1], out_Callouts);
    410     parse_Keywords.do_block(lex[BLOCKS-1], marker[BLOCKS-1], out_Callouts);
    411     prepare_content_buffer.do_block(basis_bits[BLOCKS-1], lex[BLOCKS-1], marker[BLOCKS-1], parity, escape_Callouts, out_Callouts, lex[0]);
    412     Build_ContentBuffer(out_Callouts, marker[BLOCKS-1], &content_buf_ptr, unitsums_per_reg, BLOCKS-1);
     412    match_Parens_With_Comments.do_block(lex[BLOCKS-1], escape_Callouts, marker, out_Callouts);
     413    parse_HexStrings.do_block(lex[BLOCKS-1], marker, out_Callouts);
     414    parse_Names.do_block(lex[BLOCKS-1], marker, out_Callouts, lex[0]);
     415    parse_Numeric.do_block(lex[BLOCKS-1], marker, out_Callouts);
     416    parse_Keywords.do_block(lex[BLOCKS-1], marker, out_Callouts);
     417    prepare_content_buffer.do_block(basis_bits[BLOCKS-1], lex[BLOCKS-1], marker, parity, escape_Callouts, out_Callouts, lex[0]);
     418    Build_ContentBuffer(out_Callouts, marker, &content_buf_ptr, unitsums_per_reg, BLOCKS-1);
     419    marker_starts[BLOCKS-1] = marker.starts;
     420    marker_ends[BLOCKS-1] = marker.ends;
    413421
    414422    content_buf[cb_idx+1] = (char*)malloc(BUF_SIZE*2);
    415     Postprocessing(content_buf[cb_idx], content_buf_ptr-content_buf[cb_idx], content_buf[cb_idx+1], marker, unitsums_per_reg, at_start, at_optr, base_pos);
     423    Postprocessing(content_buf[cb_idx], content_buf_ptr-content_buf[cb_idx], content_buf[cb_idx+1], marker_starts, marker_ends, unitsums_per_reg, at_start, at_optr, base_pos);
    416424//     ints_2_floats(numbers, dec_pl, num_rslt, num_idx);
    417425//      ints_x_floats(numbers, dec_pl, num_rslt, num_idx);
     
    434442    for (int i = 0; i < BLOCKS-1; i++){
    435443      parse_Escaped.do_block(lex[i], parity, escape_Callouts, out_Callouts, lex[i+1]);
    436       match_Parens_With_Comments.do_block(lex[i], escape_Callouts, marker[i], out_Callouts);
    437       parse_HexStrings.do_block(lex[i], marker[i], out_Callouts);
    438       parse_Names.do_block(lex[i], marker[i], out_Callouts, lex[i+1]);
    439       parse_Numeric.do_block(lex[i], marker[i], out_Callouts);
    440       parse_Keywords.do_block(lex[i], marker[i], out_Callouts);
    441       prepare_content_buffer.do_block(basis_bits[i], lex[i], marker[i], parity, escape_Callouts, out_Callouts, lex[i+1]);
    442       Build_ContentBuffer(out_Callouts, marker[i], &content_buf_ptr, unitsums_per_reg, i);
     444      match_Parens_With_Comments.do_block(lex[i], escape_Callouts, marker, out_Callouts);
     445      parse_HexStrings.do_block(lex[i], marker, out_Callouts);
     446      parse_Names.do_block(lex[i], marker, out_Callouts, lex[i+1]);
     447      parse_Numeric.do_block(lex[i], marker, out_Callouts);
     448      parse_Keywords.do_block(lex[i], marker, out_Callouts);
     449      prepare_content_buffer.do_block(basis_bits[i], lex[i], marker, parity, escape_Callouts, out_Callouts, lex[i+1]);
     450      Build_ContentBuffer(out_Callouts, marker, &content_buf_ptr, unitsums_per_reg, i);
     451      marker_starts[i] = marker.starts;
     452      marker_ends[i] = marker.ends;
    443453      chars_avail -= BLOCK_SIZE;
    444454    }
     
    448458    EOF_mask = bitblock::srl(simd<1>::constant<1>(), convert(BLOCK_SIZE-chars_avail));
    449459    parse_Escaped.do_final_block(lex[BLOCKS-1], parity, escape_Callouts, out_Callouts, EOF_mask);
    450     match_Parens_With_Comments.do_final_block(lex[BLOCKS-1], escape_Callouts, marker[BLOCKS-1], out_Callouts, EOF_mask);
    451     parse_HexStrings.do_final_block(lex[BLOCKS-1], marker[BLOCKS-1], out_Callouts, EOF_mask);
    452     parse_Names.do_final_block(lex[BLOCKS-1], marker[BLOCKS-1], out_Callouts, EOF_mask);
    453     parse_Numeric.do_final_block(lex[BLOCKS-1], marker[BLOCKS-1], out_Callouts, EOF_mask);
    454     parse_Keywords.do_final_block(lex[BLOCKS-1], marker[BLOCKS-1], out_Callouts, EOF_mask);
    455     prepare_content_buffer.do_final_block(basis_bits[BLOCKS-1], lex[BLOCKS-1], marker[BLOCKS-1], parity, escape_Callouts, out_Callouts, EOF_mask);
     460    match_Parens_With_Comments.do_final_block(lex[BLOCKS-1], escape_Callouts, marker, out_Callouts, EOF_mask);
     461    parse_HexStrings.do_final_block(lex[BLOCKS-1], marker, out_Callouts, EOF_mask);
     462    parse_Names.do_final_block(lex[BLOCKS-1], marker, out_Callouts, EOF_mask);
     463    parse_Numeric.do_final_block(lex[BLOCKS-1], marker, out_Callouts, EOF_mask);
     464    parse_Keywords.do_final_block(lex[BLOCKS-1], marker, out_Callouts, EOF_mask);
     465    prepare_content_buffer.do_final_block(basis_bits[BLOCKS-1], lex[BLOCKS-1], marker, parity, escape_Callouts, out_Callouts, EOF_mask);
    456466    out_Callouts.delmask |= ~EOF_mask;         
    457     Build_ContentBuffer(out_Callouts, marker[BLOCKS-1], &content_buf_ptr, unitsums_per_reg, BLOCKS-1);
     467    Build_ContentBuffer(out_Callouts, marker, &content_buf_ptr, unitsums_per_reg, BLOCKS-1);
     468    marker_starts[BLOCKS-1] = marker.starts;
     469    marker_ends[BLOCKS-1] = marker.ends;
    458470    content_buf[cb_idx+1] = (char*)malloc(BUF_SIZE*2);
    459     Postprocessing(content_buf[cb_idx], content_buf_ptr-content_buf[cb_idx], content_buf[cb_idx+1], marker, unitsums_per_reg, at_start, at_optr, base_pos); 
     471    Postprocessing(content_buf[cb_idx], content_buf_ptr-content_buf[cb_idx], content_buf[cb_idx+1], marker_starts, marker_ends, unitsums_per_reg, at_start, at_optr, base_pos); 
    460472    break;
    461473  }
     
    466478    for(int i=0;i<num_idx;i++)
    467479      printf("%i,%i\n",numbers[i],dec_pl[i]);*/
    468 /*   
     480   
    469481    for(int i=0; i<100;i++){
    470482      if(tokenArray[i].type==str_token){
     
    497509        printf("\n");
    498510      }
    499     }*/
     511    }
    500512   
    501513/*
Note: See TracChangeset for help on using the changeset viewer.