THE META-HTML LANGUAGE REFERENCE MANUAL

Moddate Module [TOC] Echo Module

Section Intro: Compiler Module

Compiler Module

Synopsis:

    The functions in this module treat their arguments ...

Commands:

<comp-dmp FUNCTION-NAMESimple

<comp-fun FUNCTION-NAMESimple

    OMPILE_FUNCTION_DOC_STRING) { /* The NAME of the function to compile. */ char *symname = mhtml_evaluate_string (get_positional_arg (vars, 0)); char *result = (char *)NULL;

    if (!empty_string_p (symname)) { Symbol *sym = symbol_lookup_in_package (mhtml_user_keywords, symname);

    if (sym == (Symbol *)NULL) sym = symbol_lookup (symname);

    if (sym != (Symbol *)NULL) { if (sym->type == symtype_USERFUN) { char *def_text = mhtml_recompose_function (sym);

    if (mh_compilable_function_p (def_text)) { /* Make a machine string with the definition. */ mh_string_t comp_string = mh_string_new (def_text); mh_object_t object = compiler_evaluate (def_text, comp_string, debug_level);

    result = mh_object_to_string (object, false); }

    xfree (def_text); } else { mh_object_restore_symbol (sym); } } }

    if (result != (char *)NULL) { bprintf_insert (page, start,

<comp-inc FILENAMESimple

    OMPILER_INCLUDE_DOC_STRING) { char *filename = mhtml_evaluate_string (get_positional_arg (vars, 0));

    if (!empty_string_p (filename)) { PAGE *file = page_read_template (filename);

    if (file != (PAGE *)NULL) { mh_string_t comp_string = mh_string_buffer (file->buffer, file->bindex);

    mh_object_t object = compiler_evaluate (filename, comp_string, debug_level);

    char *result = mh_object_to_string (object, false);

    bprintf_insert (page, start,

<compiler::compile-function FUNCTION-NAMESimple

    OMPILE_FUNCTION_DOC_STRING)

    extern void mh_object_restore_symbol (Symbol *sym);

    static int mh_compilable_function_p (char *definition) { int result = 1;

    if (definition != (char *)NULL) { if ((strstr (definition,

<compiler::compiler-and-run CODE-STRINGSimple

    OMPILE_AND_RUN_DOC_STRING) DEFUN (pf_comp_run, code-string, COMPILE_AND_RUN_DOC_STRING) { char *comp_arg = get_positional_arg (vars, 0); mh_string_t comp_string = comp_arg != NULL ? mh_string_new (comp_arg) : MH_EMPTY; mh_object_t object = compiler_evaluate (

<compiler::compiler-versionSimple

    OMPILER_VERSION_DOC_STRING) DEFUN (pf_comp_ver, , COMPILER_VERSION_DOC_STRING) { bprintf_insert (page, start,

<compiler::disassemble FUNCTION-NAMESimple

    OMPILE_DISASSEMBLE_DOC_STRING)

    DEFUN (pf_comp_dis, function-name, COMPILE_DISASSEMBLE_DOC_STRING) { /* The NAME of the function to compile */ char *fun_arg = mhtml_evaluate_string (get_positional_arg (vars, 0)); char *fun_dis = NULL;

    /* Lookup the mh_tag_t for FUN_ARG */ Symbol *fun_sym = mhtml_find_user_function_symbol (fun_arg);

    /* Disassemble it */ if (NULL != fun_sym && NULL != fun_sym->machine) { mh_tag_t tag = (mh_tag_t) fun_sym->machine;

    mh_tag_disassemble (tag, stdout); }

    bprintf_insert (page, start,

Edit Section
Function Index
Variable Index


The META-HTML Reference Manual V2.0 Copyright © 1995, 1998, Brian J. Fox
Found a bug? Send mail to bug-manual@metahtml.org