Changeset 1448


Ignore:
Timestamp:
Sep 14, 2011, 7:46:42 PM (8 years ago)
Author:
ksherdy
Message:

Added function declarations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/pablo_template.cpp

    r1445 r1448  
    1818#include "xmldecl.h"
    1919#include "namechars.h"
    20 
    21 //#include "xml_error.c"
    22 //#include "xmldecl.c"
    23 
    2420#include "../lib/perflib/perfsec.h"
    2521#include "../lib/s2p.h"
     
    4844int block_base=0;
    4945int buffer_base=0;
    50 int buffer_last;
    5146char * source;
    5247
     
    5651BitBlock EOF_mask = simd_const_1(1);
    5752
     53/* StreamScan & Post Process Declarations */
    5854//      static inline int StreamScanToFirst(ScanBlock * stream, int blk_count, int ProcessPos(int), int * error_pos_in_block)
    59 
     55static inline int StreamScan(ScanBlock * stream, int blk_count, int ProcessPos(int), int * error_pos_in_block);
     56
     57static inline int NameStrt_check(int pos);
     58static inline int Name_check(int pos);
     59static inline int PIName_check(int pos);
     60static inline int CD_check(int pos);
     61static inline int GenRef_check(int pos);
     62static inline int HexRef_check(int pos);
     63static inline int DecRef_check(int pos);
     64static inline int AttRef_check(int pos);
     65
     66@global
     67
     68static inline void s2p_do_block(BytePack U8[], Basis_bits & basis_bits) {
     69  s2p(U8[0], U8[1], U8[2], U8[3], U8[4], U8[5], U8[6], U8[7],
     70        basis_bits.bit_0, basis_bits.bit_1, basis_bits.bit_2, basis_bits.bit_3, basis_bits.bit_4, basis_bits.bit_5, basis_bits.bit_6, basis_bits.bit_7);
     71}
     72
     73static inline void s2p_do_final_block(BytePack U8[], Basis_bits & basis_bits, BitBlock EOF_mask) {
     74  s2p_do_block(U8, basis_bits);
     75  basis_bits.bit_0 = simd_and(basis_bits.bit_0, EOF_mask);
     76  basis_bits.bit_1 = simd_and(basis_bits.bit_1, EOF_mask);
     77  basis_bits.bit_2 = simd_and(basis_bits.bit_2, EOF_mask);
     78  basis_bits.bit_3 = simd_and(basis_bits.bit_3, EOF_mask);
     79  basis_bits.bit_4 = simd_and(basis_bits.bit_4, EOF_mask);
     80  basis_bits.bit_5 = simd_and(basis_bits.bit_5, EOF_mask);
     81  basis_bits.bit_6 = simd_and(basis_bits.bit_6, EOF_mask);
     82  basis_bits.bit_7 = simd_and(basis_bits.bit_7, EOF_mask);
     83}
     84
     85static inline void postprocess_do_block(Lex & lex, CtCDPI_Callouts & ctCDPI_Callouts, Ref_Callouts & ref_Callouts, Check_streams & check_streams, int chars_avail);
     86
     87void do_process(FILE *infile, FILE *outfile);
     88
     89int main(int argc, char * argv[]) {
     90        char * infilename, * outfilename;
     91        FILE *infile, *outfile;
     92        struct stat fileinfo;
     93
     94        if (argc < 2) {
     95                printf("Usage: %s <filename> [<outputfile>]\n", argv[0]);
     96                exit(-1);
     97        }
     98
     99        infilename = argv[1];
     100        stat(infilename, &fileinfo);
     101        infile = fopen(infilename, "rb");
     102        if (!infile) {
     103                fprintf(stderr, "Error: cannot open %s for input.\n", infilename);
     104                exit(-1);
     105        }
     106
     107        if (argc < 3) outfile = stdout;
     108        else {
     109                outfilename = argv[2];
     110                outfile = fopen(outfilename, "wb");
     111                if (!outfile) {
     112                        fprintf(stderr, "Error: cannot open %s for writing.\n", outfilename);
     113                        exit(-1);
     114                }
     115        }
     116
     117//      PERF_SEC_BIND(1);
     118
     119        PERF_SEC_INIT(parser_timer);
     120
     121        do_process(infile, outfile);
     122
     123        PERF_SEC_DUMP(parser_timer);
     124
     125        PERF_SEC_DESTROY(parser_timer);
     126
     127        fclose(infile);
     128        fclose(outfile);
     129        return(0);
     130}
     131
     132/* StreamScan & Post Process Definitions */
    60133static inline int StreamScan(ScanBlock * stream, int blk_count, int ProcessPos(int), int * error_pos_in_block) {
    61134
     
    194267}
    195268
    196 
    197 
    198 @global
    199 
    200 static inline void s2p_do_block(BytePack U8[], Basis_bits & basis_bits) {
    201   s2p(U8[0], U8[1], U8[2], U8[3], U8[4], U8[5], U8[6], U8[7],
    202         basis_bits.bit_0, basis_bits.bit_1, basis_bits.bit_2, basis_bits.bit_3, basis_bits.bit_4, basis_bits.bit_5, basis_bits.bit_6, basis_bits.bit_7);
    203 }
    204 
    205 static inline void s2p_do_final_block(BytePack U8[], Basis_bits & basis_bits, BitBlock EOF_mask) {
    206   s2p_do_block(U8, basis_bits);
    207   basis_bits.bit_0 = simd_and(basis_bits.bit_0, EOF_mask);
    208   basis_bits.bit_1 = simd_and(basis_bits.bit_1, EOF_mask);
    209   basis_bits.bit_2 = simd_and(basis_bits.bit_2, EOF_mask);
    210   basis_bits.bit_3 = simd_and(basis_bits.bit_3, EOF_mask);
    211   basis_bits.bit_4 = simd_and(basis_bits.bit_4, EOF_mask);
    212   basis_bits.bit_5 = simd_and(basis_bits.bit_5, EOF_mask);
    213   basis_bits.bit_6 = simd_and(basis_bits.bit_6, EOF_mask);
    214   basis_bits.bit_7 = simd_and(basis_bits.bit_7, EOF_mask);
    215 }
    216 
    217269static inline void postprocess_do_block(Lex & lex, CtCDPI_Callouts & ctCDPI_Callouts, Ref_Callouts & ref_Callouts, Check_streams & check_streams, int chars_avail){
    218270            tracker.StoreNewlines(lex.LF);
     
    370422          s2p_do_block((BytePack *) &srcbuf[block_base], basis_bits);
    371423          @block_stmts
    372           postprocess_do_block(lex, ctCDPI_Callouts, ref_Callouts, check_streams, chars_avail);
     424          postprocess_do_block(lex, ctCDPI_Callouts, ref_Callouts, check_streams, chars_avail);
    373425      }
    374426      matcher.StreamScan(chars_avail);
     
    376428      tracker.Advance_buffer();
    377429      PERF_SEC_END(parser_timer, chars_avail);
    378            
     430
    379431      int bytes_left = chars_read - chars_avail;
    380432      memmove(srcbuf, &srcbuf[BUFFER_SIZE], bytes_left);
     
    420472    }
    421473}
    422 
    423 
    424 
    425 int
    426 main(int argc, char * argv[]) {
    427         char * infilename, * outfilename;
    428         FILE *infile, *outfile;
    429         struct stat fileinfo;
    430 
    431         if (argc < 2) {
    432                 printf("Usage: %s <filename> [<outputfile>]\n", argv[0]);
    433                 exit(-1);
    434         }
    435 
    436         infilename = argv[1];
    437         stat(infilename, &fileinfo);
    438         infile = fopen(infilename, "rb");
    439         if (!infile) {
    440                 fprintf(stderr, "Error: cannot open %s for input.\n", infilename);
    441                 exit(-1);
    442         }
    443 
    444         if (argc < 3) outfile = stdout;
    445         else {
    446                 outfilename = argv[2];
    447                 outfile = fopen(outfilename, "wb");
    448                 if (!outfile) {
    449                         fprintf(stderr, "Error: cannot open %s for writing.\n", outfilename);
    450                         exit(-1);
    451                 }
    452         }
    453 
    454 //      PERF_SEC_BIND(1);
    455 
    456         PERF_SEC_INIT(parser_timer);
    457 
    458         do_process(infile, outfile);
    459 
    460         PERF_SEC_DUMP(parser_timer);
    461 
    462         PERF_SEC_DESTROY(parser_timer);
    463 
    464         fclose(infile);
    465         fclose(outfile);
    466         return(0);
    467 }
Note: See TracChangeset for help on using the changeset viewer.