Exemple #1
0
TEST( String, op_sub_eq, off )
{
    ex::string_t str1 ("Hello_World_This_is_Wu_Jie");
    ex::string_t str2 ("Hello World This is Wu Jie.");

    str1 -= "This";
    ex_log("str1 = %s\n", str1.c_str());
    CHECK( str1 == "Hello_World__is_Wu_Jie" );

    str2 -= "this";
    ex_log("str2 = %s\n", str2.c_str());
    CHECK( str2 == "Hello World This is Wu Jie." );

    str2 -= "Wu Jie";
    ex_log("str2 = %s\n", str2.c_str());
    CHECK( str2 == "Hello World This is ." );

    str2 -= "Hello";
    ex_log("str2 = %s\n", str2.c_str());
    CHECK( str2 == " World This is ." );

    str2 -= "This i";
    ex_log("str2 = %s\n", str2.c_str());
    CHECK( str2 == " World s ." );

    EX_HW_BREAK();
}
Exemple #2
0
static int thread_func1 ( void *_data ) {
    int counter = 20;
    ex_log ("this is thread1");
    while ( counter > 0 ) {
        ex_log ("thread1 tick");
        ex_sleep(1000);
        --counter;
    }
    ex_log ("thread1 ended");
	return 1;
}
Exemple #3
0
static void timescale () {
    // timer with timescale
    int id = ex_add_timer( ex_timespan_from(0,2000), _callback1, NULL, 0 );

    ex_start_timer(id); ex_log("start!");
    ex_sleep(4000);
    ex_set_timescale(0.5f);
    ex_sleep(5000);
    ex_set_timescale(1.0f);
    ex_remove_timer(id); ex_log("stop!");
}
Exemple #4
0
static void normal () {
    int counter = 5;
    ex_thread_t *thread1 = ex_create_thread ( thread_func1, NULL );
    while ( counter > 0 ) {
        ex_log ("main tick");
        ex_sleep(1000);
        --counter;
    }
    ex_log ("main waiting thread1");
    ex_wait_thread ( thread1, NULL );
    ex_log ("main thread ended");
}
Exemple #5
0
static void __verify_pattern ( alloc_unit_t *_au, 
                               const char *_file_name, 
                               const char *_func_name, 
                               size_t _line_nr )
{
    // verify pre-pattern
#if VERIFY_PREFIX
    {
        uint32 *pre  = (uint32 *)_au->dbg_addr;
        uint i_pre;

        //
        for( i_pre = 0; i_pre < PREFIX_COUNT; ++i_pre, ++pre ) {
            ex_assert ( *pre == PREFIX_PATTERN );
            if ( *pre != PREFIX_PATTERN ) {
                ex_log ( "Memory Prefix Conflict\n"
                         "FielName: %s\n"
                         "Line: %d\n"
                         "FunctionName: %s\n"
                         "Alloc ThreadID: %d\n"
                         "Current ThreadID: %d\n", 
                         _file_name, (int)_line_nr, _func_name, (int)(_au->thread_id), (int)__current_threadID() );
                break;
            }
        }
    }
#endif

    // verify post-pattern
#if VERIFY_SUFFIX
    {
        uint32 *post = (uint32 *)( (int8 *)_au->dbg_addr + __suffix_size + _au->org_size );
        uint i_post;

        //
        for ( i_post = 0; i_post < SUFFIX_COUNT; ++i_post, ++post ) {
            ex_assert ( *post == SUFFIX_PATTERN );
            if ( *post != SUFFIX_PATTERN ) {
                ex_log ( "Memory Postfix Conflict\n"
                         "FielName: %s\n"
                         "Line: %d\n"
                         "FunctionName: %s\n"
                         "Alloc ThreadID: %d\n"
                         "Current ThreadID: %d\n", 
                         _file_name, (int)_line_nr, _func_name, (int)(_au->thread_id), (int)__current_threadID() );
                break;
            }
        }
    }
#endif
}
Exemple #6
0
void ex_lua_dump_stack ( lua_State *_l ) {
    int i;
    int top = lua_gettop(_l);
    ex_log("dump lua stack:");
    ex_log("+_________");
    ex_log("|-> TOP");
    for ( i = top; i >= 0; --i ) {
        int t = lua_type(_l, i);
        switch (t) {
        case LUA_TSTRING: 
            ex_log("| %d: '%s'", i, lua_tostring(_l, i));
            break;

        case LUA_TBOOLEAN: 
            ex_log( "| %d: %s", i, lua_toboolean(_l, i) ? "true" : "false");
            break;

        case LUA_TNUMBER: 
            ex_log("| %d: %g", i, lua_tonumber(_l, i));
            break;

            // other type ( userdata, function, table ... )
        default: 
            ex_log("| %d: %s", i, lua_typename(_l, t));
            break;
        }
    }
    ex_log("|__________");
}
Exemple #7
0
bool warning_msg( bool* _pDoAssert, const char* _file_name, const char* _function_name, size_t _line_nr, const char* _expr, ... )
{
    //
    int     result = -1;
    int     buffer_count = 1024;
    char*   pBuffer = NULL;

    // keep get va string until success 
    while ( result == -1 ) {
        pBuffer = (char*)ex_realloc_nomng( pBuffer, buffer_count * sizeof(char), EX_GP(Allocator_dl283) );
        EX_GET_VA_STRING_WITH_RESULT( pBuffer, buffer_count, _expr, &result );
        buffer_count *= 2;
    }
    pBuffer[result] = 0;

    // short the function name
    _SHORT_FUNCTION_NAME(short_name,_function_name);

    //
    ex_log("Warning: %s(%d)[%s], %s\n", _file_name, _line_nr, _function_name, pBuffer );
    int mbResult = ex::message_box( MSG_BOX_FAILED, "Warning", "Warning: %s(%d)[%s], %s", _file_name, _line_nr, _function_name, pBuffer );

    // release buffer we allocate
    ex_free_nomng ( pBuffer, EX_GP(Allocator_dl283) );

    //
#if (EX_PLATFORM == EX_WIN32) || (EX_PLATFORM == EX_XENON)
    (*_pDoAssert) = (mbResult != IDIGNORE);
    return (mbResult == IDRETRY);
#else
    return true;
#endif
}
Exemple #8
0
TEST( uid_t, test, off )
{
    ex::uid_t uid1;
    ex_log("uid1 = %s\n", uid1.to_str<ex::dec|ex::hex>().c_str() );

    ex::uid_t uid2;
    ex_log("uid2 = %s\n", uid2.to_str<ex::dec|ex::hex>().c_str() );

    ex::uid_t uid3;
    ex_log("uid3 = %s\n", uid3.to_str<ex::dec|ex::hex>().c_str() );

    ex::uid_t uid4;
    ex_log("uid4 = %s\n", uid4.to_str<ex::dec|ex::hex>().c_str() );

    uid1 = uid2;
    ex_log("uid1 = %s\n", uid1.to_str<ex::dec|ex::hex>().c_str() );
}
Exemple #9
0
void ex_app_deinit () {
    if ( __initialized ) {
        __deinit_ref_table();

        ex_log ( "ex_engine deinitied" );
        __initialized = false;
    }
}
Exemple #10
0
static void __greg2jul ( uint *_out_jul, int _year, int _month, int _day ) {
    if( !ex_is_valid_date ( _year, _month, _day ) ) {
        ex_log ( "can't set date (%dy,%dm,%dd). the value is invalid!", _year, _month, _day );
        *_out_jul = 0;
        return;
    }

    *_out_jul = (1461*(_year+4800+(_month-14)/12))/4+(367*(_month-2-12*((_month-14)/12)))/12-(3*((_year+4900+(_month-14)/12)/100))/4+_day-32075;
}
Exemple #11
0
static int __log ( lua_State *_l ) {
    const char *msg = NULL;

    ex_lua_tostring(_l,1);
    msg = luaL_checkstring ( _l, -1 );
    ex_log ( "%s", msg );

    return 0;
}
Exemple #12
0
static void __dump () {
    //
    if ( ex_hashmap_count(&__au_map) > 0 ) {
        ex_log( "There are %d place(s) exsits memory leak.",  ex_hashmap_count(&__au_map) );
        EX_HW_BREAK();
    }
    
    //
    if ( ex_hashmap_count(&__au_map) ) {
        ex_hashmap_each ( &__au_map, alloc_unit_t *, au ) {
            char text[2048];
            ex_memzero ( text, 2048 );
            snprintf ( text, 2048, 
                       "%s:%d: error memory leak\r\n"
                       "function name:  %s\r\n"
                       "tag name:       %s\r\n"
                       "original addr:  %#.8lx\r\n"
                       "debug addr:     %#.8lx\r\n"
                       "original size:  %lu(%#.8lX)\r\n"
                       "debug size:     %lu(%#.8lX)\r\n"
                       "alloc nr:       %lu(%#.8lX)\r\n"
                       "thread ID:      %lu(%#.8lX)\r\n"
                       "\r\n"
                       ,au->file_name ,(int)au->line_nr 
                       ,au->func_name 
                       ,au->tag_name 
                       ,ex_ptr_to_addr(au->org_addr) 
                       ,ex_ptr_to_addr(au->dbg_addr) 
                       ,au->org_size, au->org_size 
                       ,au->dbg_size, au->dbg_size 
                       ,au->alloc_nr, au->alloc_nr 
                       ,au->thread_id, au->thread_id 
                     );

            // format log info
            ex_log( "%s", text ); 
            // DISABLE: use ex_log above instaed { 
            // __log ( "%s", text );
            // printf ( "%s", text ); // also show on the console.
            // } DISABLE end 

        } ex_hashmap_each_end;
    }
Exemple #13
0
int ex_fsys_init () {
    __PHYSFS_CHECK( PHYSFS_init(".") ); // NOTE: we write like this to prevent compile error 
    PHYSFS_permitSymbolicLinks(1); // yes, we permit symbolic links

    ex_log ( "[fsys] Version: %d.%d.%d", 
             PHYSFS_VER_MAJOR, 
             PHYSFS_VER_MINOR,
             PHYSFS_VER_PATCH );

    return 0;
}
Exemple #14
0
static void on_drag_end ( ClutterDragAction *_action,
                          ClutterActor *_actor,
                          gfloat _event_x,
                          gfloat _event_y,
                          ClutterModifierType _modifiers )
{
    ex_log("on drag end.");
    // clutter_actor_animate (_actor, CLUTTER_LINEAR, 150,
    //                        "@effects.disable.factor", 0.0,
    //                        NULL);
}
Exemple #15
0
Fichier : wiz.c Projet : ifzz/exsdk
int wiz_execute ( lua_State *_l, const char *_path ) {
    size_t len;
    const char *end, *ptr;
    char dirpath[512];
    int idx_cwd;

    // initialize
    len = strlen(_path);
    end = _path + len - 1;
    ptr = end;

    // get dirpath
    while ( ptr != _path && *ptr != '/' ) {
        --ptr;
    }
    len = ptr-_path+1;
    if ( len > 511 ) len = 511;
    if ( len == 1 ) {
        strncpy ( dirpath, "./", 2 );
        dirpath[2] = '\0';
    }
    else {
        strncpy ( dirpath, _path, len );
        dirpath[len] = '\0';
    }

    // set os.cwd to the dirpath
    lua_pushstring ( _l, ex_os_getcwd() );
    idx_cwd = lua_gettop(_l); // store the old cwd
    ex_os_setcwd(dirpath);

    // if this is a lua file
    if ( strncmp( (end-3), ".lua", 4 ) == 0 ) {
        // NOTE: do not use ex_lua_fsys_dofile, because we are working with command line environment
        if ( ex_lua_dofile ( _l, _path ) != 0 ) {
            return -1;
        }
    }
    // if this is an xml file
    else if ( strncmp( (end-3), ".xml", 4 ) == 0 ) {
        if ( __wiz_load_xml ( _l, _path ) != 0 ) {
            return -1;
        }
    }
    else {
        ex_log ( "Invalid file: %s", _path );
    }

    // restore the old cwd
    ex_os_setcwd(lua_tostring(_l, idx_cwd));
    lua_remove(_l,idx_cwd); // remove cwd

    return 0;
}
Exemple #16
0
Fichier : wiz.c Projet : ifzz/exsdk
void wiz_create_window ( lua_State *_l, int _refID, int _w, int _h ) {
    SDL_Window *sdl_window;
    SDL_Renderer *sdl_renderer;
    __window_info_t *win_info;

    // create SDL window
    sdl_window = SDL_CreateWindow( "Window",
                                   SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
                                   _w, _h,
                                   SDL_WINDOW_RESIZABLE | SDL_WINDOW_SHOWN /*| SDL_WINDOW_BORDERLESS*/
                                 );
    if ( !sdl_window ) {
        ex_log ( "[SDL] Error: Could not create window: %s", SDL_GetError() );
        return;
    }

    // create SDL renderer
    sdl_renderer = SDL_CreateRenderer( sdl_window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC );
    if ( !sdl_renderer ) {
        ex_log ( "[SDL] Error: Could not create renderer: %s", SDL_GetError() );
        return;
    }

    // add window info
    win_info = ex_malloc( sizeof(__window_info_t) );
    win_info->sdl_window = sdl_window;
    win_info->sdl_renderer = sdl_renderer;
    win_info->refID = _refID;
    win_info->dirty = true;
    ex_color3u_set ( &win_info->bg_color, 255, 255, 255 );

    // if this is the first window, create queue
    if ( ex_array_count(__window_list) == 0 ) {
        primary_win_info = win_info;
        ex_set_main_sdl_renderer(sdl_renderer);
    }
    ex_array_add ( __window_list, &win_info );
}
Exemple #17
0
TEST( String, op_sub, off )
{
    ex::string_t str ("Hello World This is Wu Jie.");
    ex::string_t result;

    result = str - "this";
    ex_log("result = %s\n", result.c_str());
    CHECK( result == "Hello World This is Wu Jie." );

    result = str - "Wu Jie";
    ex_log("result = %s\n", result.c_str());
    CHECK( result == "Hello World This is ." );

    result = str - "Hello";
    ex_log("result = %s\n", result.c_str());
    CHECK( result == " World This is Wu Jie." );

    result = str - "This i";
    ex_log("result = %s\n", str.c_str());
    CHECK( result == "Hello World s Wu Jie." );

    EX_HW_BREAK();
}
Exemple #18
0
TEST( IFile, fileid, off )
{
    ex::uint64 fileID = -1;
    ex::IFile::smart_ptr_t spFile;
    ex::r_path_t xml_file( "res://xml/Array.xml" );
    if ( ex::futil::file::exists(xml_file.rawfile()) )
    {
        fileID = ex::futil::file::fileID (xml_file.rawfile());
        ex_log("first time get fileID = %d\n", fileID );

        fileID = ex::futil::file::fileID (xml_file.rawfile());
        ex_log("second time get fileID = %d\n", fileID );

        spFile = ex::futil::file::readonly<ex::PhysicalFile> (xml_file.rawfile());
        fileID = ex::futil::file::fileID (xml_file.rawfile());
        ex_log("after readonly get fileID = %d\n", fileID );

        spFile = ex::futil::file::open<ex::PhysicalFile> (xml_file.rawfile());
        fileID = ex::futil::file::fileID (xml_file.rawfile());
        ex_log("after open exists get fileID = %d\n", fileID );

        EX_HW_BREAK();
    }
}
Exemple #19
0
Fichier : wiz.c Projet : ifzz/exsdk
void wiz_run ( lua_State *_l, int _argc, char **_argv ) {
    // init wiz
    if ( __init ( _l, _argc, _argv ) != 0 ) {
        ex_log ( "Failed to init wiz" );
        return;
    }

    // process argument
    if ( _argc >= 2 ) {
        size_t len;
        const char *p;
        const char *filepath;
        char result[512];

        filepath = _argv[1];

        // strip white space at last
        len = strlen(filepath);
        p = filepath + len - 1;
        while ( isspace(*p) ) {
            --p;
        }

        // copy the result
        len = p-filepath+1;
        if ( len > 511 ) len = 511;
        strncpy ( result, filepath, len );
        result[len] = '\0';

        // open the file
        wiz_execute(_l,result);
    }

    // enter the event-loop if we create display(window)
    if ( primary_win_info != NULL ) {
        __event_loop (_l);
    }

    // deinit wiz
    __deinit(_l);
}
Exemple #20
0
int ex_app_init () {
    // we can't init ex_engine before ex_core initialized.
    if ( ex_core_initialized () == false ) {
        ex_warning ( "ex_core haven't initialed." );
        return -1;
    }

    // if the core already inited, don't init it second times.
    if ( __initialized ) {
        ex_warning ( "ex_engine already inited" );
        return 1;
    }

    // start engine time
    __init_ref_table ();
    __start_engine_time ();

    //
    ex_log ("ex_engine inited");
    __initialized = true;
    return 0;
}
Exemple #21
0
TEST( futil, globFiles, off )
{
    ex::path_t rawDataPath = ex::core_t::config()->get<const char*>("RawDataPath");

    {
        ex::path_t path = rawDataPath + ex::path_t("misc/find");
        ex::Array<ex::path_t> result;

        result.clear();
        CHECK ( ex::futil::glob ( path, &result ) ); 
        ex_log("- glob result -\n" );
        ex_log("%s\n", result.to_str<ex::dec>().c_str() );

        result.clear();
        CHECK ( ex::futil::globFiles ( path, &result ) ); 
        ex_log("- globFiles result -\n" );
        ex_log("%s\n", result.to_str<ex::dec>().c_str() );

        result.clear();
        CHECK ( ex::futil::globDirs ( path, &result ) ); 
        ex_log("- globDirs result -\n" );
        ex_log("%s\n", result.to_str<ex::dec>().c_str() );
    }
}
Exemple #22
0
int __wiz_load_xml ( lua_State *_l, const char *_filepath ) {
    XML_Parser parser;
    ex_file_t *file;
    char buffer[BUF_SIZE];
    int done;
    size_t len;
    __user_data_t userData;

    //
    file = ex_os_fopen( _filepath, "rb" );
    if ( file == NULL ) {
        ex_log ( "[wiz] Can't find the file %s", _filepath );
        return 1;
    }

    // init userData
    userData.l = _l;
    lua_getglobal( _l, "wiz" );
    lua_getfield( _l, -1, "xmlparser" );

    lua_getfield( _l, -1, "onStartElement" );
    userData.refID_on_start_element = luaL_ref( _l, LUA_REGISTRYINDEX );

    lua_getfield( _l, -1, "onEndElement" );
    userData.refID_on_end_element = luaL_ref( _l, LUA_REGISTRYINDEX );

    lua_getfield( _l, -1, "onAddText" );
    userData.refID_on_add_text = luaL_ref( _l, LUA_REGISTRYINDEX );

    lua_getfield( _l, -1, "onFinish" );
    userData.refID_on_finish = luaL_ref( _l, LUA_REGISTRYINDEX );

        // create xml parser 
        parser = XML_ParserCreate(NULL);
        XML_SetEncoding(parser, "utf-8");
        XML_SetUserData(parser, &userData);
        XML_SetElementHandler ( parser, __start_element, __end_element );
        XML_SetCharacterDataHandler ( parser, __process_character_data );

        // begin parse strimming xml 
        do {
            len = ex_os_fread (file, buffer, BUF_SIZE);
            done = len < sizeof(buffer);
            if ( XML_Parse(parser, buffer, len, done) == XML_STATUS_ERROR ) {
                ex_log( "[wiz] %s at line %d", 
                        XML_ErrorString(XML_GetErrorCode(parser)),
                        XML_GetCurrentLineNumber(parser) );
                return 1;
            }
        } while (!done);

        XML_ParserFree(parser);
        ex_os_fclose(file);

        // invoke wiz.parser.onFinish()
        lua_rawgeti( _l, LUA_REGISTRYINDEX, userData.refID_on_finish );
        if ( lua_pcall( _l, 0, 0, 0 ) ) {
            ex_lua_alert(_l);
        }

    // deinit userData
    luaL_unref( _l, LUA_REGISTRYINDEX, userData.refID_on_start_element );
    luaL_unref( _l, LUA_REGISTRYINDEX, userData.refID_on_end_element );
    luaL_unref( _l, LUA_REGISTRYINDEX, userData.refID_on_add_text );
    luaL_unref( _l, LUA_REGISTRYINDEX, userData.refID_on_finish );
    lua_pop(_l,2); // pop wiz.parser

    return 0;
}
Exemple #23
0
static int __load_modules ( lua_State *_l, const char *_base, const char *_dir ) {
    char **file_list, **i;
    char full_path[MAX_PATH];
    int dir_len, fname_len;

    //
    dir_len = strlen(_dir);
    if ( dir_len+2 > MAX_PATH ) {
        ex_error ( "directory path is too long! %s", _dir );
        return -1;
    }

    // append '/' at the end of the path if not exists.
    strncpy ( full_path, _dir, dir_len  );
    if ( full_path[dir_len-1] != '/' ) {
        full_path[dir_len] = '/';
        full_path[dir_len+1] = '\0';
        dir_len += 1;
    }
    else {
        full_path[dir_len] = '\0';
    }

    //
    file_list = ex_fsys_files_in(_dir);
    for ( i = file_list; *i != NULL; ++i ) {
        fname_len = strlen(*i);
        if ( dir_len + fname_len + 1 > MAX_PATH ) {
            ex_error ( "file path is too long! %s%s", _dir, *i );
            continue;
        }

        // skip the hidden directory or file
        if ( **i == '.' ) {
            continue;
        }

        // ignore file name or directory name start with '__', 
        // this can help me temporary disable loading specific modules.
        if ( strncmp(*i,"__",2) == 0 ) {
            // ex_log("skip loading %s%s", _dir, *i); // for DEBUG
            continue;
        }

        // get the full path
        full_path[dir_len] = '\0'; // the easist way to reset the full_path to base_path
        strncat ( full_path, *i, fname_len  );
        full_path[dir_len+fname_len] = '\0';

        // if this is a directory
        if ( ex_fsys_isdir( full_path ) ) {
            __load_modules ( _l, _base, full_path );
        }
        // NOTE: it is possible that its a symbolic link
        else if ( ex_fsys_isfile( full_path ) ) {
            // if this is a file, check if it is a lua file.
            if ( strncmp (*i+fname_len-4, ".lua", 4 ) == 0 ) {
                char modname[MAX_PATH];
                int base_len = strlen(_base);
                int modname_len = dir_len+fname_len-4-base_len;
                char *j = modname;

                strncpy(modname,full_path+base_len,modname_len);
                modname[modname_len] = '\0';
                while ( *j != '\0' ) {
                    if ( *j == '/' )
                        *j = '.';
                    ++j;
                }

                // check if the module already loaded ( by require )
                lua_getfield(_l, LUA_REGISTRYINDEX, "_LOADED");
                lua_getfield(_l, -1, modname);  /* get _LOADED[modname] */
                if ( !lua_istable(_l,-1) ) 
                    ex_lua_dofile( _l, full_path, modname );
                // TODO: since require will change the order of module loading, 
                // I think I need a correct way report module loading 
                ex_log ("load lua module %s from file %s", modname, full_path);
            }
        }
    }
    ex_fsys_free_list(file_list);
    return 0;
}
Exemple #24
0
Fichier : wiz.c Projet : ifzz/exsdk
static int __init ( lua_State *_l, int _argc, char **_argv ) {
    const char *app_path = NULL;
    const char *usr_path = NULL;
    ex_str_t *init_file;

    // mount the wiz path to __wiz__/ in fsys
#if (EX_PLATFORM == EX_IOS)
    app_path = ex_fsys_main_bundle_path();
#else
    app_path = ex_fsys_app_dir();
#endif
    usr_path = ex_fsys_user_dir();

    ex_log ( "[wiz] User path: %s", usr_path );
    ex_log ( "[wiz] Application path: %s", app_path );

    // DISABLE: {
    // // mount wiz(.exe) process path to __wiz__/ primary
    // if ( app_path ) {
    //     strncpy ( path, app_path, MAX_PATH );
    //     // strcat ( path, "builtin/" );

    //     // NOTE: set write dir doesn't means you mount it.
    //     if ( ex_fsys_set_write_path(path) != 0 )
    //         return -1;
    //     ex_log ( "[wiz] Set default write path: %s", path  );

    //     //
    //     if ( ex_fsys_mount( path, "__wiz__", true ) != 0 )
    //         return -1;
    //     ex_log ( "[wiz] Mount %s to wiz://", path  );
    // }

    // // if ~/.wiz/ exists we mount it to __wiz__/ secondly
    // if ( usr_path ) {
    //     strncpy ( path, usr_path, MAX_PATH );
    //     strcat ( path, ".wiz/" );

    //     //
    //     if ( ex_os_exists(path) && ex_os_isdir(path) ) {
    //         if ( ex_fsys_mount( path, "__wiz__", true ) != 0 )
    //             return -1;
    //         ex_log ("[wiz] Mount %s to wiz://", path );
    //     }
    // }
    // } DISABLE end

    // init wiz_c
    lua_newtable(_l); // create wiz_c table

    __wiz_lua_add_window (_l);

    ex_lua_add_c_module ( _l, "wiz_c" );

    lua_pop(_l, 1);  /* remove wiz_c table */

    // load builtin modules
    init_file = ex_str_allocf( "%s/builtin/modules/__init__.lua", app_path );
    ex_log ( "[wiz] Initializing builtin modules..." );
    if ( ex_lua_dofile ( _l, ex_cstr(init_file) ) ) {
        ex_str_free(init_file);
        ex_log ( "Failed to init builtin modules" );
        return -1;
    }
    ex_str_free(init_file);

    // push arguments to wiz.arguments in lua
    __lua_wiz_init_arguments ( _l, _argc, _argv );

    //
    __window_list = ex_array_alloc ( sizeof(__window_info_t *), 8 );

    return 0;
}