794 |
output_statement(node, f, indent); |
output_statement(node, f, indent); |
795 |
} |
} |
796 |
|
|
797 |
static void instrument_js_stream(const char * id, int line, FILE * input, FILE * output) { |
static void instrument_js_stream(const char * id, int line, FILE * input, FILE * output, const char * temporary_file_name) { |
798 |
file_id = id; |
file_id = id; |
799 |
|
|
800 |
/* scan the javascript */ |
/* scan the javascript */ |
818 |
Create a temporary file - we can't write directly to the output because we |
Create a temporary file - we can't write directly to the output because we |
819 |
need to know the line number info first. |
need to know the line number info first. |
820 |
*/ |
*/ |
821 |
FILE * temporary = tmpfile(); |
FILE * temporary = fopen(temporary_file_name, "w+"); |
822 |
if (temporary == NULL) { |
if (temporary == NULL) { |
823 |
fatal("cannot create temporary file for script: %s", file_id); |
fatal("cannot create temporary file for script: %s", file_id); |
824 |
} |
} |
849 |
file_id = NULL; |
file_id = NULL; |
850 |
} |
} |
851 |
|
|
852 |
void jscoverage_instrument_js(const char * id, FILE * input, FILE * output) { |
void jscoverage_instrument_js(const char * id, FILE * input, FILE * output, const char * temporary_file_name) { |
853 |
instrument_js_stream(id, 0, input, output); |
instrument_js_stream(id, 0, input, output, temporary_file_name); |
854 |
} |
} |