--- trunk/instrument-js.c 2008/05/24 18:11:30 101 +++ trunk/instrument-js.c 2008/10/03 02:26:04 214 @@ -17,6 +17,8 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + #include "instrument-js.h" #include @@ -32,6 +34,10 @@ #include #include +#include "encoding.h" +#include "global.h" +#include "highlight.h" +#include "resource-manager.h" #include "util.h" static JSRuntime * runtime = NULL; @@ -44,6 +50,7 @@ */ static const char * file_id = NULL; static char * lines = NULL; +static uint16_t num_lines = 0; void jscoverage_init(void) { runtime = JS_NewRuntime(8L * 1024L * 1024L); @@ -72,9 +79,53 @@ } static void print_string(JSString * s, Stream * f) { - for (size_t i = 0; i < s->length; i++) { - char c = s->chars[i]; - Stream_write_char(f, c); + size_t length = JSSTRING_LENGTH(s); + jschar * characters = JSSTRING_CHARS(s); + for (size_t i = 0; i < length; i++) { + jschar c = characters[i]; + if (32 <= c && c <= 126) { + switch (c) { + case '"': + Stream_write_string(f, "\\\""); + break; +/* + case '\'': + Stream_write_string(f, "\\'"); + break; +*/ + case '\\': + Stream_write_string(f, "\\\\"); + break; + default: + Stream_write_char(f, c); + break; + } + } + else { + switch (c) { + case 0x8: + Stream_write_string(f, "\\b"); + break; + case 0x9: + Stream_write_string(f, "\\t"); + break; + case 0xa: + Stream_write_string(f, "\\n"); + break; + case 0xb: + Stream_write_string(f, "\\v"); + break; + case 0xc: + Stream_write_string(f, "\\f"); + break; + case 0xd: + Stream_write_string(f, "\\r"); + break; + default: + Stream_printf(f, "\\u%04x", c); + break; + } + } } } @@ -84,17 +135,28 @@ print_string(s, f); } -static void print_string_jsval(jsval value, Stream * f) { +static void print_regex(jsval value, Stream * f) { assert(JSVAL_IS_STRING(value)); JSString * s = JSVAL_TO_STRING(value); - print_string(s, f); + size_t length = JSSTRING_LENGTH(s); + jschar * characters = JSSTRING_CHARS(s); + for (size_t i = 0; i < length; i++) { + jschar c = characters[i]; + if (32 <= c && c <= 126) { + Stream_write_char(f, c); + } + else { + Stream_printf(f, "\\u%04x", c); + } + } } static void print_quoted_string_atom(JSAtom * atom, Stream * f) { assert(ATOM_IS_STRING(atom)); JSString * s = ATOM_TO_STRING(atom); - JSString * quoted = js_QuoteString(context, s, '"'); - print_string(quoted, f); + Stream_write_char(f, '"'); + print_string(s, f); + Stream_write_char(f, '"'); } static const char * get_op(uint8 op) { @@ -145,56 +207,63 @@ static void instrument_expression(JSParseNode * node, Stream * f); static void instrument_statement(JSParseNode * node, Stream * f, int indent); -static void instrument_function(JSParseNode * node, Stream * f, int indent) { - assert(node->pn_arity == PN_FUNC); - assert(ATOM_IS_OBJECT(node->pn_funAtom)); - JSObject * object = ATOM_TO_OBJECT(node->pn_funAtom); - assert(JS_ObjectIsFunction(context, object)); - JSFunction * function = (JSFunction *) JS_GetPrivate(context, object); - assert(function); - assert(object == function->object); - Stream_printf(f, "%*s", indent, ""); +enum FunctionType { + FUNCTION_NORMAL, + FUNCTION_GETTER_OR_SETTER +}; + +static void instrument_function(JSParseNode * node, Stream * f, int indent, enum FunctionType type) { + assert(node->pn_arity == PN_FUNC); + assert(ATOM_IS_OBJECT(node->pn_funAtom)); + JSObject * object = ATOM_TO_OBJECT(node->pn_funAtom); + assert(JS_ObjectIsFunction(context, object)); + JSFunction * function = (JSFunction *) JS_GetPrivate(context, object); + assert(function); + assert(object == function->object); + Stream_printf(f, "%*s", indent, ""); + if (type == FUNCTION_NORMAL) { Stream_write_string(f, "function"); + } - /* function name */ - if (function->atom) { - Stream_write_char(f, ' '); - print_string_atom(function->atom, f); - } + /* function name */ + if (function->atom) { + Stream_write_char(f, ' '); + print_string_atom(function->atom, f); + } - /* function parameters */ - Stream_write_string(f, "("); - JSAtom ** params = xmalloc(function->nargs * sizeof(JSAtom *)); - for (int i = 0; i < function->nargs; i++) { - /* initialize to NULL for sanity check */ - params[i] = NULL; - } - JSScope * scope = OBJ_SCOPE(object); - for (JSScopeProperty * scope_property = SCOPE_LAST_PROP(scope); scope_property != NULL; scope_property = scope_property->parent) { - if (scope_property->getter != js_GetArgument) { - continue; - } - assert(scope_property->flags & SPROP_HAS_SHORTID); - assert((uint16) scope_property->shortid < function->nargs); - assert(JSID_IS_ATOM(scope_property->id)); - params[(uint16) scope_property->shortid] = JSID_TO_ATOM(scope_property->id); + /* function parameters */ + Stream_write_string(f, "("); + JSAtom ** params = xnew(JSAtom *, function->nargs); + for (int i = 0; i < function->nargs; i++) { + /* initialize to NULL for sanity check */ + params[i] = NULL; + } + JSScope * scope = OBJ_SCOPE(object); + for (JSScopeProperty * scope_property = SCOPE_LAST_PROP(scope); scope_property != NULL; scope_property = scope_property->parent) { + if (scope_property->getter != js_GetArgument) { + continue; + } + assert(scope_property->flags & SPROP_HAS_SHORTID); + assert((uint16) scope_property->shortid < function->nargs); + assert(JSID_IS_ATOM(scope_property->id)); + params[(uint16) scope_property->shortid] = JSID_TO_ATOM(scope_property->id); + } + for (int i = 0; i < function->nargs; i++) { + assert(params[i] != NULL); + if (i > 0) { + Stream_write_string(f, ", "); } - for (int i = 0; i < function->nargs; i++) { - assert(params[i] != NULL); - if (i > 0) { - Stream_write_string(f, ", "); - } - if (ATOM_IS_STRING(params[i])) { - print_string_atom(params[i], f); - } + if (ATOM_IS_STRING(params[i])) { + print_string_atom(params[i], f); } - Stream_write_string(f, ") {\n"); - free(params); + } + Stream_write_string(f, ") {\n"); + free(params); - /* function body */ - instrument_statement(node->pn_body, f, indent + 2); + /* function body */ + instrument_statement(node->pn_body, f, indent + 2); - Stream_write_string(f, "}\n"); + Stream_write_string(f, "}\n"); } static void instrument_function_call(JSParseNode * node, Stream * f) { @@ -225,7 +294,7 @@ static void instrument_expression(JSParseNode * node, Stream * f) { switch (node->pn_type) { case TOK_FUNCTION: - instrument_function(node, f, 0); + instrument_function(node, f, 0, FUNCTION_NORMAL); break; case TOK_COMMA: for (struct JSParseNode * p = node->pn_head; p != NULL; p = p->pn_next) { @@ -432,9 +501,25 @@ if (p != node->pn_head) { Stream_write_string(f, ", "); } - instrument_expression(p->pn_left, f); - Stream_write_string(f, ": "); - instrument_expression(p->pn_right, f); + + /* check whether this is a getter or setter */ + switch (p->pn_op) { + case JSOP_GETTER: + Stream_write_string(f, "get "); + instrument_expression(p->pn_left, f); + instrument_function(p->pn_right, f, 0, FUNCTION_GETTER_OR_SETTER); + break; + case JSOP_SETTER: + Stream_write_string(f, "set "); + instrument_expression(p->pn_left, f); + instrument_function(p->pn_right, f, 0, FUNCTION_GETTER_OR_SETTER); + break; + default: + instrument_expression(p->pn_left, f); + Stream_write_string(f, ": "); + instrument_expression(p->pn_right, f); + break; + } } Stream_write_char(f, '}'); break; @@ -461,7 +546,7 @@ JSObject * object = ATOM_TO_OBJECT(node->pn_atom); jsval result; js_regexp_toString(context, object, 0, NULL, &result); - print_string_jsval(result, f); + print_regex(result, f); } break; default: @@ -538,7 +623,7 @@ static void output_statement(JSParseNode * node, Stream * f, int indent) { switch (node->pn_type) { case TOK_FUNCTION: - instrument_function(node, f, indent); + instrument_function(node, f, indent, FUNCTION_NORMAL); break; case TOK_LC: assert(node->pn_arity == PN_LIST); @@ -790,7 +875,11 @@ */ static void instrument_statement(JSParseNode * node, Stream * f, int indent) { if (node->pn_type != TOK_LC) { - int line = node->pn_pos.begin.lineno; + uint16_t line = node->pn_pos.begin.lineno; + if (line > num_lines) { + fatal("%s: script contains more than 65,535 lines", file_id); + } + /* the root node has line number 0 */ if (line != 0) { Stream_printf(f, "%*s", indent, ""); @@ -801,16 +890,30 @@ output_statement(node, f, indent); } -void jscoverage_instrument_js(const char * id, Stream * input, Stream * output) { +static bool characters_start_with(const jschar * characters, size_t line_start, size_t line_end, const char * prefix) { + const jschar * characters_end = characters + line_end; + const jschar * cp = characters + line_start; + const char * bp = prefix; + for (;;) { + if (*bp == '\0') { + return true; + } + else if (cp == characters_end) { + return false; + } + else if (*cp != *bp) { + return false; + } + bp++; + cp++; + } +} + +void jscoverage_instrument_js(const char * id, const uint16_t * characters, size_t num_characters, Stream * output) { file_id = id; /* scan the javascript */ - size_t input_length = input->length; - jschar * base = js_InflateString(context, input->data, &input_length); - if (base == NULL) { - fatal("out of memory"); - } - JSTokenStream * token_stream = js_NewTokenStream(context, base, input_length, NULL, 1, NULL); + JSTokenStream * token_stream = js_NewTokenStream(context, characters, num_characters, NULL, 1, NULL); if (token_stream == NULL) { fatal("cannot create token stream from file: %s", file_id); } @@ -820,7 +923,7 @@ if (node == NULL) { fatal("parse error in file: %s", file_id); } - int num_lines = node->pn_pos.end.lineno; + num_lines = node->pn_pos.end.lineno; lines = xmalloc(num_lines); for (int i = 0; i < num_lines; i++) { lines[i] = 0; @@ -830,7 +933,7 @@ An instrumented JavaScript file has 3 sections: 1. initialization 2. instrumented source code - 3. original source code (TODO) + 3. original source code */ Stream * instrumented = Stream_new(0); @@ -853,44 +956,486 @@ /* copy the instrumented source code to the output */ Stream_write(output, instrumented->data, instrumented->length); - Stream_write_char(output, '\n'); - /* copy the original source to the output */ + /* conditionals */ + bool has_conditionals = false; + size_t line_number = 0; size_t i = 0; - while (i < input_length) { - Stream_write_string(output, "// "); + while (i < num_characters) { + line_number++; size_t line_start = i; - while (i < input_length && base[i] != '\r' && base[i] != '\n') { + jschar c; + bool done = false; + while (! done && i < num_characters) { + c = characters[i]; + switch (c) { + case '\r': + case '\n': + case 0x2028: + case 0x2029: + done = true; + break; + default: + i++; + break; + } + } + size_t line_end = i; + if (i < num_characters) { i++; + if (c == '\r' && i < num_characters && characters[i] == '\n') { + i++; + } + } + if (characters_start_with(characters, line_start, line_end, "//#JSCOVERAGE_IF")) { + if (! has_conditionals) { + has_conditionals = true; + Stream_printf(output, "_$jscoverage['%s'].conditionals = [];\n", file_id); + } + Stream_write_string(output, "if (!("); + for (size_t j = line_start + 16; j < line_end; j++) { + jschar c = characters[j]; + if (c == '\t' || (32 <= c && c <= 126)) { + Stream_write_char(output, c); + } + else { + Stream_printf(output, "\\u%04x", c); + } + } + Stream_write_string(output, ")) {\n"); + Stream_printf(output, " _$jscoverage['%s'].conditionals[%d] = ", file_id, line_number); } + else if (characters_start_with(characters, line_start, line_end, "//#JSCOVERAGE_ENDIF")) { + Stream_printf(output, "%d;\n", line_number); + Stream_printf(output, "}\n"); + } + } - size_t line_end = i; - if (i < input_length) { - if (base[i] == '\r') { - line_end = i; + /* copy the original source to the output */ + Stream_printf(output, "_$jscoverage['%s'].source = ", file_id); + jscoverage_write_source(id, characters, num_characters, output); + Stream_printf(output, ";\n"); + + Stream_delete(instrumented); + + file_id = NULL; +} + +void jscoverage_write_source(const char * id, const jschar * characters, size_t num_characters, Stream * output) { + Stream_write_string(output, "["); + if (jscoverage_highlight) { + Stream * highlighted_stream = Stream_new(num_characters); + jscoverage_highlight_js(context, id, characters, num_characters, highlighted_stream); + size_t i = 0; + while (i < highlighted_stream->length) { + if (i > 0) { + Stream_write_char(output, ','); + } + + Stream_write_char(output, '"'); + bool done = false; + while (! done) { + char c = highlighted_stream->data[i]; + switch (c) { + case 0x8: + /* backspace */ + Stream_write_string(output, "\\b"); + break; + case 0x9: + /* horizontal tab */ + Stream_write_string(output, "\\t"); + break; + case 0xa: + /* line feed (new line) */ + done = true; + break; + case 0xb: + /* vertical tab */ + Stream_write_string(output, "\\v"); + break; + case 0xc: + /* form feed */ + Stream_write_string(output, "\\f"); + break; + case 0xd: + /* carriage return */ + done = true; + if (i + 1 < highlighted_stream->length && highlighted_stream->data[i + 1] == '\n') { + i++; + } + break; + case '"': + Stream_write_string(output, "\\\""); + break; + case '\\': + Stream_write_string(output, "\\\\"); + break; + default: + Stream_write_char(output, c); + break; + } i++; - if (i < input_length && base[i] == '\n') { - i++; + if (i >= highlighted_stream->length) { + done = true; } } - else if (base[i] == '\n') { - line_end = i; + Stream_write_char(output, '"'); + } + Stream_delete(highlighted_stream); + } + else { + size_t i = 0; + while (i < num_characters) { + if (i > 0) { + Stream_write_char(output, ','); + } + + Stream_write_char(output, '"'); + bool done = false; + while (! done) { + jschar c = characters[i]; + switch (c) { + case 0x8: + /* backspace */ + Stream_write_string(output, "\\b"); + break; + case 0x9: + /* horizontal tab */ + Stream_write_string(output, "\\t"); + break; + case 0xa: + /* line feed (new line) */ + done = true; + break; + case 0xb: + /* vertical tab */ + Stream_write_string(output, "\\v"); + break; + case 0xc: + /* form feed */ + Stream_write_string(output, "\\f"); + break; + case 0xd: + /* carriage return */ + done = true; + if (i + 1 < num_characters && characters[i + 1] == '\n') { + i++; + } + break; + case '"': + Stream_write_string(output, "\\\""); + break; + case '\\': + Stream_write_string(output, "\\\\"); + break; + case '&': + Stream_write_string(output, "&"); + break; + case '<': + Stream_write_string(output, "<"); + break; + case '>': + Stream_write_string(output, ">"); + break; + case 0x2028: + case 0x2029: + done = true; + break; + default: + if (32 <= c && c <= 126) { + Stream_write_char(output, c); + } + else { + Stream_printf(output, "&#%d;", c); + } + break; + } i++; + if (i >= num_characters) { + done = true; + } } - else { - abort(); + Stream_write_char(output, '"'); + } + } + Stream_write_string(output, "]"); +} + +void jscoverage_copy_resources(const char * destination_directory) { + copy_resource("jscoverage.html", destination_directory); + copy_resource("jscoverage.css", destination_directory); + copy_resource("jscoverage.js", destination_directory); + copy_resource("jscoverage-ie.css", destination_directory); + copy_resource("jscoverage-throbber.gif", destination_directory); + copy_resource("jscoverage-highlight.css", destination_directory); +} + +/* +coverage reports +*/ + +struct FileCoverageList { + FileCoverage * file_coverage; + struct FileCoverageList * next; +}; + +struct Coverage { + JSHashTable * coverage_table; + struct FileCoverageList * coverage_list; +}; + +static int compare_strings(const void * p1, const void * p2) { + return strcmp(p1, p2) == 0; +} + +Coverage * Coverage_new(void) { + Coverage * result = xmalloc(sizeof(Coverage)); + result->coverage_table = JS_NewHashTable(1024, JS_HashString, compare_strings, NULL, NULL, NULL); + if (result->coverage_table == NULL) { + fatal("cannot create hash table"); + } + result->coverage_list = NULL; + return result; +} + +void Coverage_delete(Coverage * coverage) { + JS_HashTableDestroy(coverage->coverage_table); + struct FileCoverageList * p = coverage->coverage_list; + while (p != NULL) { + free(p->file_coverage->coverage_lines); + if (p->file_coverage->source_lines != NULL) { + for (uint32 i = 0; i < p->file_coverage->num_source_lines; i++) { + free(p->file_coverage->source_lines[i]); } + free(p->file_coverage->source_lines); } + free(p->file_coverage->id); + free(p->file_coverage); + struct FileCoverageList * q = p; + p = p->next; + free(q); + } + free(coverage); +} - char * line = js_DeflateString(context, base + line_start, line_end - line_start); - Stream_write_string(output, line); - Stream_write_char(output, '\n'); - JS_free(context, line); +struct EnumeratorArg { + CoverageForeachFunction f; + void * p; +}; + +static intN enumerator(JSHashEntry * entry, intN i, void * arg) { + struct EnumeratorArg * enumerator_arg = arg; + enumerator_arg->f(entry->value, i, enumerator_arg->p); + return 0; +} + +void Coverage_foreach_file(Coverage * coverage, CoverageForeachFunction f, void * p) { + struct EnumeratorArg enumerator_arg; + enumerator_arg.f = f; + enumerator_arg.p = p; + JS_HashTableEnumerateEntries(coverage->coverage_table, enumerator, &enumerator_arg); +} + +int jscoverage_parse_json(Coverage * coverage, const uint8_t * json, size_t length) { + jschar * base = js_InflateString(context, (char *) json, &length); + if (base == NULL) { + fatal("out of memory"); } - Stream_delete(instrumented); + jschar * parenthesized_json = xnew(jschar, addst(length, 2)); + parenthesized_json[0] = '('; + memcpy(parenthesized_json + 1, base, mulst(length, sizeof(jschar))); + parenthesized_json[length + 1] = ')'; JS_free(context, base); - file_id = NULL; + JSTokenStream * token_stream = js_NewTokenStream(context, parenthesized_json, length + 2, NULL, 1, NULL); + if (token_stream == NULL) { + fatal("cannot create token stream"); + } + + JSParseNode * root = js_ParseTokenStream(context, global, token_stream); + free(parenthesized_json); + if (root == NULL) { + return -1; + } + + /* root node must be TOK_LC */ + if (root->pn_type != TOK_LC) { + return -1; + } + JSParseNode * semi = root->pn_u.list.head; + + /* the list must be TOK_SEMI and it must contain only one element */ + if (semi->pn_type != TOK_SEMI || semi->pn_next != NULL) { + return -1; + } + JSParseNode * parenthesized = semi->pn_kid; + + /* this must be a parenthesized expression */ + if (parenthesized->pn_type != TOK_RP) { + return -1; + } + JSParseNode * object = parenthesized->pn_kid; + + /* this must be an object literal */ + if (object->pn_type != TOK_RC) { + return -1; + } + + for (JSParseNode * p = object->pn_head; p != NULL; p = p->pn_next) { + /* every element of this list must be TOK_COLON */ + if (p->pn_type != TOK_COLON) { + return -1; + } + + /* the key must be a string representing the file */ + JSParseNode * key = p->pn_left; + if (key->pn_type != TOK_STRING || ! ATOM_IS_STRING(key->pn_atom)) { + return -1; + } + char * id_bytes = JS_GetStringBytes(ATOM_TO_STRING(key->pn_atom)); + + /* the value must be an object literal OR an array */ + JSParseNode * value = p->pn_right; + if (! (value->pn_type == TOK_RC || value->pn_type == TOK_RB)) { + return -1; + } + + JSParseNode * array = NULL; + JSParseNode * source = NULL; + if (value->pn_type == TOK_RB) { + /* an array */ + array = value; + } + else if (value->pn_type == TOK_RC) { + /* an object literal */ + if (value->pn_count != 2) { + return -1; + } + for (JSParseNode * element = value->pn_head; element != NULL; element = element->pn_next) { + if (element->pn_type != TOK_COLON) { + return -1; + } + JSParseNode * left = element->pn_left; + if (left->pn_type != TOK_STRING || ! ATOM_IS_STRING(left->pn_atom)) { + return -1; + } + const char * s = JS_GetStringBytes(ATOM_TO_STRING(left->pn_atom)); + if (strcmp(s, "coverage") == 0) { + array = element->pn_right; + if (array->pn_type != TOK_RB) { + return -1; + } + } + else if (strcmp(s, "source") == 0) { + source = element->pn_right; + if (source->pn_type != TOK_RB) { + return -1; + } + } + else { + return -1; + } + } + } + else { + return -1; + } + + if (array == NULL) { + return -1; + } + + /* look up the file in the coverage table */ + FileCoverage * file_coverage = JS_HashTableLookup(coverage->coverage_table, id_bytes); + if (file_coverage == NULL) { + /* not there: create a new one */ + char * id = xstrdup(id_bytes); + file_coverage = xmalloc(sizeof(FileCoverage)); + file_coverage->id = id; + file_coverage->num_coverage_lines = array->pn_count; + file_coverage->coverage_lines = xnew(int, array->pn_count); + if (source == NULL) { + file_coverage->source_lines = NULL; + } + else { + file_coverage->num_source_lines = source->pn_count; + file_coverage->source_lines = xnew(char *, source->pn_count); + uint32 i = 0; + for (JSParseNode * element = source->pn_head; element != NULL; element = element->pn_next, i++) { + if (element->pn_type != TOK_STRING) { + return -1; + } + file_coverage->source_lines[i] = xstrdup(JS_GetStringBytes(ATOM_TO_STRING(element->pn_atom))); + } + assert(i == source->pn_count); + } + + /* set coverage for all lines */ + uint32 i = 0; + for (JSParseNode * element = array->pn_head; element != NULL; element = element->pn_next, i++) { + if (element->pn_type == TOK_NUMBER) { + file_coverage->coverage_lines[i] = (int) element->pn_dval; + } + else if (element->pn_type == TOK_PRIMARY && element->pn_op == JSOP_NULL) { + file_coverage->coverage_lines[i] = -1; + } + else { + return -1; + } + } + assert(i == array->pn_count); + + /* add to the hash table */ + JS_HashTableAdd(coverage->coverage_table, id, file_coverage); + struct FileCoverageList * coverage_list = xmalloc(sizeof(struct FileCoverageList)); + coverage_list->file_coverage = file_coverage; + coverage_list->next = coverage->coverage_list; + coverage->coverage_list = coverage_list; + } + else { + /* sanity check */ + assert(strcmp(file_coverage->id, id_bytes) == 0); + if (file_coverage->num_coverage_lines != array->pn_count) { + return -2; + } + + /* merge the coverage */ + uint32 i = 0; + for (JSParseNode * element = array->pn_head; element != NULL; element = element->pn_next, i++) { + if (element->pn_type == TOK_NUMBER) { + if (file_coverage->coverage_lines[i] == -1) { + return -2; + } + file_coverage->coverage_lines[i] += (int) element->pn_dval; + } + else if (element->pn_type == TOK_PRIMARY && element->pn_op == JSOP_NULL) { + if (file_coverage->coverage_lines[i] != -1) { + return -2; + } + } + else { + return -1; + } + } + assert(i == array->pn_count); + + /* if this JSON file has source, use it */ + if (file_coverage->source_lines == NULL && source != NULL) { + file_coverage->num_source_lines = source->pn_count; + file_coverage->source_lines = xnew(char *, source->pn_count); + uint32 i = 0; + for (JSParseNode * element = source->pn_head; element != NULL; element = element->pn_next, i++) { + if (element->pn_type != TOK_STRING) { + return -1; + } + file_coverage->source_lines[i] = xstrdup(JS_GetStringBytes(ATOM_TO_STRING(element->pn_atom))); + } + assert(i == source->pn_count); + } + } + } + + return 0; }