comparison src/c/urweb.c @ 917:321a2d6feb40

dragList demo working, save for Gecko load delay and highlighting
author Adam Chlipala <adamc@hcoop.net>
date Tue, 08 Sep 2009 10:55:49 -0400
parents b873feb3eb52
children ae0110465421
comparison
equal deleted inserted replaced
916:b873feb3eb52 917:321a2d6feb40
2554 else if (buf_used(&ctx->script) == 0) { 2554 else if (buf_used(&ctx->script) == 0) {
2555 size_t len = strlen(ctx->script_header); 2555 size_t len = strlen(ctx->script_header);
2556 char *start = strstr(ctx->page.start, "<sc>"); 2556 char *start = strstr(ctx->page.start, "<sc>");
2557 if (start) { 2557 if (start) {
2558 buf_check(&ctx->page, buf_used(&ctx->page) - 4 + len); 2558 buf_check(&ctx->page, buf_used(&ctx->page) - 4 + len);
2559 start = strstr(ctx->page.start, "<sc>");
2559 memmove(start + len, start + 4, buf_used(&ctx->page) - (start - ctx->page.start) - 3); 2560 memmove(start + len, start + 4, buf_used(&ctx->page) - (start - ctx->page.start) - 3);
2560 ctx->page.front += len - 4; 2561 ctx->page.front += len - 4;
2561 memcpy(start, ctx->script_header, len); 2562 memcpy(start, ctx->script_header, len);
2562 } 2563 }
2563 } else { 2564 } else {
2564 size_t lenH = strlen(ctx->script_header), len = buf_used(&ctx->script); 2565 size_t lenH = strlen(ctx->script_header), len = buf_used(&ctx->script);
2565 size_t lenP = lenH + 40 + len; 2566 size_t lenP = lenH + 40 + len;
2566 char *start = strstr(ctx->page.start, "<sc>"); 2567 char *start = strstr(ctx->page.start, "<sc>");
2567 if (start) { 2568 if (start) {
2568 buf_check(&ctx->page, buf_used(&ctx->page) - 4 + lenP); 2569 buf_check(&ctx->page, buf_used(&ctx->page) - 4 + lenP);
2570 start = strstr(ctx->page.start, "<sc>");
2569 memmove(start + lenP, start + 4, buf_used(&ctx->page) - (start - ctx->page.start) - 3); 2571 memmove(start + lenP, start + 4, buf_used(&ctx->page) - (start - ctx->page.start) - 3);
2570 ctx->page.front += lenP - 4; 2572 ctx->page.front += lenP - 4;
2571 memcpy(start, ctx->script_header, lenH); 2573 memcpy(start, ctx->script_header, lenH);
2572 memcpy(start + lenH, "<script type=\"text/javascript\">", 31); 2574 memcpy(start + lenH, "<script type=\"text/javascript\">", 31);
2573 memcpy(start + lenH + 31, ctx->script.start, len); 2575 memcpy(start + lenH + 31, ctx->script.start, len);
2574 memcpy(start + lenH + 31 + len, "</script>", 9); 2576 memcpy(start + lenH + 31 + len, "</script>", 9);
2575 printf("start=%s\n", start);
2576 } 2577 }
2577 } 2578 }
2578 } 2579 }
2579 2580
2580 int uw_rollback(uw_context ctx) { 2581 int uw_rollback(uw_context ctx) {