Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/tolua/changes_orxonox.diff @ 10462

Last change on this file since 10462 was 8351, checked in by rgrieder, 14 years ago

Merged kicklib2 branch back to trunk (includes former branches ois_update, mac_osx and kicklib).

Notes for updating

Linux:
You don't need an extra package for CEGUILua and Tolua, it's already shipped with CEGUI.
However you do need to make sure that the OgreRenderer is installed too with CEGUI 0.7 (may be a separate package).
Also, Orxonox now recognises if you install the CgProgramManager (a separate package available on newer Ubuntu on Debian systems).

Windows:
Download the new dependency packages versioned 6.0 and use these. If you have problems with that or if you don't like the in game console problem mentioned below, you can download the new 4.3 version of the packages (only available for Visual Studio 2005/2008).

Key new features:

  • *Support for Mac OS X*
  • Visual Studio 2010 support
  • Bullet library update to 2.77
  • OIS library update to 1.3
  • Support for CEGUI 0.7 —> Support for Arch Linux and even SuSE
  • Improved install target
  • Compiles now with GCC 4.6
  • Ogre Cg Shader plugin activated for Linux if available
  • And of course lots of bug fixes

There are also some regressions:

  • No support for CEGUI 0.5, Ogre 1.4 and boost 1.35 - 1.39 any more
  • In game console is not working in main menu for CEGUI 0.7
  • Tolua (just the C lib, not the application) and CEGUILua libraries are no longer in our repository. —> You will need to get these as well when compiling Orxonox
  • And of course lots of new bugs we don't yet know about
  • Property svn:eol-style set to native
File size: 3.7 KB
  • tolua.c

    diff -ruN tolua/tolua.c tolua2/tolua.c
    old new  
    44** TeCGraf/PUC-Rio
    55** Aug 2003
    66** $Id:$
     7** Extension by Orxonox (Reto Grieder) to support working directory
     8** and direct usage of lua files. (2008)
    79*/
    810
    911/* This code is free software; you can redistribute it and/or modify it.
     
    3335         "  -o  file : set output file; default is stdout.\n"
    3436         "  -H  file : create include file.\n"
    3537         "  -n  name : set package name; default is input file root name.\n"
     38         "  -w  directory : set working directory; default is location of package file.\n"
     39         "  -s  file : specify source lua code for the parser; all.lua is default.\n"
    3640         "  -p       : parse only.\n"
    3741         "  -P       : parse and print structure information (for debug).\n"
    3842         "  -S       : disable support for c++ strings.\n"
     
    6468}
    6569
    6670static void add_extra (lua_State* L, char* value) {
    67         int len;
    68         lua_getglobal(L, "_extra_parameters");
    69         len = luaL_getn(L, -1);
    70         lua_pushstring(L, value);
    71         lua_rawseti(L, -2, len+1);
    72         lua_pop(L, 1);
     71 int len;
     72 lua_getglobal(L, "_extra_parameters");
     73 len = luaL_getn(L, -1);
     74 lua_pushstring(L, value);
     75 lua_rawseti(L, -2, len+1);
     76 lua_pop(L, 1);
    7377};
    7478
    7579static void error (char* o)
     
    8185
    8286int main (int argc, char* argv[])
    8387{
     88 char* working_directory = "";
     89 char* lua_source = "";
     90
    8491 #ifdef LUA_VERSION_NUM /* lua 5.1 */
    8592 lua_State* L = luaL_newstate();
    8693 luaL_openlibs(L);
     
    97104 lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION");
    98105 lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION");
    99106
     107
    100108 if (argc==1)
    101109 {
    102110  help();
     
    124132     case 'o': setfield(L,t,"o",argv[++i]); break;
    125133     case 'n': setfield(L,t,"n",argv[++i]); break;
    126134     case 'H': setfield(L,t,"H",argv[++i]); break;
     135     case 'w':
     136      working_directory = argv[++i];
     137      setfield(L,t,"w",argv[i]);
     138      break;
     139     case 's':
     140      lua_source = argv[++i];
     141      setfield(L,t,"s",argv[i]);
     142      break;
    127143     case 'S': setfield(L,t,"S",""); break;
    128144     case '1': setfield(L,t,"1",""); break;
    129145     case 'L': setfield(L,t,"L",argv[++i]); break;
     
    143159  }
    144160  lua_pop(L,1);
    145161 }
    146 /* #define TOLUA_SCRIPT_RUN */
    147 #ifndef TOLUA_SCRIPT_RUN
     162
    148163 {
    149   int tolua_tolua_open (lua_State* L);
    150   tolua_tolua_open(L);
    151  }
     164  char path[BUFSIZ];
     165  char file[BUFSIZ];
     166  path[0] = '\0';
     167  file[0] = '\0';
     168
     169  if (strlen(lua_source) > 0 &&
     170      lua_source[0] != '/' &&
     171      lua_source[0] != '\\' &&
     172      strlen(lua_source) > 1 &&
     173      lua_source[1] != ':')
     174  {
     175   /* Relative path, prefix working directory */
     176   strcpy(path, working_directory);
     177   /* Make sure there is '\\' or '/' at the end of the path */
     178   if (strlen(path) > 0)
     179   {
     180    char last = path[strlen(path) - 1];
     181    if (last != '\\' && last != '/')
     182     strcat(path, "/");
     183   }
     184  }
     185
     186  strcat(path, lua_source);
     187
     188  /* Extract the full path */
     189  {
     190   char* p;
     191   p = strrchr(path, '/');
     192   if (p == NULL)
     193    p = strrchr(path, '\\');
     194   p = (p == NULL) ? path : p + 1;
     195   strcpy(file, p);
     196   *p = '\0';
     197  }
     198  if (strlen(file) == 0)
     199   strcpy(file, "all.lua");
     200
     201  lua_pushstring(L, path);
     202  lua_setglobal(L, "path");
     203  strcat(path, file);
     204#ifdef LUA_VERSION_NUM /* lua 5.1 */
     205  luaL_dofile(L, path);
    152206#else
    153  {
    154   char* p;
    155   char  path[BUFSIZ];
    156   strcpy(path,argv[0]);
    157   p = strrchr(path,'/');
    158   if (p==NULL) p = strrchr(path,'\\');
    159   p = (p==NULL) ? path : p+1;
    160   sprintf(p,"%s","../src/bin/lua/");
    161   lua_pushstring(L,path); lua_setglobal(L,"path");
    162                 strcat(path,"all.lua");
    163   lua_dofile(L,path);
    164  }
     207  lua_dofile(L, path);
    165208#endif
     209 }
    166210 return 0;
    167211}
Note: See TracBrowser for help on using the repository browser.