コード例 #1
0
ファイル: lily.c プロジェクト: cgbystrom/scriptorium
int main(int argc, char **argv)
{
    process_args(argc, argv);
    if (to_process == NULL)
        usage();

    lily_options *options = lily_new_default_options();
    if (gc_threshold != 0)
        options->gc_threshold = gc_threshold;

    options->argc = argc;
    options->argv = argv;

    lily_parse_state *parser = lily_new_parse_state(options);
    lily_lex_mode mode = (do_tags ? lm_tags : lm_no_tags);

    int result;
    if (is_file == 1)
        result = lily_parse_file(parser, mode, to_process);
    else
        result = lily_parse_string(parser, "[cli]", mode, to_process);

    if (result == 0) {
        fputs(lily_build_error_message(parser), stderr);
        exit(EXIT_FAILURE);
    }

    lily_free_parse_state(parser);
    lily_free(options);
    exit(EXIT_SUCCESS);
}
コード例 #2
0
ファイル: mod_lily.c プロジェクト: akavi/lily
static int lily_handler(request_rec *r)
{
    if (strcmp(r->handler, "lily"))
        return DECLINED;

    r->content_type = "text/html";

    lily_options *options = lily_new_default_options();
    options->data = r;
    options->html_sender = (lily_html_sender) ap_rputs;

    lily_parse_state *parser = lily_new_parse_state(options);
    lily_register_package(parser, "server", apache_server_dynaload_table,
            lily_apache_server_loader);

    lily_parse_file(parser, lm_tags, r->filename);

    lily_free_parse_state(parser);
    lily_free_options(options);

    return OK;
}