/[jscoverage]/trunk/instrument-js.cpp
ViewVC logotype

Diff of /trunk/instrument-js.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 92 by siliconforks, Wed May 7 04:21:22 2008 UTC revision 95 by siliconforks, Wed May 7 22:50:00 2008 UTC
# Line 853  Line 853 
853    
854    /* copy the instrumented source code to the output */    /* copy the instrumented source code to the output */
855    Stream_write(output, instrumented->data, instrumented->length);    Stream_write(output, instrumented->data, instrumented->length);
856      Stream_write_char(output, '\n');
857    
858      /* copy the original source to the output */
859      size_t i = 0;
860      while (i < input_length) {
861        Stream_write_string(output, "// ");
862        size_t line_start = i;
863        while (i < input_length && base[i] != '\r' && base[i] != '\n') {
864          i++;
865        }
866    
867        size_t line_end = i;
868        if (i < input_length) {
869          if (base[i] == '\r') {
870            line_end = i;
871            i++;
872            if (i < input_length && base[i] == '\n') {
873              i++;
874            }
875          }
876          else if (base[i] == '\n') {
877            line_end = i;
878            i++;
879          }
880          else {
881            abort();
882          }
883        }
884    
885        char * line = js_DeflateString(context, base + line_start, line_end - line_start);
886        Stream_write_string(output, line);
887        Stream_write_char(output, '\n');
888        JS_free(context, line);
889      }
890    
891    Stream_delete(instrumented);    Stream_delete(instrumented);
892    

Legend:
Removed from v.92  
changed lines
  Added in v.95

  ViewVC Help
Powered by ViewVC 1.1.24