Changeset 324

Show
Ignore:
Timestamp:
02/02/07 16:35:22 (2 years ago)
Author:
astrange
Message:

* Remove temporary file from Ragel build phase, since it results in race conditions and silly errors.
* Support SSA style tags used for comments, and fix a crash from tags at the end of lines.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Perian.xcodeproj/project.pbxproj

    r315 r324  
    257257                                "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).dot", 
    258258                        ); 
    259                         script = "RAGEL=${PROJECT_DIR}/ragel\nRLCODEGEN=${PROJECT_DIR}/rlcodegen\n${RAGEL} -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.ragel ${INPUT_FILE_PATH} || exit\n${RLCODEGEN} -T1 -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE} ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.ragel || exit\n${RLCODEGEN} -V ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.ragel > ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.dot"; 
     259                        script = "RAGEL=${PROJECT_DIR}/ragel\nRLCODEGEN=${PROJECT_DIR}/rlcodegen\n${RAGEL} ${INPUT_FILE_PATH} | ${RLCODEGEN} -T1 -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE} || exit\n#${RLCODEGEN} -V ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.ragel > ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.dot"; 
    260260                }; 
    261261/* End PBXBuildRule section */ 
  • trunk/SSATagParsing.m.rl

    r317 r324  
    7575         
    7676        return (ATSURGBAlphaColor){r/255.,g/255.,b/255.,a}; 
     77} 
     78 
     79static void PruneEmptyStyleSpans(SSARenderEntity *re) 
     80{ 
     81        SSAStyleSpan *styles_new[re->style_count]; 
     82        size_t style_count_new = 0; 
     83        int i; 
     84         
     85        for (i = 0; i < re->style_count; i++) { 
     86                if (re->styles[i]->range.length == 0) { 
     87                        [re->styles[i] release]; 
     88                } else { 
     89                        styles_new[style_count_new++] = re->styles[i]; 
     90                } 
     91        } 
     92         
     93        if (style_count_new != re->style_count) { 
     94                re->styles = realloc(re->styles, sizeof(SSAStyleSpan*) * style_count_new);  
     95                memcpy(re->styles, styles_new, sizeof(SSAStyleSpan*) * style_count_new); 
     96                 
     97                re->style_count = style_count_new; 
     98        } 
    7799} 
    78100 
     
    374396                                } 
    375397                                 
    376                                 flag = [01]? > {flag = 1;} % {flag = *(p-1) - '0';}; 
     398                                flag = ([01] % {unichar fl = *(p-1); if (flag == '0' || flag == '1') flag = fl - '0';})? > {flag = 1;}; 
    377399                                num_ = digit+ ('.' digit*)?; 
    378400                                num = num_ > {numbegin = p;} % {num = [[NSString stringWithCharacters:numbegin length:p-numbegin] doubleValue];}; 
     
    400422                                                                ); 
    401423                                 
    402                                 cmd = "\\" cmd_specific
    403                                  
    404                                 tag = "{" cmd* "}"; 
     424                                cmd = "\\" cmd_specific
     425                                 
     426                                tag = "{" ((cmd*) | ([^\\}]*)) "}"; 
    405427                                 
    406428                                nl = "\\" [Nn]; 
     
    417439                        %%write eof; 
    418440                         
     441                        if (re->text[len-1] == '}') skipbegin = p; // make up for how exit_tag isn't called if the } is the last char in the line 
     442 
    419443                        end_re; 
    420                         for (j=0;j < re->style_count; j++) 
    421                                 if (re->styles[j]->range.length == 0) { 
    422                                         [re->styles[j] release]; 
    423                                         if (j != re->style_count-1) re->styles[j] = re->styles[j+1]; 
    424                                         re->style_count--; 
    425                                 } 
     444 
     445                        PruneEmptyStyleSpans(re); 
    426446 
    427447                        free(pb);