Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9019 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
RevLine 
[2604]1diff -ruN tolua/tolua.c tolua2/tolua.c
2--- tolua/tolua.c       Wed Jan 28 21:51:00 2009
3+++ tolua2/tolua.c      Sat Jan 10 14:48:45 2009
4@@ -4,6 +4,8 @@
[2705]5 ** TeCGraf/PUC-Rio
6 ** Aug 2003
7 ** $Id:$
8+** Extension by Orxonox (Reto Grieder) to support working directory
9+** and direct usage of lua files. (2008)
10 */
11 
12 /* This code is free software; you can redistribute it and/or modify it.
[2604]13@@ -33,6 +35,8 @@
[2705]14          "  -o  file : set output file; default is stdout.\n"
15          "  -H  file : create include file.\n"
16          "  -n  name : set package name; default is input file root name.\n"
17+         "  -w  directory : set working directory; default is location of package file.\n"
18+         "  -s  file : specify source lua code for the parser; all.lua is default.\n"
19          "  -p       : parse only.\n"
20          "  -P       : parse and print structure information (for debug).\n"
21          "  -S       : disable support for c++ strings.\n"
[2604]22@@ -64,12 +68,12 @@
[2705]23 }
24 
25 static void add_extra (lua_State* L, char* value) {
26-       int len;
27-       lua_getglobal(L, "_extra_parameters");
28-       len = luaL_getn(L, -1);
29-       lua_pushstring(L, value);
30-       lua_rawseti(L, -2, len+1);
31-       lua_pop(L, 1);
32+ int len;
33+ lua_getglobal(L, "_extra_parameters");
34+ len = luaL_getn(L, -1);
35+ lua_pushstring(L, value);
36+ lua_rawseti(L, -2, len+1);
37+ lua_pop(L, 1);
38 };
39 
40 static void error (char* o)
[2604]41@@ -81,6 +85,9 @@
[2705]42 
43 int main (int argc, char* argv[])
44 {
45+ char* working_directory = "";
46+ char* lua_source = "";
47+
48  #ifdef LUA_VERSION_NUM /* lua 5.1 */
49  lua_State* L = luaL_newstate();
50  luaL_openlibs(L);
[2604]51@@ -97,6 +104,7 @@
[2705]52  lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION");
53  lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION");
54 
55+
56  if (argc==1)
57  {
58   help();
[2604]59@@ -124,6 +132,14 @@
[2705]60      case 'o': setfield(L,t,"o",argv[++i]); break;
61      case 'n': setfield(L,t,"n",argv[++i]); break;
62      case 'H': setfield(L,t,"H",argv[++i]); break;
63+     case 'w':
64+      working_directory = argv[++i];
65+      setfield(L,t,"w",argv[i]);
66+      break;
67+     case 's':
68+      lua_source = argv[++i];
69+      setfield(L,t,"s",argv[i]);
70+      break;
71      case 'S': setfield(L,t,"S",""); break;
72      case '1': setfield(L,t,"1",""); break;
73      case 'L': setfield(L,t,"L",argv[++i]); break;
[2604]74@@ -143,25 +159,53 @@
[2705]75   }
76   lua_pop(L,1);
77  }
78-/* #define TOLUA_SCRIPT_RUN */
79-#ifndef TOLUA_SCRIPT_RUN
80+
81  {
82-  int tolua_tolua_open (lua_State* L);
83-  tolua_tolua_open(L);
84- }
85+  char path[BUFSIZ];
86+  char file[BUFSIZ];
87+  path[0] = '\0';
88+  file[0] = '\0';
89+
90+  if (strlen(lua_source) > 0 &&
91+      lua_source[0] != '/' &&
92+      lua_source[0] != '\\' &&
93+      strlen(lua_source) > 1 &&
94+      lua_source[1] != ':')
95+  {
96+   /* Relative path, prefix working directory */
97+   strcpy(path, working_directory);
98+   /* Make sure there is '\\' or '/' at the end of the path */
99+   if (strlen(path) > 0)
100+   {
101+    char last = path[strlen(path) - 1];
102+    if (last != '\\' && last != '/')
103+     strcat(path, "/");
104+   }
105+  }
106+
107+  strcat(path, lua_source);
108+
109+  /* Extract the full path */
110+  {
111+   char* p;
112+   p = strrchr(path, '/');
113+   if (p == NULL)
114+    p = strrchr(path, '\\');
115+   p = (p == NULL) ? path : p + 1;
116+   strcpy(file, p);
117+   *p = '\0';
118+  }
119+  if (strlen(file) == 0)
120+   strcpy(file, "all.lua");
121+
122+  lua_pushstring(L, path);
123+  lua_setglobal(L, "path");
124+  strcat(path, file);
125+#ifdef LUA_VERSION_NUM /* lua 5.1 */
126+  luaL_dofile(L, path);
127 #else
128- {
129-  char* p;
130-  char  path[BUFSIZ];
131-  strcpy(path,argv[0]);
132-  p = strrchr(path,'/');
133-  if (p==NULL) p = strrchr(path,'\\');
134-  p = (p==NULL) ? path : p+1;
135-  sprintf(p,"%s","../src/bin/lua/");
136-  lua_pushstring(L,path); lua_setglobal(L,"path");
137-               strcat(path,"all.lua");
138-  lua_dofile(L,path);
139- }
140+  lua_dofile(L, path);
141 #endif
142+ }
143  return 0;
144 }
Note: See TracBrowser for help on using the repository browser.