comparison src/c/urweb.c @ 2204:01c8aceac480

Finishes initial prototype, caching parameterless pages with table-match-based invalidation. Still has problems parsing non-Postgres SQL dialects properly.
author Ziv Scully <ziv@mit.edu>
date Tue, 27 May 2014 21:14:13 -0400
parents 94529780bbcf
children c1a62ce47083
comparison
equal deleted inserted replaced
2203:39faa4a037f4 2204:01c8aceac480
475 475
476 int usedSig, needsResig; 476 int usedSig, needsResig;
477 477
478 char *output_buffer; 478 char *output_buffer;
479 size_t output_buffer_size; 479 size_t output_buffer_size;
480
481 // For caching.
482 char *recording;
480 }; 483 };
481 484
482 size_t uw_headers_max = SIZE_MAX; 485 size_t uw_headers_max = SIZE_MAX;
483 size_t uw_page_max = SIZE_MAX; 486 size_t uw_page_max = SIZE_MAX;
484 size_t uw_heap_max = SIZE_MAX; 487 size_t uw_heap_max = SIZE_MAX;
557 ctx->usedSig = 0; 560 ctx->usedSig = 0;
558 ctx->needsResig = 0; 561 ctx->needsResig = 0;
559 562
560 ctx->output_buffer = malloc(1); 563 ctx->output_buffer = malloc(1);
561 ctx->output_buffer_size = 1; 564 ctx->output_buffer_size = 1;
565
566 ctx->recording = 0;
562 567
563 return ctx; 568 return ctx;
564 } 569 }
565 570
566 size_t uw_inputs_max = SIZE_MAX; 571 size_t uw_inputs_max = SIZE_MAX;
1632 1637
1633 void uw_write(uw_context ctx, const char* s) { 1638 void uw_write(uw_context ctx, const char* s) {
1634 uw_check(ctx, strlen(s) + 1); 1639 uw_check(ctx, strlen(s) + 1);
1635 uw_write_unsafe(ctx, s); 1640 uw_write_unsafe(ctx, s);
1636 *ctx->page.front = 0; 1641 *ctx->page.front = 0;
1642 }
1643
1644 void uw_recordingStart(uw_context ctx) {
1645 // TODO: remove following debug statement.
1646 uw_write(ctx, "<!--Recording started here-->");
1647 ctx->recording = ctx->page.front;
1648 }
1649
1650 char *uw_recordingRead(uw_context ctx) {
1651 char *recording = strdup(ctx->recording);
1652 // TODO: remove following debug statement.
1653 uw_write(ctx, "<!--Recording read here-->");
1654 return recording;
1637 } 1655 }
1638 1656
1639 char *uw_Basis_attrifyInt(uw_context ctx, uw_Basis_int n) { 1657 char *uw_Basis_attrifyInt(uw_context ctx, uw_Basis_int n) {
1640 char *result; 1658 char *result;
1641 int len; 1659 int len;