Remove unwanted files

13-inventory-fixes
Nuno 3 years ago
parent 92ff9f12b0
commit 70286d36a9

@ -1,396 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2012 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
// Copyright (C) 2016-2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_STRING_COMMON_H
#define NL_STRING_COMMON_H
#include "types_nl.h"
#include <cstdio>
#include <cstring>
#include <cstdarg>
#include <errno.h>
namespace NLMISC
{
// get a string and add \r before \n if necessary
std::string addSlashR (const std::string &str);
std::string removeSlashR (const std::string &str);
/**
* \def MaxCStringSize
*
* The maximum size allowed for C string (zero terminated string) buffer.
* This value is used when we have to create a standard C string buffer and we don't know exactly the final size of the string.
*/
const int MaxCStringSize = 2048;
/**
* \def NLMISC_CONVERT_VARGS(dest,format)
*
* This macro converts variable arguments into C string (zero terminated string).
* This function takes care to avoid buffer overflow.
*
* Example:
*\code
void MyFunction(const char *format, ...)
{
string str;
NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize);
// str contains the result of the conversion
}
*\endcode
*
* \param _dest \c string or \c char* that contains the result of the convertion
* \param _format format of the string, it must be the last argument before the \c '...'
* \param _size size of the buffer that will contain the C string
*/
#define NLMISC_CONVERT_VARGS(_dest,_format,_size) \
char _cstring[_size]; \
va_list _args; \
va_start (_args, _format); \
int _res = vsnprintf (_cstring, _size-1, _format, _args); \
if (_res == -1 || _res == _size-1) \
{ \
_cstring[_size-1] = '\0'; \
} \
va_end (_args); \
_dest = _cstring
/** sMart sprintf function. This function do a sprintf and add a zero at the end of the buffer
* if there no enough room in the buffer.
*
* \param buffer a C string
* \param count Size of the buffer
* \param format of the string, it must be the last argument before the \c '...'
*/
sint smprintf( char *buffer, size_t count, const char *format, ... );
#ifdef NL_OS_WINDOWS
//
// These functions are needed by template system to failed the compilation if you pass bad type on nlinfo...
//
inline void _check(int /* a */) { }
inline void _check(unsigned int /* a */) { }
inline void _check(char /* a */) { }
inline void _check(unsigned char /* a */) { }
inline void _check(long /* a */) { }
inline void _check(unsigned long /* a */) { }
#ifdef NL_COMP_VC6
inline void _check(uint8 /* a */) { }
#endif // NL_COMP_VC6
inline void _check(sint8 /* a */) { }
inline void _check(uint16 /* a */) { }
inline void _check(sint16 /* a */) { }
#ifdef NL_COMP_VC6
inline void _check(uint32 /* a */) { }
inline void _check(sint32 /* a */) { }
#endif // NL_COMP_VC6
inline void _check(uint64 /* a */) { }
inline void _check(sint64 /* a */) { }
inline void _check(float /* a */) { }
inline void _check(double /* a */) { }
inline void _check(const char * /* a */) { }
inline void _check(const void * /* a */) { }
#define CHECK_TYPES(__a,__b) \
inline __a(const char *fmt) { __b(fmt); } \
template<class A> __a(const char *fmt, A a) { _check(a); __b(fmt, a); } \
template<class A, class B> __a(const char *fmt, A a, B b) { _check(a); _check(b); __b(fmt, a, b); } \
template<class A, class B, class C> __a(const char *fmt, A a, B b, C c) { _check(a); _check(b); _check(c); __b(fmt, a, b, c); } \
template<class A, class B, class C, class D> __a(const char *fmt, A a, B b, C c, D d) { _check(a); _check(b); _check(c); _check(d); __b(fmt, a, b, c, d); } \
template<class A, class B, class C, class D, class E> __a(const char *fmt, A a, B b, C c, D d, E e) { _check(a); _check(b); _check(c); _check(d); _check(e); __b(fmt, a, b, c, d, e); } \
template<class A, class B, class C, class D, class E, class F> __a(const char *fmt, A a, B b, C c, D d, E e, F f) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); __b(fmt, a, b, c, d, e, f); } \
template<class A, class B, class C, class D, class E, class F, class G> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); __b(fmt, a, b, c, d, e, f, g); } \
template<class A, class B, class C, class D, class E, class F, class G, class H> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); __b(fmt, a, b, c, d, e, f, g, h); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); __b(fmt, a, b, c, d, e, f, g, h, i); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); __b(fmt, a, b, c, d, e, f, g, h, i, j); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); __b(fmt, a, b, c, d, e, f, g, h, i, j, k); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R, class S> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R, class S, class T> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R, class S, class T, class U> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R, class S, class T, class U, class V> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R, class S, class T, class U, class V, class W> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v, W w) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); _check(w); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R, class S, class T, class U, class V, class W, class X> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v, W w, X x) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); _check(w); _check(x); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R, class S, class T, class U, class V, class W, class X, class Y> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v, W w, X x, Y y) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); _check(w); _check(x); _check(y); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y); } \
template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M, class N, class O, class P, class Q, class R, class S, class T, class U, class V, class W, class X, class Y, class Z> __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v, W w, X x, Y y, Z z) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); _check(w); _check(x); _check(y); _check(z); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z); }
#endif
#ifdef NL_OS_WINDOWS
inline std::string _toString(const char *format, ...)
#else
inline std::string toString(const char *format, ...)
#endif
{
std::string Result;
NLMISC_CONVERT_VARGS(Result, format, NLMISC::MaxCStringSize);
return Result;
}
#ifdef NL_OS_WINDOWS
CHECK_TYPES(std::string toString, return _toString)
#endif // NL_OS_WINDOWS
template<class T> std::string toStringPtr(const T *val) { return toString("%p", val); }
template<class T> std::string toStringEnum(const T &val) { return toString("%u", (uint32)val); }
/**
* Template Object toString.
* \param obj any object providing a "std::string toString()" method. The object doesn't have to derive from anything.
*
* the VC++ error "error C2228: left of '.toString' must have class/struct/union type" means you don't provide
* a toString() method to your object.
*/
template<class T> std::string toString(const T &obj)
{
return obj.toString();
}
//inline std::string toString(const char *val) { return toString("%s", val); }
inline std::string toString(const uint8 &val) { return toString("%hu", (uint16)val); }
inline std::string toString(const sint8 &val) { return toString("%hd", (sint16)val); }
inline std::string toString(const uint16 &val) { return toString("%hu", val); }
inline std::string toString(const sint16 &val) { return toString("%hd", val); }
inline std::string toString(const uint32 &val) { return toString("%u", val); }
inline std::string toString(const sint32 &val) { return toString("%d", val); }
inline std::string toString(const uint64 &val) { return toString("%" NL_I64 "u", val); }
inline std::string toString(const sint64 &val) { return toString("%" NL_I64 "d", val); }
#ifdef NL_COMP_GCC
# if GCC_VERSION == 40102
// error fix for size_t? gcc 4.1.2 requested this type instead of size_t ...
inline std::string toString(const long unsigned int &val)
{
#ifdef _LP64
return toString((uint64)val);
#else
return toString((uint32)val);
#endif
}
# endif
#endif
#if (SIZEOF_SIZE_T) == 8
inline std::string toString(const size_t &val) { return toString("%" NL_I64 "u", val); }
#else
#ifdef NL_OS_MAC
inline std::string toString(const size_t &val) { return toString("%u", val); }
#endif
#endif
inline std::string toString(const float &val) { return toString("%f", val); }
inline std::string toString(const double &val) { return toString("%lf", val); }
inline std::string toString(const bool &val) { return val ? "1":"0"; }
inline std::string toString(const std::string &val) { return val; }
// stl vectors of bool use bit reference and not real bools, so define the operator for bit reference
#ifdef NL_COMP_VC6
inline std::string toString(const uint &val) { return toString("%u", val); }
inline std::string toString(const sint &val) { return toString("%d", val); }
#endif // NL_COMP_VC6
template<class T>
bool fromString(const std::string &str, T &obj)
{
return obj.fromString(str);
}
inline bool fromString(const std::string &str, uint32 &val) { if (str.find('-') != std::string::npos) { val = 0; return false; } char *end; unsigned long v; errno = 0; v = strtoul(str.c_str(), &end, 10); if (errno || v > UINT_MAX || end == str.c_str()) { val = 0; return false; } else { val = (uint32)v; return true; } }
inline bool fromString(const std::string &str, sint32 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > INT_MAX || v < INT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint32)v; return true; } }
inline bool fromString(const std::string &str, uint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > UCHAR_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint8)v; return true; } }
inline bool fromString(const std::string &str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint8)v; return true; } }
inline bool fromString(const std::string &str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint16)v; return true; } }
inline bool fromString(const std::string &str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint16)v; return true; } }
inline bool fromString(const std::string &str, uint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }
/// Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, and empty strings, anything else is undefined.
/// - Kaetemi
inline bool toBool(const char *str) { return str[0] == '1' || (str[0] & 0xD2) == 0x50; }
inline bool toBool(const std::string &str) { return toBool(str.c_str()); } // Safe because first byte may be null
bool fromString(const std::string &str, bool &val);
inline bool fromString(const std::string &str, std::string &val) { val = str; return true; }
// stl vectors of bool use bit reference and not real bools, so define the operator for bit reference
#ifdef NL_COMP_VC6
inline bool fromString(const std::string &str, uint &val) { return sscanf(str.c_str(), "%u", &val) == 1; }
inline bool fromString(const std::string &str, sint &val) { return sscanf(str.c_str(), "%d", &val) == 1; }
#endif // NL_COMP_VC6
inline bool startsWith(const char *str, const char *prefix)
{
for (int i = 0;; ++i)
{
if (str[i] != prefix[i] || str[i] == '\0')
{
return prefix[i] == '\0';
}
}
}
inline bool startsWith(const std::string &str, const char *prefix) { return startsWith(str.c_str(), prefix); }
inline bool startsWith(const std::string &str, const std::string &prefix) { return startsWith(str.c_str(), prefix.c_str()); }
inline bool endsWith(const char *str, size_t strLen, const char *suffix, size_t suffixLen)
{
if (strLen < suffixLen)
return false;
int minLen = strLen < suffixLen ? strLen : suffixLen;
for (int i = 1; i <= minLen; ++i)
if (str[strLen - i] != suffix[suffixLen - i])
return false;
return true;
}
inline bool endsWith(const char *str, const char *suffix) { return endsWith(str, strlen(str), suffix, strlen(suffix)); }
inline bool endsWith(const std::string &str, const char *suffix) { return endsWith(str.c_str(), str.size(), suffix, strlen(suffix)); }
inline bool endsWith(const std::string &str, const std::string &suffix) { return endsWith(str.c_str(), str.size(), suffix.c_str(), suffix.size()); }
// Convert local codepage to UTF-8
// On Windows, the local codepage is undetermined
// On Linux, the local codepage is always UTF-8 (no-op)
std::string mbcsToUtf8(const char *str, size_t len = 0);
std::string mbcsToUtf8(const std::string &str);
// Convert wide codepage to UTF-8
// On Windows, the wide codepage is UTF-16
// On Linux, the wide codepage is UTF-32
std::string wideToUtf8(const wchar_t *str, size_t len = 0);
std::string wideToUtf8(const std::wstring &str);
// Convert UTF-8 to wide character set
std::wstring utf8ToWide(const char *str, size_t len = 0);
std::wstring utf8ToWide(const std::string &str);
// Convert UTF-8 to local multibyte character set
std::string utf8ToMbcs(const char *str, size_t len = 0);
std::string utf8ToMbcs(const std::string &str);
// Convert wide to local multibyte character set
std::string wideToMbcs(const wchar_t *str, size_t len = 0);
std::string wideToMbcs(const std::wstring &str);
// Convert local multibyte to wide character set
std::wstring mbcsToWide(const char *str, size_t len = 0);
std::wstring mbcsToWide(const std::string &str);
inline const char *asCStr(const char *str) { return str; }
inline const char *asCStr(const std::string &str) { return str.c_str(); }
inline const wchar_t *asCStr(const wchar_t *str) { return str; }
inline const wchar_t *asCStr(const std::wstring &str) { return str.c_str(); }
#if defined(NL_OS_WINDOWS)
#define nlUtf8ToMbcs(str) (NLMISC::utf8ToMbcs(str).c_str())
#define nlMbcsToUtf8(str) (NLMISC::mbcsToUtf8(str).c_str())
#else
#define nlUtf8ToMbcs(str) (NLMISC::asCStr(str))
#define nlMbcsToUtf8(str) (NLMISC::asCStr(str))
#endif
#define nlWideToUtf8(str) (NLMISC::wideToUtf8(str).c_str())
#define nlUtf8ToWide(str) (NLMISC::utf8ToWide(str).c_str())
#define nlWideToMbcs(str) (NLMISC::wideToMbcs(str).c_str())
#define nlMbcsToWide(str) (NLMISC::mbcsToWide(str).c_str())
// On Windows, tstring is either local multibyte or utf-16 wide
// On Linux, tstring is always utf-8
#if defined(NL_OS_WINDOWS) && (defined(UNICODE) || defined(_UNICODE))
typedef std::wstring tstring;
typedef wchar_t tchar;
inline std::string tStrToUtf8(const tchar *str) { return wideToUtf8((const wchar_t *)str); }
inline std::string tStrToUtf8(const tstring &str) { return wideToUtf8((const std::wstring &)str); }
inline std::wstring tStrToWide(const tchar *str) { return (const wchar_t *)str; }
inline std::wstring tStrToWide(const tstring &str) { return (const std::wstring &)str; }
inline std::string tStrToMbcs(const tchar *str) { return wideToMbcs((const wchar_t *)str); }
inline std::string tStrToMbcs(const tstring &str) { return wideToMbcs((const std::wstring &)str); }
#define nlTStrToUtf8(str) (NLMISC::tStrToUtf8(str).c_str())
#define nlTStrToWide(str) ((const wchar_t *)NLMISC::asCStr(str))
#define nlTStrToMbcs(str) (NLMISC::tStrToMbcs(str).c_str())
inline tstring utf8ToTStr(const char *str) {return (const tstring &)utf8ToWide(str); }
inline tstring utf8ToTStr(const std::string &str) { return (const tstring &)utf8ToWide(str); }
inline tstring wideToTStr(const wchar_t *str) { return (const tchar *)str; }
inline tstring wideToTStr(const std::wstring &str) { return (const tstring &)str; }
inline tstring mbcsToTStr(const char *str) { return (const tstring &)mbcsToWide(str); }
inline tstring mbcsToTStr(const std::string &str) { return (const tstring &)mbcsToWide(str); }
#define nlUtf8ToTStr(str) (NLMISC::utf8ToTStr(str).c_str())
#define nlWideToTStr(str) ((const tchar *)NLMISC::asCStr(str))
#define nlMbcsToTStr(str) (NLMISC::mbcsToTStr(str).c_str())
#else
typedef std::string tstring;
typedef char tchar;
inline std::string tStrToUtf8(const tchar *str) { return mbcsToUtf8((const char *)str); }
inline std::string tStrToUtf8(const tstring &str) { return mbcsToUtf8((const std::string &)str); }
inline std::wstring tStrToWide(const tchar *str) { return mbcsToWide((const char *)str); }
inline std::wstring tStrToWide(const tstring &str) { return mbcsToWide((const std::string &)str); }
inline std::string tStrToMbcs(const tchar *str) { return (const char *)str; }
inline std::string tStrToMbcs(const tstring &str) { return (const std::string &)str; }
#if defined(NL_OS_WINDOWS)
#define nlTStrToUtf8(str) (NLMISC::tStrToUtf8(str).c_str())
#else
#define nlTStrToUtf8(str) ((const char *)NLMISC::asCStr(str))
#endif
#define nlTStrToWide(str) (NLMISC::tStrToWide(str).c_str())
#define nlTStrToMbcs(str) ((const char *)NLMISC::asCStr(str))
inline tstring utf8ToTStr(const char *str) { return (const tstring &)utf8ToMbcs(str); }
inline tstring utf8ToTStr(const std::string &str) { return (const tstring &)utf8ToMbcs(str); }
inline tstring wideToTStr(const wchar_t *str) { return (const tstring &)wideToMbcs(str); }
inline tstring wideToTStr(const std::wstring &str) { return (const tstring &)wideToMbcs(str); }
inline tstring mbcsToTStr(const char *str) { return (const tchar *)str; }
inline tstring mbcsToTStr(const std::string &str) { return (const tstring &)str; }
#if defined(NL_OS_WINDOWS)
#define nlUtf8ToTStr(str) (NLMISC::utf8ToTStr(str).c_str())
#else
#define nlUtf8ToTStr(str) ((const tchar *)NLMISC::asCStr(str))
#endif
#define nlWideToTStr(str) (NLMISC::wideToTStr(str).c_str())
#define nlMbcsToTStr(str) ((const tchar *)NLMISC::asCStr(str))
#endif
} // NLMISC
#endif // NL_STRING_COMMON_H

@ -1,594 +0,0 @@
#!/usr/bin/python
#
# \file 0_setup.py
# \brief Run all setup processes
# \date 2009-02-18 15:28GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Run all setup processes
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2009-2014 by authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time, sys, os, shutil, subprocess, distutils.dir_util, argparse
sys.path.append("configuration")
parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Setup')
parser.add_argument('--noconf', '-nc', action='store_true')
parser.add_argument('--noverify', '-nv', action='store_true')
parser.add_argument('--preset', '-p', action='store_true')
# parser.add_argument('--haltonerror', '-eh', action='store_true')
parser.add_argument('--includeproject', '-ipj', nargs='+')
parser.add_argument('--excludeproject', '-epj', nargs='+')
parser.add_argument('--includeprocess', '-ipc', nargs='+')
parser.add_argument('--excludeprocess', '-epc', nargs='+')
args = parser.parse_args()
if not args.includeproject == None and not args.excludeproject == None:
print "ERROR --includeproject cannot be combined with --excludeproject, exit."
exit()
if not args.includeprocess == None and not args.excludeprocess == None:
print "ERROR --includeprocess cannot be combined with --excludeprocess, exit."
exit()
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
from scripts import *
try:
from buildsite import *
except ImportError:
printLog(log, "*** FIRST RUN ***")
if args.noconf:
printLog(log, "ERROR --noconf is invalid on first run, exit.")
exit()
from tools import *
if not args.noconf:
try:
BuildQuality
except NameError:
BuildQuality = 1
try:
if args.preset:
DummyUnknownName
RemapLocalFrom
except NameError:
RemapLocalFrom = 'R:'
try:
if args.preset:
DummyUnknownName
RemapLocalTo
except NameError:
RemapLocalTo = os.getenv('RC_ROOT').replace('\\', '/')
if (not RemapLocalTo) or (not ':' in RemapLocalTo):
RemapLocalTo = 'R:'
try:
if args.preset:
DummyUnknownName
ToolDirectories
except NameError:
ToolDirectories = [ 'R:/distribution/nel_tools_win_x64', 'R:/distribution/ryzom_tools_win_x64' ]
try:
ToolSuffix
except NameError:
ToolSuffix = ".exe"
try:
if args.preset:
DummyUnknownName
ScriptDirectory
except NameError:
ScriptDirectory = "R:/code/nel/tools/build_gamedata"
try:
if args.preset:
DummyUnknownName
WorkspaceDirectory
except NameError:
WorkspaceDirectory = "R:/leveldesign/workspace"
try:
if args.preset:
DummyUnknownName
DatabaseDirectory
except NameError:
DatabaseDirectory = "R:/graphics"
try:
if args.preset:
DummyUnknownName
SoundDirectory
except NameError:
SoundDirectory = "R:/sound"
try:
if args.preset:
DummyUnknownName
SoundDfnDirectory
except NameError:
SoundDfnDirectory = "R:/sound/DFN"
try:
if args.preset:
DummyUnknownName
ExportBuildDirectory
except NameError:
ExportBuildDirectory = "R:/pipeline/export"
try:
if args.preset:
DummyUnknownName
InstallDirectory
except NameError:
InstallDirectory = "R:/pipeline/install"
try:
if args.preset:
DummyUnknownName
ClientDevDirectory
except NameError:
ClientDevDirectory = "R:/pipeline/client_dev"
try:
if args.preset:
DummyUnknownName
ClientDevLiveDirectory
except NameError:
ClientDevLiveDirectory = "R:/pipeline/client_dev_live"
try:
if args.preset:
DummyUnknownName
ClientPatchDirectory
except NameError:
ClientPatchDirectory = "R:/pipeline/client_patch"
try:
if args.preset:
DummyUnknownName
ClientInstallDirectory
except NameError:
ClientInstallDirectory = "R:/pipeline/client_install"
try:
if args.preset:
DummyUnknownName
ShardInstallDirectory
except NameError:
ShardInstallDirectory = "R:/pipeline/shard"
try:
if args.preset:
DummyUnknownName
ShardDevDirectory
except NameError:
ShardDevDirectory = "R:/pipeline/shard_dev"
try:
if args.preset:
DummyUnknownName
WorldEditInstallDirectory
except NameError:
WorldEditInstallDirectory = "R:/pipeline/worldedit"
try:
if args.preset:
DummyUnknownName
WorldEditorFilesDirectory
except NameError:
WorldEditorFilesDirectory = "R:/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files"
try:
if args.preset:
DummyUnknownName
LeveldesignDirectory
except NameError:
LeveldesignDirectory = "R:/leveldesign"
try:
if args.preset:
DummyUnknownName
LeveldesignDfnDirectory
except NameError:
LeveldesignDfnDirectory = "R:/leveldesign/DFN"
try:
if args.preset:
DummyUnknownName
LeveldesignWorldDirectory
except NameError:
LeveldesignWorldDirectory = "R:/leveldesign/world"
try:
if args.preset:
DummyUnknownName
PrimitivesDirectory
except NameError:
PrimitivesDirectory = "R:/leveldesign/primitives"
try:
if args.preset:
DummyUnknownName
LeveldesignDataCommonDirectory
except NameError:
LeveldesignDataCommonDirectory = "R:/leveldesign/common"
try:
if args.preset:
DummyUnknownName
LeveldesignDataShardDirectory
except NameError:
LeveldesignDataShardDirectory = "R:/leveldesign/shard"
try:
if args.preset:
DummyUnknownName
TranslationDirectory
except NameError:
TranslationDirectory = "R:/leveldesign/translation"
try:
if args.preset:
DummyUnknownName
GamedevDirectory
except NameError:
GamedevDirectory = "R:/code/ryzom/client/data/gamedev"
try:
if args.preset:
DummyUnknownName
DataCommonDirectory
except NameError:
DataCommonDirectory = "R:/code/ryzom/common/data_common"
try:
if args.preset:
DummyUnknownName
DataShardDirectory
except NameError:
DataShardDirectory = "R:/code/ryzom/server/data_shard"
try:
if args.preset:
DummyUnknownName
WindowsExeDllCfgDirectories
except NameError:
# TODO: Separate 64bit and 32bit
WindowsExeDllCfgDirectories = [ '', 'R:/build/fv_x64/bin/Release', 'R:/distribution/external_x64', 'R:/code/ryzom/client', '', '', '' ]
try:
if args.preset:
DummyUnknownName
LinuxServiceExecutableDirectory
except NameError:
LinuxServiceExecutableDirectory = "R:/build/server_gcc/bin"
try:
if args.preset:
DummyUnknownName
LinuxClientExecutableDirectory
except NameError:
LinuxClientExecutableDirectory = "R:/build/client_gcc/bin"
try:
if args.preset:
DummyUnknownName
PatchmanDevDirectory
except NameError:
PatchmanDevDirectory = "R:/patchman/terminal_dev"
try:
if args.preset:
DummyUnknownName
PatchmanCfgAdminDirectory
except NameError:
PatchmanCfgAdminDirectory = "R:/patchman/admin_install"
try:
if args.preset:
DummyUnknownName
PatchmanCfgDefaultDirectory
except NameError:
PatchmanCfgDefaultDirectory = "R:/patchman/default"
try:
if args.preset:
DummyUnknownName
PatchmanBridgeServerDirectory
except NameError:
PatchmanBridgeServerDirectory = "R:/pipeline/bridge_server"
try:
SignToolExecutable
except NameError:
SignToolExecutable = "C:/Program Files/Microsoft SDKs/Windows/v6.0A/Bin/signtool.exe"
try:
SignToolSha1
except NameError:
SignToolSha1 = ""
try:
SignToolTimestamp
except NameError:
SignToolTimestamp = "http://timestamp.comodoca.com/authenticode"
try:
MaxAvailable
except NameError:
MaxAvailable = 1
try:
MaxDirectory
except NameError:
MaxDirectory = "C:/Program Files (x86)/Autodesk/3ds Max 2010"
try:
MaxUserDirectory
except NameError:
import os
try:
MaxUserDirectory = os.path.normpath(os.environ["LOCALAPPDATA"] + "/Autodesk/3dsMax/2010 - 32bit/enu")
except KeyError:
MaxAvailable = 0
MaxUserDirectory = "C:/Users/Kaetemi/AppData/Local/Autodesk/3dsMax/2010 - 32bit/enu"
try:
MaxExecutable
except NameError:
MaxExecutable = "3dsmax.exe"
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Setup build site")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
printLog(log, "This script will set up the buildsite configuration, and create needed directories.")
printLog(log, "To use the defaults, simply hit ENTER, else type in the new value.")
printLog(log, "Use -- if you need to insert an empty value.")
printLog(log, "")
BuildQuality = int(askVar(log, "Build Quality", str(BuildQuality)))
if not args.preset:
ToolDirectories[0] = askVar(log, "[IN] Primary Tool Directory", ToolDirectories[0]).replace("\\", "/")
ToolDirectories[1] = askVar(log, "[IN] Secondary Tool Directory", ToolDirectories[1]).replace("\\", "/")
ToolSuffix = askVar(log, "Tool Suffix", ToolSuffix)
ScriptDirectory = askVar(log, "[IN] Script Directory", os.getcwd().replace("\\", "/")).replace("\\", "/")
WorkspaceDirectory = askVar(log, "[IN] Workspace Directory", WorkspaceDirectory).replace("\\", "/")
DatabaseDirectory = askVar(log, "[IN] Database Directory", DatabaseDirectory).replace("\\", "/")
SoundDirectory = askVar(log, "[IN] Sound Directory", SoundDirectory).replace("\\", "/")
SoundDfnDirectory = askVar(log, "[IN] Sound DFN Directory", SoundDfnDirectory).replace("\\", "/")
ExportBuildDirectory = askVar(log, "[OUT] Export Build Directory", ExportBuildDirectory).replace("\\", "/")
InstallDirectory = askVar(log, "[OUT] Install Directory", InstallDirectory).replace("\\", "/")
ClientDevDirectory = askVar(log, "[OUT] Client Dev Directory", ClientDevDirectory).replace("\\", "/")
ClientDevLiveDirectory = askVar(log, "[OUT] Client Dev Live Directory", ClientDevLiveDirectory).replace("\\", "/")
ClientPatchDirectory = askVar(log, "[OUT] Client Patch Directory", ClientPatchDirectory).replace("\\", "/")
ClientInstallDirectory = askVar(log, "[OUT] Client Install Directory", ClientInstallDirectory).replace("\\", "/")
ShardInstallDirectory = askVar(log, "[OUT] Shard Data Install Directory", ShardInstallDirectory).replace("\\", "/")
ShardDevDirectory = askVar(log, "[OUT] Shard Dev Directory", ShardDevDirectory).replace("\\", "/")
WorldEditInstallDirectory = askVar(log, "[OUT] World Edit Data Install Directory", WorldEditInstallDirectory).replace("\\", "/")
LeveldesignDirectory = askVar(log, "[IN] Leveldesign Directory", LeveldesignDirectory).replace("\\", "/")
LeveldesignDfnDirectory = askVar(log, "[IN] Leveldesign DFN Directory", LeveldesignDfnDirectory).replace("\\", "/")
LeveldesignWorldDirectory = askVar(log, "[IN] Leveldesign World Directory", LeveldesignWorldDirectory).replace("\\", "/")
PrimitivesDirectory = askVar(log, "[IN] Primitives Directory", PrimitivesDirectory).replace("\\", "/")
GamedevDirectory = askVar(log, "[IN] Gamedev Directory", GamedevDirectory).replace("\\", "/")
DataShardDirectory = askVar(log, "[IN] Data Shard Directory", DataShardDirectory).replace("\\", "/")
DataCommonDirectory = askVar(log, "[IN] Data Common Directory", DataCommonDirectory).replace("\\", "/")
TranslationDirectory = askVar(log, "[IN] Translation Directory", TranslationDirectory).replace("\\", "/")
LeveldesignDataShardDirectory = askVar(log, "[IN] Leveldesign Data Shard Directory", LeveldesignDataShardDirectory).replace("\\", "/")
LeveldesignDataCommonDirectory = askVar(log, "[IN] Leveldesign Data Common Directory", LeveldesignDataCommonDirectory).replace("\\", "/")
WorldEditorFilesDirectory = askVar(log, "[IN] World Editor Files Directory", WorldEditorFilesDirectory).replace("\\", "/")
WindowsExeDllCfgDirectories[0] = askVar(log, "[IN] Primary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[0]).replace("\\", "/")
WindowsExeDllCfgDirectories[1] = askVar(log, "[IN] Secondary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[1]).replace("\\", "/")
WindowsExeDllCfgDirectories[2] = askVar(log, "[IN] Tertiary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[2]).replace("\\", "/")
WindowsExeDllCfgDirectories[3] = askVar(log, "[IN] Quaternary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[3]).replace("\\", "/")
WindowsExeDllCfgDirectories[4] = askVar(log, "[IN] Quinary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[4]).replace("\\", "/")
WindowsExeDllCfgDirectories[5] = askVar(log, "[IN] Senary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[5]).replace("\\", "/")
WindowsExeDllCfgDirectories[6] = askVar(log, "[IN] Septenary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[6]).replace("\\", "/")
LinuxServiceExecutableDirectory = askVar(log, "[IN] Linux Service Executable Directory", LinuxServiceExecutableDirectory).replace("\\", "/")
LinuxClientExecutableDirectory = askVar(log, "[IN] Linux Client Executable Directory", LinuxClientExecutableDirectory).replace("\\", "/")
PatchmanDevDirectory = askVar(log, "[IN] Patchman Directory", PatchmanDevDirectory).replace("\\", "/")
PatchmanCfgAdminDirectory = askVar(log, "[IN] Patchman Cfg Admin Directory", PatchmanCfgAdminDirectory).replace("\\", "/")
PatchmanCfgDefaultDirectory = askVar(log, "[IN] Patchman Cfg Default Directory", PatchmanCfgDefaultDirectory).replace("\\", "/")
PatchmanBridgeServerDirectory = askVar(log, "[OUT] Patchman Bridge Server Patch Directory", PatchmanBridgeServerDirectory).replace("\\", "/")
SignToolExecutable = askVar(log, "Sign Tool Executable", SignToolExecutable).replace("\\", "/")
SignToolSha1 = askVar(log, "Sign Tool Signature SHA1", SignToolSha1)
SignToolTimestamp = askVar(log, "Sign Tool Timestamp Authority", SignToolTimestamp)
MaxAvailable = int(askVar(log, "3dsMax Available", str(MaxAvailable)))
if MaxAvailable:
MaxDirectory = askVar(log, "3dsMax Directory", MaxDirectory).replace("\\", "/")
MaxUserDirectory = askVar(log, "3dsMax User Directory", MaxUserDirectory).replace("\\", "/")
MaxExecutable = askVar(log, "3dsMax Executable", MaxExecutable)
if os.path.isfile("configuration/buildsite.py"):
os.remove("configuration/buildsite.py")
sf = open("configuration/buildsite.py", "w")
sf.write("#!/usr/bin/python\n")
sf.write("# \n")
sf.write("# \\file site.py\n")
sf.write("# \\brief Site configuration\n")
sf.write("# \\date " + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "\n")
sf.write("# \\author Jan Boon (Kaetemi)\n")
sf.write("# Python port of game data build pipeline.\n")
sf.write("# Site configuration.\n")
sf.write("# \n")
sf.write("# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>\n")
sf.write("# Copyright (C) 2009-2014 by authors\n")
sf.write("# \n")
sf.write("# This program is free software: you can redistribute it and/or modify\n")
sf.write("# it under the terms of the GNU Affero General Public License as\n")
sf.write("# published by the Free Software Foundation, either version 3 of the\n")
sf.write("# License, or (at your option) any later version.\n")
sf.write("# \n")
sf.write("# This program is distributed in the hope that it will be useful,\n")
sf.write("# but WITHOUT ANY WARRANTY; without even the implied warranty of\n")
sf.write("# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n")
sf.write("# GNU Affero General Public License for more details.\n")
sf.write("# \n")
sf.write("# You should have received a copy of the GNU Affero General Public License\n")
sf.write("# along with this program. If not, see <http://www.gnu.org/licenses/>.\n")
sf.write("# \n")
sf.write("\n")
sf.write("\n")
sf.write("# *** SITE INSTALLATION ***\n")
sf.write("\n")
sf.write("# Use '/' in path name, not '\'\n")
sf.write("# Don't put '/' at the end of a directory name\n")
sf.write("\n")
sf.write("\n")
sf.write("# Quality option for this site (1 for BEST, 0 for DRAFT)\n")
sf.write("BuildQuality = " + str(BuildQuality) + "\n")
sf.write("\n")
sf.write("RemapLocalFrom = \"" + str(RemapLocalFrom) + "\"\n")
sf.write("RemapLocalTo = \"" + str(RemapLocalTo) + "\"\n")
sf.write("\n")
sf.write("ToolDirectories = " + str(ToolDirectories) + "\n")
sf.write("ToolSuffix = \"" + str(ToolSuffix) + "\"\n")
sf.write("\n")
sf.write("# Build script directory\n")
sf.write("ScriptDirectory = \"" + str(ScriptDirectory) + "\"\n")
sf.write("WorkspaceDirectory = \"" + str(WorkspaceDirectory) + "\"\n")
sf.write("\n")
sf.write("# Data build directories\n")
sf.write("DatabaseDirectory = \"" + str(DatabaseDirectory) + "\"\n")
sf.write("SoundDirectory = \"" + str(SoundDirectory) + "\"\n")
sf.write("SoundDfnDirectory = \"" + str(SoundDfnDirectory) + "\"\n")
sf.write("ExportBuildDirectory = \"" + str(ExportBuildDirectory) + "\"\n")
sf.write("\n")
sf.write("# Install directories\n")
sf.write("InstallDirectory = \"" + str(InstallDirectory) + "\"\n")
sf.write("ClientDevDirectory = \"" + str(ClientDevDirectory) + "\"\n")
sf.write("ClientDevLiveDirectory = \"" + str(ClientDevLiveDirectory) + "\"\n")
sf.write("ClientPatchDirectory = \"" + str(ClientPatchDirectory) + "\"\n")
sf.write("ClientInstallDirectory = \"" + str(ClientInstallDirectory) + "\"\n")
sf.write("ShardInstallDirectory = \"" + str(ShardInstallDirectory) + "\"\n")
sf.write("ShardDevDirectory = \"" + str(ShardDevDirectory) + "\"\n")
sf.write("WorldEditInstallDirectory = \"" + str(WorldEditInstallDirectory) + "\"\n")
sf.write("\n")
sf.write("# Utility directories\n")
sf.write("WorldEditorFilesDirectory = \"" + str(WorldEditorFilesDirectory) + "\"\n")
sf.write("\n")
sf.write("# Leveldesign directories\n")
sf.write("LeveldesignDirectory = \"" + str(LeveldesignDirectory) + "\"\n")
sf.write("LeveldesignDfnDirectory = \"" + str(LeveldesignDfnDirectory) + "\"\n")
sf.write("LeveldesignWorldDirectory = \"" + str(LeveldesignWorldDirectory) + "\"\n")
sf.write("PrimitivesDirectory = \"" + str(PrimitivesDirectory) + "\"\n")
sf.write("LeveldesignDataCommonDirectory = \"" + str(LeveldesignDataCommonDirectory) + "\"\n")
sf.write("LeveldesignDataShardDirectory = \"" + str(LeveldesignDataShardDirectory) + "\"\n")
sf.write("TranslationDirectory = \"" + str(TranslationDirectory) + "\"\n")
sf.write("\n")
sf.write("# Misc data directories\n")
sf.write("GamedevDirectory = \"" + str(GamedevDirectory) + "\"\n")
sf.write("DataCommonDirectory = \"" + str(DataCommonDirectory) + "\"\n")
sf.write("DataShardDirectory = \"" + str(DataShardDirectory) + "\"\n")
sf.write("WindowsExeDllCfgDirectories = " + str(WindowsExeDllCfgDirectories) + "\n")
sf.write("LinuxServiceExecutableDirectory = \"" + str(LinuxServiceExecutableDirectory) + "\"\n")
sf.write("LinuxClientExecutableDirectory = \"" + str(LinuxClientExecutableDirectory) + "\"\n")
sf.write("PatchmanDevDirectory = \"" + str(PatchmanDevDirectory) + "\"\n")
sf.write("PatchmanCfgAdminDirectory = \"" + str(PatchmanCfgAdminDirectory) + "\"\n")
sf.write("PatchmanCfgDefaultDirectory = \"" + str(PatchmanCfgDefaultDirectory) + "\"\n")
sf.write("PatchmanBridgeServerDirectory = \"" + str(PatchmanBridgeServerDirectory) + "\"\n")
sf.write("\n")
sf.write("# Sign tool\n")
sf.write("SignToolExecutable = \"" + str(SignToolExecutable) + "\"\n")
sf.write("SignToolSha1 = \"" + str(SignToolSha1) + "\"\n")
sf.write("SignToolTimestamp = \"" + str(SignToolTimestamp) + "\"\n")
sf.write("\n")
sf.write("# 3dsMax directives\n")
sf.write("MaxAvailable = " + str(MaxAvailable) + "\n")
sf.write("MaxDirectory = \"" + str(MaxDirectory) + "\"\n")
sf.write("MaxUserDirectory = \"" + str(MaxUserDirectory) + "\"\n")
sf.write("MaxExecutable = \"" + str(MaxExecutable) + "\"\n")
sf.write("\n")
sf.write("\n")
sf.write("# end of file\n")
sf.flush()
sf.close()
sf = open("configuration/buildsite_local.py", "w")
sfr = open("configuration/buildsite.py", "r")
for l in sfr:
sf.write(l.replace(RemapLocalFrom + '/', RemapLocalTo + '/'))
sf.flush()
sfr.close()
sf.close()
from buildsite_local import *
sys.path.append(WorkspaceDirectory)
from projects import *
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Run the setup projects")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
# For each project
for projectName in ProjectsToProcess:
if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)):
printLog(log, "PROJECT " + projectName)
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
os.chdir("processes")
try:
if not args.includeprocess == None:
subprocess.call([ "python", "0_setup.py", "--includeprocess" ] + args.includeprocess)
elif not args.excludeprocess == None:
subprocess.call([ "python", "0_setup.py", "--excludeprocess" ] + args.excludeprocess)
else:
subprocess.call([ "python", "0_setup.py" ])
except Exception, e:
printLog(log, "<" + projectName + "> " + str(e))
os.chdir("..")
try:
projectLog = open("processes/log.log", "r")
projectLogData = projectLog.read()
projectLog.close()
log.write(projectLogData)
except Exception, e:
printLog(log, "<" + projectName + "> " + str(e))
else:
printLog(log, "IGNORE PROJECT " + projectName)
printLog(log, "")
# Additional directories
printLog(log, ">>> Setup additional directories <<<")
mkPath(log, ClientDevDirectory)
mkPath(log, ClientDevLiveDirectory)
mkPath(log, ClientPatchDirectory)
mkPath(log, ClientInstallDirectory)
if not args.noverify:
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Verify tool paths")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
if MaxAvailable:
findMax(log, MaxDirectory, MaxExecutable)
findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix)
findTool(log, ToolDirectories, BuildInterfaceTool, ToolSuffix)
findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix)
findTool(log, ToolDirectories, BuildSmallbankTool, ToolSuffix)
findTool(log, ToolDirectories, BuildFarbankTool, ToolSuffix)
findTool(log, ToolDirectories, ZoneDependenciesTool, ToolSuffix)
findTool(log, ToolDirectories, ZoneWelderTool, ToolSuffix)
findTool(log, ToolDirectories, ZoneElevationTool, ToolSuffix)
findTool(log, ToolDirectories, BuildRbankTool, ToolSuffix)
findTool(log, ToolDirectories, BuildIndoorRbankTool, ToolSuffix)
findTool(log, ToolDirectories, BuildIgBoxesTool, ToolSuffix)
findTool(log, ToolDirectories, GetNeighborsTool, ToolSuffix)
findTool(log, ToolDirectories, ZoneLighterTool, ToolSuffix)
findTool(log, ToolDirectories, ZoneIgLighterTool, ToolSuffix)
findTool(log, ToolDirectories, IgLighterTool, ToolSuffix)
findTool(log, ToolDirectories, AnimBuilderTool, ToolSuffix)
findTool(log, ToolDirectories, TileEditTool, ToolSuffix)
# findTool(log, ToolDirectories, BuildImagesetTool, ToolSuffix) # kaetemi stuff, ignore this
findTool(log, ToolDirectories, MakeSheetIdTool, ToolSuffix)
# findTool(log, ToolDirectories, BuildSheetsTool, ToolSuffix) # kaetemi stuff, ignore this
# findTool(log, ToolDirectories, BuildSoundTool, ToolSuffix) # kaetemi stuff, ignore this
# findTool(log, ToolDirectories, BuildSoundTool, ToolSuffix)
findTool(log, ToolDirectories, BuildSoundbankTool, ToolSuffix)
findTool(log, ToolDirectories, BuildSamplebankTool, ToolSuffix)
findTool(log, ToolDirectories, BuildCoarseMeshTool, ToolSuffix)
findTool(log, ToolDirectories, LightmapOptimizerTool, ToolSuffix)
findTool(log, ToolDirectories, BuildClodtexTool, ToolSuffix)
findTool(log, ToolDirectories, BuildShadowSkinTool, ToolSuffix)
findTool(log, ToolDirectories, PanoplyMakerTool, ToolSuffix)
findTool(log, ToolDirectories, HlsBankMakerTool, ToolSuffix)
findTool(log, ToolDirectories, LandExportTool, ToolSuffix)
findTool(log, ToolDirectories, PrimExportTool, ToolSuffix)
findTool(log, ToolDirectories, IgElevationTool, ToolSuffix)
findTool(log, ToolDirectories, IgAddTool, ToolSuffix)
findTool(log, ToolDirectories, BuildClodBankTool, ToolSuffix)
findTool(log, ToolDirectories, SheetsPackerTool, ToolSuffix)
findTool(log, ToolDirectories, BnpMakeTool, ToolSuffix)
findTool(log, ToolDirectories, AiBuildWmapTool, ToolSuffix)
findTool(log, ToolDirectories, TgaCutTool, ToolSuffix)
findTool(log, ToolDirectories, PatchGenTool, ToolSuffix)
findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix)
findTool(log, ToolDirectories, BuildWorldPackedColTool, ToolSuffix)
findTool(log, ToolDirectories, R2IslandsTexturesTool, ToolSuffix)
findTool(log, ToolDirectories, PatchmanServiceTool, ToolSuffix)
log.close()
if os.path.isfile("0_setup.log"):
os.remove("0_setup.log")
shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_setup.log")
shutil.move("log.log", "0_setup.log")

@ -1,70 +0,0 @@
#!/usr/bin/python
#
# \author Jan Boon (Kaetemi)
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2014 by authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time, sys, os, shutil, subprocess, distutils.dir_util
sys.path.append("../configuration")
from scripts import *
from buildsite import *
from tools import *
os.chdir(TranslationDirectory)
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Make and merge all translations")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix)
try:
subprocess.call([ TranslationTools, "make_phrase_diff" ])
subprocess.call([ TranslationTools, "merge_phrase_diff" ])
subprocess.call([ TranslationTools, "make_clause_diff" ])
subprocess.call([ TranslationTools, "merge_clause_diff" ])
subprocess.call([ TranslationTools, "make_words_diff" ])
subprocess.call([ TranslationTools, "merge_words_diff" ])
subprocess.call([ TranslationTools, "make_string_diff" ])
subprocess.call([ TranslationTools, "merge_string_diff" ])
subprocess.call([ TranslationTools, "clean_string_diff" ])
subprocess.call([ TranslationTools, "make_r2_string_diff" ])
subprocess.call([ TranslationTools, "merge_r2_string_diff" ])
subprocess.call([ TranslationTools, "clean_r2_string_diff" ])
subprocess.call([ TranslationTools, "clean_words_diff" ])
subprocess.call([ TranslationTools, "clean_clause_diff" ])
subprocess.call([ TranslationTools, "clean_phrase_diff" ])
subprocess.call([ TranslationTools, "make_worksheet_diff", "bot_names.txt" ])
subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ])
except Exception, e:
printLog(log, "<" + processName + "> " + str(e))
printLog(log, "")
log.close()
if os.path.isfile("make_merge_all.log"):
os.remove("make_merge_all.log")
shutil.copy("log.log", "make_merge_all_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log")
shutil.move("log.log", "make_merge_all.log")
raw_input("PRESS ANY KEY TO EXIT")

@ -1,115 +0,0 @@
#!/usr/bin/python
#
# \author Jan Boon (Kaetemi)
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2014 by authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time, sys, os, shutil, subprocess, distutils.dir_util
sys.path.append("../configuration")
from scripts import *
from buildsite import *
from tools import *
os.chdir(TranslationDirectory)
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Make, merge and clean work")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix)
printLog(log, ">>> Override languages.txt <<<")
if not os.path.isfile("make_merge_wk_languages.txt"):
shutil.move("languages.txt", "make_merge_wk_languages.txt")
languagesTxt = open("languages.txt", "w")
languagesTxt.write("wk\n")
languagesTxt.close()
printLog(log, ">>> Merge diff <<<") # This is necessary, because when we crop lines, we should only do this from untranslated files
try:
subprocess.call([ TranslationTools, "merge_phrase_diff" ])
subprocess.call([ TranslationTools, "merge_clause_diff" ])
subprocess.call([ TranslationTools, "merge_words_diff" ])
subprocess.call([ TranslationTools, "merge_string_diff" ])
subprocess.call([ TranslationTools, "merge_r2_string_diff" ])
subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ])
except Exception, e:
printLog(log, "<" + processName + "> " + str(e))
printLog(log, "")
printLog(log, ">>> Make diff <<<")
try:
subprocess.call([ TranslationTools, "make_phrase_diff" ])
subprocess.call([ TranslationTools, "make_clause_diff" ])
subprocess.call([ TranslationTools, "make_words_diff" ])
subprocess.call([ TranslationTools, "make_string_diff" ])
subprocess.call([ TranslationTools, "make_r2_string_diff" ])
subprocess.call([ TranslationTools, "make_worksheet_diff", "bot_names.txt" ])
except Exception, e:
printLog(log, "<" + processName + "> " + str(e))
printLog(log, ">>> Mark diffs as translated <<<")
diffFiles = os.listdir("diff")
for diffFile in diffFiles:
if "wk_diff_" in diffFile:
printLog(log, "DIFF " + "diff/" + diffFile)
subprocess.call([ TranslationTools, "crop_lines", "diff/" + diffFile, "3" ])
#printLog(log, ">>> Clean diff <<<")
#try:
# subprocess.call([ TranslationTools, "clean_string_diff" ])
# subprocess.call([ TranslationTools, "clean_phrase_diff" ])
# subprocess.call([ TranslationTools, "clean_clause_diff" ])
# subprocess.call([ TranslationTools, "clean_words_diff" ])
#except Exception, e:
# printLog(log, "<" + processName + "> " + str(e))
#printLog(log, "")
printLog(log, ">>> Merge diff <<<")
try:
subprocess.call([ TranslationTools, "merge_phrase_diff" ])
subprocess.call([ TranslationTools, "merge_clause_diff" ])
subprocess.call([ TranslationTools, "merge_words_diff" ])
subprocess.call([ TranslationTools, "merge_string_diff" ])
subprocess.call([ TranslationTools, "merge_r2_string_diff" ])
subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ])
except Exception, e:
printLog(log, "<" + processName + "> " + str(e))
printLog(log, "")
printLog(log, ">>> Restore languages.txt <<<")
os.remove("languages.txt")
shutil.move("make_merge_wk_languages.txt", "languages.txt")
log.close()
if os.path.isfile("make_merge_wk.log"):
os.remove("make_merge_wk.log")
shutil.copy("log.log", "make_merge_wk_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log")
shutil.move("log.log", "make_merge_wk.log")
raw_input("PRESS ANY KEY TO EXIT")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save