pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: program.c,v 1.706 2008/05/24 16:41:03 grubba Exp $ + || $Id: program.c,v 1.707 2008/05/27 19:36:00 grubba Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:8171:   /*! @decl void create(string|void source, @    *! CompilationHandler|void handler, @    *! int|void major, int|void minor,@    *! program|void target, object|void placeholder)    *!    *! Create a PikeCompiler object for a source string.    *!    *! This function takes a piece of Pike code as a string and    *! initializes a compiler object accordingly.    *! +  *! @param source +  *! Source code to compile. +  *! +  *! @param handler    *! The optional argument @[handler] is used to specify an alternative    *! error handler. If it is not specified the current master object    *! at compile time will be used.    *! -  +  *! @param major +  *! @param minor    *! The optional arguments @[major] and @[minor] are used to tell the    *! compiler to attempt to be compatible with Pike @[major].@[minor].    *! -  +  *! @param target +  *! @[__empty_program()] program to fill in. The virgin program +  *! returned by @[__empty_program()] will be modified and returned +  *! by @[compile()] on success. +  *! +  *! @param placeholder +  *! @[__null_program()] placeholder object to fill in. The object +  *! will be modified into an instance of the resulting program +  *! on successfull compile. Note that @[lfun::create()] in the +  *! program will be called without any arguments. +  *!    *! @note    *! Note that @[source] must contain the complete source for a program.    *! It is not possible to compile a single expression or statement.    *!    *! Also note that no preprocessing is performed.    *! To preprocess the program you can use @[compile_string()] or    *! call the preprocessor manually by calling @[cpp()].    *! -  +  *! @note +  *! Note that all references to @[target] and @[placeholder] should +  *! removed if @[compile()] failes. On failure the @[placeholder] +  *! object will be destructed. +  *!    *! @seealso    *! @[compile_string()], @[compile_file()], @[cpp()], @[master()],    *! @[CompilationHandler]    */   static void f_compilation_create(INT32 args)   {    struct pike_string *aprog = NULL;    struct object *ahandler = NULL;/* error handler */    int amajor = -1;    int aminor = -1;
pike.git/src/program.c:8276:   static void f_compilation_compile(INT32 args)   {    int delay, dependants_ok = 1;    struct program *ret;   #ifdef PIKE_DEBUG    ONERROR tmp;   #endif    struct compilation *c = THIS_COMPILATION;       if (c->flags & COMPILER_BUSY) { -  Pike_error("CompilationEnvironment in use.\n"); +  Pike_error("PikeCompiler in use.\n");    }       get_all_args("compile", args, "");       check_c_stack(65536);       CDFPRINTF((stderr, "th(%ld) %p compile() enter, placeholder=%p\n",    (long) th_self(), c->target, c->placeholder));       debug_malloc_touch(c);
pike.git/src/program.c:8351:       ret = debug_malloc_pass(c->p);       debug_malloc_touch(c);       if (!dependants_ok) {    CDFPRINTF((stderr, "th(%ld) %p compile() reporting failure "    "since a dependant failed.\n",    (long) th_self(), c->target));    if (ret) free_program(ret); -  throw_error_object(low_clone(compilation_error_program), 0, 0, 0, +  throw_error_object(fast_clone_object(compilation_error_program), 0, 0, 0,    "Compilation failed.\n");    }    if(!ret) {    CDFPRINTF((stderr, "th(%ld) %p compile() failed.\n",    (long) th_self(), c->target)); -  throw_error_object(low_clone(compilation_error_program), 0, 0, 0, +  throw_error_object(fast_clone_object(compilation_error_program), 0, 0, 0,    "Compilation failed.\n");    }    debug_malloc_touch(ret);   #ifdef PIKE_DEBUG    if (a_flag > 2) {    dump_program_tables(ret, 0);    }   #endif /* PIKE_DEBUG */    verify_supporters();    }
pike.git/src/program.c:9293:    ret=c->p;       debug_malloc_touch(c);    free_object(ce);       if (!dependants_ok) {    CDFPRINTF((stderr, "th(%ld) %p compile() reporting failure "    "since a dependant failed.\n",    (long) th_self(), c->target));    if (ret) free_program(ret); -  throw_error_object(low_clone(compilation_error_program), 0, 0, 0, +  throw_error_object(fast_clone_object(compilation_error_program), 0, 0, 0,    "Compilation failed.\n");    }    if(!ret) {    CDFPRINTF((stderr, "th(%ld) %p compile() failed.\n",    (long) th_self(), c->target)); -  throw_error_object(low_clone(compilation_error_program), 0, 0, 0, +  throw_error_object(fast_clone_object(compilation_error_program), 0, 0, 0,    "Compilation failed.\n");    }    debug_malloc_touch(ret);   #ifdef PIKE_DEBUG    if (a_flag > 2) {    dump_program_tables(ret, 0);    }   #endif /* PIKE_DEBUG */    verify_supporters();    return ret;
pike.git/src/program.c:9592:    set_init_callback(init_trampoline);    set_exit_callback(exit_trampoline);    set_gc_check_callback(gc_check_trampoline);    set_gc_recurse_callback(gc_recurse_trampoline);    debug_malloc_touch(Pike_compiler->fake_object);    debug_malloc_touch(Pike_compiler->fake_object->storage);    pike_trampoline_program=end_program();       /*! @decl constant __null_program    *! -  *! Program used internally by the compiler. +  *! Program used internally by the compiler to create objects +  *! that are later modified into instances of the compiled program +  *! by the compiler.    *!    *! @seealso    *! @[__placeholder_object]    */    {    struct svalue s;    start_new_program();    null_program=end_program();    s.type=T_PROGRAM;    s.u.program=null_program;