diff options
178 files changed, 65034 insertions, 0 deletions
diff --git a/WebServer/Socket.cpp b/WebServer/Socket.cpp new file mode 100644 index 000000000..1ae3c9f37 --- /dev/null +++ b/WebServer/Socket.cpp @@ -0,0 +1,278 @@ +/*
+ Socket.cpp
+
+ Copyright (C) 2002-2004 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+
+#include "../source/cMCLogger.h"
+
+#include "Socket.h"
+#include <iostream>
+
+#ifndef _WIN32
+#include <cstring>
+#include <sys/time.h>
+#else
+#define MSG_NOSIGNAL (0)
+#endif
+
+#ifdef __MAC_NA
+#define MSG_NOSIGNAL (0)
+#endif
+
+using namespace std;
+
+int Socket::nofSockets_= 0;
+
+void Socket::Start() {
+#ifdef _WIN32
+ if (!nofSockets_) {
+ WSADATA info;
+ if (WSAStartup(MAKEWORD(2,0), &info)) {
+ throw "Could not start WSA";
+ }
+ }
+#endif
+ ++nofSockets_;
+}
+
+void Socket::End() {
+#ifdef _WIN32
+ WSACleanup();
+#endif
+}
+
+Socket::Socket() : s_(0) {
+ Start();
+ // UDP: use SOCK_DGRAM instead of SOCK_STREAM
+ s_ = socket(AF_INET,SOCK_STREAM,0);
+
+#ifdef _WIN32
+ if(s_ ==INVALID_SOCKET)
+#else
+ if(s_ < 0)
+#endif
+ {
+ throw "INVALID_SOCKET";
+ }
+
+ refCounter_ = new int(1);
+}
+
+Socket::Socket(SOCKET s) : s_(s) {
+ Start();
+ refCounter_ = new int(1);
+};
+
+Socket::~Socket() {
+ if (! --(*refCounter_)) {
+ Close();
+ delete refCounter_;
+ }
+
+ --nofSockets_;
+ if (!nofSockets_) End();
+}
+
+Socket::Socket(const Socket& o) {
+ refCounter_=o.refCounter_;
+ (*refCounter_)++;
+ s_ =o.s_;
+
+ nofSockets_++;
+}
+
+Socket& Socket::operator=(Socket& o) {
+ (*o.refCounter_)++;
+
+ refCounter_=o.refCounter_;
+ s_ =o.s_;
+
+ nofSockets_++;
+
+ return *this;
+}
+
+void Socket::Close() {
+ if( s_ )
+ {
+ closesocket(s_);
+ s_ = 0;
+ }
+}
+
+std::string Socket::ReceiveLine() {
+ std::string ret;
+ while (1) {
+ char r;
+
+ if (recv(s_, &r, 1, 0) <= 0 )
+ {
+ return "";
+ }
+
+ ret += r;
+ if (r == '\n') return ret;
+ }
+}
+
+void Socket::SendLine(std::string s) {
+ s += '\n';
+ if( send(s_,s.c_str(),s.length(),MSG_NOSIGNAL) <= 0 )
+ {
+ //printf("SendLine Socket error!! \n" );
+ Close();
+ }
+}
+
+void Socket::SendBytes(const std::string& s) {
+ if( send(s_,s.c_str(),s.length(), MSG_NOSIGNAL) <= 0 )
+ {
+ //printf("SendBytes Socket error!! \n" );
+ Close();
+ }
+}
+
+SocketServer::SocketServer(int port, int connections, TypeSocket type) {
+ sockaddr_in sa;
+
+ memset(&sa, 0, sizeof(sa));
+
+ sa.sin_family = PF_INET;
+ sa.sin_port = htons(port);
+ s_ = socket(AF_INET, SOCK_STREAM, 0);
+
+#ifdef _WIN32
+ if(s_ ==INVALID_SOCKET)
+#else
+ if(s_ < 0)
+#endif
+ {
+ LOG("WebServer: INVALID_SOCKET");
+ }
+
+ if(type==NonBlockingSocket) {
+ return;
+ }
+
+#ifdef _WIN32
+ char yes = 1;
+#else
+ int yes = 1;
+#endif
+ if (setsockopt(s_,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)) == -1) {
+ LOG("WebServer: setsockopt == -1");
+ return;
+ }
+
+ /* bind the socket to the internet address */
+ if (bind(s_, (sockaddr *)&sa, sizeof(sockaddr_in)) == SOCKET_ERROR) {
+ closesocket(s_);
+ LOG("WebServer: INVALID_SOCKET");
+ }
+
+ listen(s_, connections);
+}
+
+Socket* SocketServer::Accept()
+{
+
+ SOCKET new_sock = accept(s_, 0, 0);
+#ifdef _WIN32
+ if(new_sock==INVALID_SOCKET || s_ == 0)
+#else
+ if(new_sock < 0 || s_ == 0)
+#endif
+ {
+ #ifdef _WIN32
+ int rc = WSAGetLastError();
+ if(rc==WSAEWOULDBLOCK) {
+ return 0; // non-blocking call, no request pending
+ }
+ else
+ #endif
+ {
+ //throw "Invalid Socket";
+ return 0;
+ }
+ }
+
+ Socket* r = new Socket(new_sock);
+ return r;
+}
+
+SocketClient::SocketClient(const std::string& host, int port) : Socket() {
+ std::string error;
+
+ hostent *he;
+ if ((he = gethostbyname(host.c_str())) == 0) {
+#ifdef _WIN32
+ error = strerror(errno);
+#endif
+ throw error;
+ }
+
+ sockaddr_in addr;
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port);
+ addr.sin_addr = *((in_addr *)he->h_addr);
+ memset(&(addr.sin_zero), 0, 8);
+
+ if (::connect(s_, (sockaddr *) &addr, sizeof(sockaddr))) {
+#ifdef _WIN32
+ error = strerror(WSAGetLastError());
+#endif
+ throw error;
+ }
+}
+
+#ifndef _WIN32
+struct timeval;
+#endif
+
+SocketSelect::SocketSelect(Socket const * const s1, Socket const * const s2, TypeSocket type) {
+ FD_ZERO(&fds_);
+ FD_SET(const_cast<Socket*>(s1)->s_,&fds_);
+ if(s2) {
+ FD_SET(const_cast<Socket*>(s2)->s_,&fds_);
+ }
+
+#ifdef _WIN32
+ TIMEVAL *ptval = 0;
+#else
+ timeval *ptval = 0;
+#endif
+
+ if (select (0, &fds_, (fd_set*) 0, (fd_set*) 0, ptval) == SOCKET_ERROR)
+ throw "Error in select";
+}
+
+bool SocketSelect::Readable(Socket const* const s) {
+ if (FD_ISSET(s->s_,&fds_)) return true;
+ return false;
+}
diff --git a/WebServer/Socket.h b/WebServer/Socket.h new file mode 100644 index 000000000..777f696ce --- /dev/null +++ b/WebServer/Socket.h @@ -0,0 +1,106 @@ +/*
+ Socket.h
+
+ Copyright (C) 2002-2004 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+
+#ifndef SOCKET_H
+#define SOCKET_H
+ +#include "../source/MCSocket.h"
+#ifdef _WIN32 +#include <winsock2.h>
+#endif
+
+#include <string>
+
+enum TypeSocket {BlockingSocket, NonBlockingSocket};
+
+class Socket {
+public:
+
+ virtual ~Socket();
+ Socket(const Socket&);
+ Socket& operator=(Socket&);
+
+ std::string ReceiveLine();
+ std::string ReceiveBytes();
+
+ void Close();
+
+ // The parameter of SendLine is not a const reference
+ // because SendLine modifes the std::string passed.
+ void SendLine (std::string);
+
+ // The parameter of SendBytes is a const reference
+ // because SendBytes does not modify the std::string passed
+ // (in contrast to SendLine).
+ void SendBytes(const std::string&);
+
+protected:
+ friend class SocketServer;
+ friend class SocketSelect;
+
+ Socket(SOCKET s);
+ Socket();
+
+
+ SOCKET s_;
+
+ int* refCounter_;
+
+private:
+ static void Start();
+ static void End();
+ static int nofSockets_;
+};
+
+class SocketClient : public Socket {
+public:
+ SocketClient(const std::string& host, int port);
+};
+
+class SocketServer : public Socket {
+public:
+ SocketServer(int port, int connections, TypeSocket type=BlockingSocket);
+
+ Socket* Accept();
+};
+
+// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/wsapiref_2tiq.asp
+class SocketSelect {
+ public:
+ SocketSelect(Socket const * const s1, Socket const * const s2=NULL, TypeSocket type=BlockingSocket);
+
+ bool Readable(Socket const * const s);
+
+ private:
+ fd_set fds_;
+};
+
+#endif
diff --git a/WebServer/StdHelpers.cpp b/WebServer/StdHelpers.cpp new file mode 100644 index 000000000..6bb05f421 --- /dev/null +++ b/WebServer/StdHelpers.cpp @@ -0,0 +1,61 @@ +/*
+ stdHelpers.cpp
+
+ Copyright (C) 2002-2004 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+
+#include "StdHelpers.h"
+#include <algorithm>
+#include <cctype>
+
+std::string ReplaceInStr(const std::string& in, const std::string& search_for, const std::string& replace_with) {
+ std::string ret = in;
+
+ std::string::size_type pos = ret.find(search_for);
+
+ while (pos != std::string::npos) {
+ ret = ret.replace(pos, search_for.size(), replace_with);
+ pos = pos - search_for.size() + replace_with.size() + 1;
+ pos = ret.find(search_for, pos);
+ }
+
+ return ret;
+}
+
+// std:toupper and std::tolower are overloaded. Well...
+// http://gcc.gnu.org/ml/libstdc++/2002-11/msg00180.html
+char toLower_ (char c) { return std::tolower(c); }
+char toUpper_ (char c) { return std::toupper(c); }
+
+void ToUpper(std::string& s) {
+ std::transform(s.begin(), s.end(), s.begin(),toUpper_);
+}
+
+void ToLower(std::string& s) {
+ std::transform(s.begin(), s.end(), s.begin(),toLower_);
+}
diff --git a/WebServer/StdHelpers.h b/WebServer/StdHelpers.h new file mode 100644 index 000000000..e9efa3dc2 --- /dev/null +++ b/WebServer/StdHelpers.h @@ -0,0 +1,65 @@ +/*
+ stdHelpers.h
+
+ Copyright (C) 2002-2005 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+
+#ifndef STDHELPERS_H__
+#define STDHELPERS_H__
+
+#include <string>
+#include <sstream>
+
+std::string ReplaceInStr(const std::string& in, const std::string& search_for, const std::string& replace_with);
+
+void ToUpper(std::string& s);
+void ToLower(std::string& s);
+
+template <class T>
+T To(std::string const& s) {
+ T ret;
+
+ std::stringstream stream;
+ stream << s;
+ stream >> ret;
+
+ return ret;
+}
+
+template<class T>
+std::string StringFrom(T const& t) {
+ std::string ret;
+
+ std::stringstream stream;
+ stream << t;
+ stream >> ret;
+
+ return ret;
+}
+
+#endif
\ No newline at end of file diff --git a/WebServer/Tracer.h b/WebServer/Tracer.h new file mode 100644 index 000000000..bce350219 --- /dev/null +++ b/WebServer/Tracer.h @@ -0,0 +1,113 @@ +/*
+ Tracer.h
+
+ Copyright (C) 2002-2004 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ The most current version of Tracer.h can be found at
+ http://www.adp-gmbh.ch/cpp/common/Tracer.html
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+
+#ifndef TRACER_H__
+#define TRACER_H__
+
+#ifdef DO_TRACE
+
+#include <string>
+#include <sstream>
+
+#include <windows.h>
+
+#define StartTrace(x) TraceFunc_::StartTrace_(x)
+#define Trace(x) dummy_____for_trace_func______.Trace_(x)
+#define Trace2(x,y) dummy_____for_trace_func______.Trace_(x,y)
+#define TraceFunc(x) TraceFunc_ dummy_____for_trace_func______(x)
+#define TraceFunc2(x,y) TraceFunc_ dummy_____for_trace_func______(x,y)
+
+class TraceFunc_ {
+ std::string func_name_;
+ public:
+ /*
+ Calling TraceFunc_ indents the output until the enclosing scope ( {...} )
+ is left.
+ */
+ TraceFunc_(std::string const&);
+ TraceFunc_(std::string const&, std::string const& something);
+ ~TraceFunc_();
+
+ /*
+ Creates the trace output file named by filename.
+ Must be called before any other tracing function.
+ Use the StartTrace macro for it.
+ */
+ static void StartTrace_(std::string const& filename);
+
+ template <class T>
+ void Trace_(T const& t) {
+ DWORD d;
+ std::string indent_s;
+ std::stringstream s;
+
+ s << t;
+
+ for (int i=0; i< indent; i++) indent_s += " ";
+
+ ::WriteFile(trace_file_,indent_s.c_str(), indent_s.size(), &d, 0);
+ ::WriteFile(trace_file_, s.str().c_str(), s.str().size() ,&d, 0);
+ ::WriteFile(trace_file_,"\x0a",1,&d,0);
+ }
+
+ template <class T, class U>
+ void Trace_(T const& t, U const& u) {
+ std::string indent_s;
+ std::stringstream s;
+
+ s << t;
+ s << u;
+ Trace_(s.str());
+ }
+
+ static int indent;
+ /* trace_file_ is a HANDLE for the file in which the traced output goes.
+ The file is opened (that is, created) by calling StartTrace_.
+ Better yet, use the StartTrace macro
+ to create the file.
+ */
+ static HANDLE trace_file_;
+};
+
+#else
+
+#define StartTrace(x)
+#define Trace(x)
+#define Trace2(x,y)
+#define TraceFunc(x)
+#define TraceFunc2(x,y)
+
+#endif
+
+#endif // TRACER_H__
diff --git a/WebServer/UrlHelper.cpp b/WebServer/UrlHelper.cpp new file mode 100644 index 000000000..3cdb0fc60 --- /dev/null +++ b/WebServer/UrlHelper.cpp @@ -0,0 +1,167 @@ +/*
+ UrlHelper.cpp
+
+ Copyright (C) 2002-2004 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+
+#include "UrlHelper.h"
+#include "Tracer.h"
+#include "StdHelpers.h"
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include <sstream>
+#include <iostream>
+
+bool RemoveProtocolFromUrl(std::string const& url, std::string& protocol, std::string& rest) {
+ TraceFunc("RemoveProtocolFromUrl");
+ Trace(std::string("url='")+url+"'");
+ std::string::size_type pos_colon = url.find(":");
+
+ if (pos_colon == std::string::npos) {
+ rest = url;
+ return false;
+ }
+
+ if (url.size() < pos_colon + 2) {
+ rest = url;
+ return false;
+ }
+
+ if (url[pos_colon+1] != '/' ||
+ url[pos_colon+2] != '/') {
+ rest = url;
+ return false;
+ }
+
+ protocol = url.substr(0,pos_colon);
+ rest = url.substr(3+pos_colon); // Skipping three characters ( '://' )
+
+ return true;
+}
+
+void SplitGetReq(std::string get_req, std::string& path, std::map<std::string, std::string>& params) {
+ TraceFunc("SplitGetReq");
+
+ // Remove trailing newlines
+ if (get_req[get_req.size()-1] == '\x0d' ||
+ get_req[get_req.size()-1] == '\x0a')
+ get_req=get_req.substr(0, get_req.size()-1);
+
+ if (get_req[get_req.size()-1] == '\x0d' ||
+ get_req[get_req.size()-1] == '\x0a')
+ get_req=get_req.substr(0, get_req.size()-1);
+
+ // Remove potential Trailing HTTP/1.x
+ if (get_req.size() > 7) {
+ if (get_req.substr(get_req.size()-8, 7) == "HTTP/1.") {
+ get_req=get_req.substr(0, get_req.size()-9);
+ }
+ }
+
+ std::string::size_type qm = get_req.find("?");
+ if (qm != std::string::npos) {
+ std::string url_params = get_req.substr(qm+1);
+
+ path = get_req.substr(0, qm);
+
+ // Appending a '&' so that there are as many '&' as name-value pairs.
+ // It makes it easier to split the url for name value pairs, he he he
+ url_params += "&";
+
+ std::string::size_type next_amp = url_params.find("&");
+
+ while (next_amp != std::string::npos) {
+ std::string name_value = url_params.substr(0,next_amp);
+ url_params = url_params.substr(next_amp+1);
+ next_amp = url_params.find("&");
+
+ std::string::size_type pos_equal = name_value.find("=");
+
+ std::string nam = name_value.substr(0,pos_equal);
+ std::string val = name_value.substr(pos_equal+1);
+
+ std::string::size_type pos_plus;
+ while ( (pos_plus = val.find("+")) != std::string::npos ) {
+ val.replace(pos_plus, 1, " ");
+ }
+
+ // Replacing %xy notation
+ std::string::size_type pos_hex = 0;
+ while ( (pos_hex = val.find("%", pos_hex)) != std::string::npos ) {
+ std::stringstream h;
+ h << val.substr(pos_hex+1, 2);
+ h << std::hex;
+
+ int i;
+ h>>i;
+
+ std::stringstream f;
+ f << static_cast<char>(i);
+ std::string s;
+ f >> s;
+
+ val.replace(pos_hex, 3, s);
+ pos_hex ++;
+ }
+
+ params.insert(std::map<std::string,std::string>::value_type(nam, val));
+ }
+ }
+ else {
+ path = get_req;
+ }
+}
+
+void SplitUrl(std::string const& url, std::string& protocol, std::string& server, std::string& path) {
+ TraceFunc("SplitUrl");
+ RemoveProtocolFromUrl(url, protocol, server);
+
+ if (protocol == "http") {
+ std::string::size_type pos_slash = server.find("/");
+
+ if (pos_slash != std::string::npos) {
+ Trace("slash found");
+ path = server.substr(pos_slash);
+ server = server.substr(0, pos_slash);
+ }
+ else {
+ Trace("slash not found");
+ path = "/";
+ }
+ }
+ else if (protocol == "file") {
+ path = ReplaceInStr(server, "\\", "/");
+ server = "";
+ }
+ else {
+ std::cerr << "unknown protocol in SplitUrl: '" << protocol << "'" << std::endl;
+ }
+}
diff --git a/WebServer/UrlHelper.h b/WebServer/UrlHelper.h new file mode 100644 index 000000000..06ab00446 --- /dev/null +++ b/WebServer/UrlHelper.h @@ -0,0 +1,42 @@ +/*
+ UrlHelper.h
+
+ Copyright (C) 2002-2004 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+#ifndef __URL_HELPER_H__
+#define __URL_HELPER_H__
+
+#include <string>
+#include <map>
+
+void SplitUrl (std::string const& url, std::string& protocol, std::string& server, std::string& path);
+bool RemoveProtocolFromUrl(std::string const& url, std::string& protocol, std::string& rest);
+
+void SplitGetReq (std::string et_req, std::string& path, std::map<std::string, std::string>& params);
+
+#endif
diff --git a/WebServer/WebServer.cpp b/WebServer/WebServer.cpp new file mode 100644 index 000000000..954791663 --- /dev/null +++ b/WebServer/WebServer.cpp @@ -0,0 +1,226 @@ +/*
+ WebServer.cpp
+
+ Copyright (C) 2003-2007 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+
+ Thanks to Tom Lynn who pointed out an error in this source code.
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+
+#include <ctime>
+#ifdef _WIN32
+#include <process.h>
+#endif
+#include <iostream>
+#include <string>
+#include <map>
+#include <sstream>
+
+
+#include "WebServer.h"
+#include "Socket.h"
+#include "UrlHelper.h"
+#include "base64.h"
+
+#include "cEvent.h"
+
+
+webserver::request_func webserver::request_func_=0;
+
+#ifdef _WIN32
+unsigned webserver::Request(void* ptr_s)
+#else
+void* webserver::Request(void* ptr_s)
+#endif
+{
+ Socket* s = (reinterpret_cast<Socket*>(ptr_s));
+
+ std::string line = s->ReceiveLine();
+ if (line.empty()) {
+ s->Close();
+ delete s;
+ return 0;
+ }
+
+ http_request req;
+
+ if (line.find("GET") == 0) {
+ req.method_="GET";
+ }
+ else if (line.find("POST") == 0) {
+ req.method_="POST";
+ }
+
+ std::string path;
+ std::map<std::string, std::string> params;
+
+ size_t posStartPath = line.find_first_not_of(" ",3);
+
+ SplitGetReq(line.substr(posStartPath), path, params);
+
+ req.status_ = "202 OK";
+ req.s_ = s;
+ req.path_ = path;
+ req.params_ = params;
+
+ static const std::string authorization = "Authorization: Basic ";
+ static const std::string accept = "Accept: " ;
+ static const std::string accept_language = "Accept-Language: " ;
+ static const std::string accept_encoding = "Accept-Encoding: " ;
+ static const std::string user_agent = "User-Agent: " ;
+
+ while(1) {
+ line=s->ReceiveLine();
+
+ if (line.empty()) break;
+
+ unsigned int pos_cr_lf = line.find_first_of("\x0a\x0d");
+ if (pos_cr_lf == 0) break;
+
+ line = line.substr(0,pos_cr_lf);
+
+ if (line.substr(0, authorization.size()) == authorization) {
+ req.authentication_given_ = true;
+ std::string encoded = line.substr(authorization.size());
+ std::string decoded = base64_decode(encoded);
+
+ unsigned int pos_colon = decoded.find(":");
+
+ req.username_ = decoded.substr(0, pos_colon);
+ req.password_ = decoded.substr(pos_colon+1 );
+ }
+ else if (line.substr(0, accept.size()) == accept) {
+ req.accept_ = line.substr(accept.size());
+ }
+ else if (line.substr(0, accept_language.size()) == accept_language) {
+ req.accept_language_ = line.substr(accept_language.size());
+ }
+ else if (line.substr(0, accept_encoding.size()) == accept_encoding) {
+ req.accept_encoding_ = line.substr(accept_encoding.size());
+ }
+ else if (line.substr(0, user_agent.size()) == user_agent) {
+ req.user_agent_ = line.substr(user_agent.size());
+ }
+ }
+
+ request_func_(&req);
+
+ std::stringstream str_str;
+ str_str << req.answer_.size();
+
+ time_t ltime;
+ time(<ime);
+ tm* gmt= gmtime(<ime);
+
+#ifdef _WIN32
+ static std::string const serverName = "MCServerWebAdmin (Windows)";
+#elif __APPLE__
+ static std::string const serverName = "MCServerWebAdmin (MacOSX)";
+#else
+ static std::string const serverName = "MCServerWebAdmin (Linux)";
+#endif
+
+
+ char* asctime_remove_nl = std::asctime(gmt);
+ asctime_remove_nl[24] = 0;
+
+ s->SendBytes("HTTP/1.1 ");
+
+ if (! req.auth_realm_.empty() ) {
+ s->SendLine("401 Unauthorized");
+ s->SendBytes("WWW-Authenticate: Basic Realm=\"");
+ s->SendBytes(req.auth_realm_);
+ s->SendLine("\"");
+ }
+ else {
+ s->SendLine(req.status_);
+ }
+ s->SendLine(std::string("Date: ") + asctime_remove_nl + " GMT");
+ s->SendLine(std::string("Server: ") +serverName);
+ s->SendLine("Connection: close");
+ s->SendLine("Content-Type: text/html; charset=ISO-8859-1");
+ s->SendLine("Content-Length: " + str_str.str());
+ s->SendLine("");
+ s->SendLine(req.answer_);
+
+ s->Close();
+ delete s;
+
+
+ return 0;
+}
+
+void webserver::Stop()
+{
+ m_bStop = true;
+ m_Socket->Close();
+ m_Event->Wait();
+}
+
+void webserver::Begin()
+{
+ m_bStop = false;
+ while ( !m_bStop )
+ {
+ Socket* ptr_s=m_Socket->Accept();
+ if( m_bStop )
+ {
+ if( ptr_s != 0 )
+ {
+ ptr_s->Close();
+ delete ptr_s;
+ }
+ break;
+ }
+
+ // unused variable 'ret'
+ //_beginthreadex(0,0,Request,(void*) ptr_s,0,&ret);
+ // Thanks to Frank M. Hoffmann for fixing a HANDLE leak
+ #ifdef _WIN32
+ unsigned ret;
+ HANDLE hHandle = reinterpret_cast<HANDLE>(_beginthreadex(0,0,Request,(void*) ptr_s,0,&ret));
+ CloseHandle(hHandle);
+ #else
+ pthread_t* hHandle = new pthread_t;
+ pthread_create( hHandle, NULL, Request, ptr_s);
+ #endif
+ }
+ m_Event->Set();
+}
+
+webserver::webserver(unsigned int port_to_listen, request_func r) {
+ m_Socket = new SocketServer(port_to_listen,1);
+
+ request_func_ = r;
+ m_Event = new cEvent();
+}
+
+webserver::~webserver()
+{
+ delete m_Socket;
+ delete m_Event;
+}
diff --git a/WebServer/WebServer.h b/WebServer/WebServer.h new file mode 100644 index 000000000..06c6359e6 --- /dev/null +++ b/WebServer/WebServer.h @@ -0,0 +1,95 @@ +/*
+ WebServer.h
+
+ Copyright (C) 2003-2004 René Nyffenegger
+
+ This source code is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented; you must not
+ claim that you wrote the original source code. If you use this source code
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original source code.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ René Nyffenegger rene.nyffenegger@adp-gmbh.ch
+
+*/
+
+/*
+ Note on point 2:
+ THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
+*/
+
+#include <string>
+#include <map>
+
+class cEvent;
+class Socket;
+class SocketServer;
+class webserver {
+ public:
+ struct http_request {
+
+ http_request()
+ : s_( 0 ) + , authentication_given_(false)
+ {}
+
+ Socket* s_;
+ std::string method_;
+ std::string path_;
+ std::map<std::string, std::string> params_;
+
+ std::string accept_;
+ std::string accept_language_;
+ std::string accept_encoding_;
+ std::string user_agent_;
+
+ /* status_: used to transmit server's error status, such as
+ o 202 OK
+ o 404 Not Found
+ and so on */
+ std::string status_;
+
+ /* auth_realm_: allows to set the basic realm for an authentication,
+ no need to additionally set status_ if set */
+ std::string auth_realm_;
+
+ std::string answer_;
+
+ /* authentication_given_ is true when the user has entered a username and password.
+ These can then be read from username_ and password_ */
+ bool authentication_given_;
+ std::string username_;
+ std::string password_;
+ };
+
+ typedef void (*request_func) (http_request*);
+ webserver(unsigned int port_to_listen, request_func);
+ ~webserver();
+
+ void Begin();
+ void Stop();
+
+ private:
+ bool m_bStop;
+ #ifdef _WIN32
+ static unsigned __stdcall Request(void*);
+ #else
+ static void* Request(void*);
+ #endif
+ static request_func request_func_;
+
+ cEvent* m_Event;
+ SocketServer* m_Socket;
+};
diff --git a/WebServer/base64.cpp b/WebServer/base64.cpp new file mode 100644 index 000000000..8a6f33147 --- /dev/null +++ b/WebServer/base64.cpp @@ -0,0 +1,96 @@ +#include "base64.h"
+#include <iostream>
+
+static const std::string base64_chars =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+/";
+
+
+static inline bool is_base64(unsigned char c) {
+ return (isalnum(c) || (c == '+') || (c == '/'));
+}
+
+std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
+ std::string ret;
+ int i = 0;
+ int j = 0;
+ unsigned char char_array_3[3];
+ unsigned char char_array_4[4];
+
+ while (in_len--) {
+ char_array_3[i++] = *(bytes_to_encode++);
+ if (i == 3) {
+ char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
+ char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
+ char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
+ char_array_4[3] = char_array_3[2] & 0x3f;
+
+ for(i = 0; (i <4) ; i++)
+ ret += base64_chars[char_array_4[i]];
+ i = 0;
+ }
+ }
+
+ if (i)
+ {
+ for(j = i; j < 3; j++)
+ char_array_3[j] = '\0';
+
+ char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
+ char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
+ char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
+ char_array_4[3] = char_array_3[2] & 0x3f;
+
+ for (j = 0; (j < i + 1); j++)
+ ret += base64_chars[char_array_4[j]];
+
+ while((i++ < 3))
+ ret += '=';
+
+ }
+
+ return ret;
+
+}
+
+std::string base64_decode(std::string const& encoded_string) {
+ int in_len = encoded_string.size();
+ int i = 0;
+ int j = 0;
+ int in_ = 0;
+ unsigned char char_array_4[4], char_array_3[3];
+ std::string ret;
+
+ while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
+ char_array_4[i++] = encoded_string[in_]; in_++;
+ if (i ==4) {
+ for (i = 0; i <4; i++)
+ char_array_4[i] = base64_chars.find(char_array_4[i]);
+
+ char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
+ char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
+ char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
+
+ for (i = 0; (i < 3); i++)
+ ret += char_array_3[i];
+ i = 0;
+ }
+ }
+
+ if (i) {
+ for (j = i; j <4; j++)
+ char_array_4[j] = 0;
+
+ for (j = 0; j <4; j++)
+ char_array_4[j] = base64_chars.find(char_array_4[j]);
+
+ char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
+ char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
+ char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
+
+ for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
+ }
+
+ return ret;
+}
diff --git a/WebServer/base64.h b/WebServer/base64.h new file mode 100644 index 000000000..91b731417 --- /dev/null +++ b/WebServer/base64.h @@ -0,0 +1,4 @@ +#include <string>
+
+std::string base64_encode(unsigned char const* , unsigned int len);
+std::string base64_decode(std::string const& s);
diff --git a/WebServer/cEvent.cpp b/WebServer/cEvent.cpp new file mode 100644 index 000000000..289131568 --- /dev/null +++ b/WebServer/cEvent.cpp @@ -0,0 +1,112 @@ +#include "cEvent.h"
+#include "../source/cMCLogger.h"
+
+#ifdef _WIN32
+#include <Windows.h>
+#else
+#include <semaphore.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h> // sprintf()
+#endif
+
+cEvent::cEvent( unsigned int a_NumEvents /* = 1 */ )
+ : m_NumEvents( a_NumEvents )
+#ifndef _WIN32
+ , m_bNamed( false )
+#endif
+{
+ if( m_NumEvents < 1 ) m_NumEvents = 1;
+
+#ifdef _WIN32
+ m_Handle = new HANDLE[ m_NumEvents ];
+ for( unsigned int i = 0; i < m_NumEvents; i++)
+ {
+ ((HANDLE*)m_Handle)[i] = CreateEvent( 0, FALSE, FALSE, 0 );
+ }
+#else
+ m_Handle = new sem_t*[ m_NumEvents ];
+ for( unsigned int i = 0; i < m_NumEvents; i++)
+ {
+
+ sem_t* & HandlePtr = ((sem_t**)m_Handle)[i];
+ HandlePtr = new sem_t;
+
+ if( sem_init( HandlePtr, 0, 0 ) )
+ {
+ LOG("WARNING cEvent: Could not create unnamed semaphore, fallback to named.");
+ m_bNamed = true;
+ delete HandlePtr; // named semaphores return their own address
+
+ char c_Str[32];
+ sprintf( c_Str, "cEvent%p", &HandlePtr );
+ HandlePtr = sem_open( c_Str, O_CREAT, 777, 0 );
+ if( HandlePtr == SEM_FAILED )
+ LOG("ERROR: Could not create Event. (%i)", errno);
+ else
+ if( sem_unlink( c_Str ) != 0 )
+ LOG("ERROR: Could not unlink cEvent. (%i)", errno);
+ }
+ }
+#endif
+}
+
+cEvent::~cEvent()
+{
+#ifdef _WIN32
+ for( unsigned int i = 0; i < m_NumEvents; i++ )
+ {
+ CloseHandle( ((HANDLE*)m_Handle)[i] );
+ }
+ delete [] (HANDLE*)m_Handle;
+#else
+ for( unsigned int i = 0; i < m_NumEvents; i++ )
+ {
+ if( m_bNamed )
+ {
+ sem_t* & HandlePtr = ((sem_t**)m_Handle)[i];
+ char c_Str[32];
+ sprintf( c_Str, "cEvent%p", &HandlePtr );
+ // LOG("Closing event: %s", c_Str );
+ // LOG("Sem ptr: %p", HandlePtr );
+ if( sem_close( HandlePtr ) != 0 )
+ {
+ LOG("ERROR: Could not close cEvent. (%i)", errno);
+ }
+ }
+ else
+ {
+ sem_destroy( ((sem_t**)m_Handle)[i] );
+ delete ((sem_t**)m_Handle)[i];
+ }
+ }
+ delete [] (sem_t**)m_Handle; m_Handle = 0;
+#endif
+}
+
+void cEvent::Wait()
+{
+#ifdef _WIN32
+ WaitForMultipleObjects( m_NumEvents, (HANDLE*)m_Handle, true, INFINITE );
+#else
+ for(unsigned int i = 0; i < m_NumEvents; i++)
+ {
+ if( sem_wait( ((sem_t**)m_Handle)[i] ) != 0 )
+ {
+ LOG("ERROR: Could not wait for cEvent. (%i)", errno);
+ }
+ }
+#endif
+}
+
+void cEvent::Set(unsigned int a_EventNum /* = 0 */)
+{
+#ifdef _WIN32
+ SetEvent( ((HANDLE*)m_Handle)[a_EventNum] );
+#else
+ if( sem_post( ((sem_t**)m_Handle)[a_EventNum] ) != 0 )
+ {
+ LOG("ERROR: Could not set cEvent. (%i)", errno);
+ }
+#endif
+}
diff --git a/WebServer/cEvent.h b/WebServer/cEvent.h new file mode 100644 index 000000000..e5b77be50 --- /dev/null +++ b/WebServer/cEvent.h @@ -0,0 +1,18 @@ +#pragma once
+
+class cEvent
+{
+public:
+ cEvent( unsigned int a_NumEvents = 1 );
+ ~cEvent();
+
+ void Wait();
+ void Set(unsigned int a_EventNum = 0);
+private:
+ unsigned int m_NumEvents;
+ void* m_Handle; // HANDLE[] pointer + +#ifndef _WIN32 + bool m_bNamed; +#endif
+}; diff --git a/iniFile/iniFile.cpp b/iniFile/iniFile.cpp new file mode 100644 index 000000000..76e64ff37 --- /dev/null +++ b/iniFile/iniFile.cpp @@ -0,0 +1,507 @@ +// IniFile.cpp: Implementation of the CIniFile class.
+// Written by: Adam Clauss
+// Email: cabadam@houston.rr.com
+// You may use this class/code as you wish in your programs. Feel free to distribute it, and
+// email suggested changes to me.
+//
+// Rewritten by: Shane Hill
+// Date: 21/08/2001
+// Email: Shane.Hill@dsto.defence.gov.au
+// Reason: Remove dependancy on MFC. Code should compile on any
+// platform.
+//////////////////////////////////////////////////////////////////////
+
+/*
+ !! MODIFIED BY FAKETRUTH !!
+*/
+
+// C++ Includes
+#include <iostream>
+#include <fstream>
+#include <strstream>
+
+using namespace std;
+
+// C Includes
+#include <stdio.h>
+#include <stdarg.h>
+#include <ctype.h>
+
+// Local Includes
+#include "iniFile.h"
+
+#if defined(WIN32)
+#define iniEOL endl
+#else
+#define iniEOL '\r' << endl
+#endif
+
+#ifndef _WIN32
+#define sprintf_s(buffer, buffer_size, stringbuffer, ...) (sprintf(buffer, stringbuffer, __VA_ARGS__))
+#define vsprintf_s(buffer, stringbuffer, ...) (vsprintf(buffer, stringbuffer, __VA_ARGS__))
+#define sscanf_s(buffer, stringbuffer, ...) (sscanf(buffer, stringbuffer, __VA_ARGS__))
+#endif
+
+cIniFile::cIniFile( const string iniPath)
+{
+ Path( iniPath);
+ caseInsensitive = true;
+}
+
+bool cIniFile::ReadFile()
+{
+ // Normally you would use ifstream, but the SGI CC compiler has
+ // a few bugs with ifstream. So ... fstream used.
+ fstream f;
+ string line;
+ string keyname, valuename, value;
+ string::size_type pLeft, pRight;
+
+ f.open( path.c_str(), ios::in);
+ if ( f.fail())
+ return false;
+
+ while( getline( f, line)) {
+ // To be compatible with Win32, check for existence of '\r'.
+ // Win32 files have the '\r' and Unix files don't at the end of a line.
+ // Note that the '\r' will be written to INI files from
+ // Unix so that the created INI file can be read under Win32
+ // without change.
+ unsigned int lineLength = line.length();
+ if(lineLength == 0) continue;
+ if ( line[lineLength - 1] == '\r')
+ line = line.substr( 0, lineLength - 1);
+
+ if ( line.length()) {
+ // Check that the user hasn't opened a binary file by checking the first
+ // character of each line!
+ if ( !isprint( line[0])) {
+ printf( "Failing on char %d\n", line[0]);
+ f.close();
+ return false;
+ }
+ if (( pLeft = line.find_first_of(";#[=")) != string::npos) {
+ switch ( line[pLeft]) {
+ case '[':
+ if ((pRight = line.find_last_of("]")) != string::npos &&
+ pRight > pLeft) {
+ keyname = line.substr( pLeft + 1, pRight - pLeft - 1);
+ AddKeyName( keyname);
+ }
+ break;
+
+ case '=':
+ valuename = line.substr( 0, pLeft);
+ value = line.substr( pLeft + 1);
+ SetValue( keyname, valuename, value);
+ break;
+
+ case ';':
+ case '#':
+ if ( !names.size())
+ HeaderComment( line.substr( pLeft + 1));
+ else
+ KeyComment( keyname, line.substr( pLeft + 1));
+ break;
+ }
+ }
+ }
+ }
+
+ f.close();
+ if ( names.size())
+ return true;
+ return false;
+}
+
+bool cIniFile::WriteFile()
+{
+ unsigned commentID, keyID, valueID;
+ // Normally you would use ofstream, but the SGI CC compiler has
+ // a few bugs with ofstream. So ... fstream used.
+ fstream f;
+
+ f.open( path.c_str(), ios::out);
+ if ( f.fail())
+ return false;
+
+ // Write header comments.
+ for ( commentID = 0; commentID < comments.size(); ++commentID)
+ f << ';' << comments[commentID] << iniEOL;
+ if ( comments.size())
+ f << iniEOL;
+
+ // Write keys and values.
+ for ( keyID = 0; keyID < keys.size(); ++keyID) {
+ f << '[' << names[keyID] << ']' << iniEOL;
+ // Comments.
+ for ( commentID = 0; commentID < keys[keyID].comments.size(); ++commentID)
+ f << ';' << keys[keyID].comments[commentID] << iniEOL;
+ // Values.
+ for ( valueID = 0; valueID < keys[keyID].names.size(); ++valueID)
+ f << keys[keyID].names[valueID] << '=' << keys[keyID].values[valueID] << iniEOL;
+ f << iniEOL;
+ }
+ f.close();
+
+ return true;
+}
+
+long cIniFile::FindKey( const string & keyname) const
+{
+ for ( unsigned keyID = 0; keyID < names.size(); ++keyID)
+ if ( CheckCase( names[keyID]) == CheckCase( keyname))
+ return long(keyID);
+ return noID;
+}
+
+long cIniFile::FindValue( unsigned const keyID, const string & valuename) const
+{
+ if ( !keys.size() || keyID >= keys.size())
+ return noID;
+
+ for ( unsigned valueID = 0; valueID < keys[keyID].names.size(); ++valueID)
+ if ( CheckCase( keys[keyID].names[valueID]) == CheckCase( valuename))
+ return long(valueID);
+ return noID;
+}
+
+unsigned cIniFile::AddKeyName( const string & keyname)
+{
+ names.resize( names.size() + 1, keyname);
+ keys.resize( keys.size() + 1);
+ return names.size() - 1;
+}
+
+string cIniFile::KeyName( unsigned const keyID) const
+{
+ if ( keyID < names.size())
+ return names[keyID];
+ else
+ return "";
+}
+
+unsigned cIniFile::NumValues( unsigned const keyID)
+{
+ if ( keyID < keys.size())
+ return keys[keyID].names.size();
+ return 0;
+}
+
+unsigned cIniFile::NumValues( const string & keyname)
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return 0;
+ return keys[keyID].names.size();
+}
+
+string cIniFile::ValueName( unsigned const keyID, unsigned const valueID) const
+{
+ if ( keyID < keys.size() && valueID < keys[keyID].names.size())
+ return keys[keyID].names[valueID];
+ return "";
+}
+
+string cIniFile::ValueName( const string & keyname, unsigned const valueID) const
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return "";
+ return ValueName( keyID, valueID);
+}
+
+bool cIniFile::SetValue( unsigned const keyID, unsigned const valueID, const string & value)
+{
+ if ( keyID < keys.size() && valueID < keys[keyID].names.size())
+ keys[keyID].values[valueID] = value;
+
+ return false;
+}
+
+bool cIniFile::SetValue( const string & keyname, const string & valuename, const string & value, bool const create)
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID) {
+ if ( create)
+ keyID = long( AddKeyName( keyname));
+ else
+ return false;
+ }
+
+ long valueID = FindValue( unsigned(keyID), valuename);
+ if ( valueID == noID) {
+ if ( !create)
+ return false;
+ keys[keyID].names.resize( keys[keyID].names.size() + 1, valuename);
+ keys[keyID].values.resize( keys[keyID].values.size() + 1, value);
+ } else
+ {
+ if(!create)
+ keys[keyID].values[valueID] = value;
+ else
+ {
+ keys[keyID].names.resize( keys[keyID].names.size() + 1, valuename);
+ keys[keyID].values.resize( keys[keyID].values.size() + 1, value);
+ }
+ }
+
+ return true;
+}
+
+bool cIniFile::SetValueI( const string & keyname, const string & valuename, int const value, bool const create)
+{
+ char svalue[MAX_VALUEDATA];
+
+ sprintf_s( svalue, MAX_VALUEDATA, "%d", value);
+ return SetValue( keyname, valuename, svalue, create);
+}
+
+bool cIniFile::SetValueF( const string & keyname, const string & valuename, double const value, bool const create)
+{
+ char svalue[MAX_VALUEDATA];
+
+ sprintf_s( svalue, MAX_VALUEDATA, "%f", value);
+ return SetValue( keyname, valuename, svalue, create);
+}
+
+bool cIniFile::SetValueV( const string & keyname, const string & valuename, char *format, ...)
+{
+ va_list args;
+ char value[MAX_VALUEDATA];
+
+ va_start( args, format);
+ vsprintf_s( value, format, args);
+ va_end( args);
+ return SetValue( keyname, valuename, value );
+}
+
+string cIniFile::GetValue( unsigned const keyID, unsigned const valueID, const string & defValue) const
+{
+ if ( keyID < keys.size() && valueID < keys[keyID].names.size())
+ return keys[keyID].values[valueID];
+ return defValue;
+}
+
+string cIniFile::GetValue( const string & keyname, const string & valuename, const string & defValue) const
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return defValue;
+
+ long valueID = FindValue( unsigned(keyID), valuename);
+ if ( valueID == noID)
+ return defValue;
+
+ return keys[keyID].values[valueID];
+}
+
+int cIniFile::GetValueI(const string & keyname, const string & valuename, int const defValue) const
+{
+ char svalue[MAX_VALUEDATA];
+
+ sprintf_s( svalue, MAX_VALUEDATA, "%d", defValue);
+ return atoi( GetValue( keyname, valuename, svalue).c_str());
+}
+
+double cIniFile::GetValueF(const string & keyname, const string & valuename, double const defValue) const
+{
+ char svalue[MAX_VALUEDATA];
+
+ sprintf_s( svalue, MAX_VALUEDATA, "%f", defValue);
+ return atof( GetValue( keyname, valuename, svalue).c_str());
+}
+
+// 16 variables may be a bit of over kill, but hey, it's only code.
+unsigned cIniFile::GetValueV( const string & keyname, const string & valuename, char *format,
+ void *v1, void *v2, void *v3, void *v4,
+ void *v5, void *v6, void *v7, void *v8,
+ void *v9, void *v10, void *v11, void *v12,
+ void *v13, void *v14, void *v15, void *v16)
+{
+ string value;
+ // va_list args;
+ unsigned nVals;
+
+
+ value = GetValue( keyname, valuename);
+ if ( !value.length())
+ return false;
+ // Why is there not vsscanf() function. Linux man pages say that there is
+ // but no compiler I've seen has it defined. Bummer!
+ //
+ // va_start( args, format);
+ // nVals = vsscanf( value.c_str(), format, args);
+ // va_end( args);
+
+ nVals = sscanf_s( value.c_str(), format,
+ v1, v2, v3, v4, v5, v6, v7, v8,
+ v9, v10, v11, v12, v13, v14, v15, v16);
+
+ return nVals;
+}
+
+bool cIniFile::DeleteValue( const string & keyname, const string & valuename)
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return false;
+
+ long valueID = FindValue( unsigned(keyID), valuename);
+ if ( valueID == noID)
+ return false;
+
+ // This looks strange, but is neccessary.
+ vector<string>::iterator npos = keys[keyID].names.begin() + valueID;
+ vector<string>::iterator vpos = keys[keyID].values.begin() + valueID;
+ keys[keyID].names.erase( npos, npos + 1);
+ keys[keyID].values.erase( vpos, vpos + 1);
+
+ return true;
+}
+
+bool cIniFile::DeleteKey( const string & keyname)
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return false;
+
+ // Now hopefully this destroys the vector lists within keys.
+ // Looking at <vector> source, this should be the case using the destructor.
+ // If not, I may have to do it explicitly. Memory leak check should tell.
+ // memleak_test.cpp shows that the following not required.
+ //keys[keyID].names.clear();
+ //keys[keyID].values.clear();
+
+ vector<string>::iterator npos = names.begin() + keyID;
+ vector<key>::iterator kpos = keys.begin() + keyID;
+ names.erase( npos, npos + 1);
+ keys.erase( kpos, kpos + 1);
+
+ return true;
+}
+
+void cIniFile::Erase()
+{
+ // This loop not needed. The vector<> destructor seems to do
+ // all the work itself. memleak_test.cpp shows this.
+ //for ( unsigned i = 0; i < keys.size(); ++i) {
+ // keys[i].names.clear();
+ // keys[i].values.clear();
+ //}
+ names.clear();
+ keys.clear();
+ comments.clear();
+}
+
+void cIniFile::HeaderComment( const string & comment)
+{
+ comments.resize( comments.size() + 1, comment);
+}
+
+string cIniFile::HeaderComment( unsigned const commentID) const
+{
+ if ( commentID < comments.size())
+ return comments[commentID];
+ return "";
+}
+
+bool cIniFile::DeleteHeaderComment( unsigned commentID)
+{
+ if ( commentID < comments.size()) {
+ vector<string>::iterator cpos = comments.begin() + commentID;
+ comments.erase( cpos, cpos + 1);
+ return true;
+ }
+ return false;
+}
+
+unsigned cIniFile::NumKeyComments( unsigned const keyID) const
+{
+ if ( keyID < keys.size())
+ return keys[keyID].comments.size();
+ return 0;
+}
+
+unsigned cIniFile::NumKeyComments( const string & keyname) const
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return 0;
+ return keys[keyID].comments.size();
+}
+
+bool cIniFile::KeyComment( unsigned const keyID, const string & comment)
+{
+ if ( keyID < keys.size()) {
+ keys[keyID].comments.resize( keys[keyID].comments.size() + 1, comment);
+ return true;
+ }
+ return false;
+}
+
+bool cIniFile::KeyComment( const string & keyname, const string & comment)
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return false;
+ return KeyComment( unsigned(keyID), comment);
+}
+
+string cIniFile::KeyComment( unsigned const keyID, unsigned const commentID) const
+{
+ if ( keyID < keys.size() && commentID < keys[keyID].comments.size())
+ return keys[keyID].comments[commentID];
+ return "";
+}
+
+string cIniFile::KeyComment( const string & keyname, unsigned const commentID) const
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return "";
+ return KeyComment( unsigned(keyID), commentID);
+}
+
+bool cIniFile::DeleteKeyComment( unsigned const keyID, unsigned const commentID)
+{
+ if ( keyID < keys.size() && commentID < keys[keyID].comments.size()) {
+ vector<string>::iterator cpos = keys[keyID].comments.begin() + commentID;
+ keys[keyID].comments.erase( cpos, cpos + 1);
+ return true;
+ }
+ return false;
+}
+
+bool cIniFile::DeleteKeyComment( const string & keyname, unsigned const commentID)
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return false;
+ return DeleteKeyComment( unsigned(keyID), commentID);
+}
+
+bool cIniFile::DeleteKeyComments( unsigned const keyID)
+{
+ if ( keyID < keys.size()) {
+ keys[keyID].comments.clear();
+ return true;
+ }
+ return false;
+}
+
+bool cIniFile::DeleteKeyComments( const string & keyname)
+{
+ long keyID = FindKey( keyname);
+ if ( keyID == noID)
+ return false;
+ return DeleteKeyComments( unsigned(keyID));
+}
+
+string cIniFile::CheckCase( string s) const
+{
+ if ( caseInsensitive)
+ for ( string::size_type i = 0; i < s.length(); ++i)
+ s[i] = (char)tolower(s[i]);
+ return s;
+}
diff --git a/iniFile/iniFile.h b/iniFile/iniFile.h new file mode 100644 index 000000000..c23c0369f --- /dev/null +++ b/iniFile/iniFile.h @@ -0,0 +1,184 @@ +// IniFile.cpp: Implementation of the CIniFile class.
+// Written by: Adam Clauss
+// Email: cabadam@tamu.edu
+// You may use this class/code as you wish in your programs. Feel free to distribute it, and
+// email suggested changes to me.
+//
+// Rewritten by: Shane Hill
+// Date: 21/08/2001
+// Email: Shane.Hill@dsto.defence.gov.au
+// Reason: Remove dependancy on MFC. Code should compile on any
+// platform. Tested on Windows/Linux/Irix
+//////////////////////////////////////////////////////////////////////
+
+/*
+ !! MODIFIED BY FAKETRUTH !!
+*/
+
+#ifndef CIniFile_H
+#define CIniFile_H
+
+// C++ Includes
+#include <string>
+#include <vector>
+
+// C Includes
+#include <stdlib.h>
+
+#define MAX_KEYNAME 128
+#define MAX_VALUENAME 128
+#define MAX_VALUEDATA 2048
+
+class cIniFile //tolua_export
+{ //tolua_export
+private:
+ bool caseInsensitive;
+ std::string path;
+ struct key {
+ std::vector<std::string> names;
+ std::vector<std::string> values;
+ std::vector<std::string> comments;
+ };
+ std::vector<key> keys;
+ std::vector<std::string> names;
+ std::vector<std::string> comments;
+ std::string CheckCase( std::string s) const;
+
+public:
+ enum errors{ noID = -1};
+ cIniFile( const std::string iniPath = ""); //tolua_export
+ virtual ~cIniFile() {}
+
+ // Sets whether or not keynames and valuenames should be case sensitive.
+ // The default is case insensitive.
+ void CaseSensitive() {caseInsensitive = false;} //tolua_export
+ void CaseInsensitive() {caseInsensitive = true;} //tolua_export
+
+ // Sets path of ini file to read and write from.
+ void Path(const std::string & newPath) {path = newPath;} //tolua_export
+ std::string Path() const {return path;} //tolua_export
+ void SetPath(const std::string & newPath) {Path( newPath);} //tolua_export
+
+ // Reads ini file specified using path.
+ // Returns true if successful, false otherwise.
+ bool ReadFile(); //tolua_export
+
+ // Writes data stored in class to ini file.
+ bool WriteFile(); //tolua_export
+
+ // Deletes all stored ini data.
+ void Erase(); //tolua_export
+ void Clear() {Erase();} //tolua_export
+ void Reset() {Erase();} //tolua_export
+
+ // Returns index of specified key, or noID if not found.
+ long FindKey( const std::string & keyname) const; //tolua_export
+
+ // Returns index of specified value, in the specified key, or noID if not found.
+ long FindValue( const unsigned keyID, const std::string & valuename) const; //tolua_export
+
+ // Returns number of keys currently in the ini.
+ unsigned NumKeys() const {return names.size();} //tolua_export
+ unsigned GetNumKeys() const {return NumKeys();} //tolua_export
+
+ // Add a key name.
+ unsigned AddKeyName( const std::string & keyname); //tolua_export
+
+ // Returns key names by index.
+ std::string KeyName( const unsigned keyID) const; //tolua_export
+ std::string GetKeyName( const unsigned keyID) const {return KeyName(keyID);} //tolua_export
+
+ // Returns number of values stored for specified key.
+ unsigned NumValues( const std::string & keyname); //tolua_export
+ unsigned GetNumValues( const std::string & keyname) {return NumValues( keyname);} //tolua_export
+ unsigned NumValues( const unsigned keyID); //tolua_export
+ unsigned GetNumValues( const unsigned keyID) {return NumValues( keyID);} //tolua_export
+
+ // Returns value name by index for a given keyname or keyID.
+ std::string ValueName( const std::string & keyname, const unsigned valueID) const; //tolua_export
+ std::string GetValueName( const std::string & keyname, const unsigned valueID) const { //tolua_export
+ return ValueName( keyname, valueID);
+ } //tolua_export
+ std::string ValueName( const unsigned keyID, const unsigned valueID) const; //tolua_export
+ std::string GetValueName( const unsigned keyID, const unsigned valueID) const { //tolua_export
+ return ValueName( keyID, valueID);
+ } //tolua_export
+
+ // Gets value of [keyname] valuename =.
+ // Overloaded to return string, int, and double.
+ // Returns defValue if key/value not found.
+ std::string GetValue( const std::string & keyname, const std::string & valuename, const std::string & defValue = "") const; //tolua_export
+ std::string GetValue( const unsigned keyID, const unsigned valueID, const std::string & defValue = "") const; //tolua_export
+ int GetValueI( const std::string & keyname, const std::string & valuename, const int defValue = 0) const; //tolua_export
+ bool GetValueB( const std::string & keyname, const std::string & valuename, const bool defValue = false) const { //tolua_export
+ return ( GetValueI( keyname, valuename, int( defValue)) > 0);
+ } //tolua_export
+ double GetValueF( const std::string & keyname, const std::string & valuename, const double defValue = 0.0) const; //tolua_export
+ // This is a variable length formatted GetValue routine. All these voids
+ // are required because there is no vsscanf() like there is a vsprintf().
+ // Only a maximum of 8 variable can be read.
+ unsigned GetValueV( const std::string & keyname, const std::string & valuename, char *format,
+ void *v1 = 0, void *v2 = 0, void *v3 = 0, void *v4 = 0,
+ void *v5 = 0, void *v6 = 0, void *v7 = 0, void *v8 = 0,
+ void *v9 = 0, void *v10 = 0, void *v11 = 0, void *v12 = 0,
+ void *v13 = 0, void *v14 = 0, void *v15 = 0, void *v16 = 0);
+
+ // Sets value of [keyname] valuename =.
+ // Specify the optional paramter as false (0) if you do not want it to create
+ // the key if it doesn't exist. Returns true if data entered, false otherwise.
+ // Overloaded to accept string, int, and double.
+ bool SetValue( const unsigned keyID, const unsigned valueID, const std::string & value); //tolua_export
+ bool SetValue( const std::string & keyname, const std::string & valuename, const std::string & value, const bool create = true); //tolua_export
+ bool SetValueI( const std::string & keyname, const std::string & valuename, const int value, const bool create = true); //tolua_export
+ bool SetValueB( const std::string & keyname, const std::string & valuename, const bool value, const bool create = true) { //tolua_export
+ return SetValueI( keyname, valuename, int(value), create);
+ } //tolua_export
+ bool SetValueF( const std::string & keyname, const std::string & valuename, const double value, const bool create = true); //tolua_export
+ bool SetValueV( const std::string & keyname, const std::string & valuename, char *format, ...);
+
+ // Deletes specified value.
+ // Returns true if value existed and deleted, false otherwise.
+ bool DeleteValue( const std::string & keyname, const std::string & valuename); //tolua_export
+
+ // Deletes specified key and all values contained within.
+ // Returns true if key existed and deleted, false otherwise.
+ bool DeleteKey(const std::string & keyname); //tolua_export
+
+ // Header comment functions.
+ // Header comments are those comments before the first key.
+ //
+ // Number of header comments.
+ unsigned NumHeaderComments() {return comments.size();} //tolua_export
+ // Add a header comment.
+ void HeaderComment( const std::string & comment); //tolua_export
+ // Return a header comment.
+ std::string HeaderComment( const unsigned commentID) const; //tolua_export
+ // Delete a header comment.
+ bool DeleteHeaderComment( unsigned commentID); //tolua_export
+ // Delete all header comments.
+ void DeleteHeaderComments() {comments.clear();} //tolua_export
+
+ // Key comment functions.
+ // Key comments are those comments within a key. Any comments
+ // defined within value names will be added to this list. Therefore,
+ // these comments will be moved to the top of the key definition when
+ // the CIniFile::WriteFile() is called.
+ //
+ // Number of key comments.
+ unsigned NumKeyComments( const unsigned keyID) const; //tolua_export
+ unsigned NumKeyComments( const std::string & keyname) const; //tolua_export
+ // Add a key comment.
+ bool KeyComment( const unsigned keyID, const std::string & comment); //tolua_export
+ bool KeyComment( const std::string & keyname, const std::string & comment); //tolua_export
+ // Return a key comment.
+ std::string KeyComment( const unsigned keyID, const unsigned commentID) const; //tolua_export
+ std::string KeyComment( const std::string & keyname, const unsigned commentID) const; //tolua_export
+ // Delete a key comment.
+ bool DeleteKeyComment( const unsigned keyID, const unsigned commentID); //tolua_export
+ bool DeleteKeyComment( const std::string & keyname, const unsigned commentID); //tolua_export
+ // Delete all comments for a key.
+ bool DeleteKeyComments( const unsigned keyID); //tolua_export
+ bool DeleteKeyComments( const std::string & keyname); //tolua_export
+}; //tolua_export
+
+#endif
diff --git a/jsoncpp-src-0.5.0/include/json/autolink.h b/jsoncpp-src-0.5.0/include/json/autolink.h new file mode 100644 index 000000000..37c9258ed --- /dev/null +++ b/jsoncpp-src-0.5.0/include/json/autolink.h @@ -0,0 +1,19 @@ +#ifndef JSON_AUTOLINK_H_INCLUDED +# define JSON_AUTOLINK_H_INCLUDED + +# include "config.h" + +# ifdef JSON_IN_CPPTL +# include <cpptl/cpptl_autolink.h> +# endif + +# if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && !defined(JSON_IN_CPPTL) +# define CPPTL_AUTOLINK_NAME "json" +# undef CPPTL_AUTOLINK_DLL +# ifdef JSON_DLL +# define CPPTL_AUTOLINK_DLL +# endif +# include "autolink.h" +# endif + +#endif // JSON_AUTOLINK_H_INCLUDED diff --git a/jsoncpp-src-0.5.0/include/json/config.h b/jsoncpp-src-0.5.0/include/json/config.h new file mode 100644 index 000000000..5d334cbc5 --- /dev/null +++ b/jsoncpp-src-0.5.0/include/json/config.h @@ -0,0 +1,43 @@ +#ifndef JSON_CONFIG_H_INCLUDED +# define JSON_CONFIG_H_INCLUDED + +/// If defined, indicates that json library is embedded in CppTL library. +//# define JSON_IN_CPPTL 1 + +/// If defined, indicates that json may leverage CppTL library +//# define JSON_USE_CPPTL 1 +/// If defined, indicates that cpptl vector based map should be used instead of std::map +/// as Value container. +//# define JSON_USE_CPPTL_SMALLMAP 1 +/// If defined, indicates that Json specific container should be used +/// (hash table & simple deque container with customizable allocator). +/// THIS FEATURE IS STILL EXPERIMENTAL! +//# define JSON_VALUE_USE_INTERNAL_MAP 1 +/// Force usage of standard new/malloc based allocator instead of memory pool based allocator. +/// The memory pools allocator used optimization (initializing Value and ValueInternalLink +/// as if it was a POD) that may cause some validation tool to report errors. +/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. +//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 + +/// If defined, indicates that Json use exception to report invalid type manipulation +/// instead of C assert macro. +# define JSON_USE_EXCEPTION 1 + +# ifdef JSON_IN_CPPTL +# include <cpptl/config.h> +# ifndef JSON_USE_CPPTL +# define JSON_USE_CPPTL 1 +# endif +# endif + +# ifdef JSON_IN_CPPTL +# define JSON_API CPPTL_API +# elif defined(JSON_DLL_BUILD) +# define JSON_API __declspec(dllexport) +# elif defined(JSON_DLL) +# define JSON_API __declspec(dllimport) +# else +# define JSON_API +# endif + +#endif // JSON_CONFIG_H_INCLUDED diff --git a/jsoncpp-src-0.5.0/include/json/features.h b/jsoncpp-src-0.5.0/include/json/features.h new file mode 100644 index 000000000..5a9adec11 --- /dev/null +++ b/jsoncpp-src-0.5.0/include/json/features.h @@ -0,0 +1,42 @@ +#ifndef CPPTL_JSON_FEATURES_H_INCLUDED +# define CPPTL_JSON_FEATURES_H_INCLUDED + +# include "forwards.h" + +namespace Json { + + /** \brief Configuration passed to reader and writer. + * This configuration object can be used to force the Reader or Writer + * to behave in a standard conforming way. + */ + class JSON_API Features + { + public: + /** \brief A configuration that allows all features and assumes all strings are UTF-8. + * - C & C++ comments are allowed + * - Root object can be any JSON value + * - Assumes Value strings are encoded in UTF-8 + */ + static Features all(); + + /** \brief A configuration that is strictly compatible with the JSON specification. + * - Comments are forbidden. + * - Root object must be either an array or an object value. + * - Assumes Value strings are encoded in UTF-8 + */ + static Features strictMode(); + + /** \brief Initialize the configuration like JsonConfig::allFeatures; + */ + Features(); + + /// \c true if comments are allowed. Default: \c true. + bool allowComments_; + + /// \c true if root must be either an array or an object value. Default: \c false. + bool strictRoot_; + }; + +} // namespace Json + +#endif // CPPTL_JSON_FEATURES_H_INCLUDED diff --git a/jsoncpp-src-0.5.0/include/json/forwards.h b/jsoncpp-src-0.5.0/include/json/forwards.h new file mode 100644 index 000000000..d0ce8300c --- /dev/null +++ b/jsoncpp-src-0.5.0/include/json/forwards.h @@ -0,0 +1,39 @@ +#ifndef JSON_FORWARDS_H_INCLUDED +# define JSON_FORWARDS_H_INCLUDED + +# include "config.h" + +namespace Json { + + // writer.h + class FastWriter; + class StyledWriter; + + // reader.h + class Reader; + + // features.h + class Features; + + // value.h + typedef int Int; + typedef unsigned int UInt; + class StaticString; + class Path; + class PathArgument; + class Value; + class ValueIteratorBase; + class ValueIterator; + class ValueConstIterator; +#ifdef JSON_VALUE_USE_INTERNAL_MAP + class ValueAllocator; + class ValueMapAllocator; + class ValueInternalLink; + class ValueInternalArray; + class ValueInternalMap; +#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP + +} // namespace Json + + +#endif // JSON_FORWARDS_H_INCLUDED diff --git a/jsoncpp-src-0.5.0/include/json/json.h b/jsoncpp-src-0.5.0/include/json/json.h new file mode 100644 index 000000000..c71ed65ab --- /dev/null +++ b/jsoncpp-src-0.5.0/include/json/json.h @@ -0,0 +1,10 @@ +#ifndef JSON_JSON_H_INCLUDED +# define JSON_JSON_H_INCLUDED + +# include "autolink.h" +# include "value.h" +# include "reader.h" +# include "writer.h" +# include "features.h" + +#endif // JSON_JSON_H_INCLUDED diff --git a/jsoncpp-src-0.5.0/include/json/reader.h b/jsoncpp-src-0.5.0/include/json/reader.h new file mode 100644 index 000000000..ee1d6a244 --- /dev/null +++ b/jsoncpp-src-0.5.0/include/json/reader.h @@ -0,0 +1,196 @@ +#ifndef CPPTL_JSON_READER_H_INCLUDED +# define CPPTL_JSON_READER_H_INCLUDED + +# include "features.h" +# include "value.h" +# include <deque> +# include <stack> +# include <string> +# include <iostream> + +namespace Json { + + /** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a Value. + * + */ + class JSON_API Reader + { + public: + typedef char Char; + typedef const Char *Location; + + /** \brief Constructs a Reader allowing all features + * for parsing. + */ + Reader(); + + /** \brief Constructs a Reader allowing the specified feature set + * for parsing. + */ + Reader( const Features &features ); + + /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document. + * \param document UTF-8 encoded string containing the document to read. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them back during + * serialization, \c false to discard comments. + * This parameter is ignored if Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an error occurred. + */ + bool parse( const std::string &document, + Value &root, + bool collectComments = true ); + + /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document. + * \param document UTF-8 encoded string containing the document to read. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them back during + * serialization, \c false to discard comments. + * This parameter is ignored if Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an error occurred. + */ + bool parse( const char *beginDoc, const char *endDoc, + Value &root, + bool collectComments = true ); + + /// \brief Parse from input stream. + /// \see Json::operator>>(std::istream&, Json::Value&). + bool parse( std::istream &is, + Value &root, + bool collectComments = true ); + + /** \brief Returns a user friendly string that list errors in the parsed document. + * \return Formatted error message with the list of errors with their location in + * the parsed document. An empty string is returned if no error occurred + * during parsing. + */ + std::string getFormatedErrorMessages() const; + + private: + enum TokenType + { + tokenEndOfStream = 0, + tokenObjectBegin, + tokenObjectEnd, + tokenArrayBegin, + tokenArrayEnd, + tokenString, + tokenNumber, + tokenTrue, + tokenFalse, + tokenNull, + tokenArraySeparator, + tokenMemberSeparator, + tokenComment, + tokenError + }; + + class Token + { + public: + TokenType type_; + Location start_; + Location end_; + }; + + class ErrorInfo + { + public: + Token token_; + std::string message_; + Location extra_; + }; + + typedef std::deque<ErrorInfo> Errors; + + bool expectToken( TokenType type, Token &token, const char *message ); + bool readToken( Token &token ); + void skipSpaces(); + bool match( Location pattern, + int patternLength ); + bool readComment(); + bool readCStyleComment(); + bool readCppStyleComment(); + bool readString(); + void readNumber(); + bool readValue(); + bool readObject( Token &token ); + bool readArray( Token &token ); + bool decodeNumber( Token &token ); + bool decodeString( Token &token ); + bool decodeString( Token &token, std::string &decoded ); + bool decodeDouble( Token &token ); + bool decodeUnicodeCodePoint( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ); + bool decodeUnicodeEscapeSequence( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ); + bool addError( const std::string &message, + Token &token, + Location extra = 0 ); + bool recoverFromError( TokenType skipUntilToken ); + bool addErrorAndRecover( const std::string &message, + Token &token, + TokenType skipUntilToken ); + void skipUntilSpace(); + Value ¤tValue(); + Char getNextChar(); + void getLocationLineAndColumn( Location location, + int &line, + int &column ) const; + std::string getLocationLineAndColumn( Location location ) const; + void addComment( Location begin, + Location end, + CommentPlacement placement ); + void skipCommentTokens( Token &token ); + + typedef std::stack<Value *> Nodes; + Nodes nodes_; + Errors errors_; + std::string document_; + Location begin_; + Location end_; + Location current_; + Location lastValueEnd_; + Value *lastValue_; + std::string commentsBefore_; + Features features_; + bool collectComments_; + }; + + /** \brief Read from 'sin' into 'root'. + + Always keep comments from the input JSON. + + This can be used to read a file into a particular sub-object. + For example: + \code + Json::Value root; + cin >> root["dir"]["file"]; + cout << root; + \endcode + Result: + \verbatim + { + "dir": { + "file": { + // The input stream JSON would be nested here. + } + } + } + \endverbatim + \throw std::exception on parse error. + \see Json::operator<<() + */ + std::istream& operator>>( std::istream&, Value& ); + +} // namespace Json + +#endif // CPPTL_JSON_READER_H_INCLUDED diff --git a/jsoncpp-src-0.5.0/include/json/value.h b/jsoncpp-src-0.5.0/include/json/value.h new file mode 100644 index 000000000..58bfd88e7 --- /dev/null +++ b/jsoncpp-src-0.5.0/include/json/value.h @@ -0,0 +1,1069 @@ +#ifndef CPPTL_JSON_H_INCLUDED +# define CPPTL_JSON_H_INCLUDED + +# include "forwards.h" +# include <string> +# include <vector> + +# ifndef JSON_USE_CPPTL_SMALLMAP +# include <map> +# else +# include <cpptl/smallmap.h> +# endif +# ifdef JSON_USE_CPPTL +# include <cpptl/forwards.h> +# endif + +/** \brief JSON (JavaScript Object Notation). + */ +namespace Json { + + /** \brief Type of the value held by a Value object. + */ + enum ValueType + { + nullValue = 0, ///< 'null' value + intValue, ///< signed integer value + uintValue, ///< unsigned integer value + realValue, ///< double value + stringValue, ///< UTF-8 string value + booleanValue, ///< bool value + arrayValue, ///< array value (ordered list) + objectValue ///< object value (collection of name/value pairs). + }; + + enum CommentPlacement + { + commentBefore = 0, ///< a comment placed on the line before a value + commentAfterOnSameLine, ///< a comment just after a value on the same line + commentAfter, ///< a comment on the line after a value (only make sense for root value) + numberOfCommentPlacement + }; + +//# ifdef JSON_USE_CPPTL +// typedef CppTL::AnyEnumerator<const char *> EnumMemberNames; +// typedef CppTL::AnyEnumerator<const Value &> EnumValues; +//# endif + + /** \brief Lightweight wrapper to tag static string. + * + * Value constructor and objectValue member assignement takes advantage of the + * StaticString and avoid the cost of string duplication when storing the + * string or the member name. + * + * Example of usage: + * \code + * Json::Value aValue( StaticString("some text") ); + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ + class JSON_API StaticString + { + public: + explicit StaticString( const char *czstring ) + : str_( czstring ) + { + } + + operator const char *() const + { + return str_; + } + + const char *c_str() const + { + return str_; + } + + private: + const char *str_; + }; + + /** \brief Represents a <a HREF="http://www.json.org">JSON</a> value. + * + * This class is a discriminated union wrapper that can represents a: + * - signed integer [range: Value::minInt - Value::maxInt] + * - unsigned integer (range: 0 - Value::maxUInt) + * - double + * - UTF-8 string + * - boolean + * - 'null' + * - an ordered list of Value + * - collection of name/value pairs (javascript object) + * + * The type of the held value is represented by a #ValueType and + * can be obtained using type(). + * + * values of an #objectValue or #arrayValue can be accessed using operator[]() methods. + * Non const methods will automatically create the a #nullValue element + * if it does not exist. + * The sequence of an #arrayValue will be automatically resize and initialized + * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. + * + * The get() methods can be used to obtanis default value in the case the required element + * does not exist. + * + * It is possible to iterate over the list of a #objectValue values using + * the getMemberNames() method. + */ + class JSON_API Value + { + friend class ValueIteratorBase; +# ifdef JSON_VALUE_USE_INTERNAL_MAP + friend class ValueInternalLink; + friend class ValueInternalMap; +# endif + public: + typedef std::vector<std::string> Members; + typedef ValueIterator iterator; + typedef ValueConstIterator const_iterator; + typedef Json::UInt UInt; + typedef Json::Int Int; + typedef UInt ArrayIndex; + + static const Value null; + static const Int minInt; + static const Int maxInt; + static const UInt maxUInt; + + private: +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION +# ifndef JSON_VALUE_USE_INTERNAL_MAP + class CZString + { + public: + enum DuplicationPolicy + { + noDuplication = 0, + duplicate, + duplicateOnCopy + }; + CZString( int index ); + CZString( const char *cstr, DuplicationPolicy allocate ); + CZString( const CZString &other ); + ~CZString(); + CZString &operator =( const CZString &other ); + bool operator<( const CZString &other ) const; + bool operator==( const CZString &other ) const; + int index() const; + const char *c_str() const; + bool isStaticString() const; + private: + void swap( CZString &other ); + const char *cstr_; + int index_; + }; + + public: +# ifndef JSON_USE_CPPTL_SMALLMAP + typedef std::map<CZString, Value> ObjectValues; +# else + typedef CppTL::SmallMap<CZString, Value> ObjectValues; +# endif // ifndef JSON_USE_CPPTL_SMALLMAP +# endif // ifndef JSON_VALUE_USE_INTERNAL_MAP +#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + + public: + /** \brief Create a default Value of the given type. + + This is a very useful constructor. + To create an empty array, pass arrayValue. + To create an empty object, pass objectValue. + Another Value can then be set to this one by assignment. + This is useful since clear() and resize() will not alter types. + + Examples: + \code + Json::Value null_value; // null + Json::Value arr_value(Json::arrayValue); // [] + Json::Value obj_value(Json::objectValue); // {} + \endcode + */ + Value( ValueType type = nullValue ); + Value( Int value ); + Value( UInt value ); + Value( double value ); + Value( const char *value ); + Value( const char *beginValue, const char *endValue ); + /** \brief Constructs a value from a static string. + + * Like other value string constructor but do not duplicate the string for + * internal storage. The given string must remain alive after the call to this + * constructor. + * Example of usage: + * \code + * Json::Value aValue( StaticString("some text") ); + * \endcode + */ + Value( const StaticString &value ); + Value( const std::string &value ); +# ifdef JSON_USE_CPPTL + Value( const CppTL::ConstString &value ); +# endif + Value( bool value ); + Value( const Value &other ); + ~Value(); + + Value &operator=( const Value &other ); + /// Swap values. + /// \note Currently, comments are intentionally not swapped, for + /// both logic and efficiency. + void swap( Value &other ); + + ValueType type() const; + + bool operator <( const Value &other ) const; + bool operator <=( const Value &other ) const; + bool operator >=( const Value &other ) const; + bool operator >( const Value &other ) const; + + bool operator ==( const Value &other ) const; + bool operator !=( const Value &other ) const; + + int compare( const Value &other ); + + const char *asCString() const; + std::string asString() const; +# ifdef JSON_USE_CPPTL + CppTL::ConstString asConstString() const; +# endif + Int asInt() const; + UInt asUInt() const; + double asDouble() const; + bool asBool() const; + + bool isNull() const; + bool isBool() const; + bool isInt() const; + bool isUInt() const; + bool isIntegral() const; + bool isDouble() const; + bool isNumeric() const; + bool isString() const; + bool isArray() const; + bool isObject() const; + + bool isConvertibleTo( ValueType other ) const; + + /// Number of values in array or object + UInt size() const; + + /// \brief Return true if empty array, empty object, or null; + /// otherwise, false. + bool empty() const; + + /// Return isNull() + bool operator!() const; + + /// Remove all object members and array elements. + /// \pre type() is arrayValue, objectValue, or nullValue + /// \post type() is unchanged + void clear(); + + /// Resize the array to size elements. + /// New elements are initialized to null. + /// May only be called on nullValue or arrayValue. + /// \pre type() is arrayValue or nullValue + /// \post type() is arrayValue + void resize( UInt size ); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value &operator[]( UInt index ); + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value &operator[]( UInt index ) const; + /// If the array contains at least index+1 elements, returns the element value, + /// otherwise returns defaultValue. + Value get( UInt index, + const Value &defaultValue ) const; + /// Return true if index < size(). + bool isValidIndex( UInt index ) const; + /// \brief Append value to array at the end. + /// + /// Equivalent to jsonvalue[jsonvalue.size()] = value; + Value &append( const Value &value ); + + /// Access an object value by name, create a null member if it does not exist. + Value &operator[]( const char *key ); + /// Access an object value by name, returns null if there is no member with that name. + const Value &operator[]( const char *key ) const; + /// Access an object value by name, create a null member if it does not exist. + Value &operator[]( const std::string &key ); + /// Access an object value by name, returns null if there is no member with that name. + const Value &operator[]( const std::string &key ) const; + /** \brief Access an object value by name, create a null member if it does not exist. + + * If the object as no entry for that name, then the member name used to store + * the new entry is not duplicated. + * Example of use: + * \code + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ + Value &operator[]( const StaticString &key ); +# ifdef JSON_USE_CPPTL + /// Access an object value by name, create a null member if it does not exist. + Value &operator[]( const CppTL::ConstString &key ); + /// Access an object value by name, returns null if there is no member with that name. + const Value &operator[]( const CppTL::ConstString &key ) const; +# endif + /// Return the member named key if it exist, defaultValue otherwise. + Value get( const char *key, + const Value &defaultValue ) const; + /// Return the member named key if it exist, defaultValue otherwise. + Value get( const std::string &key, + const Value &defaultValue ) const; +# ifdef JSON_USE_CPPTL + /// Return the member named key if it exist, defaultValue otherwise. + Value get( const CppTL::ConstString &key, + const Value &defaultValue ) const; +# endif + /// \brief Remove and return the named member. + /// + /// Do nothing if it did not exist. + /// \return the removed Value, or null. + /// \pre type() is objectValue or nullValue + /// \post type() is unchanged + Value removeMember( const char* key ); + /// Same as removeMember(const char*) + Value removeMember( const std::string &key ); + + /// Return true if the object has a member named key. + bool isMember( const char *key ) const; + /// Return true if the object has a member named key. + bool isMember( const std::string &key ) const; +# ifdef JSON_USE_CPPTL + /// Return true if the object has a member named key. + bool isMember( const CppTL::ConstString &key ) const; +# endif + + /// \brief Return a list of the member names. + /// + /// If null, return an empty list. + /// \pre type() is objectValue or nullValue + /// \post if type() was nullValue, it remains nullValue + Members getMemberNames() const; + +//# ifdef JSON_USE_CPPTL +// EnumMemberNames enumMemberNames() const; +// EnumValues enumValues() const; +//# endif + + /// Comments must be //... or /* ... */ + void setComment( const char *comment, + CommentPlacement placement ); + /// Comments must be //... or /* ... */ + void setComment( const std::string &comment, + CommentPlacement placement ); + bool hasComment( CommentPlacement placement ) const; + /// Include delimiters and embedded newlines. + std::string getComment( CommentPlacement placement ) const; + + std::string toStyledString() const; + + const_iterator begin() const; + const_iterator end() const; + + iterator begin(); + iterator end(); + + private: + Value &resolveReference( const char *key, + bool isStatic ); + +# ifdef JSON_VALUE_USE_INTERNAL_MAP + inline bool isItemAvailable() const + { + return itemIsUsed_ == 0; + } + + inline void setItemUsed( bool isUsed = true ) + { + itemIsUsed_ = isUsed ? 1 : 0; + } + + inline bool isMemberNameStatic() const + { + return memberNameIsStatic_ == 0; + } + + inline void setMemberNameIsStatic( bool isStatic ) + { + memberNameIsStatic_ = isStatic ? 1 : 0; + } +# endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP + + private: + struct CommentInfo + { + CommentInfo(); + ~CommentInfo(); + + void setComment( const char *text ); + + char *comment_; + }; + + //struct MemberNamesTransform + //{ + // typedef const char *result_type; + // const char *operator()( const CZString &name ) const + // { + // return name.c_str(); + // } + //}; + + union ValueHolder + { + Int int_; + UInt uint_; + double real_; + bool bool_; + char *string_; +# ifdef JSON_VALUE_USE_INTERNAL_MAP + ValueInternalArray *array_; + ValueInternalMap *map_; +#else + ObjectValues *map_; +# endif + } value_; + ValueType type_ : 8; + int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. +# ifdef JSON_VALUE_USE_INTERNAL_MAP + unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container. + int memberNameIsStatic_ : 1; // used by the ValueInternalMap container. +# endif + CommentInfo *comments_; + }; + + + /** \brief Experimental and untested: represents an element of the "path" to access a node. + */ + class PathArgument + { + public: + friend class Path; + + PathArgument(); + PathArgument( UInt index ); + PathArgument( const char *key ); + PathArgument( const std::string &key ); + + private: + enum Kind + { + kindNone = 0, + kindIndex, + kindKey + }; + std::string key_; + UInt index_; + Kind kind_; + }; + + /** \brief Experimental and untested: represents a "path" to access a node. + * + * Syntax: + * - "." => root node + * - ".[n]" => elements at index 'n' of root node (an array value) + * - ".name" => member named 'name' of root node (an object value) + * - ".name1.name2.name3" + * - ".[0][1][2].name1[3]" + * - ".%" => member name is provided as parameter + * - ".[%]" => index is provied as parameter + */ + class Path + { + public: + Path( const std::string &path, + const PathArgument &a1 = PathArgument(), + const PathArgument &a2 = PathArgument(), + const PathArgument &a3 = PathArgument(), + const PathArgument &a4 = PathArgument(), + const PathArgument &a5 = PathArgument() ); + + const Value &resolve( const Value &root ) const; + Value resolve( const Value &root, + const Value &defaultValue ) const; + /// Creates the "path" to access the specified node and returns a reference on the node. + Value &make( Value &root ) const; + + private: + typedef std::vector<const PathArgument *> InArgs; + typedef std::vector<PathArgument> Args; + + void makePath( const std::string &path, + const InArgs &in ); + void addPathInArg( const std::string &path, + const InArgs &in, + InArgs::const_iterator &itInArg, + PathArgument::Kind kind ); + void invalidPath( const std::string &path, + int location ); + + Args args_; + }; + + /** \brief Experimental do not use: Allocator to customize member name and string value memory management done by Value. + * + * - makeMemberName() and releaseMemberName() are called to respectively duplicate and + * free an Json::objectValue member name. + * - duplicateStringValue() and releaseStringValue() are called similarly to + * duplicate and free a Json::stringValue value. + */ + class ValueAllocator + { + public: + enum { unknown = (unsigned)-1 }; + + virtual ~ValueAllocator(); + + virtual char *makeMemberName( const char *memberName ) = 0; + virtual void releaseMemberName( char *memberName ) = 0; + virtual char *duplicateStringValue( const char *value, + unsigned int length = unknown ) = 0; + virtual void releaseStringValue( char *value ) = 0; + }; + +#ifdef JSON_VALUE_USE_INTERNAL_MAP + /** \brief Allocator to customize Value internal map. + * Below is an example of a simple implementation (default implementation actually + * use memory pool for speed). + * \code + class DefaultValueMapAllocator : public ValueMapAllocator + { + public: // overridden from ValueMapAllocator + virtual ValueInternalMap *newMap() + { + return new ValueInternalMap(); + } + + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) + { + return new ValueInternalMap( other ); + } + + virtual void destructMap( ValueInternalMap *map ) + { + delete map; + } + + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) + { + return new ValueInternalLink[size]; + } + + virtual void releaseMapBuckets( ValueInternalLink *links ) + { + delete [] links; + } + + virtual ValueInternalLink *allocateMapLink() + { + return new ValueInternalLink(); + } + + virtual void releaseMapLink( ValueInternalLink *link ) + { + delete link; + } + }; + * \endcode + */ + class JSON_API ValueMapAllocator + { + public: + virtual ~ValueMapAllocator(); + virtual ValueInternalMap *newMap() = 0; + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0; + virtual void destructMap( ValueInternalMap *map ) = 0; + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0; + virtual void releaseMapBuckets( ValueInternalLink *links ) = 0; + virtual ValueInternalLink *allocateMapLink() = 0; + virtual void releaseMapLink( ValueInternalLink *link ) = 0; + }; + + /** \brief ValueInternalMap hash-map bucket chain link (for internal use only). + * \internal previous_ & next_ allows for bidirectional traversal. + */ + class JSON_API ValueInternalLink + { + public: + enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture. + enum InternalFlags { + flagAvailable = 0, + flagUsed = 1 + }; + + ValueInternalLink(); + + ~ValueInternalLink(); + + Value items_[itemPerLink]; + char *keys_[itemPerLink]; + ValueInternalLink *previous_; + ValueInternalLink *next_; + }; + + + /** \brief A linked page based hash-table implementation used internally by Value. + * \internal ValueInternalMap is a tradional bucket based hash-table, with a linked + * list in each bucket to handle collision. There is an addional twist in that + * each node of the collision linked list is a page containing a fixed amount of + * value. This provides a better compromise between memory usage and speed. + * + * Each bucket is made up of a chained list of ValueInternalLink. The last + * link of a given bucket can be found in the 'previous_' field of the following bucket. + * The last link of the last bucket is stored in tailLink_ as it has no following bucket. + * Only the last link of a bucket may contains 'available' item. The last link always + * contains at least one element unless is it the bucket one very first link. + */ + class JSON_API ValueInternalMap + { + friend class ValueIteratorBase; + friend class Value; + public: + typedef unsigned int HashKey; + typedef unsigned int BucketIndex; + +# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + struct IteratorState + { + IteratorState() + : map_(0) + , link_(0) + , itemIndex_(0) + , bucketIndex_(0) + { + } + ValueInternalMap *map_; + ValueInternalLink *link_; + BucketIndex itemIndex_; + BucketIndex bucketIndex_; + }; +# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + + ValueInternalMap(); + ValueInternalMap( const ValueInternalMap &other ); + ValueInternalMap &operator =( const ValueInternalMap &other ); + ~ValueInternalMap(); + + void swap( ValueInternalMap &other ); + + BucketIndex size() const; + + void clear(); + + bool reserveDelta( BucketIndex growth ); + + bool reserve( BucketIndex newItemCount ); + + const Value *find( const char *key ) const; + + Value *find( const char *key ); + + Value &resolveReference( const char *key, + bool isStatic ); + + void remove( const char *key ); + + void doActualRemove( ValueInternalLink *link, + BucketIndex index, + BucketIndex bucketIndex ); + + ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex ); + + Value &setNewItem( const char *key, + bool isStatic, + ValueInternalLink *link, + BucketIndex index ); + + Value &unsafeAdd( const char *key, + bool isStatic, + HashKey hashedKey ); + + HashKey hash( const char *key ) const; + + int compare( const ValueInternalMap &other ) const; + + private: + void makeBeginIterator( IteratorState &it ) const; + void makeEndIterator( IteratorState &it ) const; + static bool equals( const IteratorState &x, const IteratorState &other ); + static void increment( IteratorState &iterator ); + static void incrementBucket( IteratorState &iterator ); + static void decrement( IteratorState &iterator ); + static const char *key( const IteratorState &iterator ); + static const char *key( const IteratorState &iterator, bool &isStatic ); + static Value &value( const IteratorState &iterator ); + static int distance( const IteratorState &x, const IteratorState &y ); + + private: + ValueInternalLink *buckets_; + ValueInternalLink *tailLink_; + BucketIndex bucketsSize_; + BucketIndex itemCount_; + }; + + /** \brief A simplified deque implementation used internally by Value. + * \internal + * It is based on a list of fixed "page", each page contains a fixed number of items. + * Instead of using a linked-list, a array of pointer is used for fast item look-up. + * Look-up for an element is as follow: + * - compute page index: pageIndex = itemIndex / itemsPerPage + * - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage] + * + * Insertion is amortized constant time (only the array containing the index of pointers + * need to be reallocated when items are appended). + */ + class JSON_API ValueInternalArray + { + friend class Value; + friend class ValueIteratorBase; + public: + enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo. + typedef Value::ArrayIndex ArrayIndex; + typedef unsigned int PageIndex; + +# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + struct IteratorState // Must be a POD + { + IteratorState() + : array_(0) + , currentPageIndex_(0) + , currentItemIndex_(0) + { + } + ValueInternalArray *array_; + Value **currentPageIndex_; + unsigned int currentItemIndex_; + }; +# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + + ValueInternalArray(); + ValueInternalArray( const ValueInternalArray &other ); + ValueInternalArray &operator =( const ValueInternalArray &other ); + ~ValueInternalArray(); + void swap( ValueInternalArray &other ); + + void clear(); + void resize( ArrayIndex newSize ); + + Value &resolveReference( ArrayIndex index ); + + Value *find( ArrayIndex index ) const; + + ArrayIndex size() const; + + int compare( const ValueInternalArray &other ) const; + + private: + static bool equals( const IteratorState &x, const IteratorState &other ); + static void increment( IteratorState &iterator ); + static void decrement( IteratorState &iterator ); + static Value &dereference( const IteratorState &iterator ); + static Value &unsafeDereference( const IteratorState &iterator ); + static int distance( const IteratorState &x, const IteratorState &y ); + static ArrayIndex indexOf( const IteratorState &iterator ); + void makeBeginIterator( IteratorState &it ) const; + void makeEndIterator( IteratorState &it ) const; + void makeIterator( IteratorState &it, ArrayIndex index ) const; + + void makeIndexValid( ArrayIndex index ); + + Value **pages_; + ArrayIndex size_; + PageIndex pageCount_; + }; + + /** \brief Experimental: do not use. Allocator to customize Value internal array. + * Below is an example of a simple implementation (actual implementation use + * memory pool). + \code +class DefaultValueArrayAllocator : public ValueArrayAllocator +{ +public: // overridden from ValueArrayAllocator + virtual ~DefaultValueArrayAllocator() + { + } + + virtual ValueInternalArray *newArray() + { + return new ValueInternalArray(); + } + + virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) + { + return new ValueInternalArray( other ); + } + + virtual void destruct( ValueInternalArray *array ) + { + delete array; + } + + virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount ) + { + ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; + if ( minNewIndexCount > newIndexCount ) + newIndexCount = minNewIndexCount; + void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); + if ( !newIndexes ) + throw std::bad_alloc(); + indexCount = newIndexCount; + indexes = static_cast<Value **>( newIndexes ); + } + virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) + { + if ( indexes ) + free( indexes ); + } + + virtual Value *allocateArrayPage() + { + return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) ); + } + + virtual void releaseArrayPage( Value *value ) + { + if ( value ) + free( value ); + } +}; + \endcode + */ + class JSON_API ValueArrayAllocator + { + public: + virtual ~ValueArrayAllocator(); + virtual ValueInternalArray *newArray() = 0; + virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0; + virtual void destructArray( ValueInternalArray *array ) = 0; + /** \brief Reallocate array page index. + * Reallocates an array of pointer on each page. + * \param indexes [input] pointer on the current index. May be \c NULL. + * [output] pointer on the new index of at least + * \a minNewIndexCount pages. + * \param indexCount [input] current number of pages in the index. + * [output] number of page the reallocated index can handle. + * \b MUST be >= \a minNewIndexCount. + * \param minNewIndexCount Minimum number of page the new index must be able to + * handle. + */ + virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount ) = 0; + virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) = 0; + virtual Value *allocateArrayPage() = 0; + virtual void releaseArrayPage( Value *value ) = 0; + }; +#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP + + + /** \brief base class for Value iterators. + * + */ + class ValueIteratorBase + { + public: + typedef unsigned int size_t; + typedef int difference_type; + typedef ValueIteratorBase SelfType; + + ValueIteratorBase(); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueIteratorBase( const Value::ObjectValues::iterator ¤t ); +#else + ValueIteratorBase( const ValueInternalArray::IteratorState &state ); + ValueIteratorBase( const ValueInternalMap::IteratorState &state ); +#endif + + bool operator ==( const SelfType &other ) const + { + return isEqual( other ); + } + + bool operator !=( const SelfType &other ) const + { + return !isEqual( other ); + } + + difference_type operator -( const SelfType &other ) const + { + return computeDistance( other ); + } + + /// Return either the index or the member name of the referenced value as a Value. + Value key() const; + + /// Return the index of the referenced Value. -1 if it is not an arrayValue. + UInt index() const; + + /// Return the member name of the referenced Value. "" if it is not an objectValue. + const char *memberName() const; + + protected: + Value &deref() const; + + void increment(); + + void decrement(); + + difference_type computeDistance( const SelfType &other ) const; + + bool isEqual( const SelfType &other ) const; + + void copy( const SelfType &other ); + + private: +#ifndef JSON_VALUE_USE_INTERNAL_MAP + Value::ObjectValues::iterator current_; + // Indicates that iterator is for a null value. + bool isNull_; +#else + union + { + ValueInternalArray::IteratorState array_; + ValueInternalMap::IteratorState map_; + } iterator_; + bool isArray_; +#endif + }; + + /** \brief const iterator for object and array value. + * + */ + class ValueConstIterator : public ValueIteratorBase + { + friend class Value; + public: + typedef unsigned int size_t; + typedef int difference_type; + typedef const Value &reference; + typedef const Value *pointer; + typedef ValueConstIterator SelfType; + + ValueConstIterator(); + private: + /*! \internal Use by Value to create an iterator. + */ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueConstIterator( const Value::ObjectValues::iterator ¤t ); +#else + ValueConstIterator( const ValueInternalArray::IteratorState &state ); + ValueConstIterator( const ValueInternalMap::IteratorState &state ); +#endif + public: + SelfType &operator =( const ValueIteratorBase &other ); + + SelfType operator++( int ) + { + SelfType temp( *this ); + ++*this; + return temp; + } + + SelfType operator--( int ) + { + SelfType temp( *this ); + --*this; + return temp; + } + + SelfType &operator--() + { + decrement(); + return *this; + } + + SelfType &operator++() + { + increment(); + return *this; + } + + reference operator *() const + { + return deref(); + } + }; + + + /** \brief Iterator for object and array value. + */ + class ValueIterator : public ValueIteratorBase + { + friend class Value; + public: + typedef unsigned int size_t; + typedef int difference_type; + typedef Value &reference; + typedef Value *pointer; + typedef ValueIterator SelfType; + + ValueIterator(); + ValueIterator( const ValueConstIterator &other ); + ValueIterator( const ValueIterator &other ); + private: + /*! \internal Use by Value to create an iterator. + */ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueIterator( const Value::ObjectValues::iterator ¤t ); +#else + ValueIterator( const ValueInternalArray::IteratorState &state ); + ValueIterator( const ValueInternalMap::IteratorState &state ); +#endif + public: + + SelfType &operator =( const SelfType &other ); + + SelfType operator++( int ) + { + SelfType temp( *this ); + ++*this; + return temp; + } + + SelfType operator--( int ) + { + SelfType temp( *this ); + --*this; + return temp; + } + + SelfType &operator--() + { + decrement(); + return *this; + } + + SelfType &operator++() + { + increment(); + return *this; + } + + reference operator *() const + { + return deref(); + } + }; + + +} // namespace Json + + +#endif // CPPTL_JSON_H_INCLUDED diff --git a/jsoncpp-src-0.5.0/include/json/writer.h b/jsoncpp-src-0.5.0/include/json/writer.h new file mode 100644 index 000000000..5f4b83be4 --- /dev/null +++ b/jsoncpp-src-0.5.0/include/json/writer.h @@ -0,0 +1,174 @@ +#ifndef JSON_WRITER_H_INCLUDED +# define JSON_WRITER_H_INCLUDED + +# include "value.h" +# include <vector> +# include <string> +# include <iostream> + +namespace Json { + + class Value; + + /** \brief Abstract class for writers. + */ + class JSON_API Writer + { + public: + virtual ~Writer(); + + virtual std::string write( const Value &root ) = 0; + }; + + /** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format without formatting (not human friendly). + * + * The JSON document is written in a single line. It is not intended for 'human' consumption, + * but may be usefull to support feature such as RPC where bandwith is limited. + * \sa Reader, Value + */ + class JSON_API FastWriter : public Writer + { + public: + FastWriter(); + virtual ~FastWriter(){} + + void enableYAMLCompatibility(); + + public: // overridden from Writer + virtual std::string write( const Value &root ); + + private: + void writeValue( const Value &value ); + + std::string document_; + bool yamlCompatiblityEnabled_; + }; + + /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value types, + * and all the values fit on one lines, then print the array on a single line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their #CommentPlacement. + * + * \sa Reader, Value, Value::setComment() + */ + class JSON_API StyledWriter: public Writer + { + public: + StyledWriter(); + virtual ~StyledWriter(){} + + public: // overridden from Writer + /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format. + * \param root Value to serialize. + * \return String containing the JSON document that represents the root value. + */ + virtual std::string write( const Value &root ); + + private: + void writeValue( const Value &value ); + void writeArrayValue( const Value &value ); + bool isMultineArray( const Value &value ); + void pushValue( const std::string &value ); + void writeIndent(); + void writeWithIndent( const std::string &value ); + void indent(); + void unindent(); + void writeCommentBeforeValue( const Value &root ); + void writeCommentAfterValueOnSameLine( const Value &root ); + bool hasCommentForValue( const Value &value ); + static std::string normalizeEOL( const std::string &text ); + + typedef std::vector<std::string> ChildValues; + + ChildValues childValues_; + std::string document_; + std::string indentString_; + int rightMargin_; + int indentSize_; + bool addChildValues_; + }; + + /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way, + to a stream rather than to a string. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value types, + * and all the values fit on one lines, then print the array on a single line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their #CommentPlacement. + * + * \param indentation Each level will be indented by this amount extra. + * \sa Reader, Value, Value::setComment() + */ + class JSON_API StyledStreamWriter + { + public: + StyledStreamWriter( std::string indentation="\t" ); + ~StyledStreamWriter(){} + + public: + /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format. + * \param out Stream to write to. (Can be ostringstream, e.g.) + * \param root Value to serialize. + * \note There is no point in deriving from Writer, since write() should not return a value. + */ + void write( std::ostream &out, const Value &root ); + + private: + void writeValue( const Value &value ); + void writeArrayValue( const Value &value ); + bool isMultineArray( const Value &value ); + void pushValue( const std::string &value ); + void writeIndent(); + void writeWithIndent( const std::string &value ); + void indent(); + void unindent(); + void writeCommentBeforeValue( const Value &root ); + void writeCommentAfterValueOnSameLine( const Value &root ); + bool hasCommentForValue( const Value &value ); + static std::string normalizeEOL( const std::string &text ); + + typedef std::vector<std::string> ChildValues; + + ChildValues childValues_; + std::ostream* document_; + std::string indentString_; + int rightMargin_; + std::string indentation_; + bool addChildValues_; + }; + + std::string JSON_API valueToString( Int value ); + std::string JSON_API valueToString( UInt value ); + std::string JSON_API valueToString( double value ); + std::string JSON_API valueToString( bool value ); + std::string JSON_API valueToQuotedString( const char *value ); + + /// \brief Output using the StyledStreamWriter. + /// \see Json::operator>>() + std::ostream& operator<<( std::ostream&, const Value &root ); + +} // namespace Json + + + +#endif // JSON_WRITER_H_INCLUDED diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_batchallocator.h b/jsoncpp-src-0.5.0/src/lib_json/json_batchallocator.h new file mode 100644 index 000000000..87ea5ed80 --- /dev/null +++ b/jsoncpp-src-0.5.0/src/lib_json/json_batchallocator.h @@ -0,0 +1,125 @@ +#ifndef JSONCPP_BATCHALLOCATOR_H_INCLUDED +# define JSONCPP_BATCHALLOCATOR_H_INCLUDED + +# include <stdlib.h> +# include <assert.h> + +# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + +namespace Json { + +/* Fast memory allocator. + * + * This memory allocator allocates memory for a batch of object (specified by + * the page size, the number of object in each page). + * + * It does not allow the destruction of a single object. All the allocated objects + * can be destroyed at once. The memory can be either released or reused for future + * allocation. + * + * The in-place new operator must be used to construct the object using the pointer + * returned by allocate. + */ +template<typename AllocatedType + ,const unsigned int objectPerAllocation> +class BatchAllocator +{ +public: + typedef AllocatedType Type; + + BatchAllocator( unsigned int objectsPerPage = 255 ) + : freeHead_( 0 ) + , objectsPerPage_( objectsPerPage ) + { +// printf( "Size: %d => %s\n", sizeof(AllocatedType), typeid(AllocatedType).name() ); + assert( sizeof(AllocatedType) * objectPerAllocation >= sizeof(AllocatedType *) ); // We must be able to store a slist in the object free space. + assert( objectsPerPage >= 16 ); + batches_ = allocateBatch( 0 ); // allocated a dummy page + currentBatch_ = batches_; + } + + ~BatchAllocator() + { + for ( BatchInfo *batch = batches_; batch; ) + { + BatchInfo *nextBatch = batch->next_; + free( batch ); + batch = nextBatch; + } + } + + /// allocate space for an array of objectPerAllocation object. + /// @warning it is the responsability of the caller to call objects constructors. + AllocatedType *allocate() + { + if ( freeHead_ ) // returns node from free list. + { + AllocatedType *object = freeHead_; + freeHead_ = *(AllocatedType **)object; + return object; + } + if ( currentBatch_->used_ == currentBatch_->end_ ) + { + currentBatch_ = currentBatch_->next_; + while ( currentBatch_ && currentBatch_->used_ == currentBatch_->end_ ) + currentBatch_ = currentBatch_->next_; + + if ( !currentBatch_ ) // no free batch found, allocate a new one + { + currentBatch_ = allocateBatch( objectsPerPage_ ); + currentBatch_->next_ = batches_; // insert at the head of the list + batches_ = currentBatch_; + } + } + AllocatedType *allocated = currentBatch_->used_; + currentBatch_->used_ += objectPerAllocation; + return allocated; + } + + /// Release the object. + /// @warning it is the responsability of the caller to actually destruct the object. + void release( AllocatedType *object ) + { + assert( object != 0 ); + *(AllocatedType **)object = freeHead_; + freeHead_ = object; + } + +private: + struct BatchInfo + { + BatchInfo *next_; + AllocatedType *used_; + AllocatedType *end_; + AllocatedType buffer_[objectPerAllocation]; + }; + + // disabled copy constructor and assignement operator. + BatchAllocator( const BatchAllocator & ); + void operator =( const BatchAllocator &); + + static BatchInfo *allocateBatch( unsigned int objectsPerPage ) + { + const unsigned int mallocSize = sizeof(BatchInfo) - sizeof(AllocatedType)* objectPerAllocation + + sizeof(AllocatedType) * objectPerAllocation * objectsPerPage; + BatchInfo *batch = static_cast<BatchInfo*>( malloc( mallocSize ) ); + batch->next_ = 0; + batch->used_ = batch->buffer_; + batch->end_ = batch->buffer_ + objectsPerPage; + return batch; + } + + BatchInfo *batches_; + BatchInfo *currentBatch_; + /// Head of a single linked list within the allocated space of freeed object + AllocatedType *freeHead_; + unsigned int objectsPerPage_; +}; + + +} // namespace Json + +# endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION + +#endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED + diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_internalarray.inl b/jsoncpp-src-0.5.0/src/lib_json/json_internalarray.inl new file mode 100644 index 000000000..9b985d258 --- /dev/null +++ b/jsoncpp-src-0.5.0/src/lib_json/json_internalarray.inl @@ -0,0 +1,448 @@ +// included by json_value.cpp +// everything is within Json namespace + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueInternalArray +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueArrayAllocator::~ValueArrayAllocator() +{ +} + +// ////////////////////////////////////////////////////////////////// +// class DefaultValueArrayAllocator +// ////////////////////////////////////////////////////////////////// +#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +class DefaultValueArrayAllocator : public ValueArrayAllocator +{ +public: // overridden from ValueArrayAllocator + virtual ~DefaultValueArrayAllocator() + { + } + + virtual ValueInternalArray *newArray() + { + return new ValueInternalArray(); + } + + virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) + { + return new ValueInternalArray( other ); + } + + virtual void destructArray( ValueInternalArray *array ) + { + delete array; + } + + virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount ) + { + ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; + if ( minNewIndexCount > newIndexCount ) + newIndexCount = minNewIndexCount; + void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); + if ( !newIndexes ) + throw std::bad_alloc(); + indexCount = newIndexCount; + indexes = static_cast<Value **>( newIndexes ); + } + virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) + { + if ( indexes ) + free( indexes ); + } + + virtual Value *allocateArrayPage() + { + return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) ); + } + + virtual void releaseArrayPage( Value *value ) + { + if ( value ) + free( value ); + } +}; + +#else // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +/// @todo make this thread-safe (lock when accessign batch allocator) +class DefaultValueArrayAllocator : public ValueArrayAllocator +{ +public: // overridden from ValueArrayAllocator + virtual ~DefaultValueArrayAllocator() + { + } + + virtual ValueInternalArray *newArray() + { + ValueInternalArray *array = arraysAllocator_.allocate(); + new (array) ValueInternalArray(); // placement new + return array; + } + + virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) + { + ValueInternalArray *array = arraysAllocator_.allocate(); + new (array) ValueInternalArray( other ); // placement new + return array; + } + + virtual void destructArray( ValueInternalArray *array ) + { + if ( array ) + { + array->~ValueInternalArray(); + arraysAllocator_.release( array ); + } + } + + virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount ) + { + ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; + if ( minNewIndexCount > newIndexCount ) + newIndexCount = minNewIndexCount; + void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); + if ( !newIndexes ) + throw std::bad_alloc(); + indexCount = newIndexCount; + indexes = static_cast<Value **>( newIndexes ); + } + virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) + { + if ( indexes ) + free( indexes ); + } + + virtual Value *allocateArrayPage() + { + return static_cast<Value *>( pagesAllocator_.allocate() ); + } + + virtual void releaseArrayPage( Value *value ) + { + if ( value ) + pagesAllocator_.release( value ); + } +private: + BatchAllocator<ValueInternalArray,1> arraysAllocator_; + BatchAllocator<Value,ValueInternalArray::itemsPerPage> pagesAllocator_; +}; +#endif // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR + +static ValueArrayAllocator *&arrayAllocator() +{ + static DefaultValueArrayAllocator defaultAllocator; + static ValueArrayAllocator *arrayAllocator = &defaultAllocator; + return arrayAllocator; +} + +static struct DummyArrayAllocatorInitializer { + DummyArrayAllocatorInitializer() + { + arrayAllocator(); // ensure arrayAllocator() statics are initialized before main(). + } +} dummyArrayAllocatorInitializer; + +// ////////////////////////////////////////////////////////////////// +// class ValueInternalArray +// ////////////////////////////////////////////////////////////////// +bool +ValueInternalArray::equals( const IteratorState &x, + const IteratorState &other ) +{ + return x.array_ == other.array_ + && x.currentItemIndex_ == other.currentItemIndex_ + && x.currentPageIndex_ == other.currentPageIndex_; +} + + +void +ValueInternalArray::increment( IteratorState &it ) +{ + JSON_ASSERT_MESSAGE( it.array_ && + (it.currentPageIndex_ - it.array_->pages_)*itemsPerPage + it.currentItemIndex_ + != it.array_->size_, + "ValueInternalArray::increment(): moving iterator beyond end" ); + ++(it.currentItemIndex_); + if ( it.currentItemIndex_ == itemsPerPage ) + { + it.currentItemIndex_ = 0; + ++(it.currentPageIndex_); + } +} + + +void +ValueInternalArray::decrement( IteratorState &it ) +{ + JSON_ASSERT_MESSAGE( it.array_ && it.currentPageIndex_ == it.array_->pages_ + && it.currentItemIndex_ == 0, + "ValueInternalArray::decrement(): moving iterator beyond end" ); + if ( it.currentItemIndex_ == 0 ) + { + it.currentItemIndex_ = itemsPerPage-1; + --(it.currentPageIndex_); + } + else + { + --(it.currentItemIndex_); + } +} + + +Value & +ValueInternalArray::unsafeDereference( const IteratorState &it ) +{ + return (*(it.currentPageIndex_))[it.currentItemIndex_]; +} + + +Value & +ValueInternalArray::dereference( const IteratorState &it ) +{ + JSON_ASSERT_MESSAGE( it.array_ && + (it.currentPageIndex_ - it.array_->pages_)*itemsPerPage + it.currentItemIndex_ + < it.array_->size_, + "ValueInternalArray::dereference(): dereferencing invalid iterator" ); + return unsafeDereference( it ); +} + +void +ValueInternalArray::makeBeginIterator( IteratorState &it ) const +{ + it.array_ = const_cast<ValueInternalArray *>( this ); + it.currentItemIndex_ = 0; + it.currentPageIndex_ = pages_; +} + + +void +ValueInternalArray::makeIterator( IteratorState &it, ArrayIndex index ) const +{ + it.array_ = const_cast<ValueInternalArray *>( this ); + it.currentItemIndex_ = index % itemsPerPage; + it.currentPageIndex_ = pages_ + index / itemsPerPage; +} + + +void +ValueInternalArray::makeEndIterator( IteratorState &it ) const +{ + makeIterator( it, size_ ); +} + + +ValueInternalArray::ValueInternalArray() + : pages_( 0 ) + , size_( 0 ) + , pageCount_( 0 ) +{ +} + + +ValueInternalArray::ValueInternalArray( const ValueInternalArray &other ) + : pages_( 0 ) + , pageCount_( 0 ) + , size_( other.size_ ) +{ + PageIndex minNewPages = other.size_ / itemsPerPage; + arrayAllocator()->reallocateArrayPageIndex( pages_, pageCount_, minNewPages ); + JSON_ASSERT_MESSAGE( pageCount_ >= minNewPages, + "ValueInternalArray::reserve(): bad reallocation" ); + IteratorState itOther; + other.makeBeginIterator( itOther ); + Value *value; + for ( ArrayIndex index = 0; index < size_; ++index, increment(itOther) ) + { + if ( index % itemsPerPage == 0 ) + { + PageIndex pageIndex = index / itemsPerPage; + value = arrayAllocator()->allocateArrayPage(); + pages_[pageIndex] = value; + } + new (value) Value( dereference( itOther ) ); + } +} + + +ValueInternalArray & +ValueInternalArray::operator =( const ValueInternalArray &other ) +{ + ValueInternalArray temp( other ); + swap( temp ); + return *this; +} + + +ValueInternalArray::~ValueInternalArray() +{ + // destroy all constructed items + IteratorState it; + IteratorState itEnd; + makeBeginIterator( it); + makeEndIterator( itEnd ); + for ( ; !equals(it,itEnd); increment(it) ) + { + Value *value = &dereference(it); + value->~Value(); + } + // release all pages + PageIndex lastPageIndex = size_ / itemsPerPage; + for ( PageIndex pageIndex = 0; pageIndex < lastPageIndex; ++pageIndex ) + arrayAllocator()->releaseArrayPage( pages_[pageIndex] ); + // release pages index + arrayAllocator()->releaseArrayPageIndex( pages_, pageCount_ ); +} + + +void +ValueInternalArray::swap( ValueInternalArray &other ) +{ + Value **tempPages = pages_; + pages_ = other.pages_; + other.pages_ = tempPages; + ArrayIndex tempSize = size_; + size_ = other.size_; + other.size_ = tempSize; + PageIndex tempPageCount = pageCount_; + pageCount_ = other.pageCount_; + other.pageCount_ = tempPageCount; +} + +void +ValueInternalArray::clear() +{ + ValueInternalArray dummy; + swap( dummy ); +} + + +void +ValueInternalArray::resize( ArrayIndex newSize ) +{ + if ( newSize == 0 ) + clear(); + else if ( newSize < size_ ) + { + IteratorState it; + IteratorState itEnd; + makeIterator( it, newSize ); + makeIterator( itEnd, size_ ); + for ( ; !equals(it,itEnd); increment(it) ) + { + Value *value = &dereference(it); + value->~Value(); + } + PageIndex pageIndex = (newSize + itemsPerPage - 1) / itemsPerPage; + PageIndex lastPageIndex = size_ / itemsPerPage; + for ( ; pageIndex < lastPageIndex; ++pageIndex ) + arrayAllocator()->releaseArrayPage( pages_[pageIndex] ); + size_ = newSize; + } + else if ( newSize > size_ ) + resolveReference( newSize ); +} + + +void +ValueInternalArray::makeIndexValid( ArrayIndex index ) +{ + // Need to enlarge page index ? + if ( index >= pageCount_ * itemsPerPage ) + { + PageIndex minNewPages = (index + 1) / itemsPerPage; + arrayAllocator()->reallocateArrayPageIndex( pages_, pageCount_, minNewPages ); + JSON_ASSERT_MESSAGE( pageCount_ >= minNewPages, "ValueInternalArray::reserve(): bad reallocation" ); + } + + // Need to allocate new pages ? + ArrayIndex nextPageIndex = + (size_ % itemsPerPage) != 0 ? size_ - (size_%itemsPerPage) + itemsPerPage + : size_; + if ( nextPageIndex <= index ) + { + PageIndex pageIndex = nextPageIndex / itemsPerPage; + PageIndex pageToAllocate = (index - nextPageIndex) / itemsPerPage + 1; + for ( ; pageToAllocate-- > 0; ++pageIndex ) + pages_[pageIndex] = arrayAllocator()->allocateArrayPage(); + } + + // Initialize all new entries + IteratorState it; + IteratorState itEnd; + makeIterator( it, size_ ); + size_ = index + 1; + makeIterator( itEnd, size_ ); + for ( ; !equals(it,itEnd); increment(it) ) + { + Value *value = &dereference(it); + new (value) Value(); // Construct a default value using placement new + } +} + +Value & +ValueInternalArray::resolveReference( ArrayIndex index ) +{ + if ( index >= size_ ) + makeIndexValid( index ); + return pages_[index/itemsPerPage][index%itemsPerPage]; +} + +Value * +ValueInternalArray::find( ArrayIndex index ) const +{ + if ( index >= size_ ) + return 0; + return &(pages_[index/itemsPerPage][index%itemsPerPage]); +} + +ValueInternalArray::ArrayIndex +ValueInternalArray::size() const +{ + return size_; +} + +int +ValueInternalArray::distance( const IteratorState &x, const IteratorState &y ) +{ + return indexOf(y) - indexOf(x); +} + + +ValueInternalArray::ArrayIndex +ValueInternalArray::indexOf( const IteratorState &iterator ) +{ + if ( !iterator.array_ ) + return ArrayIndex(-1); + return ArrayIndex( + (iterator.currentPageIndex_ - iterator.array_->pages_) * itemsPerPage + + iterator.currentItemIndex_ ); +} + + +int +ValueInternalArray::compare( const ValueInternalArray &other ) const +{ + int sizeDiff( size_ - other.size_ ); + if ( sizeDiff != 0 ) + return sizeDiff; + + for ( ArrayIndex index =0; index < size_; ++index ) + { + int diff = pages_[index/itemsPerPage][index%itemsPerPage].compare( + other.pages_[index/itemsPerPage][index%itemsPerPage] ); + if ( diff != 0 ) + return diff; + } + return 0; +} diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_internalmap.inl b/jsoncpp-src-0.5.0/src/lib_json/json_internalmap.inl new file mode 100644 index 000000000..19771488d --- /dev/null +++ b/jsoncpp-src-0.5.0/src/lib_json/json_internalmap.inl @@ -0,0 +1,607 @@ +// included by json_value.cpp +// everything is within Json namespace + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueInternalMap +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +/** \internal MUST be safely initialized using memset( this, 0, sizeof(ValueInternalLink) ); + * This optimization is used by the fast allocator. + */ +ValueInternalLink::ValueInternalLink() + : previous_( 0 ) + , next_( 0 ) +{ +} + +ValueInternalLink::~ValueInternalLink() +{ + for ( int index =0; index < itemPerLink; ++index ) + { + if ( !items_[index].isItemAvailable() ) + { + if ( !items_[index].isMemberNameStatic() ) + free( keys_[index] ); + } + else + break; + } +} + + + +ValueMapAllocator::~ValueMapAllocator() +{ +} + +#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +class DefaultValueMapAllocator : public ValueMapAllocator +{ +public: // overridden from ValueMapAllocator + virtual ValueInternalMap *newMap() + { + return new ValueInternalMap(); + } + + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) + { + return new ValueInternalMap( other ); + } + + virtual void destructMap( ValueInternalMap *map ) + { + delete map; + } + + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) + { + return new ValueInternalLink[size]; + } + + virtual void releaseMapBuckets( ValueInternalLink *links ) + { + delete [] links; + } + + virtual ValueInternalLink *allocateMapLink() + { + return new ValueInternalLink(); + } + + virtual void releaseMapLink( ValueInternalLink *link ) + { + delete link; + } +}; +#else +/// @todo make this thread-safe (lock when accessign batch allocator) +class DefaultValueMapAllocator : public ValueMapAllocator +{ +public: // overridden from ValueMapAllocator + virtual ValueInternalMap *newMap() + { + ValueInternalMap *map = mapsAllocator_.allocate(); + new (map) ValueInternalMap(); // placement new + return map; + } + + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) + { + ValueInternalMap *map = mapsAllocator_.allocate(); + new (map) ValueInternalMap( other ); // placement new + return map; + } + + virtual void destructMap( ValueInternalMap *map ) + { + if ( map ) + { + map->~ValueInternalMap(); + mapsAllocator_.release( map ); + } + } + + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) + { + return new ValueInternalLink[size]; + } + + virtual void releaseMapBuckets( ValueInternalLink *links ) + { + delete [] links; + } + + virtual ValueInternalLink *allocateMapLink() + { + ValueInternalLink *link = linksAllocator_.allocate(); + memset( link, 0, sizeof(ValueInternalLink) ); + return link; + } + + virtual void releaseMapLink( ValueInternalLink *link ) + { + link->~ValueInternalLink(); + linksAllocator_.release( link ); + } +private: + BatchAllocator<ValueInternalMap,1> mapsAllocator_; + BatchAllocator<ValueInternalLink,1> linksAllocator_; +}; +#endif + +static ValueMapAllocator *&mapAllocator() +{ + static DefaultValueMapAllocator defaultAllocator; + static ValueMapAllocator *mapAllocator = &defaultAllocator; + return mapAllocator; +} + +static struct DummyMapAllocatorInitializer { + DummyMapAllocatorInitializer() + { + mapAllocator(); // ensure mapAllocator() statics are initialized before main(). + } +} dummyMapAllocatorInitializer; + + + +// h(K) = value * K >> w ; with w = 32 & K prime w.r.t. 2^32. + +/* +use linked list hash map. +buckets array is a container. +linked list element contains 6 key/values. (memory = (16+4) * 6 + 4 = 124) +value have extra state: valid, available, deleted +*/ + + +ValueInternalMap::ValueInternalMap() + : buckets_( 0 ) + , tailLink_( 0 ) + , bucketsSize_( 0 ) + , itemCount_( 0 ) +{ +} + + +ValueInternalMap::ValueInternalMap( const ValueInternalMap &other ) + : buckets_( 0 ) + , tailLink_( 0 ) + , bucketsSize_( 0 ) + , itemCount_( 0 ) +{ + reserve( other.itemCount_ ); + IteratorState it; + IteratorState itEnd; + other.makeBeginIterator( it ); + other.makeEndIterator( itEnd ); + for ( ; !equals(it,itEnd); increment(it) ) + { + bool isStatic; + const char *memberName = key( it, isStatic ); + const Value &aValue = value( it ); + resolveReference(memberName, isStatic) = aValue; + } +} + + +ValueInternalMap & +ValueInternalMap::operator =( const ValueInternalMap &other ) +{ + ValueInternalMap dummy( other ); + swap( dummy ); + return *this; +} + + +ValueInternalMap::~ValueInternalMap() +{ + if ( buckets_ ) + { + for ( BucketIndex bucketIndex =0; bucketIndex < bucketsSize_; ++bucketIndex ) + { + ValueInternalLink *link = buckets_[bucketIndex].next_; + while ( link ) + { + ValueInternalLink *linkToRelease = link; + link = link->next_; + mapAllocator()->releaseMapLink( linkToRelease ); + } + } + mapAllocator()->releaseMapBuckets( buckets_ ); + } +} + + +void +ValueInternalMap::swap( ValueInternalMap &other ) +{ + ValueInternalLink *tempBuckets = buckets_; + buckets_ = other.buckets_; + other.buckets_ = tempBuckets; + ValueInternalLink *tempTailLink = tailLink_; + tailLink_ = other.tailLink_; + other.tailLink_ = tempTailLink; + BucketIndex tempBucketsSize = bucketsSize_; + bucketsSize_ = other.bucketsSize_; + other.bucketsSize_ = tempBucketsSize; + BucketIndex tempItemCount = itemCount_; + itemCount_ = other.itemCount_; + other.itemCount_ = tempItemCount; +} + + +void +ValueInternalMap::clear() +{ + ValueInternalMap dummy; + swap( dummy ); +} + + +ValueInternalMap::BucketIndex +ValueInternalMap::size() const +{ + return itemCount_; +} + +bool +ValueInternalMap::reserveDelta( BucketIndex growth ) +{ + return reserve( itemCount_ + growth ); +} + +bool +ValueInternalMap::reserve( BucketIndex newItemCount ) +{ + if ( !buckets_ && newItemCount > 0 ) + { + buckets_ = mapAllocator()->allocateMapBuckets( 1 ); + bucketsSize_ = 1; + tailLink_ = &buckets_[0]; + } +// BucketIndex idealBucketCount = (newItemCount + ValueInternalLink::itemPerLink) / ValueInternalLink::itemPerLink; + return true; +} + + +const Value * +ValueInternalMap::find( const char *key ) const +{ + if ( !bucketsSize_ ) + return 0; + HashKey hashedKey = hash( key ); + BucketIndex bucketIndex = hashedKey % bucketsSize_; + for ( const ValueInternalLink *current = &buckets_[bucketIndex]; + current != 0; + current = current->next_ ) + { + for ( BucketIndex index=0; index < ValueInternalLink::itemPerLink; ++index ) + { + if ( current->items_[index].isItemAvailable() ) + return 0; + if ( strcmp( key, current->keys_[index] ) == 0 ) + return ¤t->items_[index]; + } + } + return 0; +} + + +Value * +ValueInternalMap::find( const char *key ) +{ + const ValueInternalMap *constThis = this; + return const_cast<Value *>( constThis->find( key ) ); +} + + +Value & +ValueInternalMap::resolveReference( const char *key, + bool isStatic ) +{ + HashKey hashedKey = hash( key ); + if ( bucketsSize_ ) + { + BucketIndex bucketIndex = hashedKey % bucketsSize_; + ValueInternalLink **previous = 0; + BucketIndex index; + for ( ValueInternalLink *current = &buckets_[bucketIndex]; + current != 0; + previous = ¤t->next_, current = current->next_ ) + { + for ( index=0; index < ValueInternalLink::itemPerLink; ++index ) + { + if ( current->items_[index].isItemAvailable() ) + return setNewItem( key, isStatic, current, index ); + if ( strcmp( key, current->keys_[index] ) == 0 ) + return current->items_[index]; + } + } + } + + reserveDelta( 1 ); + return unsafeAdd( key, isStatic, hashedKey ); +} + + +void +ValueInternalMap::remove( const char *key ) +{ + HashKey hashedKey = hash( key ); + if ( !bucketsSize_ ) + return; + BucketIndex bucketIndex = hashedKey % bucketsSize_; + for ( ValueInternalLink *link = &buckets_[bucketIndex]; + link != 0; + link = link->next_ ) + { + BucketIndex index; + for ( index =0; index < ValueInternalLink::itemPerLink; ++index ) + { + if ( link->items_[index].isItemAvailable() ) + return; + if ( strcmp( key, link->keys_[index] ) == 0 ) + { + doActualRemove( link, index, bucketIndex ); + return; + } + } + } +} + +void +ValueInternalMap::doActualRemove( ValueInternalLink *link, + BucketIndex index, + BucketIndex bucketIndex ) +{ + // find last item of the bucket and swap it with the 'removed' one. + // set removed items flags to 'available'. + // if last page only contains 'available' items, then desallocate it (it's empty) + ValueInternalLink *&lastLink = getLastLinkInBucket( index ); + BucketIndex lastItemIndex = 1; // a link can never be empty, so start at 1 + for ( ; + lastItemIndex < ValueInternalLink::itemPerLink; + ++lastItemIndex ) // may be optimized with dicotomic search + { + if ( lastLink->items_[lastItemIndex].isItemAvailable() ) + break; + } + + BucketIndex lastUsedIndex = lastItemIndex - 1; + Value *valueToDelete = &link->items_[index]; + Value *valueToPreserve = &lastLink->items_[lastUsedIndex]; + if ( valueToDelete != valueToPreserve ) + valueToDelete->swap( *valueToPreserve ); + if ( lastUsedIndex == 0 ) // page is now empty + { // remove it from bucket linked list and delete it. + ValueInternalLink *linkPreviousToLast = lastLink->previous_; + if ( linkPreviousToLast != 0 ) // can not deleted bucket link. + { + mapAllocator()->releaseMapLink( lastLink ); + linkPreviousToLast->next_ = 0; + lastLink = linkPreviousToLast; + } + } + else + { + Value dummy; + valueToPreserve->swap( dummy ); // restore deleted to default Value. + valueToPreserve->setItemUsed( false ); + } + --itemCount_; +} + + +ValueInternalLink *& +ValueInternalMap::getLastLinkInBucket( BucketIndex bucketIndex ) +{ + if ( bucketIndex == bucketsSize_ - 1 ) + return tailLink_; + ValueInternalLink *&previous = buckets_[bucketIndex+1].previous_; + if ( !previous ) + previous = &buckets_[bucketIndex]; + return previous; +} + + +Value & +ValueInternalMap::setNewItem( const char *key, + bool isStatic, + ValueInternalLink *link, + BucketIndex index ) +{ + char *duplicatedKey = valueAllocator()->makeMemberName( key ); + ++itemCount_; + link->keys_[index] = duplicatedKey; + link->items_[index].setItemUsed(); + link->items_[index].setMemberNameIsStatic( isStatic ); + return link->items_[index]; // items already default constructed. +} + + +Value & +ValueInternalMap::unsafeAdd( const char *key, + bool isStatic, + HashKey hashedKey ) +{ + JSON_ASSERT_MESSAGE( bucketsSize_ > 0, "ValueInternalMap::unsafeAdd(): internal logic error." ); + BucketIndex bucketIndex = hashedKey % bucketsSize_; + ValueInternalLink *&previousLink = getLastLinkInBucket( bucketIndex ); + ValueInternalLink *link = previousLink; + BucketIndex index; + for ( index =0; index < ValueInternalLink::itemPerLink; ++index ) + { + if ( link->items_[index].isItemAvailable() ) + break; + } + if ( index == ValueInternalLink::itemPerLink ) // need to add a new page + { + ValueInternalLink *newLink = mapAllocator()->allocateMapLink(); + index = 0; + link->next_ = newLink; + previousLink = newLink; + link = newLink; + } + return setNewItem( key, isStatic, link, index ); +} + + +ValueInternalMap::HashKey +ValueInternalMap::hash( const char *key ) const +{ + HashKey hash = 0; + while ( *key ) + hash += *key++ * 37; + return hash; +} + + +int +ValueInternalMap::compare( const ValueInternalMap &other ) const +{ + int sizeDiff( itemCount_ - other.itemCount_ ); + if ( sizeDiff != 0 ) + return sizeDiff; + // Strict order guaranty is required. Compare all keys FIRST, then compare values. + IteratorState it; + IteratorState itEnd; + makeBeginIterator( it ); + makeEndIterator( itEnd ); + for ( ; !equals(it,itEnd); increment(it) ) + { + if ( !other.find( key( it ) ) ) + return 1; + } + + // All keys are equals, let's compare values + makeBeginIterator( it ); + for ( ; !equals(it,itEnd); increment(it) ) + { + const Value *otherValue = other.find( key( it ) ); + int valueDiff = value(it).compare( *otherValue ); + if ( valueDiff != 0 ) + return valueDiff; + } + return 0; +} + + +void +ValueInternalMap::makeBeginIterator( IteratorState &it ) const +{ + it.map_ = const_cast<ValueInternalMap *>( this ); + it.bucketIndex_ = 0; + it.itemIndex_ = 0; + it.link_ = buckets_; +} + + +void +ValueInternalMap::makeEndIterator( IteratorState &it ) const +{ + it.map_ = const_cast<ValueInternalMap *>( this ); + it.bucketIndex_ = bucketsSize_; + it.itemIndex_ = 0; + it.link_ = 0; +} + + +bool +ValueInternalMap::equals( const IteratorState &x, const IteratorState &other ) +{ + return x.map_ == other.map_ + && x.bucketIndex_ == other.bucketIndex_ + && x.link_ == other.link_ + && x.itemIndex_ == other.itemIndex_; +} + + +void +ValueInternalMap::incrementBucket( IteratorState &iterator ) +{ + ++iterator.bucketIndex_; + JSON_ASSERT_MESSAGE( iterator.bucketIndex_ <= iterator.map_->bucketsSize_, + "ValueInternalMap::increment(): attempting to iterate beyond end." ); + if ( iterator.bucketIndex_ == iterator.map_->bucketsSize_ ) + iterator.link_ = 0; + else + iterator.link_ = &(iterator.map_->buckets_[iterator.bucketIndex_]); + iterator.itemIndex_ = 0; +} + + +void +ValueInternalMap::increment( IteratorState &iterator ) +{ + JSON_ASSERT_MESSAGE( iterator.map_, "Attempting to iterator using invalid iterator." ); + ++iterator.itemIndex_; + if ( iterator.itemIndex_ == ValueInternalLink::itemPerLink ) + { + JSON_ASSERT_MESSAGE( iterator.link_ != 0, + "ValueInternalMap::increment(): attempting to iterate beyond end." ); + iterator.link_ = iterator.link_->next_; + if ( iterator.link_ == 0 ) + incrementBucket( iterator ); + } + else if ( iterator.link_->items_[iterator.itemIndex_].isItemAvailable() ) + { + incrementBucket( iterator ); + } +} + + +void +ValueInternalMap::decrement( IteratorState &iterator ) +{ + if ( iterator.itemIndex_ == 0 ) + { + JSON_ASSERT_MESSAGE( iterator.map_, "Attempting to iterate using invalid iterator." ); + if ( iterator.link_ == &iterator.map_->buckets_[iterator.bucketIndex_] ) + { + JSON_ASSERT_MESSAGE( iterator.bucketIndex_ > 0, "Attempting to iterate beyond beginning." ); + --(iterator.bucketIndex_); + } + iterator.link_ = iterator.link_->previous_; + iterator.itemIndex_ = ValueInternalLink::itemPerLink - 1; + } +} + + +const char * +ValueInternalMap::key( const IteratorState &iterator ) +{ + JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." ); + return iterator.link_->keys_[iterator.itemIndex_]; +} + +const char * +ValueInternalMap::key( const IteratorState &iterator, bool &isStatic ) +{ + JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." ); + isStatic = iterator.link_->items_[iterator.itemIndex_].isMemberNameStatic(); + return iterator.link_->keys_[iterator.itemIndex_]; +} + + +Value & +ValueInternalMap::value( const IteratorState &iterator ) +{ + JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." ); + return iterator.link_->items_[iterator.itemIndex_]; +} + + +int +ValueInternalMap::distance( const IteratorState &x, const IteratorState &y ) +{ + int offset = 0; + IteratorState it = x; + while ( !equals( it, y ) ) + increment( it ); + return offset; +} diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp b/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp new file mode 100644 index 000000000..4eb2d11fd --- /dev/null +++ b/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp @@ -0,0 +1,885 @@ +#include <json/reader.h> +#include <json/value.h> +#include <utility> +#include <cstdio> +#include <cassert> +#include <cstring> +#include <iostream> +#include <stdexcept> + +#if _MSC_VER >= 1400 // VC++ 8.0 +#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. +#endif + +namespace Json { + +// Implementation of class Features +// //////////////////////////////// + +Features::Features() + : allowComments_( true ) + , strictRoot_( false ) +{ +} + + +Features +Features::all() +{ + return Features(); +} + + +Features +Features::strictMode() +{ + Features features; + features.allowComments_ = false; + features.strictRoot_ = true; + return features; +} + +// Implementation of class Reader +// //////////////////////////////// + + +static inline bool +in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4 ) +{ + return c == c1 || c == c2 || c == c3 || c == c4; +} + +static inline bool +in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4, Reader::Char c5 ) +{ + return c == c1 || c == c2 || c == c3 || c == c4 || c == c5; +} + + +static bool +containsNewLine( Reader::Location begin, + Reader::Location end ) +{ + for ( ;begin < end; ++begin ) + if ( *begin == '\n' || *begin == '\r' ) + return true; + return false; +} + +static std::string codePointToUTF8(unsigned int cp) +{ + std::string result; + + // based on description from http://en.wikipedia.org/wiki/UTF-8 + + if (cp <= 0x7f) + { + result.resize(1); + result[0] = static_cast<char>(cp); + } + else if (cp <= 0x7FF) + { + result.resize(2); + result[1] = static_cast<char>(0x80 | (0x3f & cp)); + result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6))); + } + else if (cp <= 0xFFFF) + { + result.resize(3); + result[2] = static_cast<char>(0x80 | (0x3f & cp)); + result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6))); + result[0] = 0xE0 | static_cast<char>((0xf & (cp >> 12))); + } + else if (cp <= 0x10FFFF) + { + result.resize(4); + result[3] = static_cast<char>(0x80 | (0x3f & cp)); + result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6))); + result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12))); + result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18))); + } + + return result; +} + + +// Class Reader +// ////////////////////////////////////////////////////////////////// + +Reader::Reader() + : features_( Features::all() ) +{ +} + + +Reader::Reader( const Features &features ) + : features_( features ) +{ +} + + +bool +Reader::parse( const std::string &document, + Value &root, + bool collectComments ) +{ + document_ = document; + const char *begin = document_.c_str(); + const char *end = begin + document_.length(); + return parse( begin, end, root, collectComments ); +} + + +bool +Reader::parse( std::istream& sin, + Value &root, + bool collectComments ) +{ + //std::istream_iterator<char> begin(sin); + //std::istream_iterator<char> end; + // Those would allow streamed input from a file, if parse() were a + // template function. + + // Since std::string is reference-counted, this at least does not + // create an extra copy. + std::string doc; + std::getline(sin, doc, (char)EOF); + return parse( doc, root, collectComments ); +} + +bool +Reader::parse( const char *beginDoc, const char *endDoc, + Value &root, + bool collectComments ) +{ + if ( !features_.allowComments_ ) + { + collectComments = false; + } + + begin_ = beginDoc; + end_ = endDoc; + collectComments_ = collectComments; + current_ = begin_; + lastValueEnd_ = 0; + lastValue_ = 0; + commentsBefore_ = ""; + errors_.clear(); + while ( !nodes_.empty() ) + nodes_.pop(); + nodes_.push( &root ); + + bool successful = readValue(); + Token token; + skipCommentTokens( token ); + if ( collectComments_ && !commentsBefore_.empty() ) + root.setComment( commentsBefore_, commentAfter ); + if ( features_.strictRoot_ ) + { + if ( !root.isArray() && !root.isObject() ) + { + // Set error location to start of doc, ideally should be first token found in doc + token.type_ = tokenError; + token.start_ = beginDoc; + token.end_ = endDoc; + addError( "A valid JSON document must be either an array or an object value.", + token ); + return false; + } + } + return successful; +} + + +bool +Reader::readValue() +{ + Token token; + skipCommentTokens( token ); + bool successful = true; + + if ( collectComments_ && !commentsBefore_.empty() ) + { + currentValue().setComment( commentsBefore_, commentBefore ); + commentsBefore_ = ""; + } + + + switch ( token.type_ ) + { + case tokenObjectBegin: + successful = readObject( token ); + break; + case tokenArrayBegin: + successful = readArray( token ); + break; + case tokenNumber: + successful = decodeNumber( token ); + break; + case tokenString: + successful = decodeString( token ); + break; + case tokenTrue: + currentValue() = true; + break; + case tokenFalse: + currentValue() = false; + break; + case tokenNull: + currentValue() = Value(); + break; + default: + return addError( "Syntax error: value, object or array expected.", token ); + } + + if ( collectComments_ ) + { + lastValueEnd_ = current_; + lastValue_ = ¤tValue(); + } + + return successful; +} + + +void +Reader::skipCommentTokens( Token &token ) +{ + if ( features_.allowComments_ ) + { + do + { + readToken( token ); + } + while ( token.type_ == tokenComment ); + } + else + { + readToken( token ); + } +} + + +bool +Reader::expectToken( TokenType type, Token &token, const char *message ) +{ + readToken( token ); + if ( token.type_ != type ) + return addError( message, token ); + return true; +} + + +bool +Reader::readToken( Token &token ) +{ + skipSpaces(); + token.start_ = current_; + Char c = getNextChar(); + bool ok = true; + switch ( c ) + { + case '{': + token.type_ = tokenObjectBegin; + break; + case '}': + token.type_ = tokenObjectEnd; + break; + case '[': + token.type_ = tokenArrayBegin; + break; + case ']': + token.type_ = tokenArrayEnd; + break; + case '"': + token.type_ = tokenString; + ok = readString(); + break; + case '/': + token.type_ = tokenComment; + ok = readComment(); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + token.type_ = tokenNumber; + readNumber(); + break; + case 't': + token.type_ = tokenTrue; + ok = match( "rue", 3 ); + break; + case 'f': + token.type_ = tokenFalse; + ok = match( "alse", 4 ); + break; + case 'n': + token.type_ = tokenNull; + ok = match( "ull", 3 ); + break; + case ',': + token.type_ = tokenArraySeparator; + break; + case ':': + token.type_ = tokenMemberSeparator; + break; + case 0: + token.type_ = tokenEndOfStream; + break; + default: + ok = false; + break; + } + if ( !ok ) + token.type_ = tokenError; + token.end_ = current_; + return true; +} + + +void +Reader::skipSpaces() +{ + while ( current_ != end_ ) + { + Char c = *current_; + if ( c == ' ' || c == '\t' || c == '\r' || c == '\n' ) + ++current_; + else + break; + } +} + + +bool +Reader::match( Location pattern, + int patternLength ) +{ + if ( end_ - current_ < patternLength ) + return false; + int index = patternLength; + while ( index-- ) + if ( current_[index] != pattern[index] ) + return false; + current_ += patternLength; + return true; +} + + +bool +Reader::readComment() +{ + Location commentBegin = current_ - 1; + Char c = getNextChar(); + bool successful = false; + if ( c == '*' ) + successful = readCStyleComment(); + else if ( c == '/' ) + successful = readCppStyleComment(); + if ( !successful ) + return false; + + if ( collectComments_ ) + { + CommentPlacement placement = commentBefore; + if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) ) + { + if ( c != '*' || !containsNewLine( commentBegin, current_ ) ) + placement = commentAfterOnSameLine; + } + + addComment( commentBegin, current_, placement ); + } + return true; +} + + +void +Reader::addComment( Location begin, + Location end, + CommentPlacement placement ) +{ + assert( collectComments_ ); + if ( placement == commentAfterOnSameLine ) + { + assert( lastValue_ != 0 ); + lastValue_->setComment( std::string( begin, end ), placement ); + } + else + { + if ( !commentsBefore_.empty() ) + commentsBefore_ += "\n"; + commentsBefore_ += std::string( begin, end ); + } +} + + +bool +Reader::readCStyleComment() +{ + while ( current_ != end_ ) + { + Char c = getNextChar(); + if ( c == '*' && *current_ == '/' ) + break; + } + return getNextChar() == '/'; +} + + +bool +Reader::readCppStyleComment() +{ + while ( current_ != end_ ) + { + Char c = getNextChar(); + if ( c == '\r' || c == '\n' ) + break; + } + return true; +} + + +void +Reader::readNumber() +{ + while ( current_ != end_ ) + { + if ( !(*current_ >= '0' && *current_ <= '9') && + !in( *current_, '.', 'e', 'E', '+', '-' ) ) + break; + ++current_; + } +} + +bool +Reader::readString() +{ + Char c = 0; + while ( current_ != end_ ) + { + c = getNextChar(); + if ( c == '\\' ) + getNextChar(); + else if ( c == '"' ) + break; + } + return c == '"'; +} + + +bool +Reader::readObject( Token &tokenStart ) +{ + Token tokenName; + std::string name; + currentValue() = Value( objectValue ); + while ( readToken( tokenName ) ) + { + bool initialTokenOk = true; + while ( tokenName.type_ == tokenComment && initialTokenOk ) + initialTokenOk = readToken( tokenName ); + if ( !initialTokenOk ) + break; + if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object + return true; + if ( tokenName.type_ != tokenString ) + break; + + name = ""; + if ( !decodeString( tokenName, name ) ) + return recoverFromError( tokenObjectEnd ); + + Token colon; + if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator ) + { + return addErrorAndRecover( "Missing ':' after object member name", + colon, + tokenObjectEnd ); + } + Value &value = currentValue()[ name ]; + nodes_.push( &value ); + bool ok = readValue(); + nodes_.pop(); + if ( !ok ) // error already set + return recoverFromError( tokenObjectEnd ); + + Token comma; + if ( !readToken( comma ) + || ( comma.type_ != tokenObjectEnd && + comma.type_ != tokenArraySeparator && + comma.type_ != tokenComment ) ) + { + return addErrorAndRecover( "Missing ',' or '}' in object declaration", + comma, + tokenObjectEnd ); + } + bool finalizeTokenOk = true; + while ( comma.type_ == tokenComment && + finalizeTokenOk ) + finalizeTokenOk = readToken( comma ); + if ( comma.type_ == tokenObjectEnd ) + return true; + } + return addErrorAndRecover( "Missing '}' or object member name", + tokenName, + tokenObjectEnd ); +} + + +bool +Reader::readArray( Token &tokenStart ) +{ + currentValue() = Value( arrayValue ); + skipSpaces(); + if ( *current_ == ']' ) // empty array + { + Token endArray; + readToken( endArray ); + return true; + } + int index = 0; + while ( true ) + { + Value &value = currentValue()[ index++ ]; + nodes_.push( &value ); + bool ok = readValue(); + nodes_.pop(); + if ( !ok ) // error already set + return recoverFromError( tokenArrayEnd ); + + Token token; + // Accept Comment after last item in the array. + ok = readToken( token ); + while ( token.type_ == tokenComment && ok ) + { + ok = readToken( token ); + } + bool badTokenType = ( token.type_ == tokenArraySeparator && + token.type_ == tokenArrayEnd ); + if ( !ok || badTokenType ) + { + return addErrorAndRecover( "Missing ',' or ']' in array declaration", + token, + tokenArrayEnd ); + } + if ( token.type_ == tokenArrayEnd ) + break; + } + return true; +} + + +bool +Reader::decodeNumber( Token &token ) +{ + bool isDouble = false; + for ( Location inspect = token.start_; inspect != token.end_; ++inspect ) + { + isDouble = isDouble + || in( *inspect, '.', 'e', 'E', '+' ) + || ( *inspect == '-' && inspect != token.start_ ); + } + if ( isDouble ) + return decodeDouble( token ); + Location current = token.start_; + bool isNegative = *current == '-'; + if ( isNegative ) + ++current; + Value::UInt threshold = (isNegative ? Value::UInt(-Value::minInt) + : Value::maxUInt) / 10; + Value::UInt value = 0; + while ( current < token.end_ ) + { + Char c = *current++; + if ( c < '0' || c > '9' ) + return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); + if ( value >= threshold ) + return decodeDouble( token ); + value = value * 10 + Value::UInt(c - '0'); + } + if ( isNegative ) + currentValue() = -Value::Int( value ); + else if ( value <= Value::UInt(Value::maxInt) ) + currentValue() = Value::Int( value ); + else + currentValue() = value; + return true; +} + + +bool +Reader::decodeDouble( Token &token ) +{ + double value = 0; + const int bufferSize = 32; + int count; + int length = int(token.end_ - token.start_); + if ( length <= bufferSize ) + { + Char buffer[bufferSize]; + memcpy( buffer, token.start_, length ); + buffer[length] = 0; + count = sscanf( buffer, "%lf", &value ); + } + else + { + std::string buffer( token.start_, token.end_ ); + count = sscanf( buffer.c_str(), "%lf", &value ); + } + + if ( count != 1 ) + return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); + currentValue() = value; + return true; +} + + +bool +Reader::decodeString( Token &token ) +{ + std::string decoded; + if ( !decodeString( token, decoded ) ) + return false; + currentValue() = decoded; + return true; +} + + +bool +Reader::decodeString( Token &token, std::string &decoded ) +{ + decoded.reserve( token.end_ - token.start_ - 2 ); + Location current = token.start_ + 1; // skip '"' + Location end = token.end_ - 1; // do not include '"' + while ( current != end ) + { + Char c = *current++; + if ( c == '"' ) + break; + else if ( c == '\\' ) + { + if ( current == end ) + return addError( "Empty escape sequence in string", token, current ); + Char escape = *current++; + switch ( escape ) + { + case '"': decoded += '"'; break; + case '/': decoded += '/'; break; + case '\\': decoded += '\\'; break; + case 'b': decoded += '\b'; break; + case 'f': decoded += '\f'; break; + case 'n': decoded += '\n'; break; + case 'r': decoded += '\r'; break; + case 't': decoded += '\t'; break; + case 'u': + { + unsigned int unicode; + if ( !decodeUnicodeCodePoint( token, current, end, unicode ) ) + return false; + decoded += codePointToUTF8(unicode); + } + break; + default: + return addError( "Bad escape sequence in string", token, current ); + } + } + else + { + decoded += c; + } + } + return true; +} + +bool +Reader::decodeUnicodeCodePoint( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ) +{ + + if ( !decodeUnicodeEscapeSequence( token, current, end, unicode ) ) + return false; + if (unicode >= 0xD800 && unicode <= 0xDBFF) + { + // surrogate pairs + if (end - current < 6) + return addError( "additional six characters expected to parse unicode surrogate pair.", token, current ); + unsigned int surrogatePair; + if (*(current++) == '\\' && *(current++)== 'u') + { + if (decodeUnicodeEscapeSequence( token, current, end, surrogatePair )) + { + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); + } + else + return false; + } + else + return addError( "expecting another \\u token to begin the second half of a unicode surrogate pair", token, current ); + } + return true; +} + +bool +Reader::decodeUnicodeEscapeSequence( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ) +{ + if ( end - current < 4 ) + return addError( "Bad unicode escape sequence in string: four digits expected.", token, current ); + unicode = 0; + for ( int index =0; index < 4; ++index ) + { + Char c = *current++; + unicode *= 16; + if ( c >= '0' && c <= '9' ) + unicode += c - '0'; + else if ( c >= 'a' && c <= 'f' ) + unicode += c - 'a' + 10; + else if ( c >= 'A' && c <= 'F' ) + unicode += c - 'A' + 10; + else + return addError( "Bad unicode escape sequence in string: hexadecimal digit expected.", token, current ); + } + return true; +} + + +bool +Reader::addError( const std::string &message, + Token &token, + Location extra ) +{ + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = extra; + errors_.push_back( info ); + return false; +} + + +bool +Reader::recoverFromError( TokenType skipUntilToken ) +{ + int errorCount = int(errors_.size()); + Token skip; + while ( true ) + { + if ( !readToken(skip) ) + errors_.resize( errorCount ); // discard errors caused by recovery + if ( skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream ) + break; + } + errors_.resize( errorCount ); + return false; +} + + +bool +Reader::addErrorAndRecover( const std::string &message, + Token &token, + TokenType skipUntilToken ) +{ + addError( message, token ); + return recoverFromError( skipUntilToken ); +} + + +Value & +Reader::currentValue() +{ + return *(nodes_.top()); +} + + +Reader::Char +Reader::getNextChar() +{ + if ( current_ == end_ ) + return 0; + return *current_++; +} + + +void +Reader::getLocationLineAndColumn( Location location, + int &line, + int &column ) const +{ + Location current = begin_; + Location lastLineStart = current; + line = 0; + while ( current < location && current != end_ ) + { + Char c = *current++; + if ( c == '\r' ) + { + if ( *current == '\n' ) + ++current; + lastLineStart = current; + ++line; + } + else if ( c == '\n' ) + { + lastLineStart = current; + ++line; + } + } + // column & line start at 1 + column = int(location - lastLineStart) + 1; + ++line; +} + + +std::string +Reader::getLocationLineAndColumn( Location location ) const +{ + int line, column; + getLocationLineAndColumn( location, line, column ); + char buffer[18+16+16+1]; + sprintf( buffer, "Line %d, Column %d", line, column ); + return buffer; +} + + +std::string +Reader::getFormatedErrorMessages() const +{ + std::string formattedMessage; + for ( Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError ) + { + const ErrorInfo &error = *itError; + formattedMessage += "* " + getLocationLineAndColumn( error.token_.start_ ) + "\n"; + formattedMessage += " " + error.message_ + "\n"; + if ( error.extra_ ) + formattedMessage += "See " + getLocationLineAndColumn( error.extra_ ) + " for detail.\n"; + } + return formattedMessage; +} + + +std::istream& operator>>( std::istream &sin, Value &root ) +{ + Json::Reader reader; + bool ok = reader.parse(sin, root, true); + //JSON_ASSERT( ok ); + if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages()); + return sin; +} + + +} // namespace Json diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp b/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp new file mode 100644 index 000000000..573205f13 --- /dev/null +++ b/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp @@ -0,0 +1,1718 @@ +#include <iostream> +#include <json/value.h> +#include <json/writer.h> +#include <utility> +#include <stdexcept> +#include <cstring> +#include <cassert> +#ifdef JSON_USE_CPPTL +# include <cpptl/conststring.h> +#endif +#include <cstddef> // size_t +#ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +# include "json_batchallocator.h" +#endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR + +#define JSON_ASSERT_UNREACHABLE assert( false ) +#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw +#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message ); + +namespace Json { + +const Value Value::null; +const Int Value::minInt = Int( ~(UInt(-1)/2) ); +const Int Value::maxInt = Int( UInt(-1)/2 ); +const UInt Value::maxUInt = UInt(-1); + +// A "safe" implementation of strdup. Allow null pointer to be passed. +// Also avoid warning on msvc80. +// +//inline char *safeStringDup( const char *czstring ) +//{ +// if ( czstring ) +// { +// const size_t length = (unsigned int)( strlen(czstring) + 1 ); +// char *newString = static_cast<char *>( malloc( length ) ); +// memcpy( newString, czstring, length ); +// return newString; +// } +// return 0; +//} +// +//inline char *safeStringDup( const std::string &str ) +//{ +// if ( !str.empty() ) +// { +// const size_t length = str.length(); +// char *newString = static_cast<char *>( malloc( length + 1 ) ); +// memcpy( newString, str.c_str(), length ); +// newString[length] = 0; +// return newString; +// } +// return 0; +//} + +ValueAllocator::~ValueAllocator() +{ +} + +class DefaultValueAllocator : public ValueAllocator +{ +public: + virtual ~DefaultValueAllocator() + { + } + + virtual char *makeMemberName( const char *memberName ) + { + return duplicateStringValue( memberName ); + } + + virtual void releaseMemberName( char *memberName ) + { + releaseStringValue( memberName ); + } + + virtual char *duplicateStringValue( const char *value, + unsigned int length = unknown ) + { + //@todo invesgate this old optimization + //if ( !value || value[0] == 0 ) + // return 0; + + if ( length == unknown ) + length = (unsigned int)strlen(value); + char *newString = static_cast<char *>( malloc( length + 1 ) ); + memcpy( newString, value, length ); + newString[length] = 0; + return newString; + } + + virtual void releaseStringValue( char *value ) + { + if ( value ) + free( value ); + } +}; + +static ValueAllocator *&valueAllocator() +{ + static DefaultValueAllocator defaultAllocator; + static ValueAllocator *valueAllocator = &defaultAllocator; + return valueAllocator; +} + +static struct DummyValueAllocatorInitializer { + DummyValueAllocatorInitializer() + { + valueAllocator(); // ensure valueAllocator() statics are initialized before main(). + } +} dummyValueAllocatorInitializer; + + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ValueInternals... +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +#ifdef JSON_VALUE_USE_INTERNAL_MAP +# include "json_internalarray.inl" +# include "json_internalmap.inl" +#endif // JSON_VALUE_USE_INTERNAL_MAP + +# include "json_valueiterator.inl" + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CommentInfo +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + + +Value::CommentInfo::CommentInfo() + : comment_( 0 ) +{ +} + +Value::CommentInfo::~CommentInfo() +{ + if ( comment_ ) + valueAllocator()->releaseStringValue( comment_ ); +} + + +void +Value::CommentInfo::setComment( const char *text ) +{ + if ( comment_ ) + valueAllocator()->releaseStringValue( comment_ ); + JSON_ASSERT( text ); + JSON_ASSERT_MESSAGE( text[0]=='\0' || text[0]=='/', "Comments must start with /"); + // It seems that /**/ style comments are acceptable as well. + comment_ = valueAllocator()->duplicateStringValue( text ); +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CZString +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +# ifndef JSON_VALUE_USE_INTERNAL_MAP + +// Notes: index_ indicates if the string was allocated when +// a string is stored. + +Value::CZString::CZString( int index ) + : cstr_( 0 ) + , index_( index ) +{ +} + +Value::CZString::CZString( const char *cstr, DuplicationPolicy allocate ) + : cstr_( allocate == duplicate ? valueAllocator()->makeMemberName(cstr) + : cstr ) + , index_( allocate ) +{ +} + +Value::CZString::CZString( const CZString &other ) +: cstr_( other.index_ != noDuplication && other.cstr_ != 0 + ? valueAllocator()->makeMemberName( other.cstr_ ) + : other.cstr_ ) + , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate) + : other.index_ ) +{ +} + +Value::CZString::~CZString() +{ + if ( cstr_ && index_ == duplicate ) + valueAllocator()->releaseMemberName( const_cast<char *>( cstr_ ) ); +} + +void +Value::CZString::swap( CZString &other ) +{ + std::swap( cstr_, other.cstr_ ); + std::swap( index_, other.index_ ); +} + +Value::CZString & +Value::CZString::operator =( const CZString &other ) +{ + CZString temp( other ); + swap( temp ); + return *this; +} + +bool +Value::CZString::operator<( const CZString &other ) const +{ + if ( cstr_ ) + return strcmp( cstr_, other.cstr_ ) < 0; + return index_ < other.index_; +} + +bool +Value::CZString::operator==( const CZString &other ) const +{ + if ( cstr_ ) + return strcmp( cstr_, other.cstr_ ) == 0; + return index_ == other.index_; +} + + +int +Value::CZString::index() const +{ + return index_; +} + + +const char * +Value::CZString::c_str() const +{ + return cstr_; +} + +bool +Value::CZString::isStaticString() const +{ + return index_ == noDuplication; +} + +#endif // ifndef JSON_VALUE_USE_INTERNAL_MAP + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::Value +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +/*! \internal Default constructor initialization must be equivalent to: + * memset( this, 0, sizeof(Value) ) + * This optimization is used in ValueInternalMap fast allocator. + */ +Value::Value( ValueType type ) + : type_( type ) + , allocated_( 0 ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + switch ( type ) + { + case nullValue: + break; + case intValue: + case uintValue: + value_.int_ = 0; + break; + case realValue: + value_.real_ = 0.0; + break; + case stringValue: + value_.string_ = 0; + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(); + break; +#else + case arrayValue: + value_.array_ = arrayAllocator()->newArray(); + break; + case objectValue: + value_.map_ = mapAllocator()->newMap(); + break; +#endif + case booleanValue: + value_.bool_ = false; + break; + default: + JSON_ASSERT_UNREACHABLE; + } +} + + +Value::Value( Int value ) + : type_( intValue ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.int_ = value; +} + + +Value::Value( UInt value ) + : type_( uintValue ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.uint_ = value; +} + +Value::Value( double value ) + : type_( realValue ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.real_ = value; +} + +Value::Value( const char *value ) + : type_( stringValue ) + , allocated_( true ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = valueAllocator()->duplicateStringValue( value ); +} + + +Value::Value( const char *beginValue, + const char *endValue ) + : type_( stringValue ) + , allocated_( true ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = valueAllocator()->duplicateStringValue( beginValue, + UInt(endValue - beginValue) ); +} + + +Value::Value( const std::string &value ) + : type_( stringValue ) + , allocated_( true ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = valueAllocator()->duplicateStringValue( value.c_str(), + (unsigned int)value.length() ); + +} + +Value::Value( const StaticString &value ) + : type_( stringValue ) + , allocated_( false ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = const_cast<char *>( value.c_str() ); +} + + +# ifdef JSON_USE_CPPTL +Value::Value( const CppTL::ConstString &value ) + : type_( stringValue ) + , allocated_( true ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = valueAllocator()->duplicateStringValue( value, value.length() ); +} +# endif + +Value::Value( bool value ) + : type_( booleanValue ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.bool_ = value; +} + + +Value::Value( const Value &other ) + : type_( other.type_ ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + value_ = other.value_; + break; + case stringValue: + if ( other.value_.string_ ) + { + value_.string_ = valueAllocator()->duplicateStringValue( other.value_.string_ ); + allocated_ = true; + } + else + value_.string_ = 0; + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues( *other.value_.map_ ); + break; +#else + case arrayValue: + value_.array_ = arrayAllocator()->newArrayCopy( *other.value_.array_ ); + break; + case objectValue: + value_.map_ = mapAllocator()->newMapCopy( *other.value_.map_ ); + break; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + if ( other.comments_ ) + { + comments_ = new CommentInfo[numberOfCommentPlacement]; + for ( int comment =0; comment < numberOfCommentPlacement; ++comment ) + { + const CommentInfo &otherComment = other.comments_[comment]; + if ( otherComment.comment_ ) + comments_[comment].setComment( otherComment.comment_ ); + } + } +} + + +Value::~Value() +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + break; + case stringValue: + if ( allocated_ ) + valueAllocator()->releaseStringValue( value_.string_ ); + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + delete value_.map_; + break; +#else + case arrayValue: + arrayAllocator()->destructArray( value_.array_ ); + break; + case objectValue: + mapAllocator()->destructMap( value_.map_ ); + break; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + + if ( comments_ ) + delete[] comments_; +} + +Value & +Value::operator=( const Value &other ) +{ + Value temp( other ); + swap( temp ); + return *this; +} + +void +Value::swap( Value &other ) +{ + ValueType temp = type_; + type_ = other.type_; + other.type_ = temp; + std::swap( value_, other.value_ ); + int temp2 = allocated_; + allocated_ = other.allocated_; + other.allocated_ = temp2; +} + +ValueType +Value::type() const +{ + return type_; +} + + +int +Value::compare( const Value &other ) +{ + /* + int typeDelta = other.type_ - type_; + switch ( type_ ) + { + case nullValue: + + return other.type_ == type_; + case intValue: + if ( other.type_.isNumeric() + case uintValue: + case realValue: + case booleanValue: + break; + case stringValue, + break; + case arrayValue: + delete value_.array_; + break; + case objectValue: + delete value_.map_; + default: + JSON_ASSERT_UNREACHABLE; + } + */ + return 0; // unreachable +} + +bool +Value::operator <( const Value &other ) const +{ + int typeDelta = type_ - other.type_; + if ( typeDelta ) + return typeDelta < 0 ? true : false; + switch ( type_ ) + { + case nullValue: + return false; + case intValue: + return value_.int_ < other.value_.int_; + case uintValue: + return value_.uint_ < other.value_.uint_; + case realValue: + return value_.real_ < other.value_.real_; + case booleanValue: + return value_.bool_ < other.value_.bool_; + case stringValue: + return ( value_.string_ == 0 && other.value_.string_ ) + || ( other.value_.string_ + && value_.string_ + && strcmp( value_.string_, other.value_.string_ ) < 0 ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + { + int delta = int( value_.map_->size() - other.value_.map_->size() ); + if ( delta ) + return delta < 0; + return (*value_.map_) < (*other.value_.map_); + } +#else + case arrayValue: + return value_.array_->compare( *(other.value_.array_) ) < 0; + case objectValue: + return value_.map_->compare( *(other.value_.map_) ) < 0; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable +} + +bool +Value::operator <=( const Value &other ) const +{ + return !(other > *this); +} + +bool +Value::operator >=( const Value &other ) const +{ + return !(*this < other); +} + +bool +Value::operator >( const Value &other ) const +{ + return other < *this; +} + +bool +Value::operator ==( const Value &other ) const +{ + //if ( type_ != other.type_ ) + // GCC 2.95.3 says: + // attempt to take address of bit-field structure member `Json::Value::type_' + // Beats me, but a temp solves the problem. + int temp = other.type_; + if ( type_ != temp ) + return false; + switch ( type_ ) + { + case nullValue: + return true; + case intValue: + return value_.int_ == other.value_.int_; + case uintValue: + return value_.uint_ == other.value_.uint_; + case realValue: + return value_.real_ == other.value_.real_; + case booleanValue: + return value_.bool_ == other.value_.bool_; + case stringValue: + return ( value_.string_ == other.value_.string_ ) + || ( other.value_.string_ + && value_.string_ + && strcmp( value_.string_, other.value_.string_ ) == 0 ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + return value_.map_->size() == other.value_.map_->size() + && (*value_.map_) == (*other.value_.map_); +#else + case arrayValue: + return value_.array_->compare( *(other.value_.array_) ) == 0; + case objectValue: + return value_.map_->compare( *(other.value_.map_) ) == 0; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable +} + +bool +Value::operator !=( const Value &other ) const +{ + return !( *this == other ); +} + +const char * +Value::asCString() const +{ + JSON_ASSERT( type_ == stringValue ); + return value_.string_; +} + + +std::string +Value::asString() const +{ + switch ( type_ ) + { + case nullValue: + return ""; + case stringValue: + return value_.string_ ? value_.string_ : ""; + case booleanValue: + return value_.bool_ ? "true" : "false"; + case intValue: + case uintValue: + case realValue: + case arrayValue: + case objectValue: + JSON_ASSERT_MESSAGE( false, "Type is not convertible to string" ); + default: + JSON_ASSERT_UNREACHABLE; + } + return ""; // unreachable +} + +# ifdef JSON_USE_CPPTL +CppTL::ConstString +Value::asConstString() const +{ + return CppTL::ConstString( asString().c_str() ); +} +# endif + +Value::Int +Value::asInt() const +{ + switch ( type_ ) + { + case nullValue: + return 0; + case intValue: + return value_.int_; + case uintValue: + JSON_ASSERT_MESSAGE( value_.uint_ < (unsigned)maxInt, "integer out of signed integer range" ); + return value_.uint_; + case realValue: + JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" ); + return Int( value_.real_ ); + case booleanValue: + return value_.bool_ ? 1 : 0; + case stringValue: + case arrayValue: + case objectValue: + JSON_ASSERT_MESSAGE( false, "Type is not convertible to int" ); + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable; +} + +Value::UInt +Value::asUInt() const +{ + switch ( type_ ) + { + case nullValue: + return 0; + case intValue: + JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" ); + return value_.int_; + case uintValue: + return value_.uint_; + case realValue: + JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" ); + return UInt( value_.real_ ); + case booleanValue: + return value_.bool_ ? 1 : 0; + case stringValue: + case arrayValue: + case objectValue: + JSON_ASSERT_MESSAGE( false, "Type is not convertible to uint" ); + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable; +} + +double +Value::asDouble() const +{ + switch ( type_ ) + { + case nullValue: + return 0.0; + case intValue: + return value_.int_; + case uintValue: + return value_.uint_; + case realValue: + return value_.real_; + case booleanValue: + return value_.bool_ ? 1.0 : 0.0; + case stringValue: + case arrayValue: + case objectValue: + JSON_ASSERT_MESSAGE( false, "Type is not convertible to double" ); + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable; +} + +bool +Value::asBool() const +{ + switch ( type_ ) + { + case nullValue: + return false; + case intValue: + case uintValue: + return value_.int_ != 0; + case realValue: + return value_.real_ != 0.0; + case booleanValue: + return value_.bool_; + case stringValue: + return value_.string_ && value_.string_[0] != 0; + case arrayValue: + case objectValue: + return value_.map_->size() != 0; + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable; +} + + +bool +Value::isConvertibleTo( ValueType other ) const +{ + switch ( type_ ) + { + case nullValue: + return true; + case intValue: + return ( other == nullValue && value_.int_ == 0 ) + || other == intValue + || ( other == uintValue && value_.int_ >= 0 ) + || other == realValue + || other == stringValue + || other == booleanValue; + case uintValue: + return ( other == nullValue && value_.uint_ == 0 ) + || ( other == intValue && value_.uint_ <= (unsigned)maxInt ) + || other == uintValue + || other == realValue + || other == stringValue + || other == booleanValue; + case realValue: + return ( other == nullValue && value_.real_ == 0.0 ) + || ( other == intValue && value_.real_ >= minInt && value_.real_ <= maxInt ) + || ( other == uintValue && value_.real_ >= 0 && value_.real_ <= maxUInt ) + || other == realValue + || other == stringValue + || other == booleanValue; + case booleanValue: + return ( other == nullValue && value_.bool_ == false ) + || other == intValue + || other == uintValue + || other == realValue + || other == stringValue + || other == booleanValue; + case stringValue: + return other == stringValue + || ( other == nullValue && (!value_.string_ || value_.string_[0] == 0) ); + case arrayValue: + return other == arrayValue + || ( other == nullValue && value_.map_->size() == 0 ); + case objectValue: + return other == objectValue + || ( other == nullValue && value_.map_->size() == 0 ); + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable; +} + + +/// Number of values in array or object +Value::UInt +Value::size() const +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + case stringValue: + return 0; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: // size of the array is highest index + 1 + if ( !value_.map_->empty() ) + { + ObjectValues::const_iterator itLast = value_.map_->end(); + --itLast; + return (*itLast).first.index()+1; + } + return 0; + case objectValue: + return Int( value_.map_->size() ); +#else + case arrayValue: + return Int( value_.array_->size() ); + case objectValue: + return Int( value_.map_->size() ); +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable; +} + + +bool +Value::empty() const +{ + if ( isNull() || isArray() || isObject() ) + return size() == 0u; + else + return false; +} + + +bool +Value::operator!() const +{ + return isNull(); +} + + +void +Value::clear() +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue ); + + switch ( type_ ) + { +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_->clear(); + break; +#else + case arrayValue: + value_.array_->clear(); + break; + case objectValue: + value_.map_->clear(); + break; +#endif + default: + break; + } +} + +void +Value::resize( UInt newSize ) +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + *this = Value( arrayValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + UInt oldSize = size(); + if ( newSize == 0 ) + clear(); + else if ( newSize > oldSize ) + (*this)[ newSize - 1 ]; + else + { + for ( UInt index = newSize; index < oldSize; ++index ) + value_.map_->erase( index ); + assert( size() == newSize ); + } +#else + value_.array_->resize( newSize ); +#endif +} + + +Value & +Value::operator[]( UInt index ) +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + *this = Value( arrayValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString key( index ); + ObjectValues::iterator it = value_.map_->lower_bound( key ); + if ( it != value_.map_->end() && (*it).first == key ) + return (*it).second; + + ObjectValues::value_type defaultValue( key, null ); + it = value_.map_->insert( it, defaultValue ); + return (*it).second; +#else + return value_.array_->resolveReference( index ); +#endif +} + + +const Value & +Value::operator[]( UInt index ) const +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString key( index ); + ObjectValues::const_iterator it = value_.map_->find( key ); + if ( it == value_.map_->end() ) + return null; + return (*it).second; +#else + Value *value = value_.array_->find( index ); + return value ? *value : null; +#endif +} + + +Value & +Value::operator[]( const char *key ) +{ + return resolveReference( key, false ); +} + + +Value & +Value::resolveReference( const char *key, + bool isStatic ) +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + *this = Value( objectValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, isStatic ? CZString::noDuplication + : CZString::duplicateOnCopy ); + ObjectValues::iterator it = value_.map_->lower_bound( actualKey ); + if ( it != value_.map_->end() && (*it).first == actualKey ) + return (*it).second; + + ObjectValues::value_type defaultValue( actualKey, null ); + it = value_.map_->insert( it, defaultValue ); + Value &value = (*it).second; + return value; +#else + return value_.map_->resolveReference( key, isStatic ); +#endif +} + + +Value +Value::get( UInt index, + const Value &defaultValue ) const +{ + const Value *value = &((*this)[index]); + return value == &null ? defaultValue : *value; +} + + +bool +Value::isValidIndex( UInt index ) const +{ + return index < size(); +} + + + +const Value & +Value::operator[]( const char *key ) const +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, CZString::noDuplication ); + ObjectValues::const_iterator it = value_.map_->find( actualKey ); + if ( it == value_.map_->end() ) + return null; + return (*it).second; +#else + const Value *value = value_.map_->find( key ); + return value ? *value : null; +#endif +} + + +Value & +Value::operator[]( const std::string &key ) +{ + return (*this)[ key.c_str() ]; +} + + +const Value & +Value::operator[]( const std::string &key ) const +{ + return (*this)[ key.c_str() ]; +} + +Value & +Value::operator[]( const StaticString &key ) +{ + return resolveReference( key, true ); +} + + +# ifdef JSON_USE_CPPTL +Value & +Value::operator[]( const CppTL::ConstString &key ) +{ + return (*this)[ key.c_str() ]; +} + + +const Value & +Value::operator[]( const CppTL::ConstString &key ) const +{ + return (*this)[ key.c_str() ]; +} +# endif + + +Value & +Value::append( const Value &value ) +{ + return (*this)[size()] = value; +} + + +Value +Value::get( const char *key, + const Value &defaultValue ) const +{ + const Value *value = &((*this)[key]); + return value == &null ? defaultValue : *value; +} + + +Value +Value::get( const std::string &key, + const Value &defaultValue ) const +{ + return get( key.c_str(), defaultValue ); +} + +Value +Value::removeMember( const char* key ) +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, CZString::noDuplication ); + ObjectValues::iterator it = value_.map_->find( actualKey ); + if ( it == value_.map_->end() ) + return null; + Value old(it->second); + value_.map_->erase(it); + return old; +#else + Value *value = value_.map_->find( key ); + if (value){ + Value old(*value); + value_.map_.remove( key ); + return old; + } else { + return null; + } +#endif +} + +Value +Value::removeMember( const std::string &key ) +{ + return removeMember( key.c_str() ); +} + +# ifdef JSON_USE_CPPTL +Value +Value::get( const CppTL::ConstString &key, + const Value &defaultValue ) const +{ + return get( key.c_str(), defaultValue ); +} +# endif + +bool +Value::isMember( const char *key ) const +{ + const Value *value = &((*this)[key]); + return value != &null; +} + + +bool +Value::isMember( const std::string &key ) const +{ + return isMember( key.c_str() ); +} + + +# ifdef JSON_USE_CPPTL +bool +Value::isMember( const CppTL::ConstString &key ) const +{ + return isMember( key.c_str() ); +} +#endif + +Value::Members +Value::getMemberNames() const +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return Value::Members(); + Members members; + members.reserve( value_.map_->size() ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ObjectValues::const_iterator it = value_.map_->begin(); + ObjectValues::const_iterator itEnd = value_.map_->end(); + for ( ; it != itEnd; ++it ) + members.push_back( std::string( (*it).first.c_str() ) ); +#else + ValueInternalMap::IteratorState it; + ValueInternalMap::IteratorState itEnd; + value_.map_->makeBeginIterator( it ); + value_.map_->makeEndIterator( itEnd ); + for ( ; !ValueInternalMap::equals( it, itEnd ); ValueInternalMap::increment(it) ) + members.push_back( std::string( ValueInternalMap::key( it ) ) ); +#endif + return members; +} +// +//# ifdef JSON_USE_CPPTL +//EnumMemberNames +//Value::enumMemberNames() const +//{ +// if ( type_ == objectValue ) +// { +// return CppTL::Enum::any( CppTL::Enum::transform( +// CppTL::Enum::keys( *(value_.map_), CppTL::Type<const CZString &>() ), +// MemberNamesTransform() ) ); +// } +// return EnumMemberNames(); +//} +// +// +//EnumValues +//Value::enumValues() const +//{ +// if ( type_ == objectValue || type_ == arrayValue ) +// return CppTL::Enum::anyValues( *(value_.map_), +// CppTL::Type<const Value &>() ); +// return EnumValues(); +//} +// +//# endif + + +bool +Value::isNull() const +{ + return type_ == nullValue; +} + + +bool +Value::isBool() const +{ + return type_ == booleanValue; +} + + +bool +Value::isInt() const +{ + return type_ == intValue; +} + + +bool +Value::isUInt() const +{ + return type_ == uintValue; +} + + +bool +Value::isIntegral() const +{ + return type_ == intValue + || type_ == uintValue + || type_ == booleanValue; +} + + +bool +Value::isDouble() const +{ + return type_ == realValue; +} + + +bool +Value::isNumeric() const +{ + return isIntegral() || isDouble(); +} + + +bool +Value::isString() const +{ + return type_ == stringValue; +} + + +bool +Value::isArray() const +{ + return type_ == nullValue || type_ == arrayValue; +} + + +bool +Value::isObject() const +{ + return type_ == nullValue || type_ == objectValue; +} + + +void +Value::setComment( const char *comment, + CommentPlacement placement ) +{ + if ( !comments_ ) + comments_ = new CommentInfo[numberOfCommentPlacement]; + comments_[placement].setComment( comment ); +} + + +void +Value::setComment( const std::string &comment, + CommentPlacement placement ) +{ + setComment( comment.c_str(), placement ); +} + + +bool +Value::hasComment( CommentPlacement placement ) const +{ + return comments_ != 0 && comments_[placement].comment_ != 0; +} + +std::string +Value::getComment( CommentPlacement placement ) const +{ + if ( hasComment(placement) ) + return comments_[placement].comment_; + return ""; +} + + +std::string +Value::toStyledString() const +{ + StyledWriter writer; + return writer.write( *this ); +} + + +Value::const_iterator +Value::begin() const +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeBeginIterator( it ); + return const_iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeBeginIterator( it ); + return const_iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return const_iterator( value_.map_->begin() ); + break; +#endif + default: + break; + } + return const_iterator(); +} + +Value::const_iterator +Value::end() const +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeEndIterator( it ); + return const_iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeEndIterator( it ); + return const_iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return const_iterator( value_.map_->end() ); + break; +#endif + default: + break; + } + return const_iterator(); +} + + +Value::iterator +Value::begin() +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeBeginIterator( it ); + return iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeBeginIterator( it ); + return iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return iterator( value_.map_->begin() ); + break; +#endif + default: + break; + } + return iterator(); +} + +Value::iterator +Value::end() +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeEndIterator( it ); + return iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeEndIterator( it ); + return iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return iterator( value_.map_->end() ); + break; +#endif + default: + break; + } + return iterator(); +} + + +// class PathArgument +// ////////////////////////////////////////////////////////////////// + +PathArgument::PathArgument() + : kind_( kindNone ) +{ +} + + +PathArgument::PathArgument( Value::UInt index ) + : index_( index ) + , kind_( kindIndex ) +{ +} + + +PathArgument::PathArgument( const char *key ) + : key_( key ) + , kind_( kindKey ) +{ +} + + +PathArgument::PathArgument( const std::string &key ) + : key_( key.c_str() ) + , kind_( kindKey ) +{ +} + +// class Path +// ////////////////////////////////////////////////////////////////// + +Path::Path( const std::string &path, + const PathArgument &a1, + const PathArgument &a2, + const PathArgument &a3, + const PathArgument &a4, + const PathArgument &a5 ) +{ + InArgs in; + in.push_back( &a1 ); + in.push_back( &a2 ); + in.push_back( &a3 ); + in.push_back( &a4 ); + in.push_back( &a5 ); + makePath( path, in ); +} + + +void +Path::makePath( const std::string &path, + const InArgs &in ) +{ + const char *current = path.c_str(); + const char *end = current + path.length(); + InArgs::const_iterator itInArg = in.begin(); + while ( current != end ) + { + if ( *current == '[' ) + { + ++current; + if ( *current == '%' ) + addPathInArg( path, in, itInArg, PathArgument::kindIndex ); + else + { + Value::UInt index = 0; + for ( ; current != end && *current >= '0' && *current <= '9'; ++current ) + index = index * 10 + Value::UInt(*current - '0'); + args_.push_back( index ); + } + if ( current == end || *current++ != ']' ) + invalidPath( path, int(current - path.c_str()) ); + } + else if ( *current == '%' ) + { + addPathInArg( path, in, itInArg, PathArgument::kindKey ); + ++current; + } + else if ( *current == '.' ) + { + ++current; + } + else + { + const char *beginName = current; + while ( current != end && !strchr( "[.", *current ) ) + ++current; + args_.push_back( std::string( beginName, current ) ); + } + } +} + + +void +Path::addPathInArg( const std::string &path, + const InArgs &in, + InArgs::const_iterator &itInArg, + PathArgument::Kind kind ) +{ + if ( itInArg == in.end() ) + { + // Error: missing argument %d + } + else if ( (*itInArg)->kind_ != kind ) + { + // Error: bad argument type + } + else + { + args_.push_back( **itInArg ); + } +} + + +void +Path::invalidPath( const std::string &path, + int location ) +{ + // Error: invalid path. +} + + +const Value & +Path::resolve( const Value &root ) const +{ + const Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) + { + // Error: unable to resolve path (array value expected at position... + } + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + { + // Error: unable to resolve path (object value expected at position...) + } + node = &((*node)[arg.key_]); + if ( node == &Value::null ) + { + // Error: unable to resolve path (object has no member named '' at position...) + } + } + } + return *node; +} + + +Value +Path::resolve( const Value &root, + const Value &defaultValue ) const +{ + const Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) + return defaultValue; + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + return defaultValue; + node = &((*node)[arg.key_]); + if ( node == &Value::null ) + return defaultValue; + } + } + return *node; +} + + +Value & +Path::make( Value &root ) const +{ + Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() ) + { + // Error: node is not an array at position ... + } + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + { + // Error: node is not an object at position... + } + node = &((*node)[arg.key_]); + } + } + return *node; +} + + +} // namespace Json diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_valueiterator.inl b/jsoncpp-src-0.5.0/src/lib_json/json_valueiterator.inl new file mode 100644 index 000000000..736e260ea --- /dev/null +++ b/jsoncpp-src-0.5.0/src/lib_json/json_valueiterator.inl @@ -0,0 +1,292 @@ +// included by json_value.cpp +// everything is within Json namespace + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIteratorBase +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIteratorBase::ValueIteratorBase() +#ifndef JSON_VALUE_USE_INTERNAL_MAP + : current_() + , isNull_( true ) +{ +} +#else + : isArray_( true ) + , isNull_( true ) +{ + iterator_.array_ = ValueInternalArray::IteratorState(); +} +#endif + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueIteratorBase::ValueIteratorBase( const Value::ObjectValues::iterator ¤t ) + : current_( current ) + , isNull_( false ) +{ +} +#else +ValueIteratorBase::ValueIteratorBase( const ValueInternalArray::IteratorState &state ) + : isArray_( true ) +{ + iterator_.array_ = state; +} + + +ValueIteratorBase::ValueIteratorBase( const ValueInternalMap::IteratorState &state ) + : isArray_( false ) +{ + iterator_.map_ = state; +} +#endif + +Value & +ValueIteratorBase::deref() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + return current_->second; +#else + if ( isArray_ ) + return ValueInternalArray::dereference( iterator_.array_ ); + return ValueInternalMap::value( iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::increment() +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ++current_; +#else + if ( isArray_ ) + ValueInternalArray::increment( iterator_.array_ ); + ValueInternalMap::increment( iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::decrement() +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + --current_; +#else + if ( isArray_ ) + ValueInternalArray::decrement( iterator_.array_ ); + ValueInternalMap::decrement( iterator_.map_ ); +#endif +} + + +ValueIteratorBase::difference_type +ValueIteratorBase::computeDistance( const SelfType &other ) const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP +# ifdef JSON_USE_CPPTL_SMALLMAP + return current_ - other.current_; +# else + // Iterator for null value are initialized using the default + // constructor, which initialize current_ to the default + // std::map::iterator. As begin() and end() are two instance + // of the default std::map::iterator, they can not be compared. + // To allow this, we handle this comparison specifically. + if ( isNull_ && other.isNull_ ) + { + return 0; + } + + + // Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL, + // which is the one used by default). + // Using a portable hand-made version for non random iterator instead: + // return difference_type( std::distance( current_, other.current_ ) ); + difference_type myDistance = 0; + for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it ) + { + ++myDistance; + } + return myDistance; +# endif +#else + if ( isArray_ ) + return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ ); + return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ ); +#endif +} + + +bool +ValueIteratorBase::isEqual( const SelfType &other ) const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + if ( isNull_ ) + { + return other.isNull_; + } + return current_ == other.current_; +#else + if ( isArray_ ) + return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ ); + return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::copy( const SelfType &other ) +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + current_ = other.current_; +#else + if ( isArray_ ) + iterator_.array_ = other.iterator_.array_; + iterator_.map_ = other.iterator_.map_; +#endif +} + + +Value +ValueIteratorBase::key() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const Value::CZString czstring = (*current_).first; + if ( czstring.c_str() ) + { + if ( czstring.isStaticString() ) + return Value( StaticString( czstring.c_str() ) ); + return Value( czstring.c_str() ); + } + return Value( czstring.index() ); +#else + if ( isArray_ ) + return Value( ValueInternalArray::indexOf( iterator_.array_ ) ); + bool isStatic; + const char *memberName = ValueInternalMap::key( iterator_.map_, isStatic ); + if ( isStatic ) + return Value( StaticString( memberName ) ); + return Value( memberName ); +#endif +} + + +UInt +ValueIteratorBase::index() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const Value::CZString czstring = (*current_).first; + if ( !czstring.c_str() ) + return czstring.index(); + return Value::UInt( -1 ); +#else + if ( isArray_ ) + return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) ); + return Value::UInt( -1 ); +#endif +} + + +const char * +ValueIteratorBase::memberName() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const char *name = (*current_).first.c_str(); + return name ? name : ""; +#else + if ( !isArray_ ) + return ValueInternalMap::key( iterator_.map_ ); + return ""; +#endif +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueConstIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueConstIterator::ValueConstIterator() +{ +} + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueConstIterator::ValueConstIterator( const Value::ObjectValues::iterator ¤t ) + : ValueIteratorBase( current ) +{ +} +#else +ValueConstIterator::ValueConstIterator( const ValueInternalArray::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} + +ValueConstIterator::ValueConstIterator( const ValueInternalMap::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} +#endif + +ValueConstIterator & +ValueConstIterator::operator =( const ValueIteratorBase &other ) +{ + copy( other ); + return *this; +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIterator::ValueIterator() +{ +} + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueIterator::ValueIterator( const Value::ObjectValues::iterator ¤t ) + : ValueIteratorBase( current ) +{ +} +#else +ValueIterator::ValueIterator( const ValueInternalArray::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} + +ValueIterator::ValueIterator( const ValueInternalMap::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} +#endif + +ValueIterator::ValueIterator( const ValueConstIterator &other ) + : ValueIteratorBase( other ) +{ +} + +ValueIterator::ValueIterator( const ValueIterator &other ) + : ValueIteratorBase( other ) +{ +} + +ValueIterator & +ValueIterator::operator =( const SelfType &other ) +{ + copy( other ); + return *this; +} diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp b/jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp new file mode 100644 index 000000000..cdf4188f2 --- /dev/null +++ b/jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp @@ -0,0 +1,829 @@ +#include <json/writer.h> +#include <utility> +#include <assert.h> +#include <stdio.h> +#include <string.h> +#include <iostream> +#include <sstream> +#include <iomanip> + +#if _MSC_VER >= 1400 // VC++ 8.0 +#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. +#endif + +namespace Json { + +static bool isControlCharacter(char ch) +{ + return ch > 0 && ch <= 0x1F; +} + +static bool containsControlCharacter( const char* str ) +{ + while ( *str ) + { + if ( isControlCharacter( *(str++) ) ) + return true; + } + return false; +} +static void uintToString( unsigned int value, + char *¤t ) +{ + *--current = 0; + do + { + *--current = (value % 10) + '0'; + value /= 10; + } + while ( value != 0 ); +} + +std::string valueToString( Int value ) +{ + char buffer[32]; + char *current = buffer + sizeof(buffer); + bool isNegative = value < 0; + if ( isNegative ) + value = -value; + uintToString( UInt(value), current ); + if ( isNegative ) + *--current = '-'; + assert( current >= buffer ); + return current; +} + + +std::string valueToString( UInt value ) +{ + char buffer[32]; + char *current = buffer + sizeof(buffer); + uintToString( value, current ); + assert( current >= buffer ); + return current; +} + +std::string valueToString( double value ) +{ + char buffer[32]; +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning. + sprintf_s(buffer, sizeof(buffer), "%#.16g", value); +#else + sprintf(buffer, "%#.16g", value); +#endif + char* ch = buffer + strlen(buffer) - 1; + if (*ch != '0') return buffer; // nothing to truncate, so save time + while(ch > buffer && *ch == '0'){ + --ch; + } + char* last_nonzero = ch; + while(ch >= buffer){ + switch(*ch){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + --ch; + continue; + case '.': + // Truncate zeroes to save bytes in output, but keep one. + *(last_nonzero+2) = '\0'; + return buffer; + default: + return buffer; + } + } + return buffer; +} + + +std::string valueToString( bool value ) +{ + return value ? "true" : "false"; +} + +std::string valueToQuotedString( const char *value ) +{ + // Not sure how to handle unicode... + if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value )) + return std::string("\"") + value + "\""; + // We have to walk value and escape any special characters. + // Appending to std::string is not efficient, but this should be rare. + // (Note: forward slashes are *not* rare, but I am not escaping them.) + unsigned maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL + std::string result; + result.reserve(maxsize); // to avoid lots of mallocs + result += "\""; + for (const char* c=value; *c != 0; ++c) + { + switch(*c) + { + case '\"': + result += "\\\""; + break; + case '\\': + result += "\\\\"; + break; + case '\b': + result += "\\b"; + break; + case '\f': + result += "\\f"; + break; + case '\n': + result += "\\n"; + break; + case '\r': + result += "\\r"; + break; + case '\t': + result += "\\t"; + break; + //case '/': + // Even though \/ is considered a legal escape in JSON, a bare + // slash is also legal, so I see no reason to escape it. + // (I hope I am not misunderstanding something. + // blep notes: actually escaping \/ may be useful in javascript to avoid </ + // sequence. + // Should add a flag to allow this compatibility mode and prevent this + // sequence from occurring. + default: + if ( isControlCharacter( *c ) ) + { + std::ostringstream oss; + oss << "\\u" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << static_cast<int>(*c); + result += oss.str(); + } + else + { + result += *c; + } + break; + } + } + result += "\""; + return result; +} + +// Class Writer +// ////////////////////////////////////////////////////////////////// +Writer::~Writer() +{ +} + + +// Class FastWriter +// ////////////////////////////////////////////////////////////////// + +FastWriter::FastWriter() + : yamlCompatiblityEnabled_( false ) +{ +} + + +void +FastWriter::enableYAMLCompatibility() +{ + yamlCompatiblityEnabled_ = true; +} + + +std::string +FastWriter::write( const Value &root ) +{ + document_ = ""; + writeValue( root ); + document_ += "\n"; + return document_; +} + + +void +FastWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + document_ += "null"; + break; + case intValue: + document_ += valueToString( value.asInt() ); + break; + case uintValue: + document_ += valueToString( value.asUInt() ); + break; + case realValue: + document_ += valueToString( value.asDouble() ); + break; + case stringValue: + document_ += valueToQuotedString( value.asCString() ); + break; + case booleanValue: + document_ += valueToString( value.asBool() ); + break; + case arrayValue: + { + document_ += "["; + int size = value.size(); + for ( int index =0; index < size; ++index ) + { + if ( index > 0 ) + document_ += ","; + writeValue( value[index] ); + } + document_ += "]"; + } + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + document_ += "{"; + for ( Value::Members::iterator it = members.begin(); + it != members.end(); + ++it ) + { + const std::string &name = *it; + if ( it != members.begin() ) + document_ += ","; + document_ += valueToQuotedString( name.c_str() ); + document_ += yamlCompatiblityEnabled_ ? ": " + : ":"; + writeValue( value[name] ); + } + document_ += "}"; + } + break; + } +} + + +// Class StyledWriter +// ////////////////////////////////////////////////////////////////// + +StyledWriter::StyledWriter() + : rightMargin_( 74 ) + , indentSize_( 3 ) +{ +} + + +std::string +StyledWriter::write( const Value &root ) +{ + document_ = ""; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue( root ); + writeValue( root ); + writeCommentAfterValueOnSameLine( root ); + document_ += "\n"; + return document_; +} + + +void +StyledWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + pushValue( "null" ); + break; + case intValue: + pushValue( valueToString( value.asInt() ) ); + break; + case uintValue: + pushValue( valueToString( value.asUInt() ) ); + break; + case realValue: + pushValue( valueToString( value.asDouble() ) ); + break; + case stringValue: + pushValue( valueToQuotedString( value.asCString() ) ); + break; + case booleanValue: + pushValue( valueToString( value.asBool() ) ); + break; + case arrayValue: + writeArrayValue( value); + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + if ( members.empty() ) + pushValue( "{}" ); + else + { + writeWithIndent( "{" ); + indent(); + Value::Members::iterator it = members.begin(); + while ( true ) + { + const std::string &name = *it; + const Value &childValue = value[name]; + writeCommentBeforeValue( childValue ); + writeWithIndent( valueToQuotedString( name.c_str() ) ); + document_ += " : "; + writeValue( childValue ); + if ( ++it == members.end() ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + document_ += ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "}" ); + } + } + break; + } +} + + +void +StyledWriter::writeArrayValue( const Value &value ) +{ + unsigned size = value.size(); + if ( size == 0 ) + pushValue( "[]" ); + else + { + bool isArrayMultiLine = isMultineArray( value ); + if ( isArrayMultiLine ) + { + writeWithIndent( "[" ); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index =0; + while ( true ) + { + const Value &childValue = value[index]; + writeCommentBeforeValue( childValue ); + if ( hasChildValue ) + writeWithIndent( childValues_[index] ); + else + { + writeIndent(); + writeValue( childValue ); + } + if ( ++index == size ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + document_ += ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "]" ); + } + else // output on a single line + { + assert( childValues_.size() == size ); + document_ += "[ "; + for ( unsigned index =0; index < size; ++index ) + { + if ( index > 0 ) + document_ += ", "; + document_ += childValues_[index]; + } + document_ += " ]"; + } + } +} + + +bool +StyledWriter::isMultineArray( const Value &value ) +{ + int size = value.size(); + bool isMultiLine = size*3 >= rightMargin_ ; + childValues_.clear(); + for ( int index =0; index < size && !isMultiLine; ++index ) + { + const Value &childValue = value[index]; + isMultiLine = isMultiLine || + ( (childValue.isArray() || childValue.isObject()) && + childValue.size() > 0 ); + } + if ( !isMultiLine ) // check if line length > max line length + { + childValues_.reserve( size ); + addChildValues_ = true; + int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' + for ( int index =0; index < size && !isMultiLine; ++index ) + { + writeValue( value[index] ); + lineLength += int( childValues_[index].length() ); + isMultiLine = isMultiLine && hasCommentForValue( value[index] ); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + + +void +StyledWriter::pushValue( const std::string &value ) +{ + if ( addChildValues_ ) + childValues_.push_back( value ); + else + document_ += value; +} + + +void +StyledWriter::writeIndent() +{ + if ( !document_.empty() ) + { + char last = document_[document_.length()-1]; + if ( last == ' ' ) // already indented + return; + if ( last != '\n' ) // Comments may add new-line + document_ += '\n'; + } + document_ += indentString_; +} + + +void +StyledWriter::writeWithIndent( const std::string &value ) +{ + writeIndent(); + document_ += value; +} + + +void +StyledWriter::indent() +{ + indentString_ += std::string( indentSize_, ' ' ); +} + + +void +StyledWriter::unindent() +{ + assert( int(indentString_.size()) >= indentSize_ ); + indentString_.resize( indentString_.size() - indentSize_ ); +} + + +void +StyledWriter::writeCommentBeforeValue( const Value &root ) +{ + if ( !root.hasComment( commentBefore ) ) + return; + document_ += normalizeEOL( root.getComment( commentBefore ) ); + document_ += "\n"; +} + + +void +StyledWriter::writeCommentAfterValueOnSameLine( const Value &root ) +{ + if ( root.hasComment( commentAfterOnSameLine ) ) + document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); + + if ( root.hasComment( commentAfter ) ) + { + document_ += "\n"; + document_ += normalizeEOL( root.getComment( commentAfter ) ); + document_ += "\n"; + } +} + + +bool +StyledWriter::hasCommentForValue( const Value &value ) +{ + return value.hasComment( commentBefore ) + || value.hasComment( commentAfterOnSameLine ) + || value.hasComment( commentAfter ); +} + + +std::string +StyledWriter::normalizeEOL( const std::string &text ) +{ + std::string normalized; + normalized.reserve( text.length() ); + const char *begin = text.c_str(); + const char *end = begin + text.length(); + const char *current = begin; + while ( current != end ) + { + char c = *current++; + if ( c == '\r' ) // mac or dos EOL + { + if ( *current == '\n' ) // convert dos EOL + ++current; + normalized += '\n'; + } + else // handle unix EOL & other char + normalized += c; + } + return normalized; +} + + +// Class StyledStreamWriter +// ////////////////////////////////////////////////////////////////// + +StyledStreamWriter::StyledStreamWriter( std::string indentation ) + : document_(NULL) + , rightMargin_( 74 ) + , indentation_( indentation ) +{ +} + + +void +StyledStreamWriter::write( std::ostream &out, const Value &root ) +{ + document_ = &out; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue( root ); + writeValue( root ); + writeCommentAfterValueOnSameLine( root ); + *document_ << "\n"; + document_ = NULL; // Forget the stream, for safety. +} + + +void +StyledStreamWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + pushValue( "null" ); + break; + case intValue: + pushValue( valueToString( value.asInt() ) ); + break; + case uintValue: + pushValue( valueToString( value.asUInt() ) ); + break; + case realValue: + pushValue( valueToString( value.asDouble() ) ); + break; + case stringValue: + pushValue( valueToQuotedString( value.asCString() ) ); + break; + case booleanValue: + pushValue( valueToString( value.asBool() ) ); + break; + case arrayValue: + writeArrayValue( value); + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + if ( members.empty() ) + pushValue( "{}" ); + else + { + writeWithIndent( "{" ); + indent(); + Value::Members::iterator it = members.begin(); + while ( true ) + { + const std::string &name = *it; + const Value &childValue = value[name]; + writeCommentBeforeValue( childValue ); + writeWithIndent( valueToQuotedString( name.c_str() ) ); + *document_ << " : "; + writeValue( childValue ); + if ( ++it == members.end() ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "}" ); + } + } + break; + } +} + + +void +StyledStreamWriter::writeArrayValue( const Value &value ) +{ + unsigned size = value.size(); + if ( size == 0 ) + pushValue( "[]" ); + else + { + bool isArrayMultiLine = isMultineArray( value ); + if ( isArrayMultiLine ) + { + writeWithIndent( "[" ); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index =0; + while ( true ) + { + const Value &childValue = value[index]; + writeCommentBeforeValue( childValue ); + if ( hasChildValue ) + writeWithIndent( childValues_[index] ); + else + { + writeIndent(); + writeValue( childValue ); + } + if ( ++index == size ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "]" ); + } + else // output on a single line + { + assert( childValues_.size() == size ); + *document_ << "[ "; + for ( unsigned index =0; index < size; ++index ) + { + if ( index > 0 ) + *document_ << ", "; + *document_ << childValues_[index]; + } + *document_ << " ]"; + } + } +} + + +bool +StyledStreamWriter::isMultineArray( const Value &value ) +{ + int size = value.size(); + bool isMultiLine = size*3 >= rightMargin_ ; + childValues_.clear(); + for ( int index =0; index < size && !isMultiLine; ++index ) + { + const Value &childValue = value[index]; + isMultiLine = isMultiLine || + ( (childValue.isArray() || childValue.isObject()) && + childValue.size() > 0 ); + } + if ( !isMultiLine ) // check if line length > max line length + { + childValues_.reserve( size ); + addChildValues_ = true; + int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' + for ( int index =0; index < size && !isMultiLine; ++index ) + { + writeValue( value[index] ); + lineLength += int( childValues_[index].length() ); + isMultiLine = isMultiLine && hasCommentForValue( value[index] ); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + + +void +StyledStreamWriter::pushValue( const std::string &value ) +{ + if ( addChildValues_ ) + childValues_.push_back( value ); + else + *document_ << value; +} + + +void +StyledStreamWriter::writeIndent() +{ + /* + Some comments in this method would have been nice. ;-) + + if ( !document_.empty() ) + { + char last = document_[document_.length()-1]; + if ( last == ' ' ) // already indented + return; + if ( last != '\n' ) // Comments may add new-line + *document_ << '\n'; + } + */ + *document_ << '\n' << indentString_; +} + + +void +StyledStreamWriter::writeWithIndent( const std::string &value ) +{ + writeIndent(); + *document_ << value; +} + + +void +StyledStreamWriter::indent() +{ + indentString_ += indentation_; +} + + +void +StyledStreamWriter::unindent() +{ + assert( indentString_.size() >= indentation_.size() ); + indentString_.resize( indentString_.size() - indentation_.size() ); +} + + +void +StyledStreamWriter::writeCommentBeforeValue( const Value &root ) +{ + if ( !root.hasComment( commentBefore ) ) + return; + *document_ << normalizeEOL( root.getComment( commentBefore ) ); + *document_ << "\n"; +} + + +void +StyledStreamWriter::writeCommentAfterValueOnSameLine( const Value &root ) +{ + if ( root.hasComment( commentAfterOnSameLine ) ) + *document_ << " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); + + if ( root.hasComment( commentAfter ) ) + { + *document_ << "\n"; + *document_ << normalizeEOL( root.getComment( commentAfter ) ); + *document_ << "\n"; + } +} + + +bool +StyledStreamWriter::hasCommentForValue( const Value &value ) +{ + return value.hasComment( commentBefore ) + || value.hasComment( commentAfterOnSameLine ) + || value.hasComment( commentAfter ); +} + + +std::string +StyledStreamWriter::normalizeEOL( const std::string &text ) +{ + std::string normalized; + normalized.reserve( text.length() ); + const char *begin = text.c_str(); + const char *end = begin + text.length(); + const char *current = begin; + while ( current != end ) + { + char c = *current++; + if ( c == '\r' ) // mac or dos EOL + { + if ( *current == '\n' ) // convert dos EOL + ++current; + normalized += '\n'; + } + else // handle unix EOL & other char + normalized += c; + } + return normalized; +} + + +std::ostream& operator<<( std::ostream &sout, const Value &root ) +{ + Json::StyledStreamWriter writer; + writer.write(sout, root); + return sout; +} + + +} // namespace Json diff --git a/jsoncpp-src-0.5.0/src/lib_json/sconscript b/jsoncpp-src-0.5.0/src/lib_json/sconscript new file mode 100644 index 000000000..f6520d185 --- /dev/null +++ b/jsoncpp-src-0.5.0/src/lib_json/sconscript @@ -0,0 +1,8 @@ +Import( 'env buildLibrary' )
+
+buildLibrary( env, Split( """
+ json_reader.cpp
+ json_value.cpp
+ json_writer.cpp
+ """ ),
+ 'json' )
diff --git a/lua-5.1.4/COPYRIGHT b/lua-5.1.4/COPYRIGHT new file mode 100644 index 000000000..3a53e741e --- /dev/null +++ b/lua-5.1.4/COPYRIGHT @@ -0,0 +1,34 @@ +Lua License +----------- + +Lua is licensed under the terms of the MIT license reproduced below. +This means that Lua is free software and can be used for both academic +and commercial purposes at absolutely no cost. + +For details and rationale, see http://www.lua.org/license.html . + +=============================================================================== + +Copyright (C) 1994-2008 Lua.org, PUC-Rio. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +=============================================================================== + +(end of COPYRIGHT) diff --git a/lua-5.1.4/HISTORY b/lua-5.1.4/HISTORY new file mode 100644 index 000000000..ce0c95bc6 --- /dev/null +++ b/lua-5.1.4/HISTORY @@ -0,0 +1,183 @@ +HISTORY for Lua 5.1 + +* Changes from version 5.0 to 5.1 + ------------------------------- + Language: + + new module system. + + new semantics for control variables of fors. + + new semantics for setn/getn. + + new syntax/semantics for varargs. + + new long strings and comments. + + new `mod' operator (`%') + + new length operator #t + + metatables for all types + API: + + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer. + + user supplies memory allocator (lua_open becomes lua_newstate). + + luaopen_* functions must be called through Lua. + Implementation: + + new configuration scheme via luaconf.h. + + incremental garbage collection. + + better handling of end-of-line in the lexer. + + fully reentrant parser (new Lua function `load') + + better support for 64-bit machines. + + native loadlib support for Mac OS X. + + standard distribution in only one library (lualib.a merged into lua.a) + +* Changes from version 4.0 to 5.0 + ------------------------------- + Language: + + lexical scoping. + + Lua coroutines. + + standard libraries now packaged in tables. + + tags replaced by metatables and tag methods replaced by metamethods, + stored in metatables. + + proper tail calls. + + each function can have its own global table, which can be shared. + + new __newindex metamethod, called when we insert a new key into a table. + + new block comments: --[[ ... ]]. + + new generic for. + + new weak tables. + + new boolean type. + + new syntax "local function". + + (f()) returns the first value returned by f. + + {f()} fills a table with all values returned by f. + + \n ignored in [[\n . + + fixed and-or priorities. + + more general syntax for function definition (e.g. function a.x.y:f()...end). + + more general syntax for function calls (e.g. (print or write)(9)). + + new functions (time/date, tmpfile, unpack, require, load*, etc.). + API: + + chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer. + + introduced lightweight userdata, a simple "void*" without a metatable. + + new error handling protocol: the core no longer prints error messages; + all errors are reported to the caller on the stack. + + new lua_atpanic for host cleanup. + + new, signal-safe, hook scheme. + Implementation: + + new license: MIT. + + new, faster, register-based virtual machine. + + support for external multithreading and coroutines. + + new and consistent error message format. + + the core no longer needs "stdio.h" for anything (except for a single + use of sprintf to convert numbers to strings). + + lua.c now runs the environment variable LUA_INIT, if present. It can + be "@filename", to run a file, or the chunk itself. + + support for user extensions in lua.c. + sample implementation given for command line editing. + + new dynamic loading library, active by default on several platforms. + + safe garbage-collector metamethods. + + precompiled bytecodes checked for integrity (secure binary dostring). + + strings are fully aligned. + + position capture in string.find. + + read('*l') can read lines with embedded zeros. + +* Changes from version 3.2 to 4.0 + ------------------------------- + Language: + + new "break" and "for" statements (both numerical and for tables). + + uniform treatment of globals: globals are now stored in a Lua table. + + improved error messages. + + no more '$debug': full speed *and* full debug information. + + new read form: read(N) for next N bytes. + + general read patterns now deprecated. + (still available with -DCOMPAT_READPATTERNS.) + + all return values are passed as arguments for the last function + (old semantics still available with -DLUA_COMPAT_ARGRET) + + garbage collection tag methods for tables now deprecated. + + there is now only one tag method for order. + API: + + New API: fully re-entrant, simpler, and more efficient. + + New debug API. + Implementation: + + faster than ever: cleaner virtual machine and new hashing algorithm. + + non-recursive garbage-collector algorithm. + + reduced memory usage for programs with many strings. + + improved treatment for memory allocation errors. + + improved support for 16-bit machines (we hope). + + code now compiles unmodified as both ANSI C and C++. + + numbers in bases other than 10 are converted using strtoul. + + new -f option in Lua to support #! scripts. + + luac can now combine text and binaries. + +* Changes from version 3.1 to 3.2 + ------------------------------- + + redirected all output in Lua's core to _ERRORMESSAGE and _ALERT. + + increased limit on the number of constants and globals per function + (from 2^16 to 2^24). + + debugging info (lua_debug and hooks) moved into lua_state and new API + functions provided to get and set this info. + + new debug lib gives full debugging access within Lua. + + new table functions "foreachi", "sort", "tinsert", "tremove", "getn". + + new io functions "flush", "seek". + +* Changes from version 3.0 to 3.1 + ------------------------------- + + NEW FEATURE: anonymous functions with closures (via "upvalues"). + + new syntax: + - local variables in chunks. + - better scope control with DO block END. + - constructors can now be also written: { record-part; list-part }. + - more general syntax for function calls and lvalues, e.g.: + f(x).y=1 + o:f(x,y):g(z) + f"string" is sugar for f("string") + + strings may now contain arbitrary binary data (e.g., embedded zeros). + + major code re-organization and clean-up; reduced module interdependecies. + + no arbitrary limits on the total number of constants and globals. + + support for multiple global contexts. + + better syntax error messages. + + new traversal functions "foreach" and "foreachvar". + + the default for numbers is now double. + changing it to use floats or longs is easy. + + complete debug information stored in pre-compiled chunks. + + sample interpreter now prompts user when run interactively, and also + handles control-C interruptions gracefully. + +* Changes from version 2.5 to 3.0 + ------------------------------- + + NEW CONCEPT: "tag methods". + Tag methods replace fallbacks as the meta-mechanism for extending the + semantics of Lua. Whereas fallbacks had a global nature, tag methods + work on objects having the same tag (e.g., groups of tables). + Existing code that uses fallbacks should work without change. + + new, general syntax for constructors {[exp] = exp, ... }. + + support for handling variable number of arguments in functions (varargs). + + support for conditional compilation ($if ... $else ... $end). + + cleaner semantics in API simplifies host code. + + better support for writing libraries (auxlib.h). + + better type checking and error messages in the standard library. + + luac can now also undump. + +* Changes from version 2.4 to 2.5 + ------------------------------- + + io and string libraries are now based on pattern matching; + the old libraries are still available for compatibility + + dofile and dostring can now return values (via return statement) + + better support for 16- and 64-bit machines + + expanded documentation, with more examples + +* Changes from version 2.2 to 2.4 + ------------------------------- + + external compiler creates portable binary files that can be loaded faster + + interface for debugging and profiling + + new "getglobal" fallback + + new functions for handling references to Lua objects + + new functions in standard lib + + only one copy of each string is stored + + expanded documentation, with more examples + +* Changes from version 2.1 to 2.2 + ------------------------------- + + functions now may be declared with any "lvalue" as a name + + garbage collection of functions + + support for pipes + +* Changes from version 1.1 to 2.1 + ------------------------------- + + object-oriented support + + fallbacks + + simplified syntax for tables + + many internal improvements + +(end of HISTORY) diff --git a/lua-5.1.4/INSTALL b/lua-5.1.4/INSTALL new file mode 100644 index 000000000..17eb8aee8 --- /dev/null +++ b/lua-5.1.4/INSTALL @@ -0,0 +1,99 @@ +INSTALL for Lua 5.1 + +* Building Lua + ------------ + Lua is built in the src directory, but the build process can be + controlled from the top-level Makefile. + + Building Lua on Unix systems should be very easy. First do "make" and + see if your platform is listed. If so, just do "make xxx", where xxx + is your platform name. The platforms currently supported are: + aix ansi bsd freebsd generic linux macosx mingw posix solaris + + If your platform is not listed, try the closest one or posix, generic, + ansi, in this order. + + See below for customization instructions and for instructions on how + to build with other Windows compilers. + + If you want to check that Lua has been built correctly, do "make test" + after building Lua. Also, have a look at the example programs in test. + +* Installing Lua + -------------- + Once you have built Lua, you may want to install it in an official + place in your system. In this case, do "make install". The official + place and the way to install files are defined in Makefile. You must + have the right permissions to install files. + + If you want to build and install Lua in one step, do "make xxx install", + where xxx is your platform name. + + If you want to install Lua locally, then do "make local". This will + create directories bin, include, lib, man, and install Lua there as + follows: + + bin: lua luac + include: lua.h luaconf.h lualib.h lauxlib.h lua.hpp + lib: liblua.a + man/man1: lua.1 luac.1 + + These are the only directories you need for development. + + There are man pages for lua and luac, in both nroff and html, and a + reference manual in html in doc, some sample code in test, and some + useful stuff in etc. You don't need these directories for development. + + If you want to install Lua locally, but in some other directory, do + "make install INSTALL_TOP=xxx", where xxx is your chosen directory. + + See below for instructions for Windows and other systems. + +* Customization + ------------- + Three things can be customized by editing a file: + - Where and how to install Lua -- edit Makefile. + - How to build Lua -- edit src/Makefile. + - Lua features -- edit src/luaconf.h. + + You don't actually need to edit the Makefiles because you may set the + relevant variables when invoking make. + + On the other hand, if you need to select some Lua features, you'll need + to edit src/luaconf.h. The edited file will be the one installed, and + it will be used by any Lua clients that you build, to ensure consistency. + + We strongly recommend that you enable dynamic loading. This is done + automatically for all platforms listed above that have this feature + (and also Windows). See src/luaconf.h and also src/Makefile. + +* Building Lua on Windows and other systems + ----------------------------------------- + If you're not using the usual Unix tools, then the instructions for + building Lua depend on the compiler you use. You'll need to create + projects (or whatever your compiler uses) for building the library, + the interpreter, and the compiler, as follows: + + library: lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c + lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c + ltable.c ltm.c lundump.c lvm.c lzio.c + lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c + ltablib.c lstrlib.c loadlib.c linit.c + + interpreter: library, lua.c + + compiler: library, luac.c print.c + + If you use Visual Studio .NET, you can use etc/luavs.bat in its + "Command Prompt". + + If all you want is to build the Lua interpreter, you may put all .c files + in a single project, except for luac.c and print.c. Or just use etc/all.c. + + To use Lua as a library in your own programs, you'll need to know how to + create and use libraries with your compiler. + + As mentioned above, you may edit luaconf.h to select some features before + building Lua. + +(end of INSTALL) diff --git a/lua-5.1.4/Makefile b/lua-5.1.4/Makefile new file mode 100644 index 000000000..6e78f66fa --- /dev/null +++ b/lua-5.1.4/Makefile @@ -0,0 +1,128 @@ +# makefile for installing Lua +# see INSTALL for installation instructions +# see src/Makefile and src/luaconf.h for further customization + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +# Where to install. The installation starts in the src and doc directories, +# so take care if INSTALL_TOP is not an absolute path. +INSTALL_TOP= /usr/local +INSTALL_BIN= $(INSTALL_TOP)/bin +INSTALL_INC= $(INSTALL_TOP)/include +INSTALL_LIB= $(INSTALL_TOP)/lib +INSTALL_MAN= $(INSTALL_TOP)/man/man1 +# +# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with +# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc). +INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V +INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V + +# How to install. If your install program does not support "-p", then you +# may have to run ranlib on the installed liblua.a (do "make ranlib"). +INSTALL= install -p +INSTALL_EXEC= $(INSTALL) -m 0755 +INSTALL_DATA= $(INSTALL) -m 0644 +# +# If you don't have install you can use cp instead. +# INSTALL= cp -p +# INSTALL_EXEC= $(INSTALL) +# INSTALL_DATA= $(INSTALL) + +# Utilities. +MKDIR= mkdir -p +RANLIB= ranlib + +# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= + +# Convenience platforms targets. +PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +# What to install. +TO_BIN= lua luac +TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp +TO_LIB= liblua.a +TO_MAN= lua.1 luac.1 + +# Lua version and release. +V= 5.1 +R= 5.1.4 + +all: $(PLAT) + +$(PLATS) clean: + cd src && $(MAKE) $@ + +test: dummy + src/lua test/hello.lua + +install: dummy + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) + cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) + cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) + cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) + +ranlib: + cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB) + +local: + $(MAKE) install INSTALL_TOP=.. + +none: + @echo "Please do" + @echo " make PLATFORM" + @echo "where PLATFORM is one of these:" + @echo " $(PLATS)" + @echo "See INSTALL for complete instructions." + +# make may get confused with test/ and INSTALL in a case-insensitive OS +dummy: + +# echo config parameters +echo: + @echo "" + @echo "These are the parameters currently set in src/Makefile to build Lua $R:" + @echo "" + @cd src && $(MAKE) -s echo + @echo "" + @echo "These are the parameters currently set in Makefile to install Lua $R:" + @echo "" + @echo "PLAT = $(PLAT)" + @echo "INSTALL_TOP = $(INSTALL_TOP)" + @echo "INSTALL_BIN = $(INSTALL_BIN)" + @echo "INSTALL_INC = $(INSTALL_INC)" + @echo "INSTALL_LIB = $(INSTALL_LIB)" + @echo "INSTALL_MAN = $(INSTALL_MAN)" + @echo "INSTALL_LMOD = $(INSTALL_LMOD)" + @echo "INSTALL_CMOD = $(INSTALL_CMOD)" + @echo "INSTALL_EXEC = $(INSTALL_EXEC)" + @echo "INSTALL_DATA = $(INSTALL_DATA)" + @echo "" + @echo "See also src/luaconf.h ." + @echo "" + +# echo private config parameters +pecho: + @echo "V = $(V)" + @echo "R = $(R)" + @echo "TO_BIN = $(TO_BIN)" + @echo "TO_INC = $(TO_INC)" + @echo "TO_LIB = $(TO_LIB)" + @echo "TO_MAN = $(TO_MAN)" + +# echo config parameters as Lua code +# uncomment the last sed expression if you want nil instead of empty strings +lecho: + @echo "-- installation parameters for Lua $R" + @echo "VERSION = '$V'" + @echo "RELEASE = '$R'" + @$(MAKE) echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/' + @echo "-- EOF" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho + +# (end of Makefile) diff --git a/lua-5.1.4/README b/lua-5.1.4/README new file mode 100644 index 000000000..11b4dff70 --- /dev/null +++ b/lua-5.1.4/README @@ -0,0 +1,37 @@ +README for Lua 5.1 + +See INSTALL for installation instructions. +See HISTORY for a summary of changes since the last released version. + +* What is Lua? + ------------ + Lua is a powerful, light-weight programming language designed for extending + applications. Lua is also frequently used as a general-purpose, stand-alone + language. Lua is free software. + + For complete information, visit Lua's web site at http://www.lua.org/ . + For an executive summary, see http://www.lua.org/about.html . + + Lua has been used in many different projects around the world. + For a short list, see http://www.lua.org/uses.html . + +* Availability + ------------ + Lua is freely available for both academic and commercial purposes. + See COPYRIGHT and http://www.lua.org/license.html for details. + Lua can be downloaded at http://www.lua.org/download.html . + +* Installation + ------------ + Lua is implemented in pure ANSI C, and compiles unmodified in all known + platforms that have an ANSI C compiler. In most Unix-like platforms, simply + do "make" with a suitable target. See INSTALL for detailed instructions. + +* Origin + ------ + Lua is developed at Lua.org, a laboratory of the Department of Computer + Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro + in Brazil). + For more information about the authors, see http://www.lua.org/authors.html . + +(end of README) diff --git a/lua-5.1.4/src/Makefile b/lua-5.1.4/src/Makefile new file mode 100644 index 000000000..e4a3cd610 --- /dev/null +++ b/lua-5.1.4/src/Makefile @@ -0,0 +1,182 @@ +# makefile for building Lua +# see ../INSTALL for installation instructions +# see ../Makefile and luaconf.h for further customization + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +CC= gcc +CFLAGS= -O2 -Wall $(MYCFLAGS) +AR= ar rcu +RANLIB= ranlib +RM= rm -f +LIBS= -lm $(MYLIBS) + +MYCFLAGS= +MYLDFLAGS= +MYLIBS= + +# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= + +PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +LUA_A= liblua.a +CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ + lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ + lundump.o lvm.o lzio.o +LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \ + lstrlib.o loadlib.o linit.o + +LUA_T= lua +LUA_O= lua.o + +LUAC_T= luac +LUAC_O= luac.o print.o + +ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) +ALL_A= $(LUA_A) + +default: $(PLAT) + +all: $(ALL_T) + +o: $(ALL_O) + +a: $(ALL_A) + +$(LUA_A): $(CORE_O) $(LIB_O) + $(AR) $@ $? + $(RANLIB) $@ + +$(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +$(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + +clean: + $(RM) $(ALL_T) $(ALL_O) + +depend: + @$(CC) $(CFLAGS) -MM l*.c print.c + +echo: + @echo "PLAT = $(PLAT)" + @echo "CC = $(CC)" + @echo "CFLAGS = $(CFLAGS)" + @echo "AR = $(AR)" + @echo "RANLIB = $(RANLIB)" + @echo "RM = $(RM)" + @echo "MYCFLAGS = $(MYCFLAGS)" + @echo "MYLDFLAGS = $(MYLDFLAGS)" + @echo "MYLIBS = $(MYLIBS)" + +# convenience targets for popular platforms + +none: + @echo "Please choose a platform:" + @echo " $(PLATS)" + +aix: + $(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" + +ansi: + $(MAKE) all MYCFLAGS=-DLUA_ANSI + +bsd: + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E" + +freebsd: + $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline" + +generic: + $(MAKE) all MYCFLAGS= + +linux: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" + +macosx: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" +# use this on Mac OS X 10.3- +# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX + +mingw: + $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \ + "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ + "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe + $(MAKE) "LUAC_T=luac.exe" luac.exe + +posix: + $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX + +solaris: + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) default o a clean depend echo none + +# DO NOT DELETE + +lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \ + lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \ + lundump.h lvm.h +lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h +lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h +lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ + lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ + ltable.h +ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h +ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \ + llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ + lfunc.h lstring.h lgc.h ltable.h lvm.h +ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h lstring.h \ + ltable.h lundump.h lvm.h +ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ + lzio.h lmem.h lundump.h +lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h lmem.h \ + lstate.h ltm.h lzio.h +lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h +linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h +liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h +llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ + lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h +lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h +lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h +loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h +lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \ + ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h +lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h +loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h +lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ + lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ + lfunc.h lstring.h lgc.h ltable.h +lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h +lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ + ltm.h lzio.h lstring.h lgc.h +lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h +ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h lgc.h ltable.h +ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h +ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \ + lmem.h lstring.h lgc.h ltable.h +lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h +luac.o: luac.c lua.h luaconf.h lauxlib.h ldo.h lobject.h llimits.h \ + lstate.h ltm.h lzio.h lmem.h lfunc.h lopcodes.h lstring.h lgc.h \ + lundump.h +lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h +lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h +lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ + lzio.h +print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h lopcodes.h lundump.h + +# (end of Makefile) diff --git a/lua-5.1.4/src/lapi.c b/lua-5.1.4/src/lapi.c new file mode 100644 index 000000000..5d5145d2e --- /dev/null +++ b/lua-5.1.4/src/lapi.c @@ -0,0 +1,1087 @@ +/* +** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $ +** Lua API +** See Copyright Notice in lua.h +*/ + + +#include <assert.h> +#include <math.h> +#include <stdarg.h> +#include <string.h> + +#define lapi_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n" + "$Authors: " LUA_AUTHORS " $\n" + "$URL: www.lua.org $\n"; + + + +#define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) + +#define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject) + +#define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} + + + +static TValue *index2adr (lua_State *L, int idx) { + if (idx > 0) { + TValue *o = L->base + (idx - 1); + api_check(L, idx <= L->ci->top - L->base); + if (o >= L->top) return cast(TValue *, luaO_nilobject); + else return o; + } + else if (idx > LUA_REGISTRYINDEX) { + api_check(L, idx != 0 && -idx <= L->top - L->base); + return L->top + idx; + } + else switch (idx) { /* pseudo-indices */ + case LUA_REGISTRYINDEX: return registry(L); + case LUA_ENVIRONINDEX: { + Closure *func = curr_func(L); + sethvalue(L, &L->env, func->c.env); + return &L->env; + } + case LUA_GLOBALSINDEX: return gt(L); + default: { + Closure *func = curr_func(L); + idx = LUA_GLOBALSINDEX - idx; + return (idx <= func->c.nupvalues) + ? &func->c.upvalue[idx-1] + : cast(TValue *, luaO_nilobject); + } + } +} + + +static Table *getcurrenv (lua_State *L) { + if (L->ci == L->base_ci) /* no enclosing function? */ + return hvalue(gt(L)); /* use global table as environment */ + else { + Closure *func = curr_func(L); + return func->c.env; + } +} + + +void luaA_pushobject (lua_State *L, const TValue *o) { + setobj2s(L, L->top, o); + api_incr_top(L); +} + + +LUA_API int lua_checkstack (lua_State *L, int size) { + int res = 1; + lua_lock(L); + if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) + res = 0; /* stack overflow */ + else if (size > 0) { + luaD_checkstack(L, size); + if (L->ci->top < L->top + size) + L->ci->top = L->top + size; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to)); + api_check(from, to->ci->top - to->top >= n); + from->top -= n; + for (i = 0; i < n; i++) { + setobj2s(to, to->top++, from->top + i); + } + lua_unlock(to); +} + + +LUA_API void lua_setlevel (lua_State *from, lua_State *to) { + to->nCcalls = from->nCcalls; +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + L1 = luaE_newthread(L); + setthvalue(L, L->top, L1); + api_incr_top(L); + lua_unlock(L); + luai_userstatethread(L, L1); + return L1; +} + + + +/* +** basic stack manipulation +*/ + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top - L->base); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + lua_lock(L); + if (idx >= 0) { + api_check(L, idx <= L->stack_last - L->base); + while (L->top < L->base + idx) + setnilvalue(L->top++); + L->top = L->base + idx; + } + else { + api_check(L, -(idx+1) <= (L->top - L->base)); + L->top += idx+1; /* `subtract' index (index is negative) */ + } + lua_unlock(L); +} + + +LUA_API void lua_remove (lua_State *L, int idx) { + StkId p; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + while (++p < L->top) setobjs2s(L, p-1, p); + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_insert (lua_State *L, int idx) { + StkId p; + StkId q; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); + setobjs2s(L, p, L->top); + lua_unlock(L); +} + + +LUA_API void lua_replace (lua_State *L, int idx) { + StkId o; + lua_lock(L); + /* explicit test for incompatible code */ + if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) + luaG_runerror(L, "no calling environment"); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + if (idx == LUA_ENVIRONINDEX) { + Closure *func = curr_func(L); + api_check(L, ttistable(L->top - 1)); + func->c.env = hvalue(L->top - 1); + luaC_barrier(L, func, L->top - 1); + } + else { + setobj(L, o, L->top - 1); + if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ + luaC_barrier(L, curr_func(L), L->top - 1); + } + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top, index2adr(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return iscfunction(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + int t = lua_type(L, idx); + return (t == LUA_TSTRING || t == LUA_TNUMBER); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return (ttisuserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + StkId o1 = index2adr(L, index1); + StkId o2 = index2adr(L, index2); + return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaO_rawequalObj(o1, o2); +} + + +LUA_API int lua_equal (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); + lua_unlock(L); + return i; +} + + +LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaV_lessthan(L, o1, o2); + lua_unlock(L); + return i; +} + + + +LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) + return nvalue(o); + else + return 0; +} + + +LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) { + lua_Integer res; + lua_Number num = nvalue(o); + lua_number2integer(res, num); + return res; + } + else + return 0; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + StkId o = index2adr(L, idx); + if (!ttisstring(o)) { + lua_lock(L); /* `luaV_tostring' may create a new string */ + if (!luaV_tostring(L, o)) { /* conversion failed? */ + if (len != NULL) *len = 0; + lua_unlock(L); + return NULL; + } + luaC_checkGC(L); + o = index2adr(L, idx); /* previous call may reallocate the stack */ + lua_unlock(L); + } + if (len != NULL) *len = tsvalue(o)->len; + return svalue(o); +} + + +LUA_API size_t lua_objlen (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TSTRING: return tsvalue(o)->len; + case LUA_TUSERDATA: return uvalue(o)->len; + case LUA_TTABLE: return luaH_getn(hvalue(o)); + case LUA_TNUMBER: { + size_t l; + lua_lock(L); /* `luaV_tostring' may create a new string */ + l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0); + lua_unlock(L); + return l; + } + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TUSERDATA: return (rawuvalue(o) + 1); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +LUA_API const void *lua_topointer (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TTABLE: return hvalue(o); + case LUA_TFUNCTION: return clvalue(o); + case LUA_TTHREAD: return thvalue(o); + case LUA_TUSERDATA: + case LUA_TLIGHTUSERDATA: + return lua_touserdata(L, idx); + default: return NULL; + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setnvalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setnvalue(L->top, cast_num(n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { + lua_lock(L); + luaC_checkGC(L); + setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushstring (lua_State *L, const char *s) { + if (s == NULL) + lua_pushnil(L); + else + lua_pushlstring(L, s, strlen(s)); +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + luaC_checkGC(L); + ret = luaO_pushvfstring(L, fmt, argp); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + luaC_checkGC(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + Closure *cl; + lua_lock(L); + luaC_checkGC(L); + api_checknelems(L, n); + cl = luaF_newCclosure(L, n, getcurrenv(L)); + cl->c.f = fn; + L->top -= n; + while (n--) + setobj2n(L, &cl->c.upvalue[n], L->top+n); + setclvalue(L, L->top, cl); + lua_assert(iswhite(obj2gco(cl))); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(L->top, p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, L->top, L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +LUA_API void lua_gettable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_gettable(L, t, L->top - 1, L->top - 1); + lua_unlock(L); +} + + +LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_gettable(L, t, &key, L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_rawget (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); + lua_unlock(L); +} + + +LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + lua_lock(L); + luaC_checkGC(L); + sethvalue(L, L->top, luaH_new(L, narray, nrec)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt = NULL; + int res; + lua_lock(L); + obj = index2adr(L, objindex); + switch (ttype(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttype(obj)]; + break; + } + if (mt == NULL) + res = 0; + else { + sethvalue(L, L->top, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_getfenv (lua_State *L, int idx) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + switch (ttype(o)) { + case LUA_TFUNCTION: + sethvalue(L, L->top, clvalue(o)->c.env); + break; + case LUA_TUSERDATA: + sethvalue(L, L->top, uvalue(o)->env); + break; + case LUA_TTHREAD: + setobj2s(L, L->top, gt(thvalue(o))); + break; + default: + setnilvalue(L->top); + break; + } + api_incr_top(L); + lua_unlock(L); +} + + +/* +** set functions (stack -> Lua) +*/ + + +LUA_API void lua_settable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_settable(L, t, L->top - 2, L->top - 1); + L->top -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + api_checknelems(L, 1); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_settable(L, t, &key, L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); + luaC_barriert(L, hvalue(t), L->top-1); + L->top -= 2; + lua_unlock(L); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); + luaC_barriert(L, hvalue(o), L->top-1); + L->top--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2adr(L, objindex); + api_checkvalidindex(L, obj); + if (ttisnil(L->top - 1)) + mt = NULL; + else { + api_check(L, ttistable(L->top - 1)); + mt = hvalue(L->top - 1); + } + switch (ttype(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) + luaC_objbarriert(L, hvalue(obj), mt); + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) + luaC_objbarrier(L, rawuvalue(obj), mt); + break; + } + default: { + G(L)->mt[ttype(obj)] = mt; + break; + } + } + L->top--; + lua_unlock(L); + return 1; +} + + +LUA_API int lua_setfenv (lua_State *L, int idx) { + StkId o; + int res = 1; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + api_check(L, ttistable(L->top - 1)); + switch (ttype(o)) { + case LUA_TFUNCTION: + clvalue(o)->c.env = hvalue(L->top - 1); + break; + case LUA_TUSERDATA: + uvalue(o)->env = hvalue(L->top - 1); + break; + case LUA_TTHREAD: + sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1)); + break; + default: + res = 0; + break; + } + if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); + L->top--; + lua_unlock(L); + return res; +} + + +/* +** `load' and `call' functions (run Lua code) +*/ + + +#define adjustresults(L,nres) \ + { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; } + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) + + +LUA_API void lua_call (lua_State *L, int nargs, int nresults) { + StkId func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + func = L->top - (nargs+1); + luaD_call(L, func, nresults); + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to `f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_call(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2adr(L, errfunc); + api_checkvalidindex(L, o); + func = savestack(L, o); + } + c.func = L->top - (nargs+1); /* function to be called */ + c.nresults = nresults; + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +/* +** Execute a protected C call. +*/ +struct CCallS { /* data to `f_Ccall' */ + lua_CFunction func; + void *ud; +}; + + +static void f_Ccall (lua_State *L, void *ud) { + struct CCallS *c = cast(struct CCallS *, ud); + Closure *cl; + cl = luaF_newCclosure(L, 0, getcurrenv(L)); + cl->c.f = c->func; + setclvalue(L, L->top, cl); /* push function */ + api_incr_top(L); + setpvalue(L->top, c->ud); /* push only argument */ + api_incr_top(L); + luaD_call(L, L->top - 2, 0); +} + + +LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { + struct CCallS c; + int status; + lua_lock(L); + c.func = func; + c.ud = ud; + status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname); + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = L->top - 1; + if (isLfunction(o)) + status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ + +LUA_API int lua_gc (lua_State *L, int what, int data) { + int res = 0; + global_State *g; + lua_lock(L); + g = G(L); + switch (what) { + case LUA_GCSTOP: { + g->GCthreshold = MAX_LUMEM; + break; + } + case LUA_GCRESTART: { + g->GCthreshold = g->totalbytes; + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(g->totalbytes >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(g->totalbytes & 0x3ff); + break; + } + case LUA_GCSTEP: { + lu_mem a = (cast(lu_mem, data) << 10); + if (a <= g->totalbytes) + g->GCthreshold = g->totalbytes - a; + else + g->GCthreshold = 0; + while (g->GCthreshold <= g->totalbytes) { + luaC_step(L); + if (g->gcstate == GCSpause) { /* end of cycle? */ + res = 1; /* signal it */ + break; + } + } + break; + } + case LUA_GCSETPAUSE: { + res = g->gcpause; + g->gcpause = data; + break; + } + case LUA_GCSETSTEPMUL: { + res = g->gcstepmul; + g->gcstepmul = data; + break; + } + default: res = -1; /* invalid option */ + } + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + lua_lock(L); + api_checknelems(L, 1); + luaG_errormsg(L); + lua_unlock(L); + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + StkId t; + int more; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + more = luaH_next(L, hvalue(t), L->top - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n >= 2) { + luaC_checkGC(L); + luaV_concat(L, n, cast_int(L->top - L->base) - 1); + L->top -= (n-1); + } + else if (n == 0) { /* push empty string */ + setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); + api_incr_top(L); + } + /* else n == 1; nothing to do */ + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { + Udata *u; + lua_lock(L); + luaC_checkGC(L); + u = luaS_newudata(L, size, getcurrenv(L)); + setuvalue(L, L->top, u); + api_incr_top(L); + lua_unlock(L); + return u + 1; +} + + + + +static const char *aux_upvalue (StkId fi, int n, TValue **val) { + Closure *f; + if (!ttisfunction(fi)) return NULL; + f = clvalue(fi); + if (f->c.isC) { + if (!(1 <= n && n <= f->c.nupvalues)) return NULL; + *val = &f->c.upvalue[n-1]; + return ""; + } + else { + Proto *p = f->l.p; + if (!(1 <= n && n <= p->sizeupvalues)) return NULL; + *val = f->l.upvals[n-1]->v; + return getstr(p->upvalues[n-1]); + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + lua_lock(L); + name = aux_upvalue(index2adr(L, funcindex), n, &val); + if (name) { + setobj2s(L, L->top, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + StkId fi; + lua_lock(L); + fi = index2adr(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val); + if (name) { + L->top--; + setobj(L, val, L->top); + luaC_barrier(L, clvalue(fi), L->top); + } + lua_unlock(L); + return name; +} + diff --git a/lua-5.1.4/src/lapi.h b/lua-5.1.4/src/lapi.h new file mode 100644 index 000000000..2c3fab244 --- /dev/null +++ b/lua-5.1.4/src/lapi.h @@ -0,0 +1,16 @@ +/* +** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Lua API +** See Copyright Notice in lua.h +*/ + +#ifndef lapi_h +#define lapi_h + + +#include "lobject.h" + + +LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); + +#endif diff --git a/lua-5.1.4/src/lauxlib.c b/lua-5.1.4/src/lauxlib.c new file mode 100644 index 000000000..10f14e2c0 --- /dev/null +++ b/lua-5.1.4/src/lauxlib.c @@ -0,0 +1,652 @@ +/* +** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#include <ctype.h> +#include <errno.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +/* This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" + + +#define FREELIST_REF 0 /* free list of references */ + + +/* convert a stack index to positive */ +#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \ + lua_gettop(L) + (i) + 1) + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + + +LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + narg--; /* do not count `self' */ + if (narg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling " LUA_QS " on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = "?"; + return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", + narg, ar.name, extramsg); +} + + +LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { + const char *msg = lua_pushfstring(L, "%s expected, got %s", + tname, luaL_typename(L, narg)); + return luaL_argerror(L, narg, msg); +} + + +static void tag_error (lua_State *L, int narg, int tag) { + luaL_typerror(L, narg, lua_typename(L, tag)); +} + + +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushliteral(L, ""); /* else, no information available... */ +} + + +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + +/* }====================================================== */ + + +LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, narg, def) : + luaL_checkstring(L, narg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, narg, + lua_pushfstring(L, "invalid option " LUA_QS, name)); +} + + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ + if (!lua_isnil(L, -1)) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_newtable(L); /* create metatable */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ + if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + } + luaL_typerror(L, ud, tname); /* else error */ + return NULL; /* to avoid warnings */ +} + + +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { + if (!lua_checkstack(L, space)) + luaL_error(L, "stack overflow (%s)", mes); +} + + +LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { + if (lua_type(L, narg) != t) + tag_error(L, narg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int narg) { + if (lua_type(L, narg) == LUA_TNONE) + luaL_argerror(L, narg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { + const char *s = lua_tolstring(L, narg, len); + if (!s) tag_error(L, narg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, narg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, narg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { + lua_Number d = lua_tonumber(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, narg, def); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { + lua_Integer d = lua_tointeger(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, narg, def); +} + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return 0; + lua_pushstring(L, event); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { + lua_pop(L, 2); /* remove metatable and metafield */ + return 0; + } + else { + lua_remove(L, -2); /* remove only metatable */ + return 1; + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = abs_index(L, obj); + if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l) { + luaI_openlib(L, libname, l, 0); +} + + +static int libsize (const luaL_Reg *l) { + int size = 0; + for (; l->name; l++) size++; + return size; +} + + +LUALIB_API void luaI_openlib (lua_State *L, const char *libname, + const luaL_Reg *l, int nup) { + if (libname) { + int size = libsize(l); + /* check whether lib already exists */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); + lua_getfield(L, -1, libname); /* get _LOADED[libname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL) + luaL_error(L, "name conflict for module " LUA_QS, libname); + lua_pushvalue(L, -1); + lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */ + } + lua_remove(L, -2); /* remove _LOADED table */ + lua_insert(L, -(nup+1)); /* move library table to below upvalues */ + } + for (; l->name; l++) { + int i; + for (i=0; i<nup; i++) /* copy upvalues to the top */ + lua_pushvalue(L, -nup); + lua_pushcclosure(L, l->func, nup); + lua_setfield(L, -(nup+2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + + +/* +** {====================================================== +** getn-setn: size for arrays +** ======================================================= +*/ + +#if defined(LUA_COMPAT_GETN) + +static int checkint (lua_State *L, int topop) { + int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; + lua_pop(L, topop); + return n; +} + + +static void getsizes (lua_State *L) { + lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); + if (lua_isnil(L, -1)) { /* no `size' table? */ + lua_pop(L, 1); /* remove nil */ + lua_newtable(L); /* create it */ + lua_pushvalue(L, -1); /* `size' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */ + } +} + + +LUALIB_API void luaL_setn (lua_State *L, int t, int n) { + t = abs_index(L, t); + lua_pushliteral(L, "n"); + lua_rawget(L, t); + if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ + lua_pushliteral(L, "n"); /* use it */ + lua_pushinteger(L, n); + lua_rawset(L, t); + } + else { /* use `sizes' */ + getsizes(L); + lua_pushvalue(L, t); + lua_pushinteger(L, n); + lua_rawset(L, -3); /* sizes[t] = n */ + lua_pop(L, 1); /* remove `sizes' */ + } +} + + +LUALIB_API int luaL_getn (lua_State *L, int t) { + int n; + t = abs_index(L, t); + lua_pushliteral(L, "n"); /* try t.n */ + lua_rawget(L, t); + if ((n = checkint(L, 1)) >= 0) return n; + getsizes(L); /* else try sizes[t] */ + lua_pushvalue(L, t); + lua_rawget(L, -2); + if ((n = checkint(L, 2)) >= 0) return n; + return (int)lua_objlen(L, t); +} + +#endif + +/* }====================================================== */ + + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, + const char *r) { + const char *wild; + size_t l = strlen(p); + luaL_Buffer b; + luaL_buffinit(L, &b); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(&b, s, wild - s); /* push prefix */ + luaL_addstring(&b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after `p' */ + } + luaL_addstring(&b, s); /* push last suffix */ + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +LUALIB_API const char *luaL_findtable (lua_State *L, int idx, + const char *fname, int szhint) { + const char *e; + lua_pushvalue(L, idx); + do { + e = strchr(fname, '.'); + if (e == NULL) e = fname + strlen(fname); + lua_pushlstring(L, fname, e - fname); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { /* no such field? */ + lua_pop(L, 1); /* remove this nil */ + lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ + lua_pushlstring(L, fname, e - fname); + lua_pushvalue(L, -2); + lua_settable(L, -4); /* set new table into field */ + } + else if (!lua_istable(L, -1)) { /* field has a non-table value? */ + lua_pop(L, 2); /* remove table and value */ + return fname; /* return problematic part of the name */ + } + lua_remove(L, -2); /* remove previous table */ + fname = e + 1; + } while (*e == '.'); + return NULL; +} + + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + +#define bufflen(B) ((B)->p - (B)->buffer) +#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B))) + +#define LIMIT (LUA_MINSTACK/2) + + +static int emptybuffer (luaL_Buffer *B) { + size_t l = bufflen(B); + if (l == 0) return 0; /* put nothing on stack */ + else { + lua_pushlstring(B->L, B->buffer, l); + B->p = B->buffer; + B->lvl++; + return 1; + } +} + + +static void adjuststack (luaL_Buffer *B) { + if (B->lvl > 1) { + lua_State *L = B->L; + int toget = 1; /* number of levels to concat */ + size_t toplen = lua_strlen(L, -1); + do { + size_t l = lua_strlen(L, -(toget+1)); + if (B->lvl - toget + 1 >= LIMIT || toplen > l) { + toplen += l; + toget++; + } + else break; + } while (toget < B->lvl); + lua_concat(L, toget); + B->lvl = B->lvl - toget + 1; + } +} + + +LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { + if (emptybuffer(B)) + adjuststack(B); + return B->buffer; +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + while (l--) + luaL_addchar(B, *s++); +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + emptybuffer(B); + lua_concat(B->L, B->lvl); + B->lvl = 1; +} + + +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t vl; + const char *s = lua_tolstring(L, -1, &vl); + if (vl <= bufffree(B)) { /* fit into buffer? */ + memcpy(B->p, s, vl); /* put it there */ + B->p += vl; + lua_pop(L, 1); /* remove from stack */ + } + else { + if (emptybuffer(B)) + lua_insert(L, -2); /* put buffer before new value */ + B->lvl++; /* add new value into B stack */ + adjuststack(B); + } +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->p = B->buffer; + B->lvl = 0; +} + +/* }====================================================== */ + + +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + t = abs_index(L, t); + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* `nil' has a unique fixed reference */ + } + lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ + ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */ + lua_pop(L, 1); /* remove it from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ + } + else { /* no free elements */ + ref = (int)lua_objlen(L, t); + ref++; /* create new reference */ + } + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = abs_index(L, t); + lua_rawgeti(L, t, FREELIST_REF); + lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ + } +} + + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int extraline; + FILE *f; + char buff[LUAL_BUFFERSIZE]; +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; + if (lf->extraline) { + lf->extraline = 0; + *size = 1; + return "\n"; + } + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); + return (*size > 0) ? lf->buff : NULL; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + const char *serr = strerror(errno); + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + lf.extraline = 0; + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + c = getc(lf.f); + if (c == '#') { /* Unix exec. file? */ + lf.extraline = 1; + while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */ + if (c == '\n') c = getc(lf.f); + } + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + /* skip eventual `#!...' */ + while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; + lf.extraline = 0; + } + ungetc(c, lf.f); + status = lua_load(L, getF, &lf, lua_tostring(L, -1)); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from `lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, + const char *name) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name); +} + + +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + + + +/* }====================================================== */ + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; + (void)osize; + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +static int panic (lua_State *L) { + (void)L; /* to avoid warnings */ + fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n", + lua_tostring(L, -1)); + return 0; +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (L) lua_atpanic(L, &panic); + return L; +} + diff --git a/lua-5.1.4/src/lauxlib.h b/lua-5.1.4/src/lauxlib.h new file mode 100644 index 000000000..34258235d --- /dev/null +++ b/lua-5.1.4/src/lauxlib.h @@ -0,0 +1,174 @@ +/* +** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include <stddef.h> +#include <stdio.h> + +#include "lua.h" + + +#if defined(LUA_COMPAT_GETN) +LUALIB_API int (luaL_getn) (lua_State *L, int t); +LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); +#else +#define luaL_getn(L,i) ((int)lua_objlen(L, i)) +#define luaL_setn(L,i,j) ((void)0) /* no op! */ +#endif + +#if defined(LUA_COMPAT_OPENLIB) +#define luaI_openlib luaL_openlib +#endif + + +/* extra error code for `luaL_load' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + + +LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l); +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); +LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); +LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int narg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); +LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, + const char *name); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, + const char *fname, int szhint); + + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define luaL_argcheck(L, cond,numarg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + + +typedef struct luaL_Buffer { + char *p; /* current position in buffer */ + int lvl; /* number of strings in the stack (level) */ + lua_State *L; + char buffer[LUAL_BUFFERSIZE]; +} luaL_Buffer; + +#define luaL_addchar(B,c) \ + ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ + (*(B)->p++ = (char)(c))) + +/* compatibility only */ +#define luaL_putchar(B,c) luaL_addchar(B,c) + +#define luaL_addsize(B,n) ((B)->p += (n)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); + + +/* }====================================================== */ + + +/* compatibility with ref system */ + +/* pre-defined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ + (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) + +#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) + +#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) + + +#define luaL_reg luaL_Reg + +#endif + + diff --git a/lua-5.1.4/src/lbaselib.c b/lua-5.1.4/src/lbaselib.c new file mode 100644 index 000000000..2a4c079d3 --- /dev/null +++ b/lua-5.1.4/src/lbaselib.c @@ -0,0 +1,653 @@ +/* +** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $ +** Basic library +** See Copyright Notice in lua.h +*/ + + + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define lbaselib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + + +/* +** If your system does not support `stdout', you can just remove this function. +** If you need, you can define your own `print' function, following this +** model but changing `fputs' to put the strings at a proper place +** (a console window or a log file, for instance). +*/ +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + lua_getglobal(L, "tostring"); + for (i=1; i<=n; i++) { + const char *s; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tostring(L, -1); /* get result */ + if (s == NULL) + return luaL_error(L, LUA_QL("tostring") " must return a string to " + LUA_QL("print")); + if (i>1) fputs("\t", stdout); + fputs(s, stdout); + lua_pop(L, 1); /* pop result */ + } + fputs("\n", stdout); + return 0; +} + + +static int luaB_tonumber (lua_State *L) { + int base = luaL_optint(L, 2, 10); + if (base == 10) { /* standard conversion */ + luaL_checkany(L, 1); + if (lua_isnumber(L, 1)) { + lua_pushnumber(L, lua_tonumber(L, 1)); + return 1; + } + } + else { + const char *s1 = luaL_checkstring(L, 1); + char *s2; + unsigned long n; + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + n = strtoul(s1, &s2, base); + if (s1 != s2) { /* at least one valid digit? */ + while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ + if (*s2 == '\0') { /* no invalid trailing characters? */ + lua_pushnumber(L, (lua_Number)n); + return 1; + } + } + } + lua_pushnil(L); /* else not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = luaL_optint(L, 2, 1); + lua_settop(L, 1); + if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ + luaL_where(L, level); + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + if (luaL_getmetafield(L, 1, "__metatable")) + luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static void getfunc (lua_State *L, int opt) { + if (lua_isfunction(L, 1)) lua_pushvalue(L, 1); + else { + lua_Debug ar; + int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1); + luaL_argcheck(L, level >= 0, 1, "level must be non-negative"); + if (lua_getstack(L, level, &ar) == 0) + luaL_argerror(L, 1, "invalid level"); + lua_getinfo(L, "f", &ar); + if (lua_isnil(L, -1)) + luaL_error(L, "no function environment for tail call at level %d", + level); + } +} + + +static int luaB_getfenv (lua_State *L) { + getfunc(L, 1); + if (lua_iscfunction(L, -1)) /* is a C function? */ + lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */ + else + lua_getfenv(L, -1); + return 1; +} + + +static int luaB_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + getfunc(L, 0); + lua_pushvalue(L, 2); + if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) { + /* change environment of current thread */ + lua_pushthread(L); + lua_insert(L, -2); + lua_setfenv(L, -2); + return 0; + } + else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) + luaL_error(L, + LUA_QL("setfenv") " cannot change environment of given object"); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int luaB_gcinfo (lua_State *L) { + lua_pushinteger(L, lua_getgccount(L)); + return 1; +} + + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL}; + int o = luaL_checkoption(L, 1, "collect", opts); + int ex = luaL_optint(L, 2, 0); + int res = lua_gc(L, optsnum[o], ex); + switch (optsnum[o]) { + case LUA_GCCOUNT: { + int b = lua_gc(L, LUA_GCCOUNTB, 0); + lua_pushnumber(L, res + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: { + lua_pushboolean(L, res); + return 1; + } + default: { + lua_pushnumber(L, res); + return 1; + } + } +} + + +static int luaB_type (lua_State *L) { + luaL_checkany(L, 1); + lua_pushstring(L, luaL_typename(L, 1)); + return 1; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int luaB_pairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushnil(L); /* and initial value */ + return 3; +} + + +static int ipairsaux (lua_State *L) { + int i = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + i++; /* next value */ + lua_pushinteger(L, i); + lua_rawgeti(L, 1, i); + return (lua_isnil(L, -1)) ? 0 : 2; +} + + +static int luaB_ipairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushinteger(L, 0); /* and initial value */ + return 3; +} + + +static int load_aux (lua_State *L, int status) { + if (status == 0) /* OK? */ + return 1; + else { + lua_pushnil(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return nil plus error message */ + } +} + + +static int luaB_loadstring (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + const char *chunkname = luaL_optstring(L, 2, s); + return load_aux(L, luaL_loadbuffer(L, s, l, chunkname)); +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + return load_aux(L, luaL_loadfile(L, fname)); +} + + +/* +** Reader for generic `load' function: `lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)ud; /* to avoid warnings */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + *size = 0; + return NULL; + } + else if (lua_isstring(L, -1)) { + lua_replace(L, 3); /* save string in a reserved stack slot */ + return lua_tolstring(L, 3, size); + } + else luaL_error(L, "reader function must return a string"); + return NULL; /* to avoid warnings */ +} + + +static int luaB_load (lua_State *L) { + int status; + const char *cname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 3); /* function, eventual name, plus one reserved slot */ + status = lua_load(L, generic_reader, NULL, cname); + return load_aux(L, status); +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + int n = lua_gettop(L); + if (luaL_loadfile(L, fname) != 0) lua_error(L); + lua_call(L, 0, LUA_MULTRET); + return lua_gettop(L) - n; +} + + +static int luaB_assert (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_toboolean(L, 1)) + return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); + return lua_gettop(L); +} + + +static int luaB_unpack (lua_State *L) { + int i, e, n; + luaL_checktype(L, 1, LUA_TTABLE); + i = luaL_optint(L, 2, 1); + e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1)); + if (i > e) return 0; /* empty range */ + n = e - i + 1; /* number of elements */ + if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ + return luaL_error(L, "too many results to unpack"); + lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */ + while (i++ < e) /* push arg[i + 1...e] */ + lua_rawgeti(L, 1, i); + return n; +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + int i = luaL_checkint(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - i; + } +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0); + lua_pushboolean(L, (status == 0)); + lua_insert(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_xpcall (lua_State *L) { + int status; + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_insert(L, 1); /* put error function under function to be called */ + status = lua_pcall(L, 0, LUA_MULTRET, 1); + lua_pushboolean(L, (status == 0)); + lua_replace(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ + return 1; /* use its value */ + switch (lua_type(L, 1)) { + case LUA_TNUMBER: + lua_pushstring(L, lua_tostring(L, 1)); + break; + case LUA_TSTRING: + lua_pushvalue(L, 1); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: + lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); + break; + } + return 1; +} + + +static int luaB_newproxy (lua_State *L) { + lua_settop(L, 1); + lua_newuserdata(L, 0); /* create proxy */ + if (lua_toboolean(L, 1) == 0) + return 1; /* no metatable */ + else if (lua_isboolean(L, 1)) { + lua_newtable(L); /* create a new metatable `m' ... */ + lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ + lua_pushboolean(L, 1); + lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ + } + else { + int validproxy = 0; /* to check if weaktable[metatable(u)] == true */ + if (lua_getmetatable(L, 1)) { + lua_rawget(L, lua_upvalueindex(1)); + validproxy = lua_toboolean(L, -1); + lua_pop(L, 1); /* remove value */ + } + luaL_argcheck(L, validproxy, 1, "boolean or proxy expected"); + lua_getmetatable(L, 1); /* metatable is valid; get it */ + } + lua_setmetatable(L, 2); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"gcinfo", luaB_gcinfo}, + {"getfenv", luaB_getfenv}, + {"getmetatable", luaB_getmetatable}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, + {"loadstring", luaB_loadstring}, + {"next", luaB_next}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"rawequal", luaB_rawequal}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setfenv", luaB_setfenv}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"unpack", luaB_unpack}, + {"xpcall", luaB_xpcall}, + {NULL, NULL} +}; + + +/* +** {====================================================== +** Coroutine library +** ======================================================= +*/ + +#define CO_RUN 0 /* running */ +#define CO_SUS 1 /* suspended */ +#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */ +#define CO_DEAD 3 + +static const char *const statnames[] = + {"running", "suspended", "normal", "dead"}; + +static int costatus (lua_State *L, lua_State *co) { + if (L == co) return CO_RUN; + switch (lua_status(co)) { + case LUA_YIELD: + return CO_SUS; + case 0: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ + return CO_NOR; /* it is running */ + else if (lua_gettop(co) == 0) + return CO_DEAD; + else + return CO_SUS; /* initial state */ + } + default: /* some error occured */ + return CO_DEAD; + } +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argcheck(L, co, 1, "coroutine expected"); + lua_pushstring(L, statnames[costatus(L, co)]); + return 1; +} + + +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status = costatus(L, co); + if (!lua_checkstack(co, narg)) + luaL_error(L, "too many arguments to resume"); + if (status != CO_SUS) { + lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + lua_setlevel(L, co); + status = lua_resume(co, narg); + if (status == 0 || status == LUA_YIELD) { + int nres = lua_gettop(co); + if (!lua_checkstack(L, nres + 1)) + luaL_error(L, "too many results to resume"); + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + int r; + luaL_argcheck(L, co, 1, "coroutine expected"); + r = auxresume(L, co, lua_gettop(L) - 1); + if (r < 0) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + `resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (r < 0) { + if (lua_isstring(L, -1)) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL = lua_newthread(L); + luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1, + "Lua function expected"); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +static int luaB_corunning (lua_State *L) { + if (lua_pushthread(L)) + lua_pushnil(L); /* main thread is not a coroutine */ + return 1; +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {NULL, NULL} +}; + +/* }====================================================== */ + + +static void auxopen (lua_State *L, const char *name, + lua_CFunction f, lua_CFunction u) { + lua_pushcfunction(L, u); + lua_pushcclosure(L, f, 1); + lua_setfield(L, -2, name); +} + + +static void base_open (lua_State *L) { + /* set global _G */ + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "_G"); + /* open lib into global table */ + luaL_register(L, "_G", base_funcs); + lua_pushliteral(L, LUA_VERSION); + lua_setglobal(L, "_VERSION"); /* set global _VERSION */ + /* `ipairs' and `pairs' need auxliliary functions as upvalues */ + auxopen(L, "ipairs", luaB_ipairs, ipairsaux); + auxopen(L, "pairs", luaB_pairs, luaB_next); + /* `newproxy' needs a weaktable as upvalue */ + lua_createtable(L, 0, 1); /* new table `w' */ + lua_pushvalue(L, -1); /* `w' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ + lua_pushcclosure(L, luaB_newproxy, 1); + lua_setglobal(L, "newproxy"); /* set global `newproxy' */ +} + + +LUALIB_API int luaopen_base (lua_State *L) { + base_open(L); + luaL_register(L, LUA_COLIBNAME, co_funcs); + return 2; +} + diff --git a/lua-5.1.4/src/lcode.c b/lua-5.1.4/src/lcode.c new file mode 100644 index 000000000..cff626b7f --- /dev/null +++ b/lua-5.1.4/src/lcode.c @@ -0,0 +1,839 @@ +/* +** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + + +#include <stdlib.h> + +#define lcode_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "ltable.h" + + +#define hasjumps(e) ((e)->t != (e)->f) + + +static int isnumeral(expdesc *e) { + return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); +} + + +void luaK_nil (FuncState *fs, int from, int n) { + Instruction *previous; + if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ + if (fs->pc == 0) { /* function start? */ + if (from >= fs->nactvar) + return; /* positions are already clean */ + } + else { + previous = &fs->f->code[fs->pc-1]; + if (GET_OPCODE(*previous) == OP_LOADNIL) { + int pfrom = GETARG_A(*previous); + int pto = GETARG_B(*previous); + if (pfrom <= from && from <= pto+1) { /* can connect both? */ + if (from+n-1 > pto) + SETARG_B(*previous, from+n-1); + return; + } + } + } + } + luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */ +} + + +int luaK_jump (FuncState *fs) { + int jpc = fs->jpc; /* save list of jumps to here */ + int j; + fs->jpc = NO_JUMP; + j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); + luaK_concat(fs, &j, jpc); /* keep them on hold */ + return j; +} + + +void luaK_ret (FuncState *fs, int first, int nret) { + luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); +} + + +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); +} + + +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest-(pc+1); + lua_assert(dest != NO_JUMP); + if (abs(offset) > MAXARG_sBx) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_sBx(*jmp, offset); +} + + +/* +** returns current `pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sBx(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** check whether list has any jump that do not produce a value +** (or produce an inverted value) +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else /* no register to put value or register already has the value */ + *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); + + return 1; +} + + +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +static void dischargejpc (FuncState *fs) { + patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); + fs->jpc = NO_JUMP; +} + + +void luaK_patchlist (FuncState *fs, int list, int target) { + if (target == fs->pc) + luaK_patchtohere(fs, list); + else { + lua_assert(target < fs->pc); + patchlistaux(fs, list, target, NO_REG, target); + } +} + + +void luaK_patchtohere (FuncState *fs, int list) { + luaK_getlabel(fs); + luaK_concat(fs, &fs->jpc, list); +} + + +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; + else if (*l1 == NO_JUMP) + *l1 = l2; + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); + } +} + + +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXSTACK) + luaX_syntaxerror(fs->ls, "function or expression too complex"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +static void freereg (FuncState *fs, int reg) { + if (!ISK(reg) && reg >= fs->nactvar) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.s.info); +} + + +static int addk (FuncState *fs, TValue *k, TValue *v) { + lua_State *L = fs->L; + TValue *idx = luaH_set(L, fs->h, k); + Proto *f = fs->f; + int oldsize = f->sizek; + if (ttisnumber(idx)) { + lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); + return cast_int(nvalue(idx)); + } + else { /* constant not found; create a new entry */ + setnvalue(idx, cast_num(fs->nk)); + luaM_growvector(L, f->k, fs->nk, f->sizek, TValue, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[fs->nk], v); + luaC_barrier(L, f, v); + return fs->nk++; + } +} + + +int luaK_stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->L, &o, s); + return addk(fs, &o, &o); +} + + +int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + setnvalue(&o, r); + return addk(fs, &o, &o); +} + + +static int boolK (FuncState *fs, int b) { + TValue o; + setbvalue(&o, b); + return addk(fs, &o, &o); +} + + +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->L, &k, fs->h); + return addk(fs, &k, &v); +} + + +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + if (e->k == VCALL) { /* expression is an open function call? */ + SETARG_C(getcode(fs, e), nresults+1); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), nresults+1); + SETARG_A(getcode(fs, e), fs->freereg); + luaK_reserveregs(fs, 1); + } +} + + +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + e->k = VNONRELOC; + e->u.s.info = GETARG_A(getcode(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), 2); + e->k = VRELOCABLE; /* can relocate its simple result */ + } +} + + +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VLOCAL: { + e->k = VNONRELOC; + break; + } + case VUPVAL: { + e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + case VGLOBAL: { + e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info); + e->k = VRELOCABLE; + break; + } + case VINDEXED: { + freereg(fs, e->u.s.aux); + freereg(fs, e->u.s.info); + e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux); + e->k = VRELOCABLE; + break; + } + case VVARARG: + case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +static int code_label (FuncState *fs, int A, int b, int jump) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); +} + + +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: case VTRUE: { + luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); + break; + } + case VK: { + luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info); + break; + } + case VKNUM: { + luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval)); + break; + } + case VRELOCABLE: { + Instruction *pc = &getcode(fs, e); + SETARG_A(*pc, reg); + break; + } + case VNONRELOC: { + if (reg != e->u.s.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0); + break; + } + default: { + lua_assert(e->k == VVOID || e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { + luaK_reserveregs(fs, 1); + discharge2reg(fs, e, fs->freereg-1); + } +} + + +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) + luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_label(fs, reg, 0, 1); + p_t = code_label(fs, reg, 1, 0); + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { + if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */ + if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.s.info); /* put value on it */ + return e->u.s.info; + } + } + luaK_exp2nextreg(fs, e); /* default */ + return e->u.s.info; +} + + +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +int luaK_exp2RK (FuncState *fs, expdesc *e) { + luaK_exp2val(fs, e); + switch (e->k) { + case VKNUM: + case VTRUE: + case VFALSE: + case VNIL: { + if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */ + e->u.s.info = (e->k == VNIL) ? nilK(fs) : + (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) : + boolK(fs, (e->k == VTRUE)); + e->k = VK; + return RKASK(e->u.s.info); + } + else break; + } + case VK: { + if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */ + return RKASK(e->u.s.info); + else break; + } + default: break; + } + /* not a constant in the right range: put it in a register */ + return luaK_exp2anyreg(fs, e); +} + + +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.s.info); + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0); + break; + } + case VGLOBAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info); + break; + } + case VINDEXED: { + int e = luaK_exp2RK(fs, ex); + luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e); + break; + } + default: { + lua_assert(0); /* invalid var kind to store */ + break; + } + } + freeexp(fs, ex); +} + + +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int func; + luaK_exp2anyreg(fs, e); + freeexp(fs, e); + func = fs->freereg; + luaK_reserveregs(fs, 2); + luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key)); + freeexp(fs, key); + e->u.s.info = func; + e->k = VNONRELOC; +} + + +static void invertjump (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.s.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_A(*pc, !(GETARG_A(*pc))); +} + + +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOCABLE) { + Instruction ie = getcode(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + fs->pc--; /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond); +} + + +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VK: case VKNUM: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + case VFALSE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + invertjump(fs, e); + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 0); + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ + luaK_patchtohere(fs, e->t); + e->t = NO_JUMP; +} + + +static void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + case VTRUE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 1); + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ + luaK_patchtohere(fs, e->f); + e->f = NO_JUMP; +} + + +static void codenot (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; + break; + } + case VK: case VKNUM: case VTRUE: { + e->k = VFALSE; + break; + } + case VJMP: { + invertjump(fs, e); + break; + } + case VRELOCABLE: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + default: { + lua_assert(0); /* cannot happen */ + break; + } + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); + removevalues(fs, e->t); +} + + +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + t->u.s.aux = luaK_exp2RK(fs, k); + t->k = VINDEXED; +} + + +static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { + lua_Number v1, v2, r; + if (!isnumeral(e1) || !isnumeral(e2)) return 0; + v1 = e1->u.nval; + v2 = e2->u.nval; + switch (op) { + case OP_ADD: r = luai_numadd(v1, v2); break; + case OP_SUB: r = luai_numsub(v1, v2); break; + case OP_MUL: r = luai_nummul(v1, v2); break; + case OP_DIV: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_numdiv(v1, v2); break; + case OP_MOD: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_nummod(v1, v2); break; + case OP_POW: r = luai_numpow(v1, v2); break; + case OP_UNM: r = luai_numunm(v1); break; + case OP_LEN: return 0; /* no constant folding for 'len' */ + default: lua_assert(0); r = 0; break; + } + if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ + e1->u.nval = r; + return 1; +} + + +static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { + if (constfolding(op, e1, e2)) + return; + else { + int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; + int o1 = luaK_exp2RK(fs, e1); + if (o1 > o2) { + freeexp(fs, e1); + freeexp(fs, e2); + } + else { + freeexp(fs, e2); + freeexp(fs, e1); + } + e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2); + e1->k = VRELOCABLE; + } +} + + +static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, + expdesc *e2) { + int o1 = luaK_exp2RK(fs, e1); + int o2 = luaK_exp2RK(fs, e2); + freeexp(fs, e2); + freeexp(fs, e1); + if (cond == 0 && op != OP_EQ) { + int temp; /* exchange args to replace by `<' or `<=' */ + temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ + cond = 1; + } + e1->u.s.info = condjump(fs, op, cond, o1, o2); + e1->k = VJMP; +} + + +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { + expdesc e2; + e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; + switch (op) { + case OPR_MINUS: { + if (!isnumeral(e)) + luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ + codearith(fs, OP_UNM, e, &e2); + break; + } + case OPR_NOT: codenot(fs, e); break; + case OPR_LEN: { + luaK_exp2anyreg(fs, e); /* cannot operate on constants */ + codearith(fs, OP_LEN, e, &e2); + break; + } + default: lua_assert(0); + } +} + + +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ + break; + } + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: + case OPR_MOD: case OPR_POW: { + if (!isnumeral(v)) luaK_exp2RK(fs, v); + break; + } + default: { + luaK_exp2RK(fs, v); + break; + } + } +} + + +void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { + switch (op) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { + luaK_exp2val(fs, e2); + if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { + lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1); + freeexp(fs, e1); + SETARG_B(getcode(fs, e2), e1->u.s.info); + e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; + } + else { + luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ + codearith(fs, OP_CONCAT, e1, e2); + } + break; + } + case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break; + case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break; + case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break; + case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break; + case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break; + case OPR_POW: codearith(fs, OP_POW, e1, e2); break; + case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break; + case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break; + case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break; + case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break; + case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break; + case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break; + default: lua_assert(0); + } +} + + +void luaK_fixline (FuncState *fs, int line) { + fs->f->lineinfo[fs->pc - 1] = line; +} + + +static int luaK_code (FuncState *fs, Instruction i, int line) { + Proto *f = fs->f; + dischargejpc(fs); /* `pc' will change */ + /* put new instruction in code array */ + luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "code size overflow"); + f->code[fs->pc] = i; + /* save corresponding line information */ + luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int, + MAX_INT, "code size overflow"); + f->lineinfo[fs->pc] = line; + return fs->pc++; +} + + +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { + lua_assert(getOpMode(o) == iABC); + lua_assert(getBMode(o) != OpArgN || b == 0); + lua_assert(getCMode(o) != OpArgN || c == 0); + return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); +} + + +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); + lua_assert(getCMode(o) == OpArgN); + return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); +} + + +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; + int b = (tostore == LUA_MULTRET) ? 0 : tostore; + lua_assert(tostore != 0); + if (c <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, b, c); + else { + luaK_codeABC(fs, OP_SETLIST, base, b, 0); + luaK_code(fs, cast(Instruction, c), fs->ls->lastline); + } + fs->freereg = base + 1; /* free registers with list values */ +} + diff --git a/lua-5.1.4/src/lcode.h b/lua-5.1.4/src/lcode.h new file mode 100644 index 000000000..b941c6072 --- /dev/null +++ b/lua-5.1.4/src/lcode.h @@ -0,0 +1,76 @@ +/* +** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, + OPR_CONCAT, + OPR_NE, OPR_EQ, + OPR_LT, OPR_LE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/lua-5.1.4/src/ldblib.c b/lua-5.1.4/src/ldblib.c new file mode 100644 index 000000000..67de1222a --- /dev/null +++ b/lua-5.1.4/src/ldblib.c @@ -0,0 +1,397 @@ +/* +** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ +** Interface from Lua to its debug API +** See Copyright Notice in lua.h +*/ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define ldblib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static int db_getregistry (lua_State *L) { + lua_pushvalue(L, LUA_REGISTRYINDEX); + return 1; +} + + +static int db_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); /* no metatable */ + } + return 1; +} + + +static int db_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + lua_settop(L, 2); + lua_pushboolean(L, lua_setmetatable(L, 1)); + return 1; +} + + +static int db_getfenv (lua_State *L) { + lua_getfenv(L, 1); + return 1; +} + + +static int db_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + lua_settop(L, 2); + if (lua_setfenv(L, 1) == 0) + luaL_error(L, LUA_QL("setfenv") + " cannot change environment of given object"); + return 1; +} + + +static void settabss (lua_State *L, const char *i, const char *v) { + lua_pushstring(L, v); + lua_setfield(L, -2, i); +} + + +static void settabsi (lua_State *L, const char *i, int v) { + lua_pushinteger(L, v); + lua_setfield(L, -2, i); +} + + +static lua_State *getthread (lua_State *L, int *arg) { + if (lua_isthread(L, 1)) { + *arg = 1; + return lua_tothread(L, 1); + } + else { + *arg = 0; + return L; + } +} + + +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { + if (L == L1) { + lua_pushvalue(L, -2); + lua_remove(L, -3); + } + else + lua_xmove(L1, L, 1); + lua_setfield(L, -2, fname); +} + + +static int db_getinfo (lua_State *L) { + lua_Debug ar; + int arg; + lua_State *L1 = getthread(L, &arg); + const char *options = luaL_optstring(L, arg+2, "flnSu"); + if (lua_isnumber(L, arg+1)) { + if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { + lua_pushnil(L); /* level out of range */ + return 1; + } + } + else if (lua_isfunction(L, arg+1)) { + lua_pushfstring(L, ">%s", options); + options = lua_tostring(L, -1); + lua_pushvalue(L, arg+1); + lua_xmove(L, L1, 1); + } + else + return luaL_argerror(L, arg+1, "function or level expected"); + if (!lua_getinfo(L1, options, &ar)) + return luaL_argerror(L, arg+2, "invalid option"); + lua_createtable(L, 0, 2); + if (strchr(options, 'S')) { + settabss(L, "source", ar.source); + settabss(L, "short_src", ar.short_src); + settabsi(L, "linedefined", ar.linedefined); + settabsi(L, "lastlinedefined", ar.lastlinedefined); + settabss(L, "what", ar.what); + } + if (strchr(options, 'l')) + settabsi(L, "currentline", ar.currentline); + if (strchr(options, 'u')) + settabsi(L, "nups", ar.nups); + if (strchr(options, 'n')) { + settabss(L, "name", ar.name); + settabss(L, "namewhat", ar.namewhat); + } + if (strchr(options, 'L')) + treatstackoption(L, L1, "activelines"); + if (strchr(options, 'f')) + treatstackoption(L, L1, "func"); + return 1; /* return table */ +} + + +static int db_getlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + const char *name; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2)); + if (name) { + lua_xmove(L1, L, 1); + lua_pushstring(L, name); + lua_pushvalue(L, -2); + return 2; + } + else { + lua_pushnil(L); + return 1; + } +} + + +static int db_setlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + luaL_checkany(L, arg+3); + lua_settop(L, arg+3); + lua_xmove(L, L1, 1); + lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2))); + return 1; +} + + +static int auxupvalue (lua_State *L, int get) { + const char *name; + int n = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TFUNCTION); + if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */ + name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); + if (name == NULL) return 0; + lua_pushstring(L, name); + lua_insert(L, -(get+1)); + return get + 1; +} + + +static int db_getupvalue (lua_State *L) { + return auxupvalue(L, 1); +} + + +static int db_setupvalue (lua_State *L) { + luaL_checkany(L, 3); + return auxupvalue(L, 0); +} + + + +static const char KEY_HOOK = 'h'; + + +static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail return"}; + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, L); + lua_rawget(L, -2); + if (lua_isfunction(L, -1)) { + lua_pushstring(L, hooknames[(int)ar->event]); + if (ar->currentline >= 0) + lua_pushinteger(L, ar->currentline); + else lua_pushnil(L); + lua_assert(lua_getinfo(L, "lS", ar)); + lua_call(L, 2, 0); + } +} + + +static int makemask (const char *smask, int count) { + int mask = 0; + if (strchr(smask, 'c')) mask |= LUA_MASKCALL; + if (strchr(smask, 'r')) mask |= LUA_MASKRET; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + return mask; +} + + +static char *unmakemask (int mask, char *smask) { + int i = 0; + if (mask & LUA_MASKCALL) smask[i++] = 'c'; + if (mask & LUA_MASKRET) smask[i++] = 'r'; + if (mask & LUA_MASKLINE) smask[i++] = 'l'; + smask[i] = '\0'; + return smask; +} + + +static void gethooktable (lua_State *L) { + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + lua_createtable(L, 0, 1); + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_pushvalue(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + } +} + + +static int db_sethook (lua_State *L) { + int arg, mask, count; + lua_Hook func; + lua_State *L1 = getthread(L, &arg); + if (lua_isnoneornil(L, arg+1)) { + lua_settop(L, arg+1); + func = NULL; mask = 0; count = 0; /* turn off hooks */ + } + else { + const char *smask = luaL_checkstring(L, arg+2); + luaL_checktype(L, arg+1, LUA_TFUNCTION); + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); + } + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_pushvalue(L, arg+1); + lua_rawset(L, -3); /* set new hook */ + lua_pop(L, 1); /* remove hook table */ + lua_sethook(L1, func, mask, count); /* set hooks */ + return 0; +} + + +static int db_gethook (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + char buff[5]; + int mask = lua_gethookmask(L1); + lua_Hook hook = lua_gethook(L1); + if (hook != NULL && hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_rawget(L, -2); /* get hook */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); + lua_pushinteger(L, lua_gethookcount(L1)); + return 3; +} + + +static int db_debug (lua_State *L) { + for (;;) { + char buffer[250]; + fputs("lua_debug> ", stderr); + if (fgets(buffer, sizeof(buffer), stdin) == 0 || + strcmp(buffer, "cont\n") == 0) + return 0; + if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || + lua_pcall(L, 0, 0, 0)) { + fputs(lua_tostring(L, -1), stderr); + fputs("\n", stderr); + } + lua_settop(L, 0); /* remove eventual returns */ + } +} + + +#define LEVELS1 12 /* size of the first part of the stack */ +#define LEVELS2 10 /* size of the second part of the stack */ + +static int db_errorfb (lua_State *L) { + int level; + int firstpart = 1; /* still before eventual `...' */ + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (lua_isnumber(L, arg+2)) { + level = (int)lua_tointeger(L, arg+2); + lua_pop(L, 1); + } + else + level = (L == L1) ? 1 : 0; /* level 0 may be this own function */ + if (lua_gettop(L) == arg) + lua_pushliteral(L, ""); + else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */ + else lua_pushliteral(L, "\n"); + lua_pushliteral(L, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (level > LEVELS1 && firstpart) { + /* no more than `LEVELS2' more levels? */ + if (!lua_getstack(L1, level+LEVELS2, &ar)) + level--; /* keep going */ + else { + lua_pushliteral(L, "\n\t..."); /* too many levels */ + while (lua_getstack(L1, level+LEVELS2, &ar)) /* find last levels */ + level++; + } + firstpart = 0; + continue; + } + lua_pushliteral(L, "\n\t"); + lua_getinfo(L1, "Snl", &ar); + lua_pushfstring(L, "%s:", ar.short_src); + if (ar.currentline > 0) + lua_pushfstring(L, "%d:", ar.currentline); + if (*ar.namewhat != '\0') /* is there a name? */ + lua_pushfstring(L, " in function " LUA_QS, ar.name); + else { + if (*ar.what == 'm') /* main? */ + lua_pushfstring(L, " in main chunk"); + else if (*ar.what == 'C' || *ar.what == 't') + lua_pushliteral(L, " ?"); /* C function or tail call */ + else + lua_pushfstring(L, " in function <%s:%d>", + ar.short_src, ar.linedefined); + } + lua_concat(L, lua_gettop(L) - arg); + } + lua_concat(L, lua_gettop(L) - arg); + return 1; +} + + +static const luaL_Reg dblib[] = { + {"debug", db_debug}, + {"getfenv", db_getfenv}, + {"gethook", db_gethook}, + {"getinfo", db_getinfo}, + {"getlocal", db_getlocal}, + {"getregistry", db_getregistry}, + {"getmetatable", db_getmetatable}, + {"getupvalue", db_getupvalue}, + {"setfenv", db_setfenv}, + {"sethook", db_sethook}, + {"setlocal", db_setlocal}, + {"setmetatable", db_setmetatable}, + {"setupvalue", db_setupvalue}, + {"traceback", db_errorfb}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_debug (lua_State *L) { + luaL_register(L, LUA_DBLIBNAME, dblib); + return 1; +} + diff --git a/lua-5.1.4/src/ldebug.c b/lua-5.1.4/src/ldebug.c new file mode 100644 index 000000000..50ad3d380 --- /dev/null +++ b/lua-5.1.4/src/ldebug.c @@ -0,0 +1,638 @@ +/* +** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + + +#include <stdarg.h> +#include <stddef.h> +#include <string.h> + + +#define ldebug_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); + + +static int currentpc (lua_State *L, CallInfo *ci) { + if (!isLua(ci)) return -1; /* function is not a Lua function? */ + if (ci == L->ci) + ci->savedpc = L->savedpc; + return pcRel(ci->savedpc, ci_func(ci)->l.p); +} + + +static int currentline (lua_State *L, CallInfo *ci) { + int pc = currentpc(L, ci); + if (pc < 0) + return -1; /* only active lua functions have current-line information */ + else + return getline(ci_func(ci)->l.p, pc); +} + + +/* +** this function can be called asynchronous (e.g. during a signal) +*/ +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); + return 1; +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + lua_lock(L); + for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { + level--; + if (f_isLua(ci)) /* Lua function? */ + level -= ci->tailcalls; /* skip lost tail calls */ + } + if (level == 0 && ci > L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = cast_int(ci - L->base_ci); + } + else if (level < 0) { /* level is of a lost tail call? */ + status = 1; + ar->i_ci = 0; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static Proto *getluaproto (CallInfo *ci) { + return (isLua(ci) ? ci_func(ci)->l.p : NULL); +} + + +static const char *findlocal (lua_State *L, CallInfo *ci, int n) { + const char *name; + Proto *fp = getluaproto(ci); + if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) + return name; /* is a local variable in a Lua function */ + else { + StkId limit = (ci == L->ci) ? L->top : (ci+1)->func; + if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */ + return "(*temporary)"; + else + return NULL; + } +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + luaA_pushobject(L, ci->base + (n - 1)); + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + setobjs2s(L, ci->base + (n - 1), L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (cl->c.isC) { + ar->source = "=[C]"; + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + ar->source = getstr(cl->l.p->source); + ar->linedefined = cl->l.p->linedefined; + ar->lastlinedefined = cl->l.p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); +} + + +static void info_tailcall (lua_Debug *ar) { + ar->name = ar->namewhat = ""; + ar->what = "tail"; + ar->lastlinedefined = ar->linedefined = ar->currentline = -1; + ar->source = "=(tail call)"; + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); + ar->nups = 0; +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (f == NULL || f->c.isC) { + setnilvalue(L->top); + } + else { + Table *t = luaH_new(L, 0, 0); + int *lineinfo = f->l.p->lineinfo; + int i; + for (i=0; i<f->l.p->sizelineinfo; i++) + setbvalue(luaH_setnum(L, t, lineinfo[i]), 1); + sethvalue(L, L->top, t); + } + incr_top(L); +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + if (f == NULL) { + info_tailcall(ar); + return status; + } + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci) ? currentline(L, ci) : -1; + break; + } + case 'u': { + ar->nups = f->c.nupvalues; + break; + } + case 'n': { + ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL; + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *f = NULL; + CallInfo *ci = NULL; + lua_lock(L); + if (*what == '>') { + StkId func = L->top - 1; + luai_apicheck(L, ttisfunction(func)); + what++; /* skip the '>' */ + f = clvalue(func); + L->top--; /* pop function */ + } + else if (ar->i_ci != 0) { /* no tail call? */ + ci = L->base_ci + ar->i_ci; + lua_assert(ttisfunction(ci->func)); + f = clvalue(ci->func); + } + status = auxgetinfo(L, what, ar, f, ci); + if (strchr(what, 'f')) { + if (f == NULL) setnilvalue(L->top); + else setclvalue(L, L->top, f); + incr_top(L); + } + if (strchr(what, 'L')) + collectvalidlines(L, f); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution and code checker +** ======================================================= +*/ + +#define check(x) if (!(x)) return 0; + +#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) + +#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) + + + +static int precheck (const Proto *pt) { + check(pt->maxstacksize <= MAXSTACK); + check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize); + check(!(pt->is_vararg & VARARG_NEEDSARG) || + (pt->is_vararg & VARARG_HASARG)); + check(pt->sizeupvalues <= pt->nups); + check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0); + check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); + return 1; +} + + +#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) + +int luaG_checkopenop (Instruction i) { + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + case OP_RETURN: + case OP_SETLIST: { + check(GETARG_B(i) == 0); + return 1; + } + default: return 0; /* invalid instruction after an open call */ + } +} + + +static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { + switch (mode) { + case OpArgN: check(r == 0); break; + case OpArgU: break; + case OpArgR: checkreg(pt, r); break; + case OpArgK: + check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize); + break; + } + return 1; +} + + +static Instruction symbexec (const Proto *pt, int lastpc, int reg) { + int pc; + int last; /* stores position of last instruction that changed `reg' */ + last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ + check(precheck(pt)); + for (pc = 0; pc < lastpc; pc++) { + Instruction i = pt->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + int b = 0; + int c = 0; + check(op < NUM_OPCODES); + checkreg(pt, a); + switch (getOpMode(op)) { + case iABC: { + b = GETARG_B(i); + c = GETARG_C(i); + check(checkArgMode(pt, b, getBMode(op))); + check(checkArgMode(pt, c, getCMode(op))); + break; + } + case iABx: { + b = GETARG_Bx(i); + if (getBMode(op) == OpArgK) check(b < pt->sizek); + break; + } + case iAsBx: { + b = GETARG_sBx(i); + if (getBMode(op) == OpArgR) { + int dest = pc+1+b; + check(0 <= dest && dest < pt->sizecode); + if (dest > 0) { + int j; + /* check that it does not jump to a setlist count; this + is tricky, because the count from a previous setlist may + have the same value of an invalid setlist; so, we must + go all the way back to the first of them (if any) */ + for (j = 0; j < dest; j++) { + Instruction d = pt->code[dest-1-j]; + if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break; + } + /* if 'j' is even, previous value is not a setlist (even if + it looks like one) */ + check((j&1) == 0); + } + } + break; + } + } + if (testAMode(op)) { + if (a == reg) last = pc; /* change register `a' */ + } + if (testTMode(op)) { + check(pc+2 < pt->sizecode); /* check skip */ + check(GET_OPCODE(pt->code[pc+1]) == OP_JMP); + } + switch (op) { + case OP_LOADBOOL: { + if (c == 1) { /* does it jump? */ + check(pc+2 < pt->sizecode); /* check its jump */ + check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST || + GETARG_C(pt->code[pc+1]) != 0); + } + break; + } + case OP_LOADNIL: { + if (a <= reg && reg <= b) + last = pc; /* set registers from `a' to `b' */ + break; + } + case OP_GETUPVAL: + case OP_SETUPVAL: { + check(b < pt->nups); + break; + } + case OP_GETGLOBAL: + case OP_SETGLOBAL: { + check(ttisstring(&pt->k[b])); + break; + } + case OP_SELF: { + checkreg(pt, a+1); + if (reg == a+1) last = pc; + break; + } + case OP_CONCAT: { + check(b < c); /* at least two operands */ + break; + } + case OP_TFORLOOP: { + check(c >= 1); /* at least one result (control variable) */ + checkreg(pt, a+2+c); /* space for results */ + if (reg >= a+2) last = pc; /* affect all regs above its base */ + break; + } + case OP_FORLOOP: + case OP_FORPREP: + checkreg(pt, a+3); + /* go through */ + case OP_JMP: { + int dest = pc+1+b; + /* not full check and jump is forward and do not skip `lastpc'? */ + if (reg != NO_REG && pc < dest && dest <= lastpc) + pc += b; /* do the jump */ + break; + } + case OP_CALL: + case OP_TAILCALL: { + if (b != 0) { + checkreg(pt, a+b-1); + } + c--; /* c = num. returns */ + if (c == LUA_MULTRET) { + check(checkopenop(pt, pc)); + } + else if (c != 0) + checkreg(pt, a+c-1); + if (reg >= a) last = pc; /* affect all registers above base */ + break; + } + case OP_RETURN: { + b--; /* b = num. returns */ + if (b > 0) checkreg(pt, a+b-1); + break; + } + case OP_SETLIST: { + if (b > 0) checkreg(pt, a + b); + if (c == 0) { + pc++; + check(pc < pt->sizecode - 1); + } + break; + } + case OP_CLOSURE: { + int nup, j; + check(b < pt->sizep); + nup = pt->p[b]->nups; + check(pc + nup < pt->sizecode); + for (j = 1; j <= nup; j++) { + OpCode op1 = GET_OPCODE(pt->code[pc + j]); + check(op1 == OP_GETUPVAL || op1 == OP_MOVE); + } + if (reg != NO_REG) /* tracing? */ + pc += nup; /* do not 'execute' these pseudo-instructions */ + break; + } + case OP_VARARG: { + check((pt->is_vararg & VARARG_ISVARARG) && + !(pt->is_vararg & VARARG_NEEDSARG)); + b--; + if (b == LUA_MULTRET) check(checkopenop(pt, pc)); + checkreg(pt, a+b-1); + break; + } + default: break; + } + } + return pt->code[last]; +} + +#undef check +#undef checkjump +#undef checkreg + +/* }====================================================== */ + + +int luaG_checkcode (const Proto *pt) { + return (symbexec(pt, pt->sizecode, NO_REG) != 0); +} + + +static const char *kname (Proto *p, int c) { + if (ISK(c) && ttisstring(&p->k[INDEXK(c)])) + return svalue(&p->k[INDEXK(c)]); + else + return "?"; +} + + +static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, + const char **name) { + if (isLua(ci)) { /* a Lua function? */ + Proto *p = ci_func(ci)->l.p; + int pc = currentpc(L, ci); + Instruction i; + *name = luaF_getlocalname(p, stackpos+1, pc); + if (*name) /* is a local? */ + return "local"; + i = symbexec(p, pc, stackpos); /* try symbolic execution */ + lua_assert(pc != -1); + switch (GET_OPCODE(i)) { + case OP_GETGLOBAL: { + int g = GETARG_Bx(i); /* global index */ + lua_assert(ttisstring(&p->k[g])); + *name = svalue(&p->k[g]); + return "global"; + } + case OP_MOVE: { + int a = GETARG_A(i); + int b = GETARG_B(i); /* move from `b' to `a' */ + if (b < a) + return getobjname(L, ci, b, name); /* get name for `b' */ + break; + } + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "field"; + } + case OP_GETUPVAL: { + int u = GETARG_B(i); /* upvalue index */ + *name = p->upvalues ? getstr(p->upvalues[u]) : "?"; + return "upvalue"; + } + case OP_SELF: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "method"; + } + default: break; + } + } + return NULL; /* no useful name found */ +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + Instruction i; + if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) + return NULL; /* calling function is not Lua (or is unknown) */ + ci--; /* calling function */ + i = ci_func(ci)->l.p->code[currentpc(L, ci)]; + if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || + GET_OPCODE(i) == OP_TFORLOOP) + return getobjname(L, ci, GETARG_A(i), name); + else + return NULL; /* no useful name can be found */ +} + + +/* only ANSI way to check whether a pointer points to an array */ +static int isinstack (CallInfo *ci, const TValue *o) { + StkId p; + for (p = ci->base; p < ci->top; p++) + if (o == p) return 1; + return 0; +} + + +void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + const char *name = NULL; + const char *t = luaT_typenames[ttype(o)]; + const char *kind = (isinstack(L->ci, o)) ? + getobjname(L, L->ci, cast_int(o - L->base), &name) : + NULL; + if (kind) + luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", + op, kind, name, t); + else + luaG_runerror(L, "attempt to %s a %s value", op, t); +} + + +void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { + if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; + lua_assert(!ttisstring(p1) && !ttisnumber(p1)); + luaG_typeerror(L, p1, "concatenate"); +} + + +void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { + TValue temp; + if (luaV_tonumber(p1, &temp) == NULL) + p2 = p1; /* first operand is wrong */ + luaG_typeerror(L, p2, "perform arithmetic on"); +} + + +int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_typenames[ttype(p1)]; + const char *t2 = luaT_typenames[ttype(p2)]; + if (t1[2] == t2[2]) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); + return 0; +} + + +static void addinfo (lua_State *L, const char *msg) { + CallInfo *ci = L->ci; + if (isLua(ci)) { /* is Lua code? */ + char buff[LUA_IDSIZE]; /* add file:line information */ + int line = currentline(L, ci); + luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE); + luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); + } +} + + +void luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); + setobjs2s(L, L->top, L->top - 1); /* move argument */ + setobjs2s(L, L->top - 1, errfunc); /* push function */ + incr_top(L); + luaD_call(L, L->top - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +void luaG_runerror (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + addinfo(L, luaO_pushvfstring(L, fmt, argp)); + va_end(argp); + luaG_errormsg(L); +} + diff --git a/lua-5.1.4/src/ldebug.h b/lua-5.1.4/src/ldebug.h new file mode 100644 index 000000000..ba28a9724 --- /dev/null +++ b/lua-5.1.4/src/ldebug.h @@ -0,0 +1,33 @@ +/* +** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); +LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_checkcode (const Proto *pt); +LUAI_FUNC int luaG_checkopenop (Instruction i); + +#endif diff --git a/lua-5.1.4/src/ldo.c b/lua-5.1.4/src/ldo.c new file mode 100644 index 000000000..8de05f728 --- /dev/null +++ b/lua-5.1.4/src/ldo.c @@ -0,0 +1,518 @@ +/* +** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + + +#include <setjmp.h> +#include <stdlib.h> +#include <string.h> + +#define ldo_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + + +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; + + +void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { + setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + case LUA_ERRSYNTAX: + case LUA_ERRRUN: { + setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + break; + } + } + L->top = oldtop + 1; +} + + +static void restore_stack_limit (lua_State *L) { + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ + int inuse = cast_int(L->ci - L->base_ci); + if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ + luaD_reallocCI(L, LUAI_MAXCALLS); + } +} + + +static void resetstack (lua_State *L, int status) { + L->ci = L->base_ci; + L->base = L->ci->base; + luaF_close(L, L->base); /* close eventual pending closures */ + luaD_seterrorobj(L, status, L->base); + L->nCcalls = L->baseCcalls; + L->allowhook = 1; + restore_stack_limit(L); + L->errfunc = 0; + L->errorJmp = NULL; +} + + +void luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { + L->errorJmp->status = errcode; + LUAI_THROW(L, L->errorJmp); + } + else { + L->status = cast_byte(errcode); + if (G(L)->panic) { + resetstack(L, errcode); + lua_unlock(L); + G(L)->panic(L); + } + exit(EXIT_FAILURE); + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + struct lua_longjmp lj; + lj.status = 0; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); + L->errorJmp = lj.previous; /* restore old error handler */ + return lj.status; +} + +/* }====================================================== */ + + +static void correctstack (lua_State *L, TValue *oldstack) { + CallInfo *ci; + GCObject *up; + L->top = (L->top - oldstack) + L->stack; + for (up = L->openupval; up != NULL; up = up->gch.next) + gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack; + for (ci = L->base_ci; ci <= L->ci; ci++) { + ci->top = (ci->top - oldstack) + L->stack; + ci->base = (ci->base - oldstack) + L->stack; + ci->func = (ci->func - oldstack) + L->stack; + } + L->base = (L->base - oldstack) + L->stack; +} + + +void luaD_reallocstack (lua_State *L, int newsize) { + TValue *oldstack = L->stack; + int realsize = newsize + 1 + EXTRA_STACK; + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue); + L->stacksize = realsize; + L->stack_last = L->stack+newsize; + correctstack(L, oldstack); +} + + +void luaD_reallocCI (lua_State *L, int newsize) { + CallInfo *oldci = L->base_ci; + luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo); + L->size_ci = newsize; + L->ci = (L->ci - oldci) + L->base_ci; + L->end_ci = L->base_ci + L->size_ci - 1; +} + + +void luaD_growstack (lua_State *L, int n) { + if (n <= L->stacksize) /* double size is enough? */ + luaD_reallocstack(L, 2*L->stacksize); + else + luaD_reallocstack(L, L->stacksize + n); +} + + +static CallInfo *growCI (lua_State *L) { + if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ + luaD_throw(L, LUA_ERRERR); + else { + luaD_reallocCI(L, 2*L->size_ci); + if (L->size_ci > LUAI_MAXCALLS) + luaG_runerror(L, "stack overflow"); + } + return ++L->ci; +} + + +void luaD_callhook (lua_State *L, int event, int line) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { + ptrdiff_t top = savestack(L, L->top); + ptrdiff_t ci_top = savestack(L, L->ci->top); + lua_Debug ar; + ar.event = event; + ar.currentline = line; + if (event == LUA_HOOKTAILRET) + ar.i_ci = 0; /* tail call; no debug information about it */ + else + ar.i_ci = cast_int(L->ci - L->base_ci); + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + L->ci->top = L->top + LUA_MINSTACK; + lua_assert(L->ci->top <= L->stack_last); + L->allowhook = 0; /* cannot call hooks inside a hook */ + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + L->ci->top = restorestack(L, ci_top); + L->top = restorestack(L, top); + } +} + + +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { + int i; + int nfixargs = p->numparams; + Table *htab = NULL; + StkId base, fixed; + for (; actual < nfixargs; ++actual) + setnilvalue(L->top++); +#if defined(LUA_COMPAT_VARARG) + if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */ + int nvar = actual - nfixargs; /* number of extra arguments */ + lua_assert(p->is_vararg & VARARG_HASARG); + luaC_checkGC(L); + htab = luaH_new(L, nvar, 1); /* create `arg' table */ + for (i=0; i<nvar; i++) /* put extra arguments into `arg' table */ + setobj2n(L, luaH_setnum(L, htab, i+1), L->top - nvar + i); + /* store counter in field `n' */ + setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); + } +#endif + /* move fixed parameters to final position */ + fixed = L->top - actual; /* first fixed argument */ + base = L->top; /* final position of first argument */ + for (i=0; i<nfixargs; i++) { + setobjs2s(L, L->top++, fixed+i); + setnilvalue(fixed+i); + } + /* add `arg' parameter */ + if (htab) { + sethvalue(L, L->top++, htab); + lua_assert(iswhite(obj2gco(htab))); + } + return base; +} + + +static StkId tryfuncTM (lua_State *L, StkId func) { + const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); + StkId p; + ptrdiff_t funcr = savestack(L, func); + if (!ttisfunction(tm)) + luaG_typeerror(L, func, "call"); + /* Open a hole inside the stack at `func' */ + for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); + incr_top(L); + func = restorestack(L, funcr); /* previous call may change stack */ + setobj2s(L, func, tm); /* tag method is the new function to be called */ + return func; +} + + + +#define inc_ci(L) \ + ((L->ci == L->end_ci) ? growCI(L) : \ + (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) + + +int luaD_precall (lua_State *L, StkId func, int nresults) { + LClosure *cl; + ptrdiff_t funcr; + if (!ttisfunction(func)) /* `func' is not a function? */ + func = tryfuncTM(L, func); /* check the `function' tag method */ + funcr = savestack(L, func); + cl = &clvalue(func)->l; + L->ci->savedpc = L->savedpc; + if (!cl->isC) { /* Lua function? prepare its call */ + CallInfo *ci; + StkId st, base; + Proto *p = cl->p; + luaD_checkstack(L, p->maxstacksize); + func = restorestack(L, funcr); + if (!p->is_vararg) { /* no varargs? */ + base = func + 1; + if (L->top > base + p->numparams) + L->top = base + p->numparams; + } + else { /* vararg function */ + int nargs = cast_int(L->top - func) - 1; + base = adjust_varargs(L, p, nargs); + func = restorestack(L, funcr); /* previous call may change the stack */ + } + ci = inc_ci(L); /* now `enter' new function */ + ci->func = func; + L->base = ci->base = base; + ci->top = L->base + p->maxstacksize; + lua_assert(ci->top <= L->stack_last); + L->savedpc = p->code; /* starting point */ + ci->tailcalls = 0; + ci->nresults = nresults; + for (st = L->top; st < ci->top; st++) + setnilvalue(st); + L->top = ci->top; + if (L->hookmask & LUA_MASKCALL) { + L->savedpc++; /* hooks assume 'pc' is already incremented */ + luaD_callhook(L, LUA_HOOKCALL, -1); + L->savedpc--; /* correct 'pc' */ + } + return PCRLUA; + } + else { /* if is a C function, call it */ + CallInfo *ci; + int n; + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + ci = inc_ci(L); /* now `enter' new function */ + ci->func = restorestack(L, funcr); + L->base = ci->base = ci->func + 1; + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + ci->nresults = nresults; + if (L->hookmask & LUA_MASKCALL) + luaD_callhook(L, LUA_HOOKCALL, -1); + lua_unlock(L); + n = (*curr_func(L)->c.f)(L); /* do the actual call */ + lua_lock(L); + if (n < 0) /* yielding? */ + return PCRYIELD; + else { + luaD_poscall(L, L->top - n); + return PCRC; + } + } +} + + +static StkId callrethooks (lua_State *L, StkId firstResult) { + ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ + luaD_callhook(L, LUA_HOOKRET, -1); + if (f_isLua(L->ci)) { /* Lua function? */ + while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */ + luaD_callhook(L, LUA_HOOKTAILRET, -1); + } + return restorestack(L, fr); +} + + +int luaD_poscall (lua_State *L, StkId firstResult) { + StkId res; + int wanted, i; + CallInfo *ci; + if (L->hookmask & LUA_MASKRET) + firstResult = callrethooks(L, firstResult); + ci = L->ci--; + res = ci->func; /* res == final position of 1st result */ + wanted = ci->nresults; + L->base = (ci - 1)->base; /* restore base */ + L->savedpc = (ci - 1)->savedpc; /* restore savedpc */ + /* move results to correct place */ + for (i = wanted; i != 0 && firstResult < L->top; i--) + setobjs2s(L, res++, firstResult++); + while (i-- > 0) + setnilvalue(res++); + L->top = res; + return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ +} + + +/* +** Call a function (C or Lua). The function to be called is at *func. +** The arguments are on the stack, right after the function. +** When returns, all the results are on the stack, starting at the original +** function position. +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + if (++L->nCcalls >= LUAI_MAXCCALLS) { + if (L->nCcalls == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) + luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ + } + if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */ + luaV_execute(L, 1); /* call it */ + L->nCcalls--; + luaC_checkGC(L); +} + + +static void resume (lua_State *L, void *ud) { + StkId firstArg = cast(StkId, ud); + CallInfo *ci = L->ci; + if (L->status == 0) { /* start coroutine? */ + lua_assert(ci == L->base_ci && firstArg > L->base); + if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) + return; + } + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = 0; + if (!f_isLua(ci)) { /* `common' yield? */ + /* finish interrupted execution of `OP_CALL' */ + lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || + GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL); + if (luaD_poscall(L, firstArg)) /* complete it... */ + L->top = L->ci->top; /* and correct top if not multiple results */ + } + else /* yielded inside a hook: just continue its execution */ + L->base = L->ci->base; + } + luaV_execute(L, cast_int(L->ci - L->base_ci)); +} + + +static int resume_error (lua_State *L, const char *msg) { + L->top = L->ci->base; + setsvalue2s(L, L->top, luaS_new(L, msg)); + incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +LUA_API int lua_resume (lua_State *L, int nargs) { + int status; + lua_lock(L); + if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) + return resume_error(L, "cannot resume non-suspended coroutine"); + if (L->nCcalls >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow"); + luai_userstateresume(L, nargs); + lua_assert(L->errfunc == 0); + L->baseCcalls = ++L->nCcalls; + status = luaD_rawrunprotected(L, resume, L->top - nargs); + if (status != 0) { /* error? */ + L->status = cast_byte(status); /* mark thread as `dead' */ + luaD_seterrorobj(L, status, L->top); + L->ci->top = L->top; + } + else { + lua_assert(L->nCcalls == L->baseCcalls); + status = L->status; + } + --L->nCcalls; + lua_unlock(L); + return status; +} + + +LUA_API int lua_yield (lua_State *L, int nresults) { + luai_userstateyield(L, nresults); + lua_lock(L); + if (L->nCcalls > L->baseCcalls) + luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); + L->base = L->top - nresults; /* protect stack slots below */ + L->status = LUA_YIELD; + lua_unlock(L); + return -1; +} + + +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + unsigned short oldnCcalls = L->nCcalls; + ptrdiff_t old_ci = saveci(L, L->ci); + lu_byte old_allowhooks = L->allowhook; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (status != 0) { /* an error occurred? */ + StkId oldtop = restorestack(L, old_top); + luaF_close(L, oldtop); /* close eventual pending closures */ + luaD_seterrorobj(L, status, oldtop); + L->nCcalls = oldnCcalls; + L->ci = restoreci(L, old_ci); + L->base = L->ci->base; + L->savedpc = L->ci->savedpc; + L->allowhook = old_allowhooks; + restore_stack_limit(L); + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to `f_parser' */ + ZIO *z; + Mbuffer buff; /* buffer to be used by the scanner */ + const char *name; +}; + +static void f_parser (lua_State *L, void *ud) { + int i; + Proto *tf; + Closure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = luaZ_lookahead(p->z); + luaC_checkGC(L); + tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, + &p->buff, p->name); + cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L))); + cl->l.p = tf; + for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */ + cl->l.upvals[i] = luaF_newupval(L); + setclvalue(L, L->top, cl); + incr_top(L); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { + struct SParser p; + int status; + p.z = z; p.name = name; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + luaZ_freebuffer(L, &p.buff); + return status; +} + + diff --git a/lua-5.1.4/src/ldo.h b/lua-5.1.4/src/ldo.h new file mode 100644 index 000000000..98fddac59 --- /dev/null +++ b/lua-5.1.4/src/ldo.h @@ -0,0 +1,57 @@ +/* +** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +#define luaD_checkstack(L,n) \ + if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ + luaD_growstack(L, n); \ + else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); + + +#define incr_top(L) {luaD_checkstack(L,1); L->top++;} + +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) + +#define saveci(L,p) ((char *)(p) - (char *)L->base_ci) +#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) + + +/* results from luaD_precall */ +#define PCRLUA 0 /* initiated a call to a Lua function */ +#define PCRC 1 /* did a call to a C function */ +#define PCRYIELD 2 /* C funtion yielded */ + + +/* type of protected functions, to be ran by `runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); +LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); +LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); + +LUAI_FUNC void luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); + +#endif + diff --git a/lua-5.1.4/src/ldump.c b/lua-5.1.4/src/ldump.c new file mode 100644 index 000000000..c9d3d4870 --- /dev/null +++ b/lua-5.1.4/src/ldump.c @@ -0,0 +1,164 @@ +/* +** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include <stddef.h> + +#define ldump_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + +typedef struct { + lua_State* L; + lua_Writer writer; + void* data; + int strip; + int status; +} DumpState; + +#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) +#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) + +static void DumpBlock(const void* b, size_t size, DumpState* D) +{ + if (D->status==0) + { + lua_unlock(D->L); + D->status=(*D->writer)(D->L,b,size,D->data); + lua_lock(D->L); + } +} + +static void DumpChar(int y, DumpState* D) +{ + char x=(char)y; + DumpVar(x,D); +} + +static void DumpInt(int x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpNumber(lua_Number x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpVector(const void* b, int n, size_t size, DumpState* D) +{ + DumpInt(n,D); + DumpMem(b,n,size,D); +} + +static void DumpString(const TString* s, DumpState* D) +{ + if (s==NULL || getstr(s)==NULL) + { + size_t size=0; + DumpVar(size,D); + } + else + { + size_t size=s->tsv.len+1; /* include trailing '\0' */ + DumpVar(size,D); + DumpBlock(getstr(s),size,D); + } +} + +#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D); + +static void DumpConstants(const Proto* f, DumpState* D) +{ + int i,n=f->sizek; + DumpInt(n,D); + for (i=0; i<n; i++) + { + const TValue* o=&f->k[i]; + DumpChar(ttype(o),D); + switch (ttype(o)) + { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + DumpChar(bvalue(o),D); + break; + case LUA_TNUMBER: + DumpNumber(nvalue(o),D); + break; + case LUA_TSTRING: + DumpString(rawtsvalue(o),D); + break; + default: + lua_assert(0); /* cannot happen */ + break; + } + } + n=f->sizep; + DumpInt(n,D); + for (i=0; i<n; i++) DumpFunction(f->p[i],f->source,D); +} + +static void DumpDebug(const Proto* f, DumpState* D) +{ + int i,n; + n= (D->strip) ? 0 : f->sizelineinfo; + DumpVector(f->lineinfo,n,sizeof(int),D); + n= (D->strip) ? 0 : f->sizelocvars; + DumpInt(n,D); + for (i=0; i<n; i++) + { + DumpString(f->locvars[i].varname,D); + DumpInt(f->locvars[i].startpc,D); + DumpInt(f->locvars[i].endpc,D); + } + n= (D->strip) ? 0 : f->sizeupvalues; + DumpInt(n,D); + for (i=0; i<n; i++) DumpString(f->upvalues[i],D); +} + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D) +{ + DumpString((f->source==p || D->strip) ? NULL : f->source,D); + DumpInt(f->linedefined,D); + DumpInt(f->lastlinedefined,D); + DumpChar(f->nups,D); + DumpChar(f->numparams,D); + DumpChar(f->is_vararg,D); + DumpChar(f->maxstacksize,D); + DumpCode(f,D); + DumpConstants(f,D); + DumpDebug(f,D); +} + +static void DumpHeader(DumpState* D) +{ + char h[LUAC_HEADERSIZE]; + luaU_header(h); + DumpBlock(h,LUAC_HEADERSIZE,D); +} + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) +{ + DumpState D; + D.L=L; + D.writer=w; + D.data=data; + D.strip=strip; + D.status=0; + DumpHeader(&D); + DumpFunction(f,NULL,&D); + return D.status; +} diff --git a/lua-5.1.4/src/lfunc.c b/lua-5.1.4/src/lfunc.c new file mode 100644 index 000000000..813e88f58 --- /dev/null +++ b/lua-5.1.4/src/lfunc.c @@ -0,0 +1,174 @@ +/* +** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + + +#include <stddef.h> + +#define lfunc_c +#define LUA_CORE + +#include "lua.h" + +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->c.isC = 1; + c->c.env = e; + c->c.nupvalues = cast_byte(nelems); + return c; +} + + +Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->l.isC = 0; + c->l.env = e; + c->l.nupvalues = cast_byte(nelems); + while (nelems--) c->l.upvals[nelems] = NULL; + return c; +} + + +UpVal *luaF_newupval (lua_State *L) { + UpVal *uv = luaM_new(L, UpVal); + luaC_link(L, obj2gco(uv), LUA_TUPVAL); + uv->v = &uv->u.value; + setnilvalue(uv->v); + return uv; +} + + +UpVal *luaF_findupval (lua_State *L, StkId level) { + global_State *g = G(L); + GCObject **pp = &L->openupval; + UpVal *p; + UpVal *uv; + while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) { + lua_assert(p->v != &p->u.value); + if (p->v == level) { /* found a corresponding upvalue? */ + if (isdead(g, obj2gco(p))) /* is it dead? */ + changewhite(obj2gco(p)); /* ressurect it */ + return p; + } + pp = &p->next; + } + uv = luaM_new(L, UpVal); /* not found: create a new one */ + uv->tt = LUA_TUPVAL; + uv->marked = luaC_white(g); + uv->v = level; /* current value lives in the stack */ + uv->next = *pp; /* chain it in the proper position */ + *pp = obj2gco(uv); + uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */ + uv->u.l.next = g->uvhead.u.l.next; + uv->u.l.next->u.l.prev = uv; + g->uvhead.u.l.next = uv; + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + return uv; +} + + +static void unlinkupval (UpVal *uv) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ + uv->u.l.prev->u.l.next = uv->u.l.next; +} + + +void luaF_freeupval (lua_State *L, UpVal *uv) { + if (uv->v != &uv->u.value) /* is it open? */ + unlinkupval(uv); /* remove from open list */ + luaM_free(L, uv); /* free upvalue */ +} + + +void luaF_close (lua_State *L, StkId level) { + UpVal *uv; + global_State *g = G(L); + while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { + GCObject *o = obj2gco(uv); + lua_assert(!isblack(o) && uv->v != &uv->u.value); + L->openupval = uv->next; /* remove from `open' list */ + if (isdead(g, o)) + luaF_freeupval(L, uv); /* free upvalue */ + else { + unlinkupval(uv); + setobj(L, &uv->u.value, uv->v); + uv->v = &uv->u.value; /* now current value lives here */ + luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ + } + } +} + + +Proto *luaF_newproto (lua_State *L) { + Proto *f = luaM_new(L, Proto); + luaC_link(L, obj2gco(f), LUA_TPROTO); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->sizecode = 0; + f->sizelineinfo = 0; + f->sizeupvalues = 0; + f->nups = 0; + f->upvalues = NULL; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->lineinfo = NULL; + f->sizelocvars = 0; + f->locvars = NULL; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode, Instruction); + luaM_freearray(L, f->p, f->sizep, Proto *); + luaM_freearray(L, f->k, f->sizek, TValue); + luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); + luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); + luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); + luaM_free(L, f); +} + + +void luaF_freeclosure (lua_State *L, Closure *c) { + int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : + sizeLclosure(c->l.nupvalues); + luaM_freemem(L, c, size); +} + + +/* +** Look for n-th local variable at line `line' in function `func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; i<f->sizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/lua-5.1.4/src/lfunc.h b/lua-5.1.4/src/lfunc.h new file mode 100644 index 000000000..a68cf5151 --- /dev/null +++ b/lua-5.1.4/src/lfunc.h @@ -0,0 +1,34 @@ +/* +** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) + +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); +LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/lua-5.1.4/src/lgc.c b/lua-5.1.4/src/lgc.c new file mode 100644 index 000000000..d9e0b7829 --- /dev/null +++ b/lua-5.1.4/src/lgc.c @@ -0,0 +1,711 @@ +/* +** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#include <string.h> + +#define lgc_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define GCSTEPSIZE 1024u +#define GCSWEEPMAX 40 +#define GCSWEEPCOST 10 +#define GCFINALIZECOST 100 + + +#define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) + +#define makewhite(g,x) \ + ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) + +#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) + +#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) + + +#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT) +#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT) + + +#define KEYWEAK bitmask(KEYWEAKBIT) +#define VALUEWEAK bitmask(VALUEWEAKBIT) + + + +#define markvalue(g,o) { checkconsistency(o); \ + if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); } + +#define markobject(g,t) { if (iswhite(obj2gco(t))) \ + reallymarkobject(g, obj2gco(t)); } + + +#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) + + +static void removeentry (Node *n) { + lua_assert(ttisnil(gval(n))); + if (iscollectable(gkey(n))) + setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */ +} + + +static void reallymarkobject (global_State *g, GCObject *o) { + lua_assert(iswhite(o) && !isdead(g, o)); + white2gray(o); + switch (o->gch.tt) { + case LUA_TSTRING: { + return; + } + case LUA_TUSERDATA: { + Table *mt = gco2u(o)->metatable; + gray2black(o); /* udata are never gray */ + if (mt) markobject(g, mt); + markobject(g, gco2u(o)->env); + return; + } + case LUA_TUPVAL: { + UpVal *uv = gco2uv(o); + markvalue(g, uv->v); + if (uv->v == &uv->u.value) /* closed? */ + gray2black(o); /* open upvalues are never black */ + return; + } + case LUA_TFUNCTION: { + gco2cl(o)->c.gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTABLE: { + gco2h(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTHREAD: { + gco2th(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TPROTO: { + gco2p(o)->gclist = g->gray; + g->gray = o; + break; + } + default: lua_assert(0); + } +} + + +static void marktmu (global_State *g) { + GCObject *u = g->tmudata; + if (u) { + do { + u = u->gch.next; + makewhite(g, u); /* may be marked, if left from previous GC */ + reallymarkobject(g, u); + } while (u != g->tmudata); + } +} + + +/* move `dead' udata that need finalization to list `tmudata' */ +size_t luaC_separateudata (lua_State *L, int all) { + global_State *g = G(L); + size_t deadmem = 0; + GCObject **p = &g->mainthread->next; + GCObject *curr; + while ((curr = *p) != NULL) { + if (!(iswhite(curr) || all) || isfinalized(gco2u(curr))) + p = &curr->gch.next; /* don't bother with them */ + else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) { + markfinalized(gco2u(curr)); /* don't need finalization */ + p = &curr->gch.next; + } + else { /* must call its gc method */ + deadmem += sizeudata(gco2u(curr)); + markfinalized(gco2u(curr)); + *p = curr->gch.next; + /* link `curr' at the end of `tmudata' list */ + if (g->tmudata == NULL) /* list is empty? */ + g->tmudata = curr->gch.next = curr; /* creates a circular list */ + else { + curr->gch.next = g->tmudata->gch.next; + g->tmudata->gch.next = curr; + g->tmudata = curr; + } + } + } + return deadmem; +} + + +static int traversetable (global_State *g, Table *h) { + int i; + int weakkey = 0; + int weakvalue = 0; + const TValue *mode; + if (h->metatable) + markobject(g, h->metatable); + mode = gfasttm(g, h->metatable, TM_MODE); + if (mode && ttisstring(mode)) { /* is there a weak mode? */ + weakkey = (strchr(svalue(mode), 'k') != NULL); + weakvalue = (strchr(svalue(mode), 'v') != NULL); + if (weakkey || weakvalue) { /* is really weak? */ + h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ + h->marked |= cast_byte((weakkey << KEYWEAKBIT) | + (weakvalue << VALUEWEAKBIT)); + h->gclist = g->weak; /* must be cleared after GC, ... */ + g->weak = obj2gco(h); /* ... so put in the appropriate list */ + } + } + if (weakkey && weakvalue) return 1; + if (!weakvalue) { + i = h->sizearray; + while (i--) + markvalue(g, &h->array[i]); + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n))); + if (ttisnil(gval(n))) + removeentry(n); /* remove empty entries */ + else { + lua_assert(!ttisnil(gkey(n))); + if (!weakkey) markvalue(g, gkey(n)); + if (!weakvalue) markvalue(g, gval(n)); + } + } + return weakkey || weakvalue; +} + + +/* +** All marks are conditional because a GC may happen while the +** prototype is still being created +*/ +static void traverseproto (global_State *g, Proto *f) { + int i; + if (f->source) stringmark(f->source); + for (i=0; i<f->sizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i=0; i<f->sizeupvalues; i++) { /* mark upvalue names */ + if (f->upvalues[i]) + stringmark(f->upvalues[i]); + } + for (i=0; i<f->sizep; i++) { /* mark nested protos */ + if (f->p[i]) + markobject(g, f->p[i]); + } + for (i=0; i<f->sizelocvars; i++) { /* mark local-variable names */ + if (f->locvars[i].varname) + stringmark(f->locvars[i].varname); + } +} + + + +static void traverseclosure (global_State *g, Closure *cl) { + markobject(g, cl->c.env); + if (cl->c.isC) { + int i; + for (i=0; i<cl->c.nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->c.upvalue[i]); + } + else { + int i; + lua_assert(cl->l.nupvalues == cl->l.p->nups); + markobject(g, cl->l.p); + for (i=0; i<cl->l.nupvalues; i++) /* mark its upvalues */ + markobject(g, cl->l.upvals[i]); + } +} + + +static void checkstacksizes (lua_State *L, StkId max) { + int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ + int s_used = cast_int(max - L->stack); /* part of stack in use */ + if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ + return; /* do not touch the stacks */ + if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) + luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ + condhardstacktests(luaD_reallocCI(L, ci_used + 1)); + if (4*s_used < L->stacksize && + 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize) + luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ + condhardstacktests(luaD_reallocstack(L, s_used)); +} + + +static void traversestack (global_State *g, lua_State *l) { + StkId o, lim; + CallInfo *ci; + markvalue(g, gt(l)); + lim = l->top; + for (ci = l->base_ci; ci <= l->ci; ci++) { + lua_assert(ci->top <= l->stack_last); + if (lim < ci->top) lim = ci->top; + } + for (o = l->stack; o < l->top; o++) + markvalue(g, o); + for (; o <= lim; o++) + setnilvalue(o); + checkstacksizes(l, lim); +} + + +/* +** traverse one gray object, turning it to black. +** Returns `quantity' traversed. +*/ +static l_mem propagatemark (global_State *g) { + GCObject *o = g->gray; + lua_assert(isgray(o)); + gray2black(o); + switch (o->gch.tt) { + case LUA_TTABLE: { + Table *h = gco2h(o); + g->gray = h->gclist; + if (traversetable(g, h)) /* table is weak? */ + black2gray(o); /* keep it gray */ + return sizeof(Table) + sizeof(TValue) * h->sizearray + + sizeof(Node) * sizenode(h); + } + case LUA_TFUNCTION: { + Closure *cl = gco2cl(o); + g->gray = cl->c.gclist; + traverseclosure(g, cl); + return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) : + sizeLclosure(cl->l.nupvalues); + } + case LUA_TTHREAD: { + lua_State *th = gco2th(o); + g->gray = th->gclist; + th->gclist = g->grayagain; + g->grayagain = o; + black2gray(o); + traversestack(g, th); + return sizeof(lua_State) + sizeof(TValue) * th->stacksize + + sizeof(CallInfo) * th->size_ci; + } + case LUA_TPROTO: { + Proto *p = gco2p(o); + g->gray = p->gclist; + traverseproto(g, p); + return sizeof(Proto) + sizeof(Instruction) * p->sizecode + + sizeof(Proto *) * p->sizep + + sizeof(TValue) * p->sizek + + sizeof(int) * p->sizelineinfo + + sizeof(LocVar) * p->sizelocvars + + sizeof(TString *) * p->sizeupvalues; + } + default: lua_assert(0); return 0; + } +} + + +static size_t propagateall (global_State *g) { + size_t m = 0; + while (g->gray) m += propagatemark(g); + return m; +} + + +/* +** The next function tells whether a key or value can be cleared from +** a weak table. Non-collectable objects are never removed from weak +** tables. Strings behave as `values', so are never removed too. for +** other objects: if really collected, cannot keep them; for userdata +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (const TValue *o, int iskey) { + if (!iscollectable(o)) return 0; + if (ttisstring(o)) { + stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ + return 0; + } + return iswhite(gcvalue(o)) || + (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); +} + + +/* +** clear collected entries from weaktables +*/ +static void cleartable (GCObject *l) { + while (l) { + Table *h = gco2h(l); + int i = h->sizearray; + lua_assert(testbit(h->marked, VALUEWEAKBIT) || + testbit(h->marked, KEYWEAKBIT)); + if (testbit(h->marked, VALUEWEAKBIT)) { + while (i--) { + TValue *o = &h->array[i]; + if (iscleared(o, 0)) /* value was collected? */ + setnilvalue(o); /* remove value */ + } + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + if (!ttisnil(gval(n)) && /* non-empty entry? */ + (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* remove entry from table */ + } + } + l = h->gclist; + } +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->gch.tt) { + case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; + case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; + case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break; + case LUA_TTABLE: luaH_free(L, gco2h(o)); break; + case LUA_TTHREAD: { + lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); + luaE_freethread(L, gco2th(o)); + break; + } + case LUA_TSTRING: { + G(L)->strt.nuse--; + luaM_freemem(L, o, sizestring(gco2ts(o))); + break; + } + case LUA_TUSERDATA: { + luaM_freemem(L, o, sizeudata(gco2u(o))); + break; + } + default: lua_assert(0); + } +} + + + +#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) + + +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { + GCObject *curr; + global_State *g = G(L); + int deadmask = otherwhite(g); + while ((curr = *p) != NULL && count-- > 0) { + if (curr->gch.tt == LUA_TTHREAD) /* sweep open upvalues of each thread */ + sweepwholelist(L, &gco2th(curr)->openupval); + if ((curr->gch.marked ^ WHITEBITS) & deadmask) { /* not dead? */ + lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); + makewhite(g, curr); /* make it white (for next cycle) */ + p = &curr->gch.next; + } + else { /* must erase `curr' */ + lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT)); + *p = curr->gch.next; + if (curr == g->rootgc) /* is the first element of the list? */ + g->rootgc = curr->gch.next; /* adjust first */ + freeobj(L, curr); + } + } + return p; +} + + +static void checkSizes (lua_State *L) { + global_State *g = G(L); + /* check size of string hash */ + if (g->strt.nuse < cast(lu_int32, g->strt.size/4) && + g->strt.size > MINSTRTABSIZE*2) + luaS_resize(L, g->strt.size/2); /* table is too big */ + /* check size of buffer */ + if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) { /* buffer too big? */ + size_t newsize = luaZ_sizebuffer(&g->buff) / 2; + luaZ_resizebuffer(L, &g->buff, newsize); + } +} + + +static void GCTM (lua_State *L) { + global_State *g = G(L); + GCObject *o = g->tmudata->gch.next; /* get first element */ + Udata *udata = rawgco2u(o); + const TValue *tm; + /* remove udata from `tmudata' */ + if (o == g->tmudata) /* last element? */ + g->tmudata = NULL; + else + g->tmudata->gch.next = udata->uv.next; + udata->uv.next = g->mainthread->next; /* return it to `root' list */ + g->mainthread->next = o; + makewhite(g, o); + tm = fasttm(L, udata->uv.metatable, TM_GC); + if (tm != NULL) { + lu_byte oldah = L->allowhook; + lu_mem oldt = g->GCthreshold; + L->allowhook = 0; /* stop debug hooks during GC tag method */ + g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */ + setobj2s(L, L->top, tm); + setuvalue(L, L->top+1, udata); + L->top += 2; + luaD_call(L, L->top - 2, 0); + L->allowhook = oldah; /* restore hooks */ + g->GCthreshold = oldt; /* restore threshold */ + } +} + + +/* +** Call all GC tag methods +*/ +void luaC_callGCTM (lua_State *L) { + while (G(L)->tmudata) + GCTM(L); +} + + +void luaC_freeall (lua_State *L) { + global_State *g = G(L); + int i; + g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */ + sweepwholelist(L, &g->rootgc); + for (i = 0; i < g->strt.size; i++) /* free all string lists */ + sweepwholelist(L, &g->strt.hash[i]); +} + + +static void markmt (global_State *g) { + int i; + for (i=0; i<NUM_TAGS; i++) + if (g->mt[i]) markobject(g, g->mt[i]); +} + + +/* mark root set */ +static void markroot (lua_State *L) { + global_State *g = G(L); + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + markobject(g, g->mainthread); + /* make global table be traversed before main stack */ + markvalue(g, gt(g->mainthread)); + markvalue(g, registry(L)); + markmt(g); + g->gcstate = GCSpropagate; +} + + +static void remarkupvals (global_State *g) { + UpVal *uv; + for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + if (isgray(obj2gco(uv))) + markvalue(g, uv->v); + } +} + + +static void atomic (lua_State *L) { + global_State *g = G(L); + size_t udsize; /* total size of userdata to be finalized */ + /* remark occasional upvalues of (maybe) dead threads */ + remarkupvals(g); + /* traverse objects cautch by write barrier and by 'remarkupvals' */ + propagateall(g); + /* remark weak tables */ + g->gray = g->weak; + g->weak = NULL; + lua_assert(!iswhite(obj2gco(g->mainthread))); + markobject(g, L); /* mark running thread */ + markmt(g); /* mark basic metatables (again) */ + propagateall(g); + /* remark gray again */ + g->gray = g->grayagain; + g->grayagain = NULL; + propagateall(g); + udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ + marktmu(g); /* mark `preserved' userdata */ + udsize += propagateall(g); /* remark, to propagate `preserveness' */ + cleartable(g->weak); /* remove collected objects from weak tables */ + /* flip current white */ + g->currentwhite = cast_byte(otherwhite(g)); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gcstate = GCSsweepstring; + g->estimate = g->totalbytes - udsize; /* first estimate */ +} + + +static l_mem singlestep (lua_State *L) { + global_State *g = G(L); + /*lua_checkmemory(L);*/ + switch (g->gcstate) { + case GCSpause: { + markroot(L); /* start a new collection */ + return 0; + } + case GCSpropagate: { + if (g->gray) + return propagatemark(g); + else { /* no more `gray' objects */ + atomic(L); /* finish mark phase */ + return 0; + } + } + case GCSsweepstring: { + lu_mem old = g->totalbytes; + sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); + if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */ + g->gcstate = GCSsweep; /* end sweep-string phase */ + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPCOST; + } + case GCSsweep: { + lu_mem old = g->totalbytes; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); + if (*g->sweepgc == NULL) { /* nothing more to sweep? */ + checkSizes(L); + g->gcstate = GCSfinalize; /* end sweep phase */ + } + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPMAX*GCSWEEPCOST; + } + case GCSfinalize: { + if (g->tmudata) { + GCTM(L); + if (g->estimate > GCFINALIZECOST) + g->estimate -= GCFINALIZECOST; + return GCFINALIZECOST; + } + else { + g->gcstate = GCSpause; /* end collection */ + g->gcdept = 0; + return 0; + } + } + default: lua_assert(0); return 0; + } +} + + +void luaC_step (lua_State *L) { + global_State *g = G(L); + l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; + if (lim == 0) + lim = (MAX_LUMEM-1)/2; /* no limit */ + g->gcdept += g->totalbytes - g->GCthreshold; + do { + lim -= singlestep(L); + if (g->gcstate == GCSpause) + break; + } while (lim > 0); + if (g->gcstate != GCSpause) { + if (g->gcdept < GCSTEPSIZE) + g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ + else { + g->gcdept -= GCSTEPSIZE; + g->GCthreshold = g->totalbytes; + } + } + else { + lua_assert(g->totalbytes >= g->estimate); + setthreshold(g); + } +} + + +void luaC_fullgc (lua_State *L) { + global_State *g = G(L); + if (g->gcstate <= GCSpropagate) { + /* reset sweep marks to sweep all elements (returning them to white) */ + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + /* reset other collector lists */ + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->gcstate = GCSsweepstring; + } + lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate); + /* finish any pending sweep phase */ + while (g->gcstate != GCSfinalize) { + lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep); + singlestep(L); + } + markroot(L); + while (g->gcstate != GCSpause) { + singlestep(L); + } + setthreshold(g); +} + + +void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + lua_assert(ttype(&o->gch) != LUA_TTABLE); + /* must keep invariant? */ + if (g->gcstate == GCSpropagate) + reallymarkobject(g, v); /* restore invariant */ + else /* don't mind */ + makewhite(g, o); /* mark as white just to avoid other barriers */ +} + + +void luaC_barrierback (lua_State *L, Table *t) { + global_State *g = G(L); + GCObject *o = obj2gco(t); + lua_assert(isblack(o) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + black2gray(o); /* make table gray (again) */ + t->gclist = g->grayagain; + g->grayagain = o; +} + + +void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { + global_State *g = G(L); + o->gch.next = g->rootgc; + g->rootgc = o; + o->gch.marked = luaC_white(g); + o->gch.tt = tt; +} + + +void luaC_linkupval (lua_State *L, UpVal *uv) { + global_State *g = G(L); + GCObject *o = obj2gco(uv); + o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ + g->rootgc = o; + if (isgray(o)) { + if (g->gcstate == GCSpropagate) { + gray2black(o); /* closed upvalues need barrier */ + luaC_barrier(L, uv, uv->v); + } + else { /* sweep phase: sweep it (turning it into white) */ + makewhite(g, o); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + } + } +} + diff --git a/lua-5.1.4/src/lgc.h b/lua-5.1.4/src/lgc.h new file mode 100644 index 000000000..5a8dc605b --- /dev/null +++ b/lua-5.1.4/src/lgc.h @@ -0,0 +1,110 @@ +/* +** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpause 0 +#define GCSpropagate 1 +#define GCSsweepstring 2 +#define GCSsweep 3 +#define GCSfinalize 4 + + +/* +** some userful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) +#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) +#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) +#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) + + + +/* +** Layout for bit use in `marked' field: +** bit 0 - object is white (type 0) +** bit 1 - object is white (type 1) +** bit 2 - object is black +** bit 3 - for userdata: has been finalized +** bit 3 - for tables: has weak keys +** bit 4 - for tables: has weak values +** bit 5 - object is fixed (should not be collected) +** bit 6 - object is "super" fixed (only the main thread) +*/ + + +#define WHITE0BIT 0 +#define WHITE1BIT 1 +#define BLACKBIT 2 +#define FINALIZEDBIT 3 +#define KEYWEAKBIT 3 +#define VALUEWEAKBIT 4 +#define FIXEDBIT 5 +#define SFIXEDBIT 6 +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define isblack(x) testbit((x)->gch.marked, BLACKBIT) +#define isgray(x) (!isblack(x) && !iswhite(x)) + +#define otherwhite(g) (g->currentwhite ^ WHITEBITS) +#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) + +#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +#define luaC_checkGC(L) { \ + condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ + if (G(L)->totalbytes >= G(L)->GCthreshold) \ + luaC_step(L); } + + +#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),gcvalue(v)); } + +#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ + luaC_barrierback(L,t); } + +#define luaC_objbarrier(L,p,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),obj2gco(o)); } + +#define luaC_objbarriert(L,t,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } + +LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); +LUAI_FUNC void luaC_callGCTM (lua_State *L); +LUAI_FUNC void luaC_freeall (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_fullgc (lua_State *L); +LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); +LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); + + +#endif diff --git a/lua-5.1.4/src/linit.c b/lua-5.1.4/src/linit.c new file mode 100644 index 000000000..c1f90dfab --- /dev/null +++ b/lua-5.1.4/src/linit.c @@ -0,0 +1,38 @@ +/* +** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ +** Initialization of libraries for lua.c +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" + + +static const luaL_Reg lualibs[] = { + {"", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_DBLIBNAME, luaopen_debug}, + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) { + lua_pushcfunction(L, lib->func); + lua_pushstring(L, lib->name); + lua_call(L, 1, 0); + } +} + diff --git a/lua-5.1.4/src/liolib.c b/lua-5.1.4/src/liolib.c new file mode 100644 index 000000000..e79ed1cb2 --- /dev/null +++ b/lua-5.1.4/src/liolib.c @@ -0,0 +1,553 @@ +/* +** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $ +** Standard I/O (and system) library +** See Copyright Notice in lua.h +*/ + + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define liolib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +#define IO_INPUT 1 +#define IO_OUTPUT 2 + + +static const char *const fnames[] = {"input", "output"}; + + +static int pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (filename) + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + else + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static void fileerror (lua_State *L, int arg, const char *filename) { + lua_pushfstring(L, "%s: %s", filename, strerror(errno)); + luaL_argerror(L, arg, lua_tostring(L, -1)); +} + + +#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) + + +static int io_type (lua_State *L) { + void *ud; + luaL_checkany(L, 1); + ud = lua_touserdata(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE); + if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1)) + lua_pushnil(L); /* not a file */ + else if (*((FILE **)ud) == NULL) + lua_pushliteral(L, "closed file"); + else + lua_pushliteral(L, "file"); + return 1; +} + + +static FILE *tofile (lua_State *L) { + FILE **f = tofilep(L); + if (*f == NULL) + luaL_error(L, "attempt to use a closed file"); + return *f; +} + + + +/* +** When creating file handles, always creates a `closed' file handle +** before opening the actual file; so, if there is a memory error, the +** file is not left opened. +*/ +static FILE **newfile (lua_State *L) { + FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); + *pf = NULL; /* file handle is currently `closed' */ + luaL_getmetatable(L, LUA_FILEHANDLE); + lua_setmetatable(L, -2); + return pf; +} + + +/* +** function to (not) close the standard files stdin, stdout, and stderr +*/ +static int io_noclose (lua_State *L) { + lua_pushnil(L); + lua_pushliteral(L, "cannot close standard file"); + return 2; +} + + +/* +** function to close 'popen' files +*/ +static int io_pclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = lua_pclose(L, *p); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +/* +** function to close regular files +*/ +static int io_fclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = (fclose(*p) == 0); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +static int aux_close (lua_State *L) { + lua_getfenv(L, 1); + lua_getfield(L, -1, "__close"); + return (lua_tocfunction(L, -1))(L); +} + + +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT); + tofile(L); /* make sure argument is a file */ + return aux_close(L); +} + + +static int io_gc (lua_State *L) { + FILE *f = *tofilep(L); + /* ignore closed files */ + if (f != NULL) + aux_close(L); + return 0; +} + + +static int io_tostring (lua_State *L) { + FILE *f = *tofilep(L); + if (f == NULL) + lua_pushliteral(L, "file (closed)"); + else + lua_pushfstring(L, "file (%p)", f); + return 1; +} + + +static int io_open (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +/* +** this function has a separated environment, which defines the +** correct __close for 'popen' files +*/ +static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = lua_popen(L, filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +static int io_tmpfile (lua_State *L) { + FILE **pf = newfile(L); + *pf = tmpfile(); + return (*pf == NULL) ? pushresult(L, 0, NULL) : 1; +} + + +static FILE *getiofile (lua_State *L, int findex) { + FILE *f; + lua_rawgeti(L, LUA_ENVIRONINDEX, findex); + f = *(FILE **)lua_touserdata(L, -1); + if (f == NULL) + luaL_error(L, "standard %s file is closed", fnames[findex - 1]); + return f; +} + + +static int g_iofile (lua_State *L, int f, const char *mode) { + if (!lua_isnoneornil(L, 1)) { + const char *filename = lua_tostring(L, 1); + if (filename) { + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + if (*pf == NULL) + fileerror(L, 1, filename); + } + else { + tofile(L); /* check that it's a valid file handle */ + lua_pushvalue(L, 1); + } + lua_rawseti(L, LUA_ENVIRONINDEX, f); + } + /* return current value */ + lua_rawgeti(L, LUA_ENVIRONINDEX, f); + return 1; +} + + +static int io_input (lua_State *L) { + return g_iofile(L, IO_INPUT, "r"); +} + + +static int io_output (lua_State *L) { + return g_iofile(L, IO_OUTPUT, "w"); +} + + +static int io_readline (lua_State *L); + + +static void aux_lines (lua_State *L, int idx, int toclose) { + lua_pushvalue(L, idx); + lua_pushboolean(L, toclose); /* close/not close file when finished */ + lua_pushcclosure(L, io_readline, 2); +} + + +static int f_lines (lua_State *L) { + tofile(L); /* check that it's a valid file handle */ + aux_lines(L, 1, 0); + return 1; +} + + +static int io_lines (lua_State *L) { + if (lua_isnoneornil(L, 1)) { /* no arguments? */ + /* will iterate over default input */ + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT); + return f_lines(L); + } + else { + const char *filename = luaL_checkstring(L, 1); + FILE **pf = newfile(L); + *pf = fopen(filename, "r"); + if (*pf == NULL) + fileerror(L, 1, filename); + aux_lines(L, lua_gettop(L), 1); + return 1; + } +} + + +/* +** {====================================================== +** READ +** ======================================================= +*/ + + +static int read_number (lua_State *L, FILE *f) { + lua_Number d; + if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { + lua_pushnumber(L, d); + return 1; + } + else return 0; /* read fails */ +} + + +static int test_eof (lua_State *L, FILE *f) { + int c = getc(f); + ungetc(c, f); + lua_pushlstring(L, NULL, 0); + return (c != EOF); +} + + +static int read_line (lua_State *L, FILE *f) { + luaL_Buffer b; + luaL_buffinit(L, &b); + for (;;) { + size_t l; + char *p = luaL_prepbuffer(&b); + if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ + luaL_pushresult(&b); /* close buffer */ + return (lua_objlen(L, -1) > 0); /* check whether read something */ + } + l = strlen(p); + if (l == 0 || p[l-1] != '\n') + luaL_addsize(&b, l); + else { + luaL_addsize(&b, l - 1); /* do not include `eol' */ + luaL_pushresult(&b); /* close buffer */ + return 1; /* read at least an `eol' */ + } + } +} + + +static int read_chars (lua_State *L, FILE *f, size_t n) { + size_t rlen; /* how much to read */ + size_t nr; /* number of chars actually read */ + luaL_Buffer b; + luaL_buffinit(L, &b); + rlen = LUAL_BUFFERSIZE; /* try to read that much each time */ + do { + char *p = luaL_prepbuffer(&b); + if (rlen > n) rlen = n; /* cannot read more than asked */ + nr = fread(p, sizeof(char), rlen, f); + luaL_addsize(&b, nr); + n -= nr; /* still have to read `n' chars */ + } while (n > 0 && nr == rlen); /* until end of count or eof */ + luaL_pushresult(&b); /* close buffer */ + return (n == 0 || lua_objlen(L, -1) > 0); +} + + +static int g_read (lua_State *L, FILE *f, int first) { + int nargs = lua_gettop(L) - 1; + int success; + int n; + clearerr(f); + if (nargs == 0) { /* no arguments? */ + success = read_line(L, f); + n = first+1; /* to return 1 result */ + } + else { /* ensure stack space for all results and for auxlib's buffer */ + luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); + success = 1; + for (n = first; nargs-- && success; n++) { + if (lua_type(L, n) == LUA_TNUMBER) { + size_t l = (size_t)lua_tointeger(L, n); + success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); + } + else { + const char *p = lua_tostring(L, n); + luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); + switch (p[1]) { + case 'n': /* number */ + success = read_number(L, f); + break; + case 'l': /* line */ + success = read_line(L, f); + break; + case 'a': /* file */ + read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */ + success = 1; /* always success */ + break; + default: + return luaL_argerror(L, n, "invalid format"); + } + } + } + } + if (ferror(f)) + return pushresult(L, 0, NULL); + if (!success) { + lua_pop(L, 1); /* remove last result */ + lua_pushnil(L); /* push nil instead */ + } + return n - first; +} + + +static int io_read (lua_State *L) { + return g_read(L, getiofile(L, IO_INPUT), 1); +} + + +static int f_read (lua_State *L) { + return g_read(L, tofile(L), 2); +} + + +static int io_readline (lua_State *L) { + FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); + int sucess; + if (f == NULL) /* file is already closed? */ + luaL_error(L, "file is already closed"); + sucess = read_line(L, f); + if (ferror(f)) + return luaL_error(L, "%s", strerror(errno)); + if (sucess) return 1; + else { /* EOF */ + if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */ + lua_settop(L, 0); + lua_pushvalue(L, lua_upvalueindex(1)); + aux_close(L); /* close it */ + } + return 0; + } +} + +/* }====================================================== */ + + +static int g_write (lua_State *L, FILE *f, int arg) { + int nargs = lua_gettop(L) - 1; + int status = 1; + for (; nargs--; arg++) { + if (lua_type(L, arg) == LUA_TNUMBER) { + /* optimization: could be done exactly as for strings */ + status = status && + fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; + } + else { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + status = status && (fwrite(s, sizeof(char), l, f) == l); + } + } + return pushresult(L, status, NULL); +} + + +static int io_write (lua_State *L) { + return g_write(L, getiofile(L, IO_OUTPUT), 1); +} + + +static int f_write (lua_State *L) { + return g_write(L, tofile(L), 2); +} + + +static int f_seek (lua_State *L) { + static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static const char *const modenames[] = {"set", "cur", "end", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, "cur", modenames); + long offset = luaL_optlong(L, 3, 0); + op = fseek(f, offset, mode[op]); + if (op) + return pushresult(L, 0, NULL); /* error */ + else { + lua_pushinteger(L, ftell(f)); + return 1; + } +} + + +static int f_setvbuf (lua_State *L) { + static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; + static const char *const modenames[] = {"no", "full", "line", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, NULL, modenames); + lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); + int res = setvbuf(f, NULL, mode[op], sz); + return pushresult(L, res == 0, NULL); +} + + + +static int io_flush (lua_State *L) { + return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); +} + + +static int f_flush (lua_State *L) { + return pushresult(L, fflush(tofile(L)) == 0, NULL); +} + + +static const luaL_Reg iolib[] = { + {"close", io_close}, + {"flush", io_flush}, + {"input", io_input}, + {"lines", io_lines}, + {"open", io_open}, + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, + {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +}; + + +static const luaL_Reg flib[] = { + {"close", io_close}, + {"flush", f_flush}, + {"lines", f_lines}, + {"read", f_read}, + {"seek", f_seek}, + {"setvbuf", f_setvbuf}, + {"write", f_write}, + {"__gc", io_gc}, + {"__tostring", io_tostring}, + {NULL, NULL} +}; + + +static void createmeta (lua_State *L) { + luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ + lua_pushvalue(L, -1); /* push metatable */ + lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ + luaL_register(L, NULL, flib); /* file methods */ +} + + +static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { + *newfile(L) = f; + if (k > 0) { + lua_pushvalue(L, -1); + lua_rawseti(L, LUA_ENVIRONINDEX, k); + } + lua_pushvalue(L, -2); /* copy environment */ + lua_setfenv(L, -2); /* set it */ + lua_setfield(L, -3, fname); +} + + +static void newfenv (lua_State *L, lua_CFunction cls) { + lua_createtable(L, 0, 1); + lua_pushcfunction(L, cls); + lua_setfield(L, -2, "__close"); +} + + +LUALIB_API int luaopen_io (lua_State *L) { + createmeta(L); + /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ + newfenv(L, io_fclose); + lua_replace(L, LUA_ENVIRONINDEX); + /* open library */ + luaL_register(L, LUA_IOLIBNAME, iolib); + /* create (and set) default files */ + newfenv(L, io_noclose); /* close function for default files */ + createstdfile(L, stdin, IO_INPUT, "stdin"); + createstdfile(L, stdout, IO_OUTPUT, "stdout"); + createstdfile(L, stderr, 0, "stderr"); + lua_pop(L, 1); /* pop environment for default files */ + lua_getfield(L, -1, "popen"); + newfenv(L, io_pclose); /* create environment for 'popen' */ + lua_setfenv(L, -2); /* set fenv for 'popen' */ + lua_pop(L, 1); /* pop 'popen' */ + return 1; +} + diff --git a/lua-5.1.4/src/llex.c b/lua-5.1.4/src/llex.c new file mode 100644 index 000000000..6dc319358 --- /dev/null +++ b/lua-5.1.4/src/llex.c @@ -0,0 +1,461 @@ +/* +** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + + +#include <ctype.h> +#include <locale.h> +#include <string.h> + +#define llex_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "llex.h" +#include "lobject.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lzio.h" + + + +#define next(ls) (ls->current = zgetc(ls->z)) + + + + +#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') + + +/* ORDER RESERVED */ +const char *const luaX_tokens [] = { + "and", "break", "do", "else", "elseif", + "end", "false", "for", "function", "if", + "in", "local", "nil", "not", "or", "repeat", + "return", "then", "true", "until", "while", + "..", "...", "==", ">=", "<=", "~=", + "<number>", "<name>", "<string>", "<eof>", + NULL +}; + + +#define save_and_next(ls) (save(ls, ls->current), next(ls)) + + +static void save (LexState *ls, int c) { + Mbuffer *b = ls->buff; + if (b->n + 1 > b->buffsize) { + size_t newsize; + if (b->buffsize >= MAX_SIZET/2) + luaX_lexerror(ls, "lexical element too long", 0); + newsize = b->buffsize * 2; + luaZ_resizebuffer(ls->L, b, newsize); + } + b->buffer[b->n++] = cast(char, c); +} + + +void luaX_init (lua_State *L) { + int i; + for (i=0; i<NUM_RESERVED; i++) { + TString *ts = luaS_new(L, luaX_tokens[i]); + luaS_fix(ts); /* reserved words are never collected */ + lua_assert(strlen(luaX_tokens[i])+1 <= TOKEN_LEN); + ts->tsv.reserved = cast_byte(i+1); /* reserved word */ + } +} + + +#define MAXSRC 80 + + +const char *luaX_token2str (LexState *ls, int token) { + if (token < FIRST_RESERVED) { + lua_assert(token == cast(unsigned char, token)); + return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) : + luaO_pushfstring(ls->L, "%c", token); + } + else + return luaX_tokens[token-FIRST_RESERVED]; +} + + +static const char *txtToken (LexState *ls, int token) { + switch (token) { + case TK_NAME: + case TK_STRING: + case TK_NUMBER: + save(ls, '\0'); + return luaZ_buffer(ls->buff); + default: + return luaX_token2str(ls, token); + } +} + + +void luaX_lexerror (LexState *ls, const char *msg, int token) { + char buff[MAXSRC]; + luaO_chunkid(buff, getstr(ls->source), MAXSRC); + msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); + if (token) + luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token)); + luaD_throw(ls->L, LUA_ERRSYNTAX); +} + + +void luaX_syntaxerror (LexState *ls, const char *msg) { + luaX_lexerror(ls, msg, ls->t.token); +} + + +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { + lua_State *L = ls->L; + TString *ts = luaS_newlstr(L, str, l); + TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ + if (ttisnil(o)) + setbvalue(o, 1); /* make sure `str' will not be collected */ + return ts; +} + + +static void inclinenumber (LexState *ls) { + int old = ls->current; + lua_assert(currIsNewline(ls)); + next(ls); /* skip `\n' or `\r' */ + if (currIsNewline(ls) && ls->current != old) + next(ls); /* skip `\n\r' or `\r\n' */ + if (++ls->linenumber >= MAX_INT) + luaX_syntaxerror(ls, "chunk has too many lines"); +} + + +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { + ls->decpoint = '.'; + ls->L = L; + ls->lookahead.token = TK_EOS; /* no look-ahead token */ + ls->z = z; + ls->fs = NULL; + ls->linenumber = 1; + ls->lastline = 1; + ls->source = source; + luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ + next(ls); /* read first char */ +} + + + +/* +** ======================================================= +** LEXICAL ANALYZER +** ======================================================= +*/ + + + +static int check_next (LexState *ls, const char *set) { + if (!strchr(set, ls->current)) + return 0; + save_and_next(ls); + return 1; +} + + +static void buffreplace (LexState *ls, char from, char to) { + size_t n = luaZ_bufflen(ls->buff); + char *p = luaZ_buffer(ls->buff); + while (n--) + if (p[n] == from) p[n] = to; +} + + +static void trydecpoint (LexState *ls, SemInfo *seminfo) { + /* format error: try to update decimal point separator */ + struct lconv *cv = localeconv(); + char old = ls->decpoint; + ls->decpoint = (cv ? cv->decimal_point[0] : '.'); + buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) { + /* format error with correct decimal point: no more options */ + buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ + luaX_lexerror(ls, "malformed number", TK_NUMBER); + } +} + + +/* LUA_NUMBER */ +static void read_numeral (LexState *ls, SemInfo *seminfo) { + lua_assert(isdigit(ls->current)); + do { + save_and_next(ls); + } while (isdigit(ls->current) || ls->current == '.'); + if (check_next(ls, "Ee")) /* `E'? */ + check_next(ls, "+-"); /* optional exponent sign */ + while (isalnum(ls->current) || ls->current == '_') + save_and_next(ls); + save(ls, '\0'); + buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ + trydecpoint(ls, seminfo); /* try to update decimal point separator */ +} + + +static int skip_sep (LexState *ls) { + int count = 0; + int s = ls->current; + lua_assert(s == '[' || s == ']'); + save_and_next(ls); + while (ls->current == '=') { + save_and_next(ls); + count++; + } + return (ls->current == s) ? count : (-count) - 1; +} + + +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { + int cont = 0; + (void)(cont); /* avoid warnings when `cont' is not used */ + save_and_next(ls); /* skip 2nd `[' */ + if (currIsNewline(ls)) /* string starts with a newline? */ + inclinenumber(ls); /* skip it */ + for (;;) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, (seminfo) ? "unfinished long string" : + "unfinished long comment", TK_EOS); + break; /* to avoid warnings */ +#if defined(LUA_COMPAT_LSTR) + case '[': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `[' */ + cont++; +#if LUA_COMPAT_LSTR == 1 + if (sep == 0) + luaX_lexerror(ls, "nesting of [[...]] is deprecated", '['); +#endif + } + break; + } +#endif + case ']': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `]' */ +#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2 + cont--; + if (sep == 0 && cont >= 0) break; +#endif + goto endloop; + } + break; + } + case '\n': + case '\r': { + save(ls, '\n'); + inclinenumber(ls); + if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ + break; + } + default: { + if (seminfo) save_and_next(ls); + else next(ls); + } + } + } endloop: + if (seminfo) + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), + luaZ_bufflen(ls->buff) - 2*(2 + sep)); +} + + +static void read_string (LexState *ls, int del, SemInfo *seminfo) { + save_and_next(ls); + while (ls->current != del) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, "unfinished string", TK_EOS); + continue; /* to avoid warnings */ + case '\n': + case '\r': + luaX_lexerror(ls, "unfinished string", TK_STRING); + continue; /* to avoid warnings */ + case '\\': { + int c; + next(ls); /* do not save the `\' */ + switch (ls->current) { + case 'a': c = '\a'; break; + case 'b': c = '\b'; break; + case 'f': c = '\f'; break; + case 'n': c = '\n'; break; + case 'r': c = '\r'; break; + case 't': c = '\t'; break; + case 'v': c = '\v'; break; + case '\n': /* go through */ + case '\r': save(ls, '\n'); inclinenumber(ls); continue; + case EOZ: continue; /* will raise an error next loop */ + default: { + if (!isdigit(ls->current)) + save_and_next(ls); /* handles \\, \", \', and \? */ + else { /* \xxx */ + int i = 0; + c = 0; + do { + c = 10*c + (ls->current-'0'); + next(ls); + } while (++i<3 && isdigit(ls->current)); + if (c > UCHAR_MAX) + luaX_lexerror(ls, "escape sequence too large", TK_STRING); + save(ls, c); + } + continue; + } + } + save(ls, c); + next(ls); + continue; + } + default: + save_and_next(ls); + } + } + save_and_next(ls); /* skip delimiter */ + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, + luaZ_bufflen(ls->buff) - 2); +} + + +static int llex (LexState *ls, SemInfo *seminfo) { + luaZ_resetbuffer(ls->buff); + for (;;) { + switch (ls->current) { + case '\n': + case '\r': { + inclinenumber(ls); + continue; + } + case '-': { + next(ls); + if (ls->current != '-') return '-'; + /* else is a comment */ + next(ls); + if (ls->current == '[') { + int sep = skip_sep(ls); + luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ + if (sep >= 0) { + read_long_string(ls, NULL, sep); /* long comment */ + luaZ_resetbuffer(ls->buff); + continue; + } + } + /* else short comment */ + while (!currIsNewline(ls) && ls->current != EOZ) + next(ls); + continue; + } + case '[': { + int sep = skip_sep(ls); + if (sep >= 0) { + read_long_string(ls, seminfo, sep); + return TK_STRING; + } + else if (sep == -1) return '['; + else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); + } + case '=': { + next(ls); + if (ls->current != '=') return '='; + else { next(ls); return TK_EQ; } + } + case '<': { + next(ls); + if (ls->current != '=') return '<'; + else { next(ls); return TK_LE; } + } + case '>': { + next(ls); + if (ls->current != '=') return '>'; + else { next(ls); return TK_GE; } + } + case '~': { + next(ls); + if (ls->current != '=') return '~'; + else { next(ls); return TK_NE; } + } + case '"': + case '\'': { + read_string(ls, ls->current, seminfo); + return TK_STRING; + } + case '.': { + save_and_next(ls); + if (check_next(ls, ".")) { + if (check_next(ls, ".")) + return TK_DOTS; /* ... */ + else return TK_CONCAT; /* .. */ + } + else if (!isdigit(ls->current)) return '.'; + else { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + } + case EOZ: { + return TK_EOS; + } + default: { + if (isspace(ls->current)) { + lua_assert(!currIsNewline(ls)); + next(ls); + continue; + } + else if (isdigit(ls->current)) { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + else if (isalpha(ls->current) || ls->current == '_') { + /* identifier or reserved word */ + TString *ts; + do { + save_and_next(ls); + } while (isalnum(ls->current) || ls->current == '_'); + ts = luaX_newstring(ls, luaZ_buffer(ls->buff), + luaZ_bufflen(ls->buff)); + if (ts->tsv.reserved > 0) /* reserved word? */ + return ts->tsv.reserved - 1 + FIRST_RESERVED; + else { + seminfo->ts = ts; + return TK_NAME; + } + } + else { + int c = ls->current; + next(ls); + return c; /* single-char tokens (+ - / ...) */ + } + } + } + } +} + + +void luaX_next (LexState *ls) { + ls->lastline = ls->linenumber; + if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ + ls->t = ls->lookahead; /* use this one */ + ls->lookahead.token = TK_EOS; /* and discharge it */ + } + else + ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ +} + + +void luaX_lookahead (LexState *ls) { + lua_assert(ls->lookahead.token == TK_EOS); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); +} + diff --git a/lua-5.1.4/src/llex.h b/lua-5.1.4/src/llex.h new file mode 100644 index 000000000..a9201cee4 --- /dev/null +++ b/lua-5.1.4/src/llex.h @@ -0,0 +1,81 @@ +/* +** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#ifndef llex_h +#define llex_h + +#include "lobject.h" +#include "lzio.h" + + +#define FIRST_RESERVED 257 + +/* maximum length of a reserved word */ +#define TOKEN_LEN (sizeof("function")/sizeof(char)) + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER RESERVED" +*/ +enum RESERVED { + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, + TK_NAME, TK_STRING, TK_EOS +}; + +/* number of reserved words */ +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) + + +/* array with token `names' */ +LUAI_DATA const char *const luaX_tokens []; + + +typedef union { + lua_Number r; + TString *ts; +} SemInfo; /* semantics information */ + + +typedef struct Token { + int token; + SemInfo seminfo; +} Token; + + +typedef struct LexState { + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token `consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* `FuncState' is private to the parser */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + TString *source; /* current source name */ + char decpoint; /* locale decimal point */ +} LexState; + + +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, + TString *source); +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); +LUAI_FUNC void luaX_next (LexState *ls); +LUAI_FUNC void luaX_lookahead (LexState *ls); +LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); +LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); + + +#endif diff --git a/lua-5.1.4/src/llimits.h b/lua-5.1.4/src/llimits.h new file mode 100644 index 000000000..ca8dcb722 --- /dev/null +++ b/lua-5.1.4/src/llimits.h @@ -0,0 +1,128 @@ +/* +** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ +** Limits, basic types, and some other `installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include <limits.h> +#include <stddef.h> + + +#include "lua.h" + + +typedef LUAI_UINT32 lu_int32; + +typedef LUAI_UMEM lu_mem; + +typedef LUAI_MEM l_mem; + + + +/* chars used as small naturals (so that `char' is reserved for characters) */ +typedef unsigned char lu_byte; + + +#define MAX_SIZET ((size_t)(~(size_t)0)-2) + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) + + +#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ + +/* +** conversion of pointer to integer +** this is for hashing only; there is no problem if the integer +** cannot hold the whole pointer value +*/ +#define IntPoint(p) ((unsigned int)(lu_mem)(p)) + + + +/* type to ensure maximum alignment */ +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; + + +/* result of a `usual argument conversion' over lua_Number */ +typedef LUAI_UACNUMBER l_uacNumber; + + +/* internal assertions for in-house debugging */ +#ifdef lua_assert + +#define check_exp(c,e) (lua_assert(c), (e)) +#define api_check(l,e) lua_assert(e) + +#else + +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define api_check luai_apicheck + +#endif + + +#ifndef UNUSED +#define UNUSED(x) ((void)(x)) /* to avoid warnings */ +#endif + + +#ifndef cast +#define cast(t, exp) ((t)(exp)) +#endif + +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) + + + +/* +** type for virtual-machine instructions +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +typedef lu_int32 Instruction; + + + +/* maximum stack for a Lua function */ +#define MAXSTACK 250 + + + +/* minimum size for the string table (must be power of 2) */ +#ifndef MINSTRTABSIZE +#define MINSTRTABSIZE 32 +#endif + + +/* minimum size for string buffer */ +#ifndef LUA_MINBUFFER +#define LUA_MINBUFFER 32 +#endif + + +#ifndef lua_lock +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +#ifndef luai_threadyield +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#ifndef HARDSTACKTESTS +#define condhardstacktests(x) ((void)0) +#else +#define condhardstacktests(x) x +#endif + +#endif diff --git a/lua-5.1.4/src/lmathlib.c b/lua-5.1.4/src/lmathlib.c new file mode 100644 index 000000000..441fbf736 --- /dev/null +++ b/lua-5.1.4/src/lmathlib.c @@ -0,0 +1,263 @@ +/* +** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + + +#include <stdlib.h> +#include <math.h> + +#define lmathlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (3.14159265358979323846) +#define RADIANS_PER_DEGREE (PI/180.0) + + + +static int math_abs (lua_State *L) { + lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, sin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, cos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, tan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, asin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, acos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_pushnumber(L, atan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan2 (lua_State *L) { + lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_ceil (lua_State *L) { + lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); + return 1; +} + +static int math_floor (lua_State *L) { + lua_pushnumber(L, floor(luaL_checknumber(L, 1))); + return 1; +} + +static int math_fmod (lua_State *L) { + lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_modf (lua_State *L) { + double ip; + double fp = modf(luaL_checknumber(L, 1), &ip); + lua_pushnumber(L, ip); + lua_pushnumber(L, fp); + return 2; +} + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, sqrt(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_log (lua_State *L) { + lua_pushnumber(L, log(luaL_checknumber(L, 1))); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, log10(luaL_checknumber(L, 1))); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, exp(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); + return 1; +} + + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmin = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d < dmin) + dmin = d; + } + lua_pushnumber(L, dmin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmax = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d > dmax) + dmax = d; + } + lua_pushnumber(L, dmax); + return 1; +} + + +static int math_random (lua_State *L) { + /* the `%' avoids the (rare) case of r==1, and is needed also because on + some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ + lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, r); /* Number between 0 and 1 */ + break; + } + case 1: { /* only upper limit */ + int u = luaL_checkint(L, 1); + luaL_argcheck(L, 1<=u, 1, "interval is empty"); + lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ + break; + } + case 2: { /* lower and upper limits */ + int l = luaL_checkint(L, 1); + int u = luaL_checkint(L, 2); + luaL_argcheck(L, l<=u, 2, "interval is empty"); + lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + return 1; +} + + +static int math_randomseed (lua_State *L) { + srand(luaL_checkint(L, 1)); + return 0; +} + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan2", math_atan2}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cosh", math_cosh}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"pow", math_pow}, + {"rad", math_rad}, + {"random", math_random}, + {"randomseed", math_randomseed}, + {"sinh", math_sinh}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tanh", math_tanh}, + {"tan", math_tan}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUALIB_API int luaopen_math (lua_State *L) { + luaL_register(L, LUA_MATHLIBNAME, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, HUGE_VAL); + lua_setfield(L, -2, "huge"); +#if defined(LUA_COMPAT_MOD) + lua_getfield(L, -1, "fmod"); + lua_setfield(L, -2, "mod"); +#endif + return 1; +} + diff --git a/lua-5.1.4/src/lmem.c b/lua-5.1.4/src/lmem.c new file mode 100644 index 000000000..ae7d8c965 --- /dev/null +++ b/lua-5.1.4/src/lmem.c @@ -0,0 +1,86 @@ +/* +** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + + +#include <stddef.h> + +#define lmem_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** (`osize' is the old size, `nsize' is the new size) +** +** Lua ensures that (ptr == NULL) iff (osize == 0). +** +** * frealloc(ud, NULL, 0, x) creates a new block of size `x' +** +** * frealloc(ud, p, x, 0) frees the block `p' +** (in this specific case, frealloc must return NULL). +** particularly, frealloc(ud, NULL, 0, 0) does nothing +** (which is equivalent to free(NULL) in ANSI C) +** +** frealloc returns NULL if it cannot create or reallocate the area +** (any reallocation to an equal or smaller size cannot fail!) +*/ + + + +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, + int limit, const char *errormsg) { + void *newblock; + int newsize; + if (*size >= limit/2) { /* cannot double it? */ + if (*size >= limit) /* cannot grow even a little? */ + luaG_runerror(L, errormsg); + newsize = limit; /* still have at least one free place */ + } + else { + newsize = (*size)*2; + if (newsize < MINSIZEARRAY) + newsize = MINSIZEARRAY; /* minimum size */ + } + newblock = luaM_reallocv(L, block, *size, newsize, size_elems); + *size = newsize; /* update only when everything else is OK */ + return newblock; +} + + +void *luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); + return NULL; /* to avoid warnings */ +} + + + +/* +** generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + global_State *g = G(L); + lua_assert((osize == 0) == (block == NULL)); + block = (*g->frealloc)(g->ud, block, osize, nsize); + if (block == NULL && nsize > 0) + luaD_throw(L, LUA_ERRMEM); + lua_assert((nsize == 0) == (block == NULL)); + g->totalbytes = (g->totalbytes - osize) + nsize; + return block; +} + diff --git a/lua-5.1.4/src/lmem.h b/lua-5.1.4/src/lmem.h new file mode 100644 index 000000000..7c2dcb322 --- /dev/null +++ b/lua-5.1.4/src/lmem.h @@ -0,0 +1,49 @@ +/* +** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include <stddef.h> + +#include "llimits.h" +#include "lua.h" + +#define MEMERRMSG "not enough memory" + + +#define luaM_reallocv(L,b,on,n,e) \ + ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ + luaM_toobig(L)) + +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) + +#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L,n,t) \ + cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + + +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_toobig (lua_State *L); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *errormsg); + +#endif + diff --git a/lua-5.1.4/src/loadlib.c b/lua-5.1.4/src/loadlib.c new file mode 100644 index 000000000..0d401eba1 --- /dev/null +++ b/lua-5.1.4/src/loadlib.c @@ -0,0 +1,666 @@ +/* +** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $ +** Dynamic library loader for Lua +** See Copyright Notice in lua.h +** +** This module contains an implementation of loadlib for Unix systems +** that have dlfcn, an implementation for Darwin (Mac OS X), an +** implementation for Windows, and a stub for other systems. +*/ + + +#include <stdlib.h> +#include <string.h> + + +#define loadlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* prefix for open functions in C libraries */ +#define LUA_POF "luaopen_" + +/* separator for open functions in C libraries */ +#define LUA_OFSEP "_" + + +#define LIBPREFIX "LOADLIB: " + +#define POF LUA_POF +#define LIB_FAIL "open" + + +/* error codes for ll_loadfunc */ +#define ERRLIB 1 +#define ERRFUNC 2 + +#define setprogdir(L) ((void)0) + + +static void ll_unloadlib (void *lib); +static void *ll_load (lua_State *L, const char *path); +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); + + + +#if defined(LUA_DL_DLOPEN) +/* +** {======================================================================== +** This is an implementation of loadlib based on the dlfcn interface. +** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, +** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least +** as an emulation layer on top of native functions. +** ========================================================================= +*/ + +#include <dlfcn.h> + +static void ll_unloadlib (void *lib) { + dlclose(lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + void *lib = dlopen(path, RTLD_NOW); + if (lib == NULL) lua_pushstring(L, dlerror()); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)dlsym(lib, sym); + if (f == NULL) lua_pushstring(L, dlerror()); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DLL) +/* +** {====================================================================== +** This is an implementation of loadlib for Windows using native functions. +** ======================================================================= +*/ + +#include <windows.h> + + +#undef setprogdir + +static void setprogdir (lua_State *L) { + char buff[MAX_PATH + 1]; + char *lb; + DWORD nsize = sizeof(buff)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, buff, nsize); + if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) + luaL_error(L, "unable to get ModuleFileName"); + else { + *lb = '\0'; + luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff); + lua_remove(L, -2); /* remove original string */ + } +} + + +static void pusherror (lua_State *L) { + int error = GetLastError(); + char buffer[128]; + if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error, 0, buffer, sizeof(buffer), NULL)) + lua_pushstring(L, buffer); + else + lua_pushfstring(L, "system error %d\n", error); +} + +static void ll_unloadlib (void *lib) { + FreeLibrary((HINSTANCE)lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + HINSTANCE lib = LoadLibraryA(path); + if (lib == NULL) pusherror(L); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym); + if (f == NULL) pusherror(L); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DYLD) +/* +** {====================================================================== +** Native Mac OS X / Darwin Implementation +** ======================================================================= +*/ + +#include <mach-o/dyld.h> + + +/* Mac appends a `_' before C function names */ +#undef POF +#define POF "_" LUA_POF + + +static void pusherror (lua_State *L) { + const char *err_str; + const char *err_file; + NSLinkEditErrors err; + int err_num; + NSLinkEditError(&err, &err_num, &err_file, &err_str); + lua_pushstring(L, err_str); +} + + +static const char *errorfromcode (NSObjectFileImageReturnCode ret) { + switch (ret) { + case NSObjectFileImageInappropriateFile: + return "file is not a bundle"; + case NSObjectFileImageArch: + return "library is for wrong CPU type"; + case NSObjectFileImageFormat: + return "bad format"; + case NSObjectFileImageAccess: + return "cannot access file"; + case NSObjectFileImageFailure: + default: + return "unable to load library"; + } +} + + +static void ll_unloadlib (void *lib) { + NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES); +} + + +static void *ll_load (lua_State *L, const char *path) { + NSObjectFileImage img; + NSObjectFileImageReturnCode ret; + /* this would be a rare case, but prevents crashing if it happens */ + if(!_dyld_present()) { + lua_pushliteral(L, "dyld not present"); + return NULL; + } + ret = NSCreateObjectFileImageFromFile(path, &img); + if (ret == NSObjectFileImageSuccess) { + NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); + NSDestroyObjectFileImage(img); + if (mod == NULL) pusherror(L); + return mod; + } + lua_pushstring(L, errorfromcode(ret)); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); + if (nss == NULL) { + lua_pushfstring(L, "symbol " LUA_QS " not found", sym); + return NULL; + } + return (lua_CFunction)NSAddressOfSymbol(nss); +} + +/* }====================================================== */ + + + +#else +/* +** {====================================================== +** Fallback for other systems +** ======================================================= +*/ + +#undef LIB_FAIL +#define LIB_FAIL "absent" + + +#define DLMSG "dynamic libraries not enabled; check your Lua installation" + + +static void ll_unloadlib (void *lib) { + (void)lib; /* to avoid warnings */ +} + + +static void *ll_load (lua_State *L, const char *path) { + (void)path; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + (void)lib; (void)sym; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + +/* }====================================================== */ +#endif + + + +static void **ll_register (lua_State *L, const char *path) { + void **plib; + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ + if (!lua_isnil(L, -1)) /* is there an entry? */ + plib = (void **)lua_touserdata(L, -1); + else { /* no entry yet; create one */ + lua_pop(L, 1); + plib = (void **)lua_newuserdata(L, sizeof(const void *)); + *plib = NULL; + luaL_getmetatable(L, "_LOADLIB"); + lua_setmetatable(L, -2); + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_pushvalue(L, -2); + lua_settable(L, LUA_REGISTRYINDEX); + } + return plib; +} + + +/* +** __gc tag method: calls library's `ll_unloadlib' function with the lib +** handle +*/ +static int gctm (lua_State *L) { + void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); + if (*lib) ll_unloadlib(*lib); + *lib = NULL; /* mark library as closed */ + return 0; +} + + +static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { + void **reg = ll_register(L, path); + if (*reg == NULL) *reg = ll_load(L, path); + if (*reg == NULL) + return ERRLIB; /* unable to load library */ + else { + lua_CFunction f = ll_sym(L, *reg, sym); + if (f == NULL) + return ERRFUNC; /* unable to find function */ + lua_pushcfunction(L, f); + return 0; /* return function */ + } +} + + +static int ll_loadlib (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + const char *init = luaL_checkstring(L, 2); + int stat = ll_loadfunc(L, path, init); + if (stat == 0) /* no errors? */ + return 1; /* return the loaded function */ + else { /* error; error message is on stack top */ + lua_pushnil(L); + lua_insert(L, -2); + lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); + return 3; /* return nil, error message, and where */ + } +} + + + +/* +** {====================================================== +** 'require' function +** ======================================================= +*/ + + +static int readable (const char *filename) { + FILE *f = fopen(filename, "r"); /* try to open file */ + if (f == NULL) return 0; /* open failed */ + fclose(f); + return 1; +} + + +static const char *pushnexttemplate (lua_State *L, const char *path) { + const char *l; + while (*path == *LUA_PATHSEP) path++; /* skip separators */ + if (*path == '\0') return NULL; /* no more templates */ + l = strchr(path, *LUA_PATHSEP); /* find next separator */ + if (l == NULL) l = path + strlen(path); + lua_pushlstring(L, path, l - path); /* template */ + return l; +} + + +static const char *findfile (lua_State *L, const char *name, + const char *pname) { + const char *path; + name = luaL_gsub(L, name, ".", LUA_DIRSEP); + lua_getfield(L, LUA_ENVIRONINDEX, pname); + path = lua_tostring(L, -1); + if (path == NULL) + luaL_error(L, LUA_QL("package.%s") " must be a string", pname); + lua_pushliteral(L, ""); /* error accumulator */ + while ((path = pushnexttemplate(L, path)) != NULL) { + const char *filename; + filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ + if (readable(filename)) /* does file exist and is readable? */ + return filename; /* return that file name */ + lua_pushfstring(L, "\n\tno file " LUA_QS, filename); + lua_remove(L, -2); /* remove file name */ + lua_concat(L, 2); /* add entry to possible error message */ + } + return NULL; /* not found */ +} + + +static void loaderror (lua_State *L, const char *filename) { + luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", + lua_tostring(L, 1), filename, lua_tostring(L, -1)); +} + + +static int loader_Lua (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + filename = findfile(L, name, "path"); + if (filename == NULL) return 1; /* library not found in this path */ + if (luaL_loadfile(L, filename) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static const char *mkfuncname (lua_State *L, const char *modname) { + const char *funcname; + const char *mark = strchr(modname, *LUA_IGMARK); + if (mark) modname = mark + 1; + funcname = luaL_gsub(L, modname, ".", LUA_OFSEP); + funcname = lua_pushfstring(L, POF"%s", funcname); + lua_remove(L, -2); /* remove 'gsub' result */ + return funcname; +} + + +static int loader_C (lua_State *L) { + const char *funcname; + const char *name = luaL_checkstring(L, 1); + const char *filename = findfile(L, name, "cpath"); + if (filename == NULL) return 1; /* library not found in this path */ + funcname = mkfuncname(L, name); + if (ll_loadfunc(L, filename, funcname) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static int loader_Croot (lua_State *L) { + const char *funcname; + const char *filename; + const char *name = luaL_checkstring(L, 1); + const char *p = strchr(name, '.'); + int stat; + if (p == NULL) return 0; /* is root */ + lua_pushlstring(L, name, p - name); + filename = findfile(L, lua_tostring(L, -1), "cpath"); + if (filename == NULL) return 1; /* root not found */ + funcname = mkfuncname(L, name); + if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { + if (stat != ERRFUNC) loaderror(L, filename); /* real error */ + lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, + name, filename); + return 1; /* function not found */ + } + return 1; +} + + +static int loader_preload (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_getfield(L, LUA_ENVIRONINDEX, "preload"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.preload") " must be a table"); + lua_getfield(L, -1, name); + if (lua_isnil(L, -1)) /* not found? */ + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); + return 1; +} + + +static const int sentinel_ = 0; +#define sentinel ((void *)&sentinel_) + + +static int ll_require (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + int i; + lua_settop(L, 1); /* _LOADED table will be at index 2 */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, 2, name); + if (lua_toboolean(L, -1)) { /* is it there? */ + if (lua_touserdata(L, -1) == sentinel) /* check loops */ + luaL_error(L, "loop or previous error loading module " LUA_QS, name); + return 1; /* package is already loaded */ + } + /* else must load it; iterate over available loaders */ + lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.loaders") " must be a table"); + lua_pushliteral(L, ""); /* error message accumulator */ + for (i=1; ; i++) { + lua_rawgeti(L, -2, i); /* get a loader */ + if (lua_isnil(L, -1)) + luaL_error(L, "module " LUA_QS " not found:%s", + name, lua_tostring(L, -2)); + lua_pushstring(L, name); + lua_call(L, 1, 1); /* call it */ + if (lua_isfunction(L, -1)) /* did it find module? */ + break; /* module loaded successfully */ + else if (lua_isstring(L, -1)) /* loader returned error message? */ + lua_concat(L, 2); /* accumulate it */ + else + lua_pop(L, 1); + } + lua_pushlightuserdata(L, sentinel); + lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */ + lua_pushstring(L, name); /* pass name as argument to module */ + lua_call(L, 1, 1); /* run loaded module */ + if (!lua_isnil(L, -1)) /* non-nil return? */ + lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ + lua_getfield(L, 2, name); + if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */ + lua_pushboolean(L, 1); /* use true as result */ + lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_setfield(L, 2, name); /* _LOADED[name] = true */ + } + return 1; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** 'module' function +** ======================================================= +*/ + + +static void setfenv (lua_State *L) { + lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || + lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ + lua_iscfunction(L, -1)) + luaL_error(L, LUA_QL("module") " not called from a Lua function"); + lua_pushvalue(L, -2); + lua_setfenv(L, -2); + lua_pop(L, 1); +} + + +static void dooptions (lua_State *L, int n) { + int i; + for (i = 2; i <= n; i++) { + lua_pushvalue(L, i); /* get option (a function) */ + lua_pushvalue(L, -2); /* module */ + lua_call(L, 1, 0); + } +} + + +static void modinit (lua_State *L, const char *modname) { + const char *dot; + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_M"); /* module._M = module */ + lua_pushstring(L, modname); + lua_setfield(L, -2, "_NAME"); + dot = strrchr(modname, '.'); /* look for last dot in module name */ + if (dot == NULL) dot = modname; + else dot++; + /* set _PACKAGE as package name (full module name minus last part) */ + lua_pushlstring(L, modname, dot - modname); + lua_setfield(L, -2, "_PACKAGE"); +} + + +static int ll_module (lua_State *L) { + const char *modname = luaL_checkstring(L, 1); + int loaded = lua_gettop(L) + 1; /* index of _LOADED table */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, loaded, modname); /* get _LOADED[modname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL) + return luaL_error(L, "name conflict for module " LUA_QS, modname); + lua_pushvalue(L, -1); + lua_setfield(L, loaded, modname); /* _LOADED[modname] = new table */ + } + /* check whether table already has a _NAME field */ + lua_getfield(L, -1, "_NAME"); + if (!lua_isnil(L, -1)) /* is table an initialized module? */ + lua_pop(L, 1); + else { /* no; initialize it */ + lua_pop(L, 1); + modinit(L, modname); + } + lua_pushvalue(L, -1); + setfenv(L); + dooptions(L, loaded - 1); + return 0; +} + + +static int ll_seeall (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + if (!lua_getmetatable(L, 1)) { + lua_createtable(L, 0, 1); /* create new metatable */ + lua_pushvalue(L, -1); + lua_setmetatable(L, 1); + } + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setfield(L, -2, "__index"); /* mt.__index = _G */ + return 0; +} + + +/* }====================================================== */ + + + +/* auxiliary mark (for internal use) */ +#define AUXMARK "\1" + +static void setpath (lua_State *L, const char *fieldname, const char *envname, + const char *def) { + const char *path = getenv(envname); + if (path == NULL) /* no environment variable? */ + lua_pushstring(L, def); /* use default */ + else { + /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ + path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP, + LUA_PATHSEP AUXMARK LUA_PATHSEP); + luaL_gsub(L, path, AUXMARK, def); + lua_remove(L, -2); + } + setprogdir(L); + lua_setfield(L, -2, fieldname); +} + + +static const luaL_Reg pk_funcs[] = { + {"loadlib", ll_loadlib}, + {"seeall", ll_seeall}, + {NULL, NULL} +}; + + +static const luaL_Reg ll_funcs[] = { + {"module", ll_module}, + {"require", ll_require}, + {NULL, NULL} +}; + + +static const lua_CFunction loaders[] = + {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}; + + +LUALIB_API int luaopen_package (lua_State *L) { + int i; + /* create new type _LOADLIB */ + luaL_newmetatable(L, "_LOADLIB"); + lua_pushcfunction(L, gctm); + lua_setfield(L, -2, "__gc"); + /* create `package' table */ + luaL_register(L, LUA_LOADLIBNAME, pk_funcs); +#if defined(LUA_COMPAT_LOADLIB) + lua_getfield(L, -1, "loadlib"); + lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); +#endif + lua_pushvalue(L, -1); + lua_replace(L, LUA_ENVIRONINDEX); + /* create `loaders' table */ + lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); + /* fill it with pre-defined loaders */ + for (i=0; loaders[i] != NULL; i++) { + lua_pushcfunction(L, loaders[i]); + lua_rawseti(L, -2, i+1); + } + lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */ + setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */ + setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */ + /* store config information */ + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" + LUA_EXECDIR "\n" LUA_IGMARK); + lua_setfield(L, -2, "config"); + /* set field `loaded' */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2); + lua_setfield(L, -2, "loaded"); + /* set field `preload' */ + lua_newtable(L); + lua_setfield(L, -2, "preload"); + lua_pushvalue(L, LUA_GLOBALSINDEX); + luaL_register(L, NULL, ll_funcs); /* open lib into global table */ + lua_pop(L, 1); + return 1; /* return 'package' table */ +} + diff --git a/lua-5.1.4/src/lobject.c b/lua-5.1.4/src/lobject.c new file mode 100644 index 000000000..4ff50732a --- /dev/null +++ b/lua-5.1.4/src/lobject.c @@ -0,0 +1,214 @@ +/* +** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#include <ctype.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define lobject_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + + +const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; + + +/* +** converts an integer to a "floating point byte", represented as +** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if +** eeeee != 0 and (xxx) otherwise. +*/ +int luaO_int2fb (unsigned int x) { + int e = 0; /* expoent */ + while (x >= 16) { + x = (x+1) >> 1; + e++; + } + if (x < 8) return x; + else return ((e+1) << 3) | (cast_int(x) - 8); +} + + +/* converts back */ +int luaO_fb2int (int x) { + int e = (x >> 3) & 31; + if (e == 0) return x; + else return ((x & 7)+8) << (e - 1); +} + + +int luaO_log2 (unsigned int x) { + static const lu_byte log_2[256] = { + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = -1; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; + +} + + +int luaO_rawequalObj (const TValue *t1, const TValue *t2) { + if (ttype(t1) != ttype(t2)) return 0; + else switch (ttype(t1)) { + case LUA_TNIL: + return 1; + case LUA_TNUMBER: + return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: + return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ + case LUA_TLIGHTUSERDATA: + return pvalue(t1) == pvalue(t2); + default: + lua_assert(iscollectable(t1)); + return gcvalue(t1) == gcvalue(t2); + } +} + + +int luaO_str2d (const char *s, lua_Number *result) { + char *endptr; + *result = lua_str2number(s, &endptr); + if (endptr == s) return 0; /* conversion failed */ + if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ + *result = cast_num(strtoul(s, &endptr, 16)); + if (*endptr == '\0') return 1; /* most common case */ + while (isspace(cast(unsigned char, *endptr))) endptr++; + if (*endptr != '\0') return 0; /* invalid trailing characters? */ + return 1; +} + + + +static void pushstr (lua_State *L, const char *str) { + setsvalue2s(L, L->top, luaS_new(L, str)); + incr_top(L); +} + + +/* this function handles only `%d', `%c', %f, %p, and `%s' formats */ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + int n = 1; + pushstr(L, ""); + for (;;) { + const char *e = strchr(fmt, '%'); + if (e == NULL) break; + setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt)); + incr_top(L); + switch (*(e+1)) { + case 's': { + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + pushstr(L, s); + break; + } + case 'c': { + char buff[2]; + buff[0] = cast(char, va_arg(argp, int)); + buff[1] = '\0'; + pushstr(L, buff); + break; + } + case 'd': { + setnvalue(L->top, cast_num(va_arg(argp, int))); + incr_top(L); + break; + } + case 'f': { + setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); + incr_top(L); + break; + } + case 'p': { + char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ + sprintf(buff, "%p", va_arg(argp, void *)); + pushstr(L, buff); + break; + } + case '%': { + pushstr(L, "%"); + break; + } + default: { + char buff[3]; + buff[0] = '%'; + buff[1] = *(e+1); + buff[2] = '\0'; + pushstr(L, buff); + break; + } + } + n += 2; + fmt = e+2; + } + pushstr(L, fmt); + luaV_concat(L, n+1, cast_int(L->top - L->base) - 1); + L->top -= n; + return svalue(L->top - 1); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + + +void luaO_chunkid (char *out, const char *source, size_t bufflen) { + if (*source == '=') { + strncpy(out, source+1, bufflen); /* remove first char */ + out[bufflen-1] = '\0'; /* ensures null termination */ + } + else { /* out = "source", or "...source" */ + if (*source == '@') { + size_t l; + source++; /* skip the `@' */ + bufflen -= sizeof(" '...' "); + l = strlen(source); + strcpy(out, ""); + if (l > bufflen) { + source += (l-bufflen); /* get last part of file name */ + strcat(out, "..."); + } + strcat(out, source); + } + else { /* out = [string "string"] */ + size_t len = strcspn(source, "\n\r"); /* stop at first newline */ + bufflen -= sizeof(" [string \"...\"] "); + if (len > bufflen) len = bufflen; + strcpy(out, "[string \""); + if (source[len] != '\0') { /* must truncate? */ + strncat(out, source, len); + strcat(out, "..."); + } + else + strcat(out, source); + strcat(out, "\"]"); + } + } +} diff --git a/lua-5.1.4/src/lobject.h b/lua-5.1.4/src/lobject.h new file mode 100644 index 000000000..f1e447ef3 --- /dev/null +++ b/lua-5.1.4/src/lobject.h @@ -0,0 +1,381 @@ +/* +** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include <stdarg.h> + + +#include "llimits.h" +#include "lua.h" + + +/* tags for values visible from Lua */ +#define LAST_TAG LUA_TTHREAD + +#define NUM_TAGS (LAST_TAG+1) + + +/* +** Extra tags for non-values +*/ +#define LUA_TPROTO (LAST_TAG+1) +#define LUA_TUPVAL (LAST_TAG+2) +#define LUA_TDEADKEY (LAST_TAG+3) + + +/* +** Union of all collectable objects +*/ +typedef union GCObject GCObject; + + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked + + +/* +** Common header in struct form +*/ +typedef struct GCheader { + CommonHeader; +} GCheader; + + + + +/* +** Union of all Lua values +*/ +typedef union { + GCObject *gc; + void *p; + lua_Number n; + int b; +} Value; + + +/* +** Tagged Values +*/ + +#define TValuefields Value value; int tt + +typedef struct lua_TValue { + TValuefields; +} TValue; + + +/* Macros to test type */ +#define ttisnil(o) (ttype(o) == LUA_TNIL) +#define ttisnumber(o) (ttype(o) == LUA_TNUMBER) +#define ttisstring(o) (ttype(o) == LUA_TSTRING) +#define ttistable(o) (ttype(o) == LUA_TTABLE) +#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) +#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) +#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) +#define ttisthread(o) (ttype(o) == LUA_TTHREAD) +#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) + +/* Macros to access values */ +#define ttype(o) ((o)->tt) +#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) +#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) +#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) +#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) +#define tsvalue(o) (&rawtsvalue(o)->tsv) +#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) +#define uvalue(o) (&rawuvalue(o)->uv) +#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) +#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) +#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) +#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) + +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) + +/* +** for internal debug only +*/ +#define checkconsistency(obj) \ + lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) + +#define checkliveness(g,obj) \ + lua_assert(!iscollectable(obj) || \ + ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) + + +/* Macros to set values */ +#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) + +#define setnvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; } + +#define setpvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } + +#define setbvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; } + +#define setsvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \ + checkliveness(G(L),i_o); } + +#define setuvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \ + checkliveness(G(L),i_o); } + +#define setthvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \ + checkliveness(G(L),i_o); } + +#define setclvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \ + checkliveness(G(L),i_o); } + +#define sethvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \ + checkliveness(G(L),i_o); } + +#define setptvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \ + checkliveness(G(L),i_o); } + + + + +#define setobj(L,obj1,obj2) \ + { const TValue *o2=(obj2); TValue *o1=(obj1); \ + o1->value = o2->value; o1->tt=o2->tt; \ + checkliveness(G(L),o1); } + + +/* +** different types of sets, according to destination +*/ + +/* from stack to (same) stack */ +#define setobjs2s setobj +/* to stack (not from same stack) */ +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue +/* from table to same table */ +#define setobjt2t setobj +/* to table */ +#define setobj2t setobj +/* to new object */ +#define setobj2n setobj +#define setsvalue2n setsvalue + +#define setttype(obj, tt) (ttype(obj) = (tt)) + + +#define iscollectable(o) (ttype(o) >= LUA_TSTRING) + + + +typedef TValue *StkId; /* index to stack elements */ + + +/* +** String headers for string table +*/ +typedef union TString { + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + struct { + CommonHeader; + lu_byte reserved; + unsigned int hash; + size_t len; + } tsv; +} TString; + + +#define getstr(ts) cast(const char *, (ts) + 1) +#define svalue(o) getstr(rawtsvalue(o)) + + + +typedef union Udata { + L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ + struct { + CommonHeader; + struct Table *metatable; + struct Table *env; + size_t len; + } uv; +} Udata; + + + + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + TValue *k; /* constants used by the function */ + Instruction *code; + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines */ + struct LocVar *locvars; /* information about local variables */ + TString **upvalues; /* upvalue names */ + TString *source; + int sizeupvalues; + int sizek; /* size of `k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of `p' */ + int sizelocvars; + int linedefined; + int lastlinedefined; + GCObject *gclist; + lu_byte nups; /* number of upvalues */ + lu_byte numparams; + lu_byte is_vararg; + lu_byte maxstacksize; +} Proto; + + +/* masks for new-style vararg */ +#define VARARG_HASARG 1 +#define VARARG_ISVARARG 2 +#define VARARG_NEEDSARG 4 + + +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + + +/* +** Upvalues +*/ + +typedef struct UpVal { + CommonHeader; + TValue *v; /* points to stack or to its own value */ + union { + TValue value; /* the value (when closed) */ + struct { /* double linked list (when open) */ + struct UpVal *prev; + struct UpVal *next; + } l; + } u; +} UpVal; + + +/* +** Closures +*/ + +#define ClosureHeader \ + CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ + struct Table *env + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) +#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) + + +/* +** Tables +*/ + +typedef union TKey { + struct { + TValuefields; + struct Node *next; /* for chaining */ + } nk; + TValue tvk; +} TKey; + + +typedef struct Node { + TValue i_val; + TKey i_key; +} Node; + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<<p means tagmethod(p) is not present */ + lu_byte lsizenode; /* log2 of size of `node' array */ + struct Table *metatable; + TValue *array; /* array part */ + Node *node; + Node *lastfree; /* any free position is before this position */ + GCObject *gclist; + int sizearray; /* size of `array' array */ +} Table; + + + +/* +** `module' operation for hashing (size is always a power of 2) +*/ +#define lmod(s,size) \ + (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1))))) + + +#define twoto(x) (1<<(x)) +#define sizenode(t) (twoto((t)->lsizenode)) + + +#define luaO_nilobject (&luaO_nilobject_) + +LUAI_DATA const TValue luaO_nilobject_; + +#define ceillog2(x) (luaO_log2((x)-1) + 1) + +LUAI_FUNC int luaO_log2 (unsigned int x); +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); +LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); + + +#endif + diff --git a/lua-5.1.4/src/lopcodes.c b/lua-5.1.4/src/lopcodes.c new file mode 100644 index 000000000..4cc745230 --- /dev/null +++ b/lua-5.1.4/src/lopcodes.c @@ -0,0 +1,102 @@ +/* +** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** See Copyright Notice in lua.h +*/ + + +#define lopcodes_c +#define LUA_CORE + + +#include "lopcodes.h" + + +/* ORDER OP */ + +const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADBOOL", + "LOADNIL", + "GETUPVAL", + "GETGLOBAL", + "GETTABLE", + "SETGLOBAL", + "SETUPVAL", + "SETTABLE", + "NEWTABLE", + "SELF", + "ADD", + "SUB", + "MUL", + "DIV", + "MOD", + "POW", + "UNM", + "NOT", + "LEN", + "CONCAT", + "JMP", + "EQ", + "LT", + "LE", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "FORLOOP", + "FORPREP", + "TFORLOOP", + "SETLIST", + "CLOSE", + "CLOSURE", + "VARARG", + NULL +}; + + +#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ + ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ + ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ + ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */ + ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ + ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ + ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ +}; + diff --git a/lua-5.1.4/src/lopcodes.h b/lua-5.1.4/src/lopcodes.h new file mode 100644 index 000000000..41224d6ee --- /dev/null +++ b/lua-5.1.4/src/lopcodes.h @@ -0,0 +1,268 @@ +/* +** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned numbers. + All instructions have an opcode in the first 6 bits. + Instructions can have the following fields: + `A' : 8 bits + `B' : 9 bits + `C' : 9 bits + `Bx' : 18 bits (`B' and `C' together) + `sBx' : signed Bx + + A signed argument is represented in excess K; that is, the number + value is the unsigned value minus K. K is exactly the maximum value + for that argument (so that -max is represented by 0, and +max is + represented by 2*max), which is half the maximum for the corresponding + unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 + +#define SIZE_OP 6 + +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C + + +/* +** limits for opcode arguments. +** we use (signed) int to manipulate most arguments, +** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) +*/ +#if SIZE_Bx < LUAI_BITSINT-1 +#define MAXARG_Bx ((1<<SIZE_Bx)-1) +#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */ +#else +#define MAXARG_Bx MAX_INT +#define MAXARG_sBx MAX_INT +#endif + + +#define MAXARG_A ((1<<SIZE_A)-1) +#define MAXARG_B ((1<<SIZE_B)-1) +#define MAXARG_C ((1<<SIZE_C)-1) + + +/* creates a mask with `n' 1 bits at position `p' */ +#define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p) + +/* creates a mask with `n' 0 bits at position `p' */ +#define MASK0(n,p) (~MASK1(n,p)) + +/* +** the following macros help to manipulate instructions +*/ + +#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP)))) + +#define GETARG_A(i) (cast(int, ((i)>>POS_A) & MASK1(SIZE_A,0))) +#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ + ((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A)))) + +#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0))) +#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ + ((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B)))) + +#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0))) +#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ + ((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C)))) + +#define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0))) +#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ + ((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx)))) + +#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx) +#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx)) + + +#define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \ + | (cast(Instruction, a)<<POS_A) \ + | (cast(Instruction, b)<<POS_B) \ + | (cast(Instruction, c)<<POS_C)) + +#define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \ + | (cast(Instruction, a)<<POS_A) \ + | (cast(Instruction, bc)<<POS_Bx)) + + +/* +** Macros to operate RK indices +*/ + +/* this bit 1 means constant (0 means register) */ +#define BITRK (1 << (SIZE_B - 1)) + +/* test whether value is a constant */ +#define ISK(x) ((x) & BITRK) + +/* gets the index of the constant */ +#define INDEXK(r) ((int)(r) & ~BITRK) + +#define MAXINDEXRK (BITRK - 1) + +/* code a constant index as a RK value */ +#define RKASK(x) ((x) | BITRK) + + +/* +** invalid register that fits in 8 bits +*/ +#define NO_REG MAXARG_A + + +/* +** R(x) - register +** Kst(x) - constant (in constant table) +** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x) +*/ + + +/* +** grep "ORDER OP" if you change these enums +*/ + +typedef enum { +/*---------------------------------------------------------------------- +name args description +------------------------------------------------------------------------*/ +OP_MOVE,/* A B R(A) := R(B) */ +OP_LOADK,/* A Bx R(A) := Kst(Bx) */ +OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) pc++ */ +OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */ +OP_GETUPVAL,/* A B R(A) := UpValue[B] */ + +OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] */ +OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */ + +OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) */ +OP_SETUPVAL,/* A B UpValue[B] := R(A) */ +OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */ + +OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */ + +OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ + +OP_ADD,/* A B C R(A) := RK(B) + RK(C) */ +OP_SUB,/* A B C R(A) := RK(B) - RK(C) */ +OP_MUL,/* A B C R(A) := RK(B) * RK(C) */ +OP_DIV,/* A B C R(A) := RK(B) / RK(C) */ +OP_MOD,/* A B C R(A) := RK(B) % RK(C) */ +OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */ +OP_UNM,/* A B R(A) := -R(B) */ +OP_NOT,/* A B R(A) := not R(B) */ +OP_LEN,/* A B R(A) := length of R(B) */ + +OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ + +OP_JMP,/* sBx pc+=sBx */ + +OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ +OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ +OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ + +OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ + +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ + +OP_FORLOOP,/* A sBx R(A)+=R(A+2); + if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/ +OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ + +OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); + if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */ +OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ + +OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ +OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ + +OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ +} OpCode; + + +#define NUM_OPCODES (cast(int, OP_VARARG) + 1) + + + +/*=========================================================================== + Notes: + (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, + and can be 0: OP_CALL then sets `top' to last_result+1, so + next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. + + (*) In OP_VARARG, if (B == 0) then use actual number of varargs and + set top (like in OP_CALL with C == 0). + + (*) In OP_RETURN, if (B == 0) then return up to `top' + + (*) In OP_SETLIST, if (B == 0) then B = `top'; + if (C == 0) then next `instruction' is real C + + (*) For comparisons, A specifies what condition the test should accept + (true or false). + + (*) All `skips' (pc++) assume that next instruction is a jump +===========================================================================*/ + + +/* +** masks for instruction properties. The format is: +** bits 0-1: op mode +** bits 2-3: C arg mode +** bits 4-5: B arg mode +** bit 6: instruction set register A +** bit 7: operator is a test +*/ + +enum OpArgMask { + OpArgN, /* argument is not used */ + OpArgU, /* argument is used */ + OpArgR, /* argument is a register or a jump offset */ + OpArgK /* argument is a constant or register/constant */ +}; + +LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; + +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) +#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + + +#endif diff --git a/lua-5.1.4/src/loslib.c b/lua-5.1.4/src/loslib.c new file mode 100644 index 000000000..da06a572a --- /dev/null +++ b/lua-5.1.4/src/loslib.c @@ -0,0 +1,243 @@ +/* +** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ +** Standard Operating System library +** See Copyright Notice in lua.h +*/ + + +#include <errno.h> +#include <locale.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#define loslib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int os_pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static int os_execute (lua_State *L) { + lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); + return 1; +} + + +static int os_remove (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return os_pushresult(L, remove(filename) == 0, filename); +} + + +static int os_rename (lua_State *L) { + const char *fromname = luaL_checkstring(L, 1); + const char *toname = luaL_checkstring(L, 2); + return os_pushresult(L, rename(fromname, toname) == 0, fromname); +} + + +static int os_tmpname (lua_State *L) { + char buff[LUA_TMPNAMBUFSIZE]; + int err; + lua_tmpnam(buff, err); + if (err) + return luaL_error(L, "unable to generate a unique filename"); + lua_pushstring(L, buff); + return 1; +} + + +static int os_getenv (lua_State *L) { + lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ + return 1; +} + + +static int os_clock (lua_State *L) { + lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); + return 1; +} + + +/* +** {====================================================== +** Time/Date operations +** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, +** wday=%w+1, yday=%j, isdst=? } +** ======================================================= +*/ + +static void setfield (lua_State *L, const char *key, int value) { + lua_pushinteger(L, value); + lua_setfield(L, -2, key); +} + +static void setboolfield (lua_State *L, const char *key, int value) { + if (value < 0) /* undefined? */ + return; /* does not set field */ + lua_pushboolean(L, value); + lua_setfield(L, -2, key); +} + +static int getboolfield (lua_State *L, const char *key) { + int res; + lua_getfield(L, -1, key); + res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); + lua_pop(L, 1); + return res; +} + + +static int getfield (lua_State *L, const char *key, int d) { + int res; + lua_getfield(L, -1, key); + if (lua_isnumber(L, -1)) + res = (int)lua_tointeger(L, -1); + else { + if (d < 0) + return luaL_error(L, "field " LUA_QS " missing in date table", key); + res = d; + } + lua_pop(L, 1); + return res; +} + + +static int os_date (lua_State *L) { + const char *s = luaL_optstring(L, 1, "%c"); + time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); + struct tm *stm; + if (*s == '!') { /* UTC? */ + stm = gmtime(&t); + s++; /* skip `!' */ + } + else + stm = localtime(&t); + if (stm == NULL) /* invalid date? */ + lua_pushnil(L); + else if (strcmp(s, "*t") == 0) { + lua_createtable(L, 0, 9); /* 9 = number of fields */ + setfield(L, "sec", stm->tm_sec); + setfield(L, "min", stm->tm_min); + setfield(L, "hour", stm->tm_hour); + setfield(L, "day", stm->tm_mday); + setfield(L, "month", stm->tm_mon+1); + setfield(L, "year", stm->tm_year+1900); + setfield(L, "wday", stm->tm_wday+1); + setfield(L, "yday", stm->tm_yday+1); + setboolfield(L, "isdst", stm->tm_isdst); + } + else { + char cc[3]; + luaL_Buffer b; + cc[0] = '%'; cc[2] = '\0'; + luaL_buffinit(L, &b); + for (; *s; s++) { + if (*s != '%' || *(s + 1) == '\0') /* no conversion specifier? */ + luaL_addchar(&b, *s); + else { + size_t reslen; + char buff[200]; /* should be big enough for any conversion result */ + cc[1] = *(++s); + reslen = strftime(buff, sizeof(buff), cc, stm); + luaL_addlstring(&b, buff, reslen); + } + } + luaL_pushresult(&b); + } + return 1; +} + + +static int os_time (lua_State *L) { + time_t t; + if (lua_isnoneornil(L, 1)) /* called without args? */ + t = time(NULL); /* get current time */ + else { + struct tm ts; + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 1); /* make sure table is at the top */ + ts.tm_sec = getfield(L, "sec", 0); + ts.tm_min = getfield(L, "min", 0); + ts.tm_hour = getfield(L, "hour", 12); + ts.tm_mday = getfield(L, "day", -1); + ts.tm_mon = getfield(L, "month", -1) - 1; + ts.tm_year = getfield(L, "year", -1) - 1900; + ts.tm_isdst = getboolfield(L, "isdst"); + t = mktime(&ts); + } + if (t == (time_t)(-1)) + lua_pushnil(L); + else + lua_pushnumber(L, (lua_Number)t); + return 1; +} + + +static int os_difftime (lua_State *L) { + lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), + (time_t)(luaL_optnumber(L, 2, 0)))); + return 1; +} + +/* }====================================================== */ + + +static int os_setlocale (lua_State *L) { + static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, + LC_NUMERIC, LC_TIME}; + static const char *const catnames[] = {"all", "collate", "ctype", "monetary", + "numeric", "time", NULL}; + const char *l = luaL_optstring(L, 1, NULL); + int op = luaL_checkoption(L, 2, "all", catnames); + lua_pushstring(L, setlocale(cat[op], l)); + return 1; +} + + +static int os_exit (lua_State *L) { + exit(luaL_optint(L, 1, EXIT_SUCCESS)); +} + +static const luaL_Reg syslib[] = { + {"clock", os_clock}, + {"date", os_date}, + {"difftime", os_difftime}, + {"execute", os_execute}, + {"exit", os_exit}, + {"getenv", os_getenv}, + {"remove", os_remove}, + {"rename", os_rename}, + {"setlocale", os_setlocale}, + {"time", os_time}, + {"tmpname", os_tmpname}, + {NULL, NULL} +}; + +/* }====================================================== */ + + + +LUALIB_API int luaopen_os (lua_State *L) { + luaL_register(L, LUA_OSLIBNAME, syslib); + return 1; +} + diff --git a/lua-5.1.4/src/lparser.c b/lua-5.1.4/src/lparser.c new file mode 100644 index 000000000..1e2a9a88b --- /dev/null +++ b/lua-5.1.4/src/lparser.c @@ -0,0 +1,1339 @@ +/* +** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + + +#include <string.h> + +#define lparser_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + +#define getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]]) + +#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int breaklist; /* list of jumps out of this loop */ + lu_byte nactvar; /* # active locals outside the breakable structure */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isbreakable; /* true if `block' is a loop */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void chunk (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +static void anchor_token (LexState *ls) { + if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { + TString *ts = ls->t.seminfo.ts; + luaX_newstring(ls, getstr(ts), ts->tsv.len); + } +} + + +static void error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); +} + + +static void errorlimit (FuncState *fs, int limit, const char *what) { + const char *msg = (fs->f->linedefined == 0) ? + luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : + luaO_pushfstring(fs->L, "function at line %d has more than %d %s", + fs->f->linedefined, limit, what); + luaX_lexerror(fs->ls, msg, 0); +} + + +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + + +static void check_match (LexState *ls, int what, int who, int where) { + if (!testnext(ls, what)) { + if (where == ls->linenumber) + error_expected(ls, what); + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + LUA_QS " expected (to close " LUA_QS " at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.s.info = i; +} + + +static void codestring (LexState *ls, expdesc *e, TString *s) { + init_exp(e, VK, luaK_stringK(ls->fs, s)); +} + + +static void checkname(LexState *ls, expdesc *e) { + codestring(ls, e, str_checkname(ls)); +} + + +static int registerlocalvar (LexState *ls, TString *varname) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, + LocVar, SHRT_MAX, "too many local variables"); + while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; + f->locvars[fs->nlocvars].varname = varname; + luaC_objbarrier(ls->L, f, varname); + return fs->nlocvars++; +} + + +#define new_localvarliteral(ls,v,n) \ + new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n) + + +static void new_localvar (LexState *ls, TString *name, int n) { + FuncState *fs = ls->fs; + luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables"); + fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); +} + + +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + fs->nactvar = cast_byte(fs->nactvar + nvars); + for (; nvars; nvars--) { + getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc; + } +} + + +static void removevars (LexState *ls, int tolevel) { + FuncState *fs = ls->fs; + while (fs->nactvar > tolevel) + getlocvar(fs, --fs->nactvar).endpc = fs->pc; +} + + +static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { + int i; + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + for (i=0; i<f->nups; i++) { + if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) { + lua_assert(f->upvalues[i] == name); + return i; + } + } + /* new one */ + luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues"); + luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, + TString *, MAX_INT, ""); + while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; + f->upvalues[f->nups] = name; + luaC_objbarrier(fs->L, f, name); + lua_assert(v->k == VLOCAL || v->k == VUPVAL); + fs->upvalues[f->nups].k = cast_byte(v->k); + fs->upvalues[f->nups].info = cast_byte(v->u.s.info); + return f->nups++; +} + + +static int searchvar (FuncState *fs, TString *n) { + int i; + for (i=fs->nactvar-1; i >= 0; i--) { + if (n == getlocvar(fs, i).varname) + return i; + } + return -1; /* not found */ +} + + +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl && bl->nactvar > level) bl = bl->previous; + if (bl) bl->upval = 1; +} + + +static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) { /* no more levels? */ + init_exp(var, VGLOBAL, NO_REG); /* default is global variable */ + return VGLOBAL; + } + else { + int v = searchvar(fs, n); /* look up at current level */ + if (v >= 0) { + init_exp(var, VLOCAL, v); + if (!base) + markupval(fs, v); /* local will be used as an upval */ + return VLOCAL; + } + else { /* not found at current level; try upper one */ + if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL) + return VGLOBAL; + var->u.s.info = indexupvalue(fs, n, var); /* else was LOCAL or UPVAL */ + var->k = VUPVAL; /* upvalue in this level */ + return VUPVAL; + } + } +} + + +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + if (singlevaraux(fs, varname, var, 1) == VGLOBAL) + var->u.s.info = luaK_stringK(fs, varname); /* info points to global name */ +} + + +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int extra = nvars - nexps; + if (hasmultret(e->k)) { + extra++; /* includes call itself */ + if (extra < 0) extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + if (extra > 1) luaK_reserveregs(fs, extra-1); + } + else { + if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ + if (extra > 0) { + int reg = fs->freereg; + luaK_reserveregs(fs, extra); + luaK_nil(fs, reg, extra); + } + } +} + + +static void enterlevel (LexState *ls) { + if (++ls->L->nCcalls > LUAI_MAXCCALLS) + luaX_lexerror(ls, "chunk has too many syntax levels", 0); +} + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { + bl->breaklist = NO_JUMP; + bl->isbreakable = isbreakable; + bl->nactvar = fs->nactvar; + bl->upval = 0; + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == fs->nactvar); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + fs->bl = bl->previous; + removevars(fs->ls, bl->nactvar); + if (bl->upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + /* a block either controls scope or breaks (never both) */ + lua_assert(!bl->isbreakable || !bl->upval); + lua_assert(bl->nactvar == fs->nactvar); + fs->freereg = fs->nactvar; /* free registers */ + luaK_patchtohere(fs, bl->breaklist); +} + + +static void pushclosure (LexState *ls, FuncState *func, expdesc *v) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizep; + int i; + luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizep) f->p[oldsize++] = NULL; + f->p[fs->np++] = func->f; + luaC_objbarrier(ls->L, f, func->f); + init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); + for (i=0; i<func->f->nups; i++) { + OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; + luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0); + } +} + + +static void open_func (LexState *ls, FuncState *fs) { + lua_State *L = ls->L; + Proto *f = luaF_newproto(L); + fs->f = f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + fs->L = L; + ls->fs = fs; + fs->pc = 0; + fs->lasttarget = -1; + fs->jpc = NO_JUMP; + fs->freereg = 0; + fs->nk = 0; + fs->np = 0; + fs->nlocvars = 0; + fs->nactvar = 0; + fs->bl = NULL; + f->source = ls->source; + f->maxstacksize = 2; /* registers 0/1 are always valid */ + fs->h = luaH_new(L, 0, 0); + /* anchor table of constants and prototype (to avoid being collected) */ + sethvalue2s(L, L->top, fs->h); + incr_top(L); + setptvalue2s(L, L->top, f); + incr_top(L); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + removevars(ls, 0); + luaK_ret(fs, 0, 0); /* final return */ + luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); + f->sizecode = fs->pc; + luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); + f->sizelineinfo = fs->pc; + luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); + f->sizek = fs->nk; + luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); + f->sizep = fs->np; + luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); + f->sizelocvars = fs->nlocvars; + luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *); + f->sizeupvalues = f->nups; + lua_assert(luaG_checkcode(f)); + lua_assert(fs->bl == NULL); + ls->fs = fs->prev; + L->top -= 2; /* remove table and prototype from the stack */ + /* last token read was anchored in defunct function; must reanchor it */ + if (fs) anchor_token(ls); +} + + +Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { + struct LexState lexstate; + struct FuncState funcstate; + lexstate.buff = buff; + luaX_setinput(L, &lexstate, z, luaS_new(L, name)); + open_func(&lexstate, &funcstate); + funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ + luaX_next(&lexstate); /* read first token */ + chunk(&lexstate); + check(&lexstate, TK_EOS); + close_func(&lexstate); + lua_assert(funcstate.prev == NULL); + lua_assert(funcstate.f->nups == 0); + lua_assert(lexstate.fs == NULL); + return funcstate.f; +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +static void field (LexState *ls, expdesc *v) { + /* field -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyreg(fs, v); + luaX_next(ls); /* skip the dot or colon */ + checkname(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of `record' elements */ + int na; /* total number of array elements */ + int tostore; /* number of array elements pending to be stored */ +}; + + +static void recfield (LexState *ls, struct ConsControl *cc) { + /* recfield -> (NAME | `['exp1`]') = exp1 */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc key, val; + int rkkey; + if (ls->t.token == TK_NAME) { + luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + checkname(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + rkkey = luaK_exp2RK(fs, &key); + expr(ls, &val); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */ + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); + } +} + + +static void listfield (LexState *ls, struct ConsControl *cc) { + expr(ls, &cc->v); + luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); + cc->na++; + cc->tostore++; +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> ?? */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + struct ConsControl cc; + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VRELOCABLE, pc); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + luaK_exp2nextreg(ls->fs, t); /* fix it at stack top (for gc) */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + switch(ls->t.token) { + case TK_NAME: { /* may be listfields or recfields */ + luaX_lookahead(ls); + if (ls->lookahead.token != '=') /* expression? */ + listfield(ls, &cc); + else + recfield(ls, &cc); + break; + } + case '[': { /* constructor_item -> recfield */ + recfield(ls, &cc); + break; + } + default: { /* constructor_part -> listfield */ + listfield(ls, &cc); + break; + } + } + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ + SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ +} + +/* }====================================================================== */ + + + +static void parlist (LexState *ls) { + /* parlist -> [ param { `,' param } ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + f->is_vararg = 0; + if (ls->t.token != ')') { /* is `parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { /* param -> NAME */ + new_localvar(ls, str_checkname(ls), nparams++); + break; + } + case TK_DOTS: { /* param -> `...' */ + luaX_next(ls); +#if defined(LUA_COMPAT_VARARG) + /* use `arg' as default name */ + new_localvarliteral(ls, "arg", nparams++); + f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG; +#endif + f->is_vararg |= VARARG_ISVARARG; + break; + } + default: luaX_syntaxerror(ls, "<name> or " LUA_QL("...") " expected"); + } + } while (!f->is_vararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG)); + luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int needself, int line) { + /* body -> `(' parlist `)' chunk END */ + FuncState new_fs; + open_func(ls, &new_fs); + new_fs.f->linedefined = line; + checknext(ls, '('); + if (needself) { + new_localvarliteral(ls, "self", 0); + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + chunk(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + close_func(ls); + pushclosure(ls, &new_fs, e); +} + + +static int explist1 (LexState *ls, expdesc *v) { + /* explist1 -> expr { `,' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + int line = ls->linenumber; + switch (ls->t.token) { + case '(': { /* funcargs -> `(' [ explist1 ] `)' */ + if (line != ls->lastline) + luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)"); + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist1(ls, &args); + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(ls, &args, ls->t.seminfo.ts); + luaX_next(ls); /* must use `seminfo' before `next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + return; + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.s.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call remove function and arguments and leaves + (unless changed) one result */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void prefixexp (LexState *ls, expdesc *v) { + /* prefixexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + return; + } + } +} + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> + prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + prefixexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* field */ + field(ls, v); + break; + } + case '[': { /* `[' exp1 `]' */ + expdesc key; + luaK_exp2anyreg(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* `:' NAME funcargs */ + expdesc key; + luaX_next(ls); + checkname(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> NUMBER | STRING | NIL | true | false | ... | + constructor | FUNCTION body | primaryexp */ + switch (ls->t.token) { + case TK_NUMBER: { + init_exp(v, VKNUM, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_STRING: { + codestring(ls, v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use " LUA_QL("...") " outside a vararg function"); + fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */ + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + primaryexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '/': return OPR_DIV; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */ + {10, 9}, {5, 4}, /* power and concat (right associative) */ + {3, 3}, {3, 3}, /* equality and inequality */ + {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ + {2, 2}, {1, 1} /* logical (and/or) */ +}; + +#define UNARY_PRIORITY 8 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where `binop' is any binary operator with a priority higher than `limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { + luaX_next(ls); + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than `limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + luaX_next(ls); + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static int block_follow (int token) { + switch (token) { + case TK_ELSE: case TK_ELSEIF: case TK_END: + case TK_UNTIL: case TK_EOS: + return 1; + default: return 0; + } +} + + +static void block (LexState *ls) { + /* block -> chunk */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + chunk(ls); + lua_assert(bl.breaklist == NO_JUMP); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to a local variable, the local variable +** is needed in a previous assignment (to a table). If so, save original +** local value in a safe place and use this safe copy in the previous +** assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { + if (lh->v.k == VINDEXED) { + if (lh->v.u.s.info == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.info = extra; /* previous assignment will use safe copy */ + } + if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.aux = extra; /* previous assignment will use safe copy */ + } + } + } + if (conflict) { + luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */ + luaK_reserveregs(fs, 1); + } +} + + +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED, + "syntax error"); + if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */ + struct LHS_assign nv; + nv.prev = lh; + primaryexp(ls, &nv.v); + if (nv.v.k == VLOCAL) + check_conflict(ls, lh, &nv.v); + luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls, + "variables in assignment"); + assignment(ls, &nv, nvars+1); + } + else { /* assignment -> `=' explist1 */ + int nexps; + checknext(ls, '='); + nexps = explist1(ls, &e); + if (nexps != nvars) { + adjust_assign(ls, nvars, nexps, &e); + if (nexps > nvars) + ls->fs->freereg -= nexps - nvars; /* remove extra values */ + } + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void breakstat (LexState *ls) { + FuncState *fs = ls->fs; + BlockCnt *bl = fs->bl; + int upval = 0; + while (bl && !bl->isbreakable) { + upval |= bl->upval; + bl = bl->previous; + } + if (!bl) + luaX_syntaxerror(ls, "no loop to break"); + if (upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + luaK_concat(fs, &bl->breaklist, luaK_jump(fs)); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_patchlist(fs, luaK_jump(fs), whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + chunk(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + if (!bl2.upval) { /* no upvalues? */ + leaveblock(fs); /* finish scope */ + luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ + } + else { /* complete semantics when there are upvalues */ + breakstat(ls); /* if condition then break */ + luaK_patchtohere(ls->fs, condexit); /* else... */ + leaveblock(fs); /* finish scope... */ + luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ + } + leaveblock(fs); /* finish loop */ +} + + +static int exp1 (LexState *ls) { + expdesc e; + int k; + expr(ls, &e); + k = e.k; + luaK_exp2nextreg(ls->fs, &e); + return k; +} + + +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { + /* forbody -> DO block */ + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + adjustlocalvars(ls, 3); /* control variables */ + checknext(ls, TK_DO); + prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + luaK_patchtohere(fs, prep); + endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) : + luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); + luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */ + luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp1,exp1[,exp1] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for index)", 0); + new_localvarliteral(ls, "(for limit)", 1); + new_localvarliteral(ls, "(for step)", 2); + new_localvar(ls, varname, 3); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1)); + luaK_reserveregs(fs, 1); + } + forbody(ls, base, line, 1, 1); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist1 forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 0; + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for generator)", nvars++); + new_localvarliteral(ls, "(for state)", nvars++); + new_localvarliteral(ls, "(for control)", nvars++); + /* create declared variables */ + new_localvar(ls, indexname, nvars++); + while (testnext(ls, ',')) + new_localvar(ls, str_checkname(ls), nvars++); + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 3, explist1(ls, &e), &e); + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 3, 0); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip `for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope (`break' jumps to this point) */ +} + + +static int test_then_block (LexState *ls) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + int condexit; + luaX_next(ls); /* skip IF or ELSEIF */ + condexit = cond(ls); + checknext(ls, TK_THEN); + block(ls); /* `then' part */ + return condexit; +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int flist; + int escapelist = NO_JUMP; + flist = test_then_block(ls); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + flist = test_then_block(ls); /* ELSEIF cond THEN block */ + } + if (ls->t.token == TK_ELSE) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + luaX_next(ls); /* skip ELSE (after patch, for correct line info) */ + block(ls); /* `else' part */ + } + else + luaK_concat(fs, &escapelist, flist); + luaK_patchtohere(fs, escapelist); + check_match(ls, TK_END, TK_IF, line); +} + + +static void localfunc (LexState *ls) { + expdesc v, b; + FuncState *fs = ls->fs; + new_localvar(ls, str_checkname(ls), 0); + init_exp(&v, VLOCAL, fs->freereg); + luaK_reserveregs(fs, 1); + adjustlocalvars(ls, 1); + body(ls, &b, 0, ls->linenumber); + luaK_storevar(fs, &v, &b); + /* debug information will only see the variable after this point! */ + getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ + int nvars = 0; + int nexps; + expdesc e; + do { + new_localvar(ls, str_checkname(ls), nvars++); + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist1(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {field} [`:' NAME] */ + int needself = 0; + singlevar(ls, v); + while (ls->t.token == '.') + field(ls, v); + if (ls->t.token == ':') { + needself = 1; + field(ls, v); + } + return needself; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int needself; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + needself = funcname(ls, &v); + body(ls, &b, needself, line); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + primaryexp(ls, &v.v); + if (v.v.k == VCALL) /* stat -> func */ + SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ + else { /* stat -> assignment */ + v.prev = NULL; + assignment(ls, &v, 1); + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN explist */ + FuncState *fs = ls->fs; + expdesc e; + int first, nret; /* registers with returned values */ + luaX_next(ls); /* skip RETURN */ + if (block_follow(ls->t.token) || ls->t.token == ';') + first = nret = 0; /* return no values */ + else { + nret = explist1(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1) { /* tail call? */ + SET_OPCODE(getcode(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); + } + first = fs->nactvar; + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); + else { + luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ + first = fs->nactvar; /* return all `active' values */ + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); +} + + +static int statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + switch (ls->t.token) { + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + return 0; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + return 0; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + return 0; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + return 0; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + return 0; + } + case TK_FUNCTION: { + funcstat(ls, line); /* stat -> funcstat */ + return 0; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + return 0; + } + case TK_RETURN: { /* stat -> retstat */ + retstat(ls); + return 1; /* must be last statement */ + } + case TK_BREAK: { /* stat -> breakstat */ + luaX_next(ls); /* skip BREAK */ + breakstat(ls); + return 1; /* must be last statement */ + } + default: { + exprstat(ls); + return 0; /* to avoid warnings */ + } + } +} + + +static void chunk (LexState *ls) { + /* chunk -> { stat [`;'] } */ + int islast = 0; + enterlevel(ls); + while (!islast && !block_follow(ls->t.token)) { + islast = statement(ls); + testnext(ls, ';'); + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= ls->fs->nactvar); + ls->fs->freereg = ls->fs->nactvar; /* free registers */ + } + leavelevel(ls); +} + +/* }====================================================================== */ diff --git a/lua-5.1.4/src/lparser.h b/lua-5.1.4/src/lparser.h new file mode 100644 index 000000000..18836afd1 --- /dev/null +++ b/lua-5.1.4/src/lparser.h @@ -0,0 +1,82 @@ +/* +** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression descriptor +*/ + +typedef enum { + VVOID, /* no value */ + VNIL, + VTRUE, + VFALSE, + VK, /* info = index of constant in `k' */ + VKNUM, /* nval = numerical value */ + VLOCAL, /* info = local register */ + VUPVAL, /* info = index of upvalue in `upvalues' */ + VGLOBAL, /* info = index of table; aux = index of global name in `k' */ + VINDEXED, /* info = table register; aux = index register (or `k') */ + VJMP, /* info = instruction pc */ + VRELOCABLE, /* info = instruction pc */ + VNONRELOC, /* info = result register */ + VCALL, /* info = instruction pc */ + VVARARG /* info = instruction pc */ +} expkind; + +typedef struct expdesc { + expkind k; + union { + struct { int info, aux; } s; + lua_Number nval; + } u; + int t; /* patch list of `exit when true' */ + int f; /* patch list of `exit when false' */ +} expdesc; + + +typedef struct upvaldesc { + lu_byte k; + lu_byte info; +} upvaldesc; + + +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + Table *h; /* table to find (and reuse) elements in `k' */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct lua_State *L; /* copy of the Lua state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to `ncode') */ + int lasttarget; /* `pc' of last `jump target' */ + int jpc; /* list of pending jumps to `pc' */ + int freereg; /* first free register */ + int nk; /* number of elements in `k' */ + int np; /* number of elements in `p' */ + short nlocvars; /* number of elements in `locvars' */ + lu_byte nactvar; /* number of active local variables */ + upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ + unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ +} FuncState; + + +LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + const char *name); + + +#endif diff --git a/lua-5.1.4/src/lstate.c b/lua-5.1.4/src/lstate.c new file mode 100644 index 000000000..4313b83a0 --- /dev/null +++ b/lua-5.1.4/src/lstate.c @@ -0,0 +1,214 @@ +/* +** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + + +#include <stddef.h> + +#define lstate_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define state_size(x) (sizeof(x) + LUAI_EXTRASPACE) +#define fromstate(l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE) +#define tostate(l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE)) + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + lua_State l; + global_State g; +} LG; + + + +static void stack_init (lua_State *L1, lua_State *L) { + /* initialize CallInfo array */ + L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo); + L1->ci = L1->base_ci; + L1->size_ci = BASIC_CI_SIZE; + L1->end_ci = L1->base_ci + L1->size_ci - 1; + /* initialize stack array */ + L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); + L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; + L1->top = L1->stack; + L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; + /* initialize first ci */ + L1->ci->func = L1->top; + setnilvalue(L1->top++); /* `function' entry for this `ci' */ + L1->base = L1->ci->base = L1->top; + L1->ci->top = L1->top + LUA_MINSTACK; +} + + +static void freestack (lua_State *L, lua_State *L1) { + luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo); + luaM_freearray(L, L1->stack, L1->stacksize, TValue); +} + + +/* +** open parts that may cause memory-allocation errors +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */ + sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */ + luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ + luaT_init(L); + luaX_init(L); + luaS_fix(luaS_newliteral(L, MEMERRMSG)); + g->GCthreshold = 4*g->totalbytes; +} + + +static void preinit_state (lua_State *L, global_State *g) { + G(L) = g; + L->stack = NULL; + L->stacksize = 0; + L->errorJmp = NULL; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->size_ci = 0; + L->nCcalls = L->baseCcalls = 0; + L->status = 0; + L->base_ci = L->ci = NULL; + L->savedpc = NULL; + L->errfunc = 0; + setnilvalue(gt(L)); +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_freeall(L); /* collect all objects */ + lua_assert(g->rootgc == obj2gco(L)); + lua_assert(g->strt.nuse == 0); + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *); + luaZ_freebuffer(L, &g->buff); + freestack(L, L); + lua_assert(g->totalbytes == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0); +} + + +lua_State *luaE_newthread (lua_State *L) { + lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); + luaC_link(L, obj2gco(L1), LUA_TTHREAD); + preinit_state(L1, G(L)); + stack_init(L1, L); /* init stack */ + setobj2n(L, gt(L1), gt(L)); /* share table of globals */ + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + lua_assert(iswhite(obj2gco(L1))); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + luaF_close(L1, L1->stack); /* close all upvalues for this thread */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L1); + freestack(L, L1); + luaM_freemem(L, fromstate(L1), state_size(lua_State)); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + void *l = (*f)(ud, NULL, 0, state_size(LG)); + if (l == NULL) return NULL; + L = tostate(l); + g = &((LG *)L)->g; + L->next = NULL; + L->tt = LUA_TTHREAD; + g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); + L->marked = luaC_white(g); + set2bits(L->marked, FIXEDBIT, SFIXEDBIT); + preinit_state(L, g); + g->frealloc = f; + g->ud = ud; + g->mainthread = L; + g->uvhead.u.l.prev = &g->uvhead; + g->uvhead.u.l.next = &g->uvhead; + g->GCthreshold = 0; /* mark it as unfinished state */ + g->strt.size = 0; + g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(registry(L)); + luaZ_initbuffer(L, &g->buff); + g->panic = NULL; + g->gcstate = GCSpause; + g->rootgc = obj2gco(L); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->tmudata = NULL; + g->totalbytes = sizeof(LG); + g->gcpause = LUAI_GCPAUSE; + g->gcstepmul = LUAI_GCMUL; + g->gcdept = 0; + for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + else + luai_userstateopen(L); + return L; +} + + +static void callallgcTM (lua_State *L, void *ud) { + UNUSED(ud); + luaC_callGCTM(L); /* call GC metamethods for all udata */ +} + + +LUA_API void lua_close (lua_State *L) { + L = G(L)->mainthread; /* only the main thread can be closed */ + lua_lock(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ + L->errfunc = 0; /* no error function during GC metamethods */ + do { /* repeat until no more errors */ + L->ci = L->base_ci; + L->base = L->top = L->ci->base; + L->nCcalls = L->baseCcalls = 0; + } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); + lua_assert(G(L)->tmudata == NULL); + luai_userstateclose(L); + close_state(L); +} + diff --git a/lua-5.1.4/src/lstate.h b/lua-5.1.4/src/lstate.h new file mode 100644 index 000000000..3bc575b6b --- /dev/null +++ b/lua-5.1.4/src/lstate.h @@ -0,0 +1,169 @@ +/* +** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* table of globals */ +#define gt(L) (&L->l_gt) + +/* registry */ +#define registry(L) (&G(L)->l_registry) + + +/* extra stack space to handle TM calls and some other extras */ +#define EXTRA_STACK 5 + + +#define BASIC_CI_SIZE 8 + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + + + +typedef struct stringtable { + GCObject **hash; + lu_int32 nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** informations about a call +*/ +typedef struct CallInfo { + StkId base; /* base for this function */ + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + const Instruction *savedpc; + int nresults; /* expected number of results from this function */ + int tailcalls; /* number of tail calls lost under this entry */ +} CallInfo; + + + +#define curr_func(L) (clvalue(L->ci->func)) +#define ci_func(ci) (clvalue((ci)->func)) +#define f_isLua(ci) (!ci_func(ci)->c.isC) +#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) + + +/* +** `global state', shared by all threads of this state +*/ +typedef struct global_State { + stringtable strt; /* hash table for strings */ + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to `frealloc' */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + int sweepstrgc; /* position of sweep in `strt' */ + GCObject *rootgc; /* list of all collectable objects */ + GCObject **sweepgc; /* position of sweep in `rootgc' */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of weak tables (to be cleared) */ + GCObject *tmudata; /* last element of list of userdata to be GC */ + Mbuffer buff; /* temporary buffer for string concatentation */ + lu_mem GCthreshold; + lu_mem totalbytes; /* number of bytes currently allocated */ + lu_mem estimate; /* an estimate of number of bytes actually in use */ + lu_mem gcdept; /* how much GC is `behind schedule' */ + int gcpause; /* size of pause between successive GCs */ + int gcstepmul; /* GC `granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + TValue l_registry; + struct lua_State *mainthread; + UpVal uvhead; /* head of double-linked list of all open upvalues */ + struct Table *mt[NUM_TAGS]; /* metatables for basic types */ + TString *tmname[TM_N]; /* array with tag-method names */ +} global_State; + + +/* +** `per thread' state +*/ +struct lua_State { + CommonHeader; + lu_byte status; + StkId top; /* first free slot in the stack */ + StkId base; /* base of current function */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *savedpc; /* `savedpc' of current function */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + CallInfo *end_ci; /* points after end of ci array*/ + CallInfo *base_ci; /* array of CallInfo's */ + int stacksize; + int size_ci; /* size of array `base_ci' */ + unsigned short nCcalls; /* number of nested C calls */ + unsigned short baseCcalls; /* nested C calls when resuming coroutine */ + lu_byte hookmask; + lu_byte allowhook; + int basehookcount; + int hookcount; + lua_Hook hook; + TValue l_gt; /* table of globals */ + TValue env; /* temporary place for environments */ + GCObject *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_longjmp *errorJmp; /* current error recover point */ + ptrdiff_t errfunc; /* current error handling function (stack index) */ +}; + + +#define G(L) (L->l_G) + + +/* +** Union of all collectable objects +*/ +union GCObject { + GCheader gch; + union TString ts; + union Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct UpVal uv; + struct lua_State th; /* thread */ +}; + + +/* macros to convert a GCObject into a specific value */ +#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) +#define gco2ts(o) (&rawgco2ts(o)->tsv) +#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) +#define gco2u(o) (&rawgco2u(o)->uv) +#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) +#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) +#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) +#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define ngcotouv(o) \ + check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) + +/* macro to convert any Lua object into a GCObject */ +#define obj2gco(v) (cast(GCObject *, (v))) + + +LUAI_FUNC lua_State *luaE_newthread (lua_State *L); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); + +#endif + diff --git a/lua-5.1.4/src/lstring.c b/lua-5.1.4/src/lstring.c new file mode 100644 index 000000000..49113151c --- /dev/null +++ b/lua-5.1.4/src/lstring.c @@ -0,0 +1,111 @@ +/* +** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + + +#include <string.h> + +#define lstring_c +#define LUA_CORE + +#include "lua.h" + +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + + +void luaS_resize (lua_State *L, int newsize) { + GCObject **newhash; + stringtable *tb; + int i; + if (G(L)->gcstate == GCSsweepstring) + return; /* cannot resize during GC traverse */ + newhash = luaM_newvector(L, newsize, GCObject *); + tb = &G(L)->strt; + for (i=0; i<newsize; i++) newhash[i] = NULL; + /* rehash */ + for (i=0; i<tb->size; i++) { + GCObject *p = tb->hash[i]; + while (p) { /* for each node in the list */ + GCObject *next = p->gch.next; /* save next */ + unsigned int h = gco2ts(p)->hash; + int h1 = lmod(h, newsize); /* new position */ + lua_assert(cast_int(h%newsize) == lmod(h, newsize)); + p->gch.next = newhash[h1]; /* chain it */ + newhash[h1] = p; + p = next; + } + } + luaM_freearray(L, tb->hash, tb->size, TString *); + tb->size = newsize; + tb->hash = newhash; +} + + +static TString *newlstr (lua_State *L, const char *str, size_t l, + unsigned int h) { + TString *ts; + stringtable *tb; + if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) + luaM_toobig(L); + ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); + ts->tsv.len = l; + ts->tsv.hash = h; + ts->tsv.marked = luaC_white(G(L)); + ts->tsv.tt = LUA_TSTRING; + ts->tsv.reserved = 0; + memcpy(ts+1, str, l*sizeof(char)); + ((char *)(ts+1))[l] = '\0'; /* ending 0 */ + tb = &G(L)->strt; + h = lmod(h, tb->size); + ts->tsv.next = tb->hash[h]; /* chain new entry */ + tb->hash[h] = obj2gco(ts); + tb->nuse++; + if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) + luaS_resize(L, tb->size*2); /* too crowded */ + return ts; +} + + +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + GCObject *o; + unsigned int h = cast(unsigned int, l); /* seed */ + size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ + size_t l1; + for (l1=l; l1>=step; l1-=step) /* compute hash */ + h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); + for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; + o != NULL; + o = o->gch.next) { + TString *ts = rawgco2ts(o); + if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { + /* string may be dead */ + if (isdead(G(L), o)) changewhite(o); + return ts; + } + } + return newlstr(L, str, l, h); /* not found */ +} + + +Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { + Udata *u; + if (s > MAX_SIZET - sizeof(Udata)) + luaM_toobig(L); + u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); + u->uv.marked = luaC_white(G(L)); /* is not finalized */ + u->uv.tt = LUA_TUSERDATA; + u->uv.len = s; + u->uv.metatable = NULL; + u->uv.env = e; + /* chain it on udata list (after main thread) */ + u->uv.next = G(L)->mainthread->next; + G(L)->mainthread->next = obj2gco(u); + return u; +} + diff --git a/lua-5.1.4/src/lstring.h b/lua-5.1.4/src/lstring.h new file mode 100644 index 000000000..73a2ff8b3 --- /dev/null +++ b/lua-5.1.4/src/lstring.h @@ -0,0 +1,31 @@ +/* +** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) + +#define sizeudata(u) (sizeof(union Udata)+(u)->len) + +#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + +#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) + +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); + + +#endif diff --git a/lua-5.1.4/src/lstrlib.c b/lua-5.1.4/src/lstrlib.c new file mode 100644 index 000000000..1b4763d4e --- /dev/null +++ b/lua-5.1.4/src/lstrlib.c @@ -0,0 +1,869 @@ +/* +** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + + +#include <ctype.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define lstrlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* macro to `unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, l); + return 1; +} + + +static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { + /* relative string position: negative means back from end */ + if (pos < 0) pos += (ptrdiff_t)len + 1; + return (pos >= 0) ? pos : 0; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l); + ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l); + if (start < 1) start = 1; + if (end > (ptrdiff_t)l) end = (ptrdiff_t)l; + if (start <= end) + lua_pushlstring(L, s+start-1, end-start+1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + while (l--) luaL_addchar(&b, s[l]); + luaL_pushresult(&b); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + for (i=0; i<l; i++) + luaL_addchar(&b, tolower(uchar(s[i]))); + luaL_pushresult(&b); + return 1; +} + + +static int str_upper (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + for (i=0; i<l; i++) + luaL_addchar(&b, toupper(uchar(s[i]))); + luaL_pushresult(&b); + return 1; +} + +static int str_rep (lua_State *L) { + size_t l; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + int n = luaL_checkint(L, 2); + luaL_buffinit(L, &b); + while (n-- > 0) + luaL_addlstring(&b, s, l); + luaL_pushresult(&b); + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l); + ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l); + int n, i; + if (posi <= 0) posi = 1; + if ((size_t)pose > l) pose = l; + if (posi > pose) return 0; /* empty interval; return no values */ + n = (int)(pose - posi + 1); + if (posi + n <= pose) /* overflow? */ + luaL_error(L, "string slice too long"); + luaL_checkstack(L, n, "string slice too long"); + for (i=0; i<n; i++) + lua_pushinteger(L, uchar(s[posi+i-1])); + return n; +} + + +static int str_char (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + luaL_Buffer b; + luaL_buffinit(L, &b); + for (i=1; i<=n; i++) { + int c = luaL_checkint(L, i); + luaL_argcheck(L, uchar(c) == c, i, "invalid value"); + luaL_addchar(&b, uchar(c)); + } + luaL_pushresult(&b); + return 1; +} + + +static int writer (lua_State *L, const void* b, size_t size, void* B) { + (void)L; + luaL_addlstring((luaL_Buffer*) B, (const char *)b, size); + return 0; +} + + +static int str_dump (lua_State *L) { + luaL_Buffer b; + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 1); + luaL_buffinit(L,&b); + if (lua_dump(L, writer, &b) != 0) + luaL_error(L, "unable to dump given function"); + luaL_pushresult(&b); + return 1; +} + + + +/* +** {====================================================== +** PATTERN MATCHING +** ======================================================= +*/ + + +#define CAP_UNFINISHED (-1) +#define CAP_POSITION (-2) + +typedef struct MatchState { + const char *src_init; /* init of source string */ + const char *src_end; /* end (`\0') of source string */ + lua_State *L; + int level; /* total number of captures (finished or unfinished) */ + struct { + const char *init; + ptrdiff_t len; + } capture[LUA_MAXCAPTURES]; +} MatchState; + + +#define L_ESC '%' +#define SPECIALS "^$*+?.([%-" + + +static int check_capture (MatchState *ms, int l) { + l -= '1'; + if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED) + return luaL_error(ms->L, "invalid capture index"); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a `]' */ + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); + if (*(p++) == L_ESC && *p != '\0') + p++; /* skip escapes (e.g. `%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the `^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (int c, const char *p, const char *ep) { + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } +} + + +static const char *match (MatchState *ms, const char *s, const char *p); + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (*p == 0 || *(p+1) == 0) + luaL_error(ms->L, "unbalanced pattern"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (s<ms->src_end && singlematch(uchar(*s), p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + init: /* using goto's to optimize tail recursion */ + switch (*p) { + case '(': { /* start capture */ + if (*(p+1) == ')') /* position capture? */ + return start_capture(ms, s, p+2, CAP_POSITION); + else + return start_capture(ms, s, p+1, CAP_UNFINISHED); + } + case ')': { /* end capture */ + return end_capture(ms, s, p+1); + } + case L_ESC: { + switch (*(p+1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p+2); + if (s == NULL) return NULL; + p+=4; goto init; /* else return match(ms, s, p+4); */ + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (*p != '[') + luaL_error(ms->L, "missing " LUA_QL("[") " after " + LUA_QL("%%f") " in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s-1); + if (matchbracketclass(uchar(previous), p, ep-1) || + !matchbracketclass(uchar(*s), p, ep-1)) return NULL; + p=ep; goto init; /* else return match(ms, s, ep); */ + } + default: { + if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p+1))); + if (s == NULL) return NULL; + p+=2; goto init; /* else return match(ms, s, p+2) */ + } + goto dflt; /* case default */ + } + } + } + case '\0': { /* end of pattern */ + return s; /* match succeeded */ + } + case '$': { + if (*(p+1) == '\0') /* is the `$' the last char in pattern? */ + return (s == ms->src_end) ? s : NULL; /* check end of string */ + else goto dflt; + } + default: dflt: { /* it is a pattern item */ + const char *ep = classend(ms, p); /* points to what is next */ + int m = s<ms->src_end && singlematch(uchar(*s), p, ep); + switch (*ep) { + case '?': { /* optional */ + const char *res; + if (m && ((res=match(ms, s+1, ep+1)) != NULL)) + return res; + p=ep+1; goto init; /* else return match(ms, s, ep+1); */ + } + case '*': { /* 0 or more repetitions */ + return max_expand(ms, s, p, ep); + } + case '+': { /* 1 or more repetitions */ + return (m ? max_expand(ms, s+1, p, ep) : NULL); + } + case '-': { /* 0 or more repetitions (minimum) */ + return min_expand(ms, s, p, ep); + } + default: { + if (!m) return NULL; + s++; p=ep; goto init; /* else return match(ms, s+1, ep); */ + } + } + } + } +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative `l1' */ + else { + const char *init; /* to search for a `*s2' inside `s1' */ + l2--; /* 1st char will be checked by `memchr' */ + l1 = l1-l2; /* `s2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct `l1' and `s1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + if (i >= ms->level) { + if (i == 0) /* ms->level == 0, too */ + lua_pushlstring(ms->L, s, e - s); /* add whole match */ + else + luaL_error(ms->L, "invalid capture index"); + } + else { + ptrdiff_t l = ms->capture[i].len; + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); + if (l == CAP_POSITION) + lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); + else + lua_pushlstring(ms->L, ms->capture[i].init, l); + } +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +static int str_find_aux (lua_State *L, int find) { + size_t l1, l2; + const char *s = luaL_checklstring(L, 1, &l1); + const char *p = luaL_checklstring(L, 2, &l2); + ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1; + if (init < 0) init = 0; + else if ((size_t)(init) > l1) init = (ptrdiff_t)l1; + if (find && (lua_toboolean(L, 4) || /* explicit request? */ + strpbrk(p, SPECIALS) == NULL)) { /* or no special characters? */ + /* do a plain search */ + const char *s2 = lmemfind(s+init, l1-init, p, l2); + if (s2) { + lua_pushinteger(L, s2-s+1); + lua_pushinteger(L, s2-s+l2); + return 2; + } + } + else { + MatchState ms; + int anchor = (*p == '^') ? (p++, 1) : 0; + const char *s1=s+init; + ms.L = L; + ms.src_init = s; + ms.src_end = s+l1; + do { + const char *res; + ms.level = 0; + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, s1-s+1); /* start */ + lua_pushinteger(L, res-s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + lua_pushnil(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +static int gmatch_aux (lua_State *L) { + MatchState ms; + size_t ls; + const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); + const char *p = lua_tostring(L, lua_upvalueindex(2)); + const char *src; + ms.L = L; + ms.src_init = s; + ms.src_end = s+ls; + for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); + src <= ms.src_end; + src++) { + const char *e; + ms.level = 0; + if ((e = match(&ms, src, p)) != NULL) { + lua_Integer newstart = e-s; + if (e == src) newstart++; /* empty match? go at least one position */ + lua_pushinteger(L, newstart); + lua_replace(L, lua_upvalueindex(3)); + return push_captures(&ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + luaL_checkstring(L, 1); + luaL_checkstring(L, 2); + lua_settop(L, 2); + lua_pushinteger(L, 0); + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static int gfind_nodef (lua_State *L) { + return luaL_error(L, LUA_QL("string.gfind") " was renamed to " + LUA_QL("string.gmatch")); +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l, i; + const char *news = lua_tolstring(ms->L, 3, &l); + for (i = 0; i < l; i++) { + if (news[i] != L_ESC) + luaL_addchar(b, news[i]); + else { + i++; /* skip ESC */ + if (!isdigit(uchar(news[i]))) + luaL_addchar(b, news[i]); + else if (news[i] == '0') + luaL_addlstring(b, s, e - s); + else { + push_onecapture(ms, news[i] - '1', s, e); + luaL_addvalue(b); /* add capture to accumulated result */ + } + } + } +} + + +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + lua_State *L = ms->L; + switch (lua_type(L, 3)) { + case LUA_TNUMBER: + case LUA_TSTRING: { + add_s(ms, b, s, e); + return; + } + case LUA_TFUNCTION: { + int n; + lua_pushvalue(L, 3); + n = push_captures(ms, s, e); + lua_call(L, n, 1); + break; + } + case LUA_TTABLE: { + push_onecapture(ms, 0, s, e); + lua_gettable(L, 3); + break; + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); + lua_pushlstring(L, s, e - s); /* keep original text */ + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_addvalue(b); /* add result to accumulator */ +} + + +static int str_gsub (lua_State *L) { + size_t srcl; + const char *src = luaL_checklstring(L, 1, &srcl); + const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); + int max_s = luaL_optint(L, 4, srcl+1); + int anchor = (*p == '^') ? (p++, 1) : 0; + int n = 0; + MatchState ms; + luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); + luaL_buffinit(L, &b); + ms.L = L; + ms.src_init = src; + ms.src_end = src+srcl; + while (n < max_s) { + const char *e; + ms.level = 0; + e = match(&ms, src, p); + if (e) { + n++; + add_value(&ms, &b, src, e); + } + if (e && e>src) /* non empty match? */ + src = e; /* skip it */ + else if (src < ms.src_end) + luaL_addchar(&b, *src++); + else break; + if (anchor) break; + } + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + +/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */ +#define MAX_ITEM 512 +/* valid flags in a format specification */ +#define FLAGS "-+ #0" +/* +** maximum size of each format specification (such as '%-099.99d') +** (+10 accounts for %99.99x plus margin of error) +*/ +#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) + + +static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + luaL_addchar(b, '"'); + while (l--) { + switch (*s) { + case '"': case '\\': case '\n': { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + break; + } + case '\r': { + luaL_addlstring(b, "\\r", 2); + break; + } + case '\0': { + luaL_addlstring(b, "\\000", 4); + break; + } + default: { + luaL_addchar(b, *s); + break; + } + } + s++; + } + luaL_addchar(b, '"'); +} + +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { + const char *p = strfrmt; + while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ + if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) + luaL_error(L, "invalid format (repeated flags)"); + if (isdigit(uchar(*p))) p++; /* skip width */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + if (*p == '.') { + p++; + if (isdigit(uchar(*p))) p++; /* skip precision */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + } + if (isdigit(uchar(*p))) + luaL_error(L, "invalid format (width or precision too long)"); + *(form++) = '%'; + strncpy(form, strfrmt, p - strfrmt + 1); + form += p - strfrmt + 1; + *form = '\0'; + return p; +} + + +static void addintlen (char *form) { + size_t l = strlen(form); + char spec = form[l - 1]; + strcpy(form + l - 1, LUA_INTFRMLEN); + form[l + sizeof(LUA_INTFRMLEN) - 2] = spec; + form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0'; +} + + +static int str_format (lua_State *L) { + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format (`%...') */ + char buff[MAX_ITEM]; /* to store the formatted item */ + arg++; + strfrmt = scanformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + sprintf(buff, form, (int)luaL_checknumber(L, arg)); + break; + } + case 'd': case 'i': { + addintlen(form); + sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'o': case 'u': case 'x': case 'X': { + addintlen(form); + sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'e': case 'E': case 'f': + case 'g': case 'G': { + sprintf(buff, form, (double)luaL_checknumber(L, arg)); + break; + } + case 'q': { + addquoted(L, &b, arg); + continue; /* skip the 'addsize' at the end */ + } + case 's': { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + if (!strchr(form, '.') && l >= 100) { + /* no precision and string is too long to be formatted; + keep original string */ + lua_pushvalue(L, arg); + luaL_addvalue(&b); + continue; /* skip the `addsize' at the end */ + } + else { + sprintf(buff, form, s); + break; + } + } + default: { /* also treat cases `pnLlh' */ + return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " + LUA_QL("format"), *(strfrmt - 1)); + } + } + luaL_addlstring(&b, buff, strlen(buff)); + } + } + luaL_pushresult(&b); + return 1; +} + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gfind", gfind_nodef}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + lua_createtable(L, 0, 1); /* create metatable for strings */ + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); + lua_setmetatable(L, -2); /* set string metatable */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* string library... */ + lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUALIB_API int luaopen_string (lua_State *L) { + luaL_register(L, LUA_STRLIBNAME, strlib); +#if defined(LUA_COMPAT_GFIND) + lua_getfield(L, -1, "gmatch"); + lua_setfield(L, -2, "gfind"); +#endif + createmetatable(L); + return 1; +} + diff --git a/lua-5.1.4/src/ltable.c b/lua-5.1.4/src/ltable.c new file mode 100644 index 000000000..ec84f4fab --- /dev/null +++ b/lua-5.1.4/src/ltable.c @@ -0,0 +1,588 @@ +/* +** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest `n' such that at +** least half the slots between 0 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the `original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include <math.h> +#include <string.h> + +#define ltable_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "ltable.h" + + +/* +** max size of array part is 2^MAXBITS +*/ +#if LUAI_BITSINT > 26 +#define MAXBITS 26 +#else +#define MAXBITS (LUAI_BITSINT-2) +#endif + +#define MAXASIZE (1 << MAXBITS) + + +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +#define hashstr(t,str) hashpow2(t, (str)->tsv.hash) +#define hashboolean(t,p) hashpow2(t, p) + + +/* +** for some types, it is better to avoid modulus by power of 2, as +** they tend to have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashpointer(t,p) hashmod(t, IntPoint(p)) + + +/* +** number of ints inside a lua_Number +*/ +#define numints cast_int(sizeof(lua_Number)/sizeof(int)) + + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {{NULL}, LUA_TNIL}, /* value */ + {{{NULL}, LUA_TNIL, NULL}} /* key */ +}; + + +/* +** hash for lua_Numbers +*/ +static Node *hashnum (const Table *t, lua_Number n) { + unsigned int a[numints]; + int i; + if (luai_numeq(n, 0)) /* avoid problems with -0 */ + return gnode(t, 0); + memcpy(a, &n, sizeof(a)); + for (i = 1; i < numints; i++) a[0] += a[i]; + return hashmod(t, a[0]); +} + + + +/* +** returns the `main' position of an element in a table (that is, the index +** of its hash value) +*/ +static Node *mainposition (const Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNUMBER: + return hashnum(t, nvalue(key)); + case LUA_TSTRING: + return hashstr(t, rawtsvalue(key)); + case LUA_TBOOLEAN: + return hashboolean(t, bvalue(key)); + case LUA_TLIGHTUSERDATA: + return hashpointer(t, pvalue(key)); + default: + return hashpointer(t, gcvalue(key)); + } +} + + +/* +** returns the index for `key' if `key' is an appropriate key to live in +** the array part of the table, -1 otherwise. +*/ +static int arrayindex (const TValue *key) { + if (ttisnumber(key)) { + lua_Number n = nvalue(key); + int k; + lua_number2int(k, n); + if (luai_numeq(cast_num(k), n)) + return k; + } + return -1; /* `key' did not match some condition */ +} + + +/* +** returns the index of a `key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signalled by -1. +*/ +static int findindex (lua_State *L, Table *t, StkId key) { + int i; + if (ttisnil(key)) return -1; /* first iteration */ + i = arrayindex(key); + if (0 < i && i <= t->sizearray) /* is `key' inside array part? */ + return i-1; /* yes; that's the index (corrected to C) */ + else { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + /* key may be dead already, but it is ok to use it in `next' */ + if (luaO_rawequalObj(key2tval(n), key) || + (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && + gcvalue(gkey(n)) == gcvalue(key))) { + i = cast_int(n - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return i + t->sizearray; + } + else n = gnext(n); + } while (n); + luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ + return 0; /* to avoid warnings */ + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + int i = findindex(L, t, key); /* find original element */ + for (i++; i < t->sizearray; i++) { /* try first array part */ + if (!ttisnil(&t->array[i])) { /* a non-nil value? */ + setnvalue(key, cast_num(i+1)); + setobj2s(L, key+1, &t->array[i]); + return 1; + } + } + for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ + if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ + setobj2s(L, key, key2tval(gnode(t, i))); + setobj2s(L, key+1, gval(gnode(t, i))); + return 1; + } + } + return 0; /* no more elements */ +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + + +static int computesizes (int nums[], int *narray) { + int i; + int twotoi; /* 2^i */ + int a = 0; /* number of elements smaller than 2^i */ + int na = 0; /* number of elements to go to array part */ + int n = 0; /* optimal size for array part */ + for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) { + if (nums[i] > 0) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + n = twotoi; /* optimal size (till now) */ + na = a; /* all elements smaller than n will go to array part */ + } + } + if (a == *narray) break; /* all elements already counted */ + } + *narray = n; + lua_assert(*narray/2 <= na && na <= *narray); + return na; +} + + +static int countint (const TValue *key, int *nums) { + int k = arrayindex(key); + if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ + nums[ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +static int numusearray (const Table *t, int *nums) { + int lg; + int ttlg; /* 2^lg */ + int ause = 0; /* summation of `nums' */ + int i = 1; /* count to traverse all array keys */ + for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */ + int lc = 0; /* counter */ + int lim = ttlg; + if (lim > t->sizearray) { + lim = t->sizearray; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg-1), 2^lg] */ + for (; i <= lim; i++) { + if (!ttisnil(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, int *nums, int *pnasize) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* summation of `nums' */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!ttisnil(gval(n))) { + ause += countint(key2tval(n), nums); + totaluse++; + } + } + *pnasize += ause; + return totaluse; +} + + +static void setarrayvector (lua_State *L, Table *t, int size) { + int i; + luaM_reallocvector(L, t->array, t->sizearray, size, TValue); + for (i=t->sizearray; i<size; i++) + setnilvalue(&t->array[i]); + t->sizearray = size; +} + + +static void setnodevector (lua_State *L, Table *t, int size) { + int lsize; + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common `dummynode' */ + lsize = 0; + } + else { + int i; + lsize = ceillog2(size); + if (lsize > MAXBITS) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i=0; i<size; i++) { + Node *n = gnode(t, i); + gnext(n) = NULL; + setnilvalue(gkey(n)); + setnilvalue(gval(n)); + } + } + t->lsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ +} + + +static void resize (lua_State *L, Table *t, int nasize, int nhsize) { + int i; + int oldasize = t->sizearray; + int oldhsize = t->lsizenode; + Node *nold = t->node; /* save old hash ... */ + if (nasize > oldasize) /* array part must grow? */ + setarrayvector(L, t, nasize); + /* create new hash part with appropriate size */ + setnodevector(L, t, nhsize); + if (nasize < oldasize) { /* array part must shrink? */ + t->sizearray = nasize; + /* re-insert elements from vanishing slice */ + for (i=nasize; i<oldasize; i++) { + if (!ttisnil(&t->array[i])) + setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]); + } + /* shrink array */ + luaM_reallocvector(L, t->array, oldasize, nasize, TValue); + } + /* re-insert elements from hash part */ + for (i = twoto(oldhsize) - 1; i >= 0; i--) { + Node *old = nold+i; + if (!ttisnil(gval(old))) + setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old)); + } + if (nold != dummynode) + luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ +} + + +void luaH_resizearray (lua_State *L, Table *t, int nasize) { + int nsize = (t->node == dummynode) ? 0 : sizenode(t); + resize(L, t, nasize, nsize); +} + + +static void rehash (lua_State *L, Table *t, const TValue *ek) { + int nasize, na; + int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */ + int i; + int totaluse; + for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */ + nasize = numusearray(t, nums); /* count keys in array part */ + totaluse = nasize; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */ + /* count extra key */ + nasize += countint(ek, nums); + totaluse++; + /* compute new size for array part */ + na = computesizes(nums, &nasize); + /* resize the table to new computed sizes */ + resize(L, t, nasize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L, int narray, int nhash) { + Table *t = luaM_new(L, Table); + luaC_link(L, obj2gco(t), LUA_TTABLE); + t->metatable = NULL; + t->flags = cast_byte(~0); + /* temporary values (kept only if some malloc fails) */ + t->array = NULL; + t->sizearray = 0; + t->lsizenode = 0; + t->node = cast(Node *, dummynode); + setarrayvector(L, t, narray); + setnodevector(L, t, nhash); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + if (t->node != dummynode) + luaM_freearray(L, t->node, sizenode(t), Node); + luaM_freearray(L, t->array, t->sizearray, TValue); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + while (t->lastfree-- > t->node) { + if (ttisnil(gkey(t->lastfree))) + return t->lastfree; + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +static TValue *newkey (lua_State *L, Table *t, const TValue *key) { + Node *mp = mainposition(t, key); + if (!ttisnil(gval(mp)) || mp == dummynode) { + Node *othern; + Node *n = getfreepos(t); /* get a free place */ + if (n == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + return luaH_set(L, t, key); /* re-insert key into grown table */ + } + lua_assert(n != dummynode); + othern = mainposition(t, key2tval(mp)); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ + gnext(othern) = n; /* redo the chain with `n' in place of `mp' */ + *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + gnext(mp) = NULL; /* now `mp' is free */ + setnilvalue(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + gnext(n) = gnext(mp); /* chain new position */ + gnext(mp) = n; + mp = n; + } + } + gkey(mp)->value = key->value; gkey(mp)->tt = key->tt; + luaC_barriert(L, t, key); + lua_assert(ttisnil(gval(mp))); + return gval(mp); +} + + +/* +** search function for integers +*/ +const TValue *luaH_getnum (Table *t, int key) { + /* (1 <= key && key <= t->sizearray) */ + if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) + return &t->array[key-1]; + else { + lua_Number nk = cast_num(key); + Node *n = hashnum(t, nk); + do { /* check whether `key' is somewhere in the chain */ + if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } +} + + +/* +** search function for strings +*/ +const TValue *luaH_getstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNIL: return luaO_nilobject; + case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); + case LUA_TNUMBER: { + int k; + lua_Number n = nvalue(key); + lua_number2int(k, n); + if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ + return luaH_getnum(t, k); /* use specialized version */ + /* else go through */ + } + default: { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (luaO_rawequalObj(key2tval(n), key)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } + } +} + + +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { + const TValue *p = luaH_get(t, key); + t->flags = 0; + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + if (ttisnil(key)) luaG_runerror(L, "table index is nil"); + else if (ttisnumber(key) && luai_numisnan(nvalue(key))) + luaG_runerror(L, "table index is NaN"); + return newkey(L, t, key); + } +} + + +TValue *luaH_setnum (lua_State *L, Table *t, int key) { + const TValue *p = luaH_getnum(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setnvalue(&k, cast_num(key)); + return newkey(L, t, &k); + } +} + + +TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { + const TValue *p = luaH_getstr(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setsvalue(L, &k, key); + return newkey(L, t, &k); + } +} + + +static int unbound_search (Table *t, unsigned int j) { + unsigned int i = j; /* i is zero or a present index */ + j++; + /* find `i' and `j' such that i is present and j is not */ + while (!ttisnil(luaH_getnum(t, j))) { + i = j; + j *= 2; + if (j > cast(unsigned int, MAX_INT)) { /* overflow? */ + /* table was built with bad purposes: resort to linear search */ + i = 1; + while (!ttisnil(luaH_getnum(t, i))) i++; + return i - 1; + } + } + /* now do a binary search between them */ + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(luaH_getnum(t, m))) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table `t'. A `boundary' is an integer index +** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). +*/ +int luaH_getn (Table *t) { + unsigned int j = t->sizearray; + if (j > 0 && ttisnil(&t->array[j - 1])) { + /* there is a boundary in the array part: (binary) search for it */ + unsigned int i = 0; + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(&t->array[m - 1])) j = m; + else i = m; + } + return i; + } + /* else must find a boundary in hash part */ + else if (t->node == dummynode) /* hash part is empty? */ + return j; /* that is easy... */ + else return unbound_search(t, j); +} + + + +#if defined(LUA_DEBUG) + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainposition(t, key); +} + +int luaH_isdummy (Node *n) { return n == dummynode; } + +#endif diff --git a/lua-5.1.4/src/ltable.h b/lua-5.1.4/src/ltable.h new file mode 100644 index 000000000..f5b9d5ead --- /dev/null +++ b/lua-5.1.4/src/ltable.h @@ -0,0 +1,40 @@ +/* +** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gkey(n) (&(n)->i_key.nk) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) + +#define key2tval(n) (&(n)->i_key.tvk) + + +LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); +LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC int luaH_getn (Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC int luaH_isdummy (Node *n); +#endif + + +#endif diff --git a/lua-5.1.4/src/ltablib.c b/lua-5.1.4/src/ltablib.c new file mode 100644 index 000000000..b6d9cb4ac --- /dev/null +++ b/lua-5.1.4/src/ltablib.c @@ -0,0 +1,287 @@ +/* +** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $ +** Library for Table Manipulation +** See Copyright Notice in lua.h +*/ + + +#include <stddef.h> + +#define ltablib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) + + +static int foreachi (lua_State *L) { + int i; + int n = aux_getn(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + for (i=1; i <= n; i++) { + lua_pushvalue(L, 2); /* function */ + lua_pushinteger(L, i); /* 1st argument */ + lua_rawgeti(L, 1, i); /* 2nd argument */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 1); /* remove nil result */ + } + return 0; +} + + +static int foreach (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pushvalue(L, 2); /* function */ + lua_pushvalue(L, -3); /* key */ + lua_pushvalue(L, -3); /* value */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 2); /* remove value and result */ + } + return 0; +} + + +static int maxn (lua_State *L) { + lua_Number max = 0; + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ + if (lua_type(L, -1) == LUA_TNUMBER) { + lua_Number v = lua_tonumber(L, -1); + if (v > max) max = v; + } + } + lua_pushnumber(L, max); + return 1; +} + + +static int getn (lua_State *L) { + lua_pushinteger(L, aux_getn(L, 1)); + return 1; +} + + +static int setn (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); +#ifndef luaL_setn + luaL_setn(L, 1, luaL_checkint(L, 2)); +#else + luaL_error(L, LUA_QL("setn") " is obsolete"); +#endif + lua_pushvalue(L, 1); + return 1; +} + + +static int tinsert (lua_State *L) { + int e = aux_getn(L, 1) + 1; /* first empty element */ + int pos; /* where to insert new element */ + switch (lua_gettop(L)) { + case 2: { /* called with only 2 arguments */ + pos = e; /* insert new element at the end */ + break; + } + case 3: { + int i; + pos = luaL_checkint(L, 2); /* 2nd argument is the position */ + if (pos > e) e = pos; /* `grow' array if necessary */ + for (i = e; i > pos; i--) { /* move up elements */ + lua_rawgeti(L, 1, i-1); + lua_rawseti(L, 1, i); /* t[i] = t[i-1] */ + } + break; + } + default: { + return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); + } + } + luaL_setn(L, 1, e); /* new size */ + lua_rawseti(L, 1, pos); /* t[pos] = v */ + return 0; +} + + +static int tremove (lua_State *L) { + int e = aux_getn(L, 1); + int pos = luaL_optint(L, 2, e); + if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ + return 0; /* nothing to remove */ + luaL_setn(L, 1, e - 1); /* t.n = n-1 */ + lua_rawgeti(L, 1, pos); /* result = t[pos] */ + for ( ;pos<e; pos++) { + lua_rawgeti(L, 1, pos+1); + lua_rawseti(L, 1, pos); /* t[pos] = t[pos+1] */ + } + lua_pushnil(L); + lua_rawseti(L, 1, e); /* t[e] = nil */ + return 1; +} + + +static void addfield (lua_State *L, luaL_Buffer *b, int i) { + lua_rawgeti(L, 1, i); + if (!lua_isstring(L, -1)) + luaL_error(L, "invalid value (%s) at index %d in table for " + LUA_QL("concat"), luaL_typename(L, -1), i); + luaL_addvalue(b); +} + + +static int tconcat (lua_State *L) { + luaL_Buffer b; + size_t lsep; + int i, last; + const char *sep = luaL_optlstring(L, 2, "", &lsep); + luaL_checktype(L, 1, LUA_TTABLE); + i = luaL_optint(L, 3, 1); + last = luaL_opt(L, luaL_checkint, 4, luaL_getn(L, 1)); + luaL_buffinit(L, &b); + for (; i < last; i++) { + addfield(L, &b, i); + luaL_addlstring(&b, sep, lsep); + } + if (i == last) /* add last value (if interval was not empty) */ + addfield(L, &b, i); + luaL_pushresult(&b); + return 1; +} + + + +/* +** {====================================================== +** Quicksort +** (based on `Algorithms in MODULA-3', Robert Sedgewick; +** Addison-Wesley, 1993.) +*/ + + +static void set2 (lua_State *L, int i, int j) { + lua_rawseti(L, 1, i); + lua_rawseti(L, 1, j); +} + +static int sort_comp (lua_State *L, int a, int b) { + if (!lua_isnil(L, 2)) { /* function? */ + int res; + lua_pushvalue(L, 2); + lua_pushvalue(L, a-1); /* -1 to compensate function */ + lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */ + lua_call(L, 2, 1); + res = lua_toboolean(L, -1); + lua_pop(L, 1); + return res; + } + else /* a < b? */ + return lua_lessthan(L, a, b); +} + +static void auxsort (lua_State *L, int l, int u) { + while (l < u) { /* for tail recursion */ + int i, j; + /* sort elements a[l], a[(l+u)/2] and a[u] */ + lua_rawgeti(L, 1, l); + lua_rawgeti(L, 1, u); + if (sort_comp(L, -1, -2)) /* a[u] < a[l]? */ + set2(L, l, u); /* swap a[l] - a[u] */ + else + lua_pop(L, 2); + if (u-l == 1) break; /* only 2 elements */ + i = (l+u)/2; + lua_rawgeti(L, 1, i); + lua_rawgeti(L, 1, l); + if (sort_comp(L, -2, -1)) /* a[i]<a[l]? */ + set2(L, i, l); + else { + lua_pop(L, 1); /* remove a[l] */ + lua_rawgeti(L, 1, u); + if (sort_comp(L, -1, -2)) /* a[u]<a[i]? */ + set2(L, i, u); + else + lua_pop(L, 2); + } + if (u-l == 2) break; /* only 3 elements */ + lua_rawgeti(L, 1, i); /* Pivot */ + lua_pushvalue(L, -1); + lua_rawgeti(L, 1, u-1); + set2(L, i, u-1); + /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */ + i = l; j = u-1; + for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */ + /* repeat ++i until a[i] >= P */ + while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (i>u) luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[i] */ + } + /* repeat --j until a[j] <= P */ + while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { + if (j<l) luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[j] */ + } + if (j<i) { + lua_pop(L, 3); /* pop pivot, a[i], a[j] */ + break; + } + set2(L, i, j); + } + lua_rawgeti(L, 1, u-1); + lua_rawgeti(L, 1, i); + set2(L, u-1, i); /* swap pivot (a[u-1]) with a[i] */ + /* a[l..i-1] <= a[i] == P <= a[i+1..u] */ + /* adjust so that smaller half is in [j..i] and larger one in [l..u] */ + if (i-l < u-i) { + j=l; i=i-1; l=i+2; + } + else { + j=i+1; i=u; u=j-2; + } + auxsort(L, j, i); /* call recursively the smaller one */ + } /* repeat the routine for the larger one */ +} + +static int sort (lua_State *L) { + int n = aux_getn(L, 1); + luaL_checkstack(L, 40, ""); /* assume array is smaller than 2^40 */ + if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */ + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_settop(L, 2); /* make sure there is two arguments */ + auxsort(L, 1, n); + return 0; +} + +/* }====================================================== */ + + +static const luaL_Reg tab_funcs[] = { + {"concat", tconcat}, + {"foreach", foreach}, + {"foreachi", foreachi}, + {"getn", getn}, + {"maxn", maxn}, + {"insert", tinsert}, + {"remove", tremove}, + {"setn", setn}, + {"sort", sort}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_table (lua_State *L) { + luaL_register(L, LUA_TABLIBNAME, tab_funcs); + return 1; +} + diff --git a/lua-5.1.4/src/ltm.c b/lua-5.1.4/src/ltm.c new file mode 100644 index 000000000..c27f0f6fa --- /dev/null +++ b/lua-5.1.4/src/ltm.c @@ -0,0 +1,75 @@ +/* +** $Id: ltm.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + + +#include <string.h> + +#define ltm_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + + +const char *const luaT_typenames[] = { + "nil", "boolean", "userdata", "number", + "string", "table", "function", "userdata", "thread", + "proto", "upval" +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__eq", + "__add", "__sub", "__mul", "__div", "__mod", + "__pow", "__unm", "__len", "__lt", "__le", + "__concat", "__call" + }; + int i; + for (i=0; i<TM_N; i++) { + G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]); + luaS_fix(G(L)->tmname[i]); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getstr(events, ename); + lua_assert(event <= TM_EQ); + if (ttisnil(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<<event); /* cache this fact */ + return NULL; + } + else return tm; +} + + +const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { + Table *mt; + switch (ttype(o)) { + case LUA_TTABLE: + mt = hvalue(o)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttype(o)]; + } + return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); +} + diff --git a/lua-5.1.4/src/ltm.h b/lua-5.1.4/src/ltm.h new file mode 100644 index 000000000..64343b781 --- /dev/null +++ b/lua-5.1.4/src/ltm.h @@ -0,0 +1,54 @@ +/* +** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_EQ, /* last tag method with `fast' access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_DIV, + TM_MOD, + TM_POW, + TM_UNM, + TM_LEN, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ +} TMS; + + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +LUAI_DATA const char *const luaT_typenames[]; + + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +#endif diff --git a/lua-5.1.4/src/lua.c b/lua-5.1.4/src/lua.c new file mode 100644 index 000000000..3a4660932 --- /dev/null +++ b/lua-5.1.4/src/lua.c @@ -0,0 +1,392 @@ +/* +** $Id: lua.c,v 1.160.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua stand-alone interpreter +** See Copyright Notice in lua.h +*/ + + +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define lua_c + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static lua_State *globalL = NULL; + +static const char *progname = LUA_PROGNAME; + + + +static void lstop (lua_State *L, lua_Debug *ar) { + (void)ar; /* unused arg. */ + lua_sethook(L, NULL, 0, 0); + luaL_error(L, "interrupted!"); +} + + +static void laction (int i) { + signal(i, SIG_DFL); /* if another SIGINT happens before lstop, + terminate process (default action) */ + lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); +} + + +static void print_usage (void) { + fprintf(stderr, + "usage: %s [options] [script [args]].\n" + "Available options are:\n" + " -e stat execute string " LUA_QL("stat") "\n" + " -l name require library " LUA_QL("name") "\n" + " -i enter interactive mode after executing " LUA_QL("script") "\n" + " -v show version information\n" + " -- stop handling options\n" + " - execute stdin and stop handling options\n" + , + progname); + fflush(stderr); +} + + +static void l_message (const char *pname, const char *msg) { + if (pname) fprintf(stderr, "%s: ", pname); + fprintf(stderr, "%s\n", msg); + fflush(stderr); +} + + +static int report (lua_State *L, int status) { + if (status && !lua_isnil(L, -1)) { + const char *msg = lua_tostring(L, -1); + if (msg == NULL) msg = "(error object is not a string)"; + l_message(progname, msg); + lua_pop(L, 1); + } + return status; +} + + +static int traceback (lua_State *L) { + if (!lua_isstring(L, 1)) /* 'message' not a string? */ + return 1; /* keep it intact */ + lua_getfield(L, LUA_GLOBALSINDEX, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ + return 1; +} + + +static int docall (lua_State *L, int narg, int clear) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, traceback); /* push traceback function */ + lua_insert(L, base); /* put it under chunk and args */ + signal(SIGINT, laction); + status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); + signal(SIGINT, SIG_DFL); + lua_remove(L, base); /* remove traceback function */ + /* force a complete garbage collection in case of errors */ + if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); + return status; +} + + +static void print_version (void) { + l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); +} + + +static int getargs (lua_State *L, char **argv, int n) { + int narg; + int i; + int argc = 0; + while (argv[argc]) argc++; /* count total number of arguments */ + narg = argc - (n + 1); /* number of arguments to the script */ + luaL_checkstack(L, narg + 3, "too many arguments to script"); + for (i=n+1; i < argc; i++) + lua_pushstring(L, argv[i]); + lua_createtable(L, narg, n + 1); + for (i=0; i < argc; i++) { + lua_pushstring(L, argv[i]); + lua_rawseti(L, -2, i - n); + } + return narg; +} + + +static int dofile (lua_State *L, const char *name) { + int status = luaL_loadfile(L, name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dostring (lua_State *L, const char *s, const char *name) { + int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dolibrary (lua_State *L, const char *name) { + lua_getglobal(L, "require"); + lua_pushstring(L, name); + return report(L, docall(L, 1, 1)); +} + + +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + lua_pop(L, 1); /* remove global */ + return p; +} + + +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + const char *tp = msg + lmsg - (sizeof(LUA_QL("<eof>")) - 1); + if (strstr(msg, LUA_QL("<eof>")) == tp) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} + + +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + if (lua_readline(L, b, prmt) == 0) + return 0; /* no input */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[l-1] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* first line starts with `=' ? */ + lua_pushfstring(L, "return %s", b+1); /* change it to `return' */ + else + lua_pushstring(L, b); + lua_freeline(L, b); + return 1; +} + + +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + for (;;) { /* repeat until gets a complete line */ + status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); + if (!incomplete(L, status)) break; /* cannot try to add lines? */ + if (!pushline(L, 0)) /* no more input? */ + return -1; + lua_pushliteral(L, "\n"); /* add a new line... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } + lua_saveline(L, 1); + lua_remove(L, 1); /* remove line */ + return status; +} + + +static void dotty (lua_State *L) { + int status; + const char *oldprogname = progname; + progname = NULL; + while ((status = loadline(L)) != -1) { + if (status == 0) status = docall(L, 0, 0); + report(L, status); + if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) + l_message(progname, lua_pushfstring(L, + "error calling " LUA_QL("print") " (%s)", + lua_tostring(L, -1))); + } + } + lua_settop(L, 0); /* clear stack */ + fputs("\n", stdout); + fflush(stdout); + progname = oldprogname; +} + + +static int handle_script (lua_State *L, char **argv, int n) { + int status; + const char *fname; + int narg = getargs(L, argv, n); /* collect arguments */ + lua_setglobal(L, "arg"); + fname = argv[n]; + if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) + fname = NULL; /* stdin */ + status = luaL_loadfile(L, fname); + lua_insert(L, -(narg+1)); + if (status == 0) + status = docall(L, narg, 0); + else + lua_pop(L, narg); + return report(L, status); +} + + +/* check that argument has no extra characters at the end */ +#define notail(x) {if ((x)[2] != '\0') return -1;} + + +static int collectargs (char **argv, int *pi, int *pv, int *pe) { + int i; + for (i = 1; argv[i] != NULL; i++) { + if (argv[i][0] != '-') /* not an option? */ + return i; + switch (argv[i][1]) { /* option */ + case '-': + notail(argv[i]); + return (argv[i+1] != NULL ? i+1 : 0); + case '\0': + return i; + case 'i': + notail(argv[i]); + *pi = 1; /* go through */ + case 'v': + notail(argv[i]); + *pv = 1; + break; + case 'e': + *pe = 1; /* go through */ + case 'l': + if (argv[i][2] == '\0') { + i++; + if (argv[i] == NULL) return -1; + } + break; + default: return -1; /* invalid option */ + } + } + return 0; +} + + +static int runargs (lua_State *L, char **argv, int n) { + int i; + for (i = 1; i < n; i++) { + if (argv[i] == NULL) continue; + lua_assert(argv[i][0] == '-'); + switch (argv[i][1]) { /* option */ + case 'e': { + const char *chunk = argv[i] + 2; + if (*chunk == '\0') chunk = argv[++i]; + lua_assert(chunk != NULL); + if (dostring(L, chunk, "=(command line)") != 0) + return 1; + break; + } + case 'l': { + const char *filename = argv[i] + 2; + if (*filename == '\0') filename = argv[++i]; + lua_assert(filename != NULL); + if (dolibrary(L, filename)) + return 1; /* stop if file fails */ + break; + } + default: break; + } + } + return 0; +} + + +static int handle_luainit (lua_State *L) { + const char *init = getenv(LUA_INIT); + if (init == NULL) return 0; /* status OK */ + else if (init[0] == '@') + return dofile(L, init+1); + else + return dostring(L, init, "=" LUA_INIT); +} + + +struct Smain { + int argc; + char **argv; + int status; +}; + + +static int pmain (lua_State *L) { + struct Smain *s = (struct Smain *)lua_touserdata(L, 1); + char **argv = s->argv; + int script; + int has_i = 0, has_v = 0, has_e = 0; + globalL = L; + if (argv[0] && argv[0][0]) progname = argv[0]; + lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ + luaL_openlibs(L); /* open libraries */ + lua_gc(L, LUA_GCRESTART, 0); + s->status = handle_luainit(L); + if (s->status != 0) return 0; + script = collectargs(argv, &has_i, &has_v, &has_e); + if (script < 0) { /* invalid args? */ + print_usage(); + s->status = 1; + return 0; + } + if (has_v) print_version(); + s->status = runargs(L, argv, (script > 0) ? script : s->argc); + if (s->status != 0) return 0; + if (script) + s->status = handle_script(L, argv, script); + if (s->status != 0) return 0; + if (has_i) + dotty(L); + else if (script == 0 && !has_e && !has_v) { + if (lua_stdin_is_tty()) { + print_version(); + dotty(L); + } + else dofile(L, NULL); /* executes stdin as a file */ + } + return 0; +} + + +int main (int argc, char **argv) { + int status; + struct Smain s; + lua_State *L = lua_open(); /* create state */ + if (L == NULL) { + l_message(argv[0], "cannot create state: not enough memory"); + return EXIT_FAILURE; + } + s.argc = argc; + s.argv = argv; + status = lua_cpcall(L, &pmain, &s); + report(L, status); + lua_close(L); + return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; +} + diff --git a/lua-5.1.4/src/lua.h b/lua-5.1.4/src/lua.h new file mode 100644 index 000000000..1f8513667 --- /dev/null +++ b/lua-5.1.4/src/lua.h @@ -0,0 +1,390 @@ +/* +** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $ +** Lua - An Extensible Extension Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include <stdarg.h> +#include <stddef.h> + +#ifndef _WIN32 +#define LUA_USE_POSIX +#endif +#include "luaconf.h" + + +#define LUA_VERSION "Lua 5.1" +#define LUA_RELEASE "Lua 5.1.4" +#define LUA_VERSION_NUM 501 +#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" + + +/* mark for precompiled code (`<esc>Lua') */ +#define LUA_SIGNATURE "\033Lua" + +/* option for multiple returns in `lua_pcall' and `lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** pseudo-indices +*/ +#define LUA_REGISTRYINDEX (-10000) +#define LUA_ENVIRONINDEX (-10001) +#define LUA_GLOBALSINDEX (-10002) +#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) + + +/* thread status; 0 is OK */ +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRERR 5 + + +typedef struct lua_State lua_State; + +typedef int (*lua_CFunction) (lua_State *L); + + +/* +** functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); + + +/* +** prototype for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_remove) (lua_State *L, int idx); +LUA_API void (lua_insert) (lua_State *L, int idx); +LUA_API void (lua_replace) (lua_State *L, int idx); +LUA_API int (lua_checkstack) (lua_State *L, int sz); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); + +LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); +LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_objlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); +LUA_API void (lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API void (lua_gettable) (lua_State *L, int idx); +LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawget) (lua_State *L, int idx); +LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API void (lua_getfenv) (lua_State *L, int idx); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API int (lua_setfenv) (lua_State *L, int idx); + + +/* +** `load' and `call' functions (load and run Lua code) +*/ +LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); +LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yield) (lua_State *L, int nresults); +LUA_API int (lua_resume) (lua_State *L, int narg); +LUA_API int (lua_status) (lua_State *L); + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 + +LUA_API int (lua_gc) (lua_State *L, int what, int data); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_strlen(L,i) lua_objlen(L, (i)) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) \ + lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) + +#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) +#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + + +/* +** compatibility macros and functions +*/ + +#define lua_open() luaL_newstate() + +#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) + +#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) + +#define lua_Chunkreader lua_Reader +#define lua_Chunkwriter lua_Writer + + +/* hack */ +LUA_API void lua_setlevel (lua_State *from, lua_State *to); + + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILRET 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + +typedef struct lua_Debug lua_Debug; /* activation record */ + + +/* Functions to be called by the debuger in specific events */ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); + +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook lua_gethook (lua_State *L); +LUA_API int lua_gethookmask (lua_State *L); +LUA_API int lua_gethookcount (lua_State *L); + + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) `global', `local', `field', `method' */ + const char *what; /* (S) `Lua', `C', `main', `tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int nups; /* (u) number of upvalues */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + int i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************/ + + +#endif diff --git a/lua-5.1.4/src/luac.c b/lua-5.1.4/src/luac.c new file mode 100644 index 000000000..487715433 --- /dev/null +++ b/lua-5.1.4/src/luac.c @@ -0,0 +1,202 @@ +/* +** $Id: luac.c,v 1.54 2006/06/02 17:37:11 lhf Exp $ +** Lua compiler (saves bytecodes to files; also list bytecodes) +** See Copyright Notice in lua.h +*/ + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define luac_c +#define LUA_CORE + +#include "lua.h" +#include "lauxlib.h" + +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstring.h" +#include "lundump.h" + +#define PROGNAME "luac" /* default program name */ +#define OUTPUT PROGNAME ".out" /* default output file */ + +static int listing=0; /* list bytecodes? */ +static int dumping=1; /* dump bytecodes? */ +static int stripping=0; /* strip debug information? */ +static char Output[]={ OUTPUT }; /* default output file name */ +static const char* output=Output; /* actual output file name */ +static const char* progname=PROGNAME; /* actual program name */ + +static void fatal(const char* message) +{ + fprintf(stderr,"%s: %s\n",progname,message); + exit(EXIT_FAILURE); +} + +static void cannot(const char* what) +{ + fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); + exit(EXIT_FAILURE); +} + +static void usage(const char* message) +{ + if (*message=='-') + fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); + else + fprintf(stderr,"%s: %s\n",progname,message); + fprintf(stderr, + "usage: %s [options] [filenames].\n" + "Available options are:\n" + " - process stdin\n" + " -l list\n" + " -o name output to file " LUA_QL("name") " (default is \"%s\")\n" + " -p parse only\n" + " -s strip debug information\n" + " -v show version information\n" + " -- stop handling options\n", + progname,Output); + exit(EXIT_FAILURE); +} + +#define IS(s) (strcmp(argv[i],s)==0) + +static int doargs(int argc, char* argv[]) +{ + int i; + int version=0; + if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; + for (i=1; i<argc; i++) + { + if (*argv[i]!='-') /* end of options; keep it */ + break; + else if (IS("--")) /* end of options; skip it */ + { + ++i; + if (version) ++version; + break; + } + else if (IS("-")) /* end of options; use stdin */ + break; + else if (IS("-l")) /* list */ + ++listing; + else if (IS("-o")) /* output file */ + { + output=argv[++i]; + if (output==NULL || *output==0) usage(LUA_QL("-o") " needs argument"); + if (IS("-")) output=NULL; + } + else if (IS("-p")) /* parse only */ + dumping=0; + else if (IS("-s")) /* strip debug information */ + stripping=1; + else if (IS("-v")) /* show version */ + ++version; + else /* unknown option */ + usage(argv[i]); + } + if (i==argc && (listing || !dumping)) + { + dumping=0; + argv[--i]=Output; + } + if (version) + { + printf("%s %s\n",LUA_RELEASE,LUA_COPYRIGHT); + if (version==argc-1) exit(EXIT_SUCCESS); + } + return i; +} + +#define toproto(L,i) (clvalue(L->top+(i))->l.p) + +static const Proto* combine(lua_State* L, int n) +{ + if (n==1) + return toproto(L,-1); + else + { + int i,pc; + Proto* f=luaF_newproto(L); + setptvalue2s(L,L->top,f); incr_top(L); + f->source=luaS_newliteral(L,"=(" PROGNAME ")"); + f->maxstacksize=1; + pc=2*n+1; + f->code=luaM_newvector(L,pc,Instruction); + f->sizecode=pc; + f->p=luaM_newvector(L,n,Proto*); + f->sizep=n; + pc=0; + for (i=0; i<n; i++) + { + f->p[i]=toproto(L,i-n-1); + f->code[pc++]=CREATE_ABx(OP_CLOSURE,0,i); + f->code[pc++]=CREATE_ABC(OP_CALL,0,1,1); + } + f->code[pc++]=CREATE_ABC(OP_RETURN,0,1,0); + return f; + } +} + +static int writer(lua_State* L, const void* p, size_t size, void* u) +{ + UNUSED(L); + return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); +} + +struct Smain { + int argc; + char** argv; +}; + +static int pmain(lua_State* L) +{ + struct Smain* s = (struct Smain*)lua_touserdata(L, 1); + int argc=s->argc; + char** argv=s->argv; + const Proto* f; + int i; + if (!lua_checkstack(L,argc)) fatal("too many input files"); + for (i=0; i<argc; i++) + { + const char* filename=IS("-") ? NULL : argv[i]; + if (luaL_loadfile(L,filename)!=0) fatal(lua_tostring(L,-1)); + } + f=combine(L,argc); + if (listing) luaU_print(f,listing>1); + if (dumping) + { + FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); + if (D==NULL) cannot("open"); + lua_lock(L); + luaU_dump(L,f,writer,D,stripping); + lua_unlock(L); + if (ferror(D)) cannot("write"); + if (fclose(D)) cannot("close"); + } + return 0; +} + +/* +int main(int argc, char* argv[]) +{ + lua_State* L; + struct Smain s; + int i=doargs(argc,argv); + argc-=i; argv+=i; + if (argc<=0) usage("no input files given"); + L=lua_open(); + if (L==NULL) fatal("not enough memory for state"); + s.argc=argc; + s.argv=argv; + if (lua_cpcall(L,pmain,&s)!=0) fatal(lua_tostring(L,-1)); + lua_close(L); + return EXIT_SUCCESS; +} +*/ diff --git a/lua-5.1.4/src/luaconf.h b/lua-5.1.4/src/luaconf.h new file mode 100644 index 000000000..e2cb26163 --- /dev/null +++ b/lua-5.1.4/src/luaconf.h @@ -0,0 +1,763 @@ +/* +** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef lconfig_h +#define lconfig_h + +#include <limits.h> +#include <stddef.h> + + +/* +** ================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +@@ LUA_ANSI controls the use of non-ansi features. +** CHANGE it (define it) if you want Lua to avoid the use of any +** non-ansi feature or library. +*/ +#if defined(__STRICT_ANSI__) +#define LUA_ANSI +#endif + + +#if !defined(LUA_ANSI) && defined(_WIN32) +#define LUA_WIN +#endif + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_DL_DYLD /* does not need extra library */ +#endif + + + +/* +@@ LUA_USE_POSIX includes all functionallity listed as X/Open System +@* Interfaces Extension (XSI). +** CHANGE it (define it) if your system is XSI compatible. +*/ +#if defined(LUA_USE_POSIX) +#define LUA_USE_MKSTEMP +#define LUA_USE_ISATTY +#define LUA_USE_POPEN +#define LUA_USE_ULONGJMP +#endif + + +/* +@@ LUA_PATH and LUA_CPATH are the names of the environment variables that +@* Lua check to set its paths. +@@ LUA_INIT is the name of the environment variable that Lua +@* checks for initialization code. +** CHANGE them if you want different names. +*/ +#define LUA_PATH "LUA_PATH" +#define LUA_CPATH "LUA_CPATH" +#define LUA_INIT "LUA_INIT" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +@* Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +@* C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#if defined(_WIN32) +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_PATH_DEFAULT \ + ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" +#define LUA_CPATH_DEFAULT \ + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + +#else +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/5.1/" +#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" +#define LUA_PATH_DEFAULT \ + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" +#define LUA_CPATH_DEFAULT \ + "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" +#endif + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + + +/* +@@ LUA_PATHSEP is the character that separates templates in a path. +@@ LUA_PATH_MARK is the string that marks the substitution points in a +@* template. +@@ LUA_EXECDIR in a Windows path is replaced by the executable's +@* directory. +@@ LUA_IGMARK is a mark to ignore all before it when bulding the +@* luaopen_ function name. +** CHANGE them if for some reason your system cannot use those +** characters. (E.g., if one of those characters is a common character +** in file/directory names.) Probably you do not need to change them. +*/ +#define LUA_PATHSEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXECDIR "!" +#define LUA_IGMARK "-" + + +/* +@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. +** CHANGE that if ptrdiff_t is not adequate on your machine. (On most +** machines, ptrdiff_t gives a good choice between int or long.) +*/ +#define LUA_INTEGER ptrdiff_t + + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all standard library functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) + +#if defined(LUA_CORE) || defined(LUA_LIB) +#define LUA_API __declspec(dllexport) +#else +#define LUA_API __declspec(dllimport) +#endif + +#else + +#define LUA_API extern + +#endif + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +@* exported to outside modules. +@@ LUAI_DATA is a mark for all extern (const) variables that are not to +@* be exported to outside modules. +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. +*/ +#if defined(luaall_c) +#define LUAI_FUNC static +#define LUAI_DATA /* empty */ + +#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#define LUAI_DATA LUAI_FUNC + +#else +#define LUAI_FUNC extern +#define LUAI_DATA extern +#endif + + + +/* +@@ LUA_QL describes how error messages quote program elements. +** CHANGE it if you want a different appearance. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@* of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +** {================================================================== +** Stand-alone configuration +** =================================================================== +*/ + +#if defined(lua_c) || defined(luaall_c) + +/* +@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that +@* is, whether we're running lua interactively). +** CHANGE it if you have a better definition for non-POSIX/non-Windows +** systems. +*/ +#if defined(LUA_USE_ISATTY) +#include <unistd.h> +#define lua_stdin_is_tty() isatty(0) +#elif defined(LUA_WIN) +#include <io.h> +#include <stdio.h> +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) +#else +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ +#endif + + +/* +@@ LUA_PROMPT is the default prompt used by stand-alone Lua. +@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. +** CHANGE them if you want different prompts. (You can also change the +** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) +*/ +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " + + +/* +@@ LUA_PROGNAME is the default name for the stand-alone Lua program. +** CHANGE it if your stand-alone interpreter has a different name and +** your system is not able to detect that name automatically. +*/ +#define LUA_PROGNAME "lua" + + +/* +@@ LUA_MAXINPUT is the maximum length for an input line in the +@* stand-alone interpreter. +** CHANGE it if you need longer lines. +*/ +#define LUA_MAXINPUT 512 + + +/* +@@ lua_readline defines how to show a prompt and then read a line from +@* the standard input. +@@ lua_saveline defines how to "save" a read line in a "history". +@@ lua_freeline defines how to free a line read by lua_readline. +** CHANGE them if you want to improve this functionality (e.g., by using +** GNU readline and history facilities). +*/ +#if defined(LUA_USE_READLINE) +#include <stdio.h> +#include <readline/readline.h> +#include <readline/history.h> +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,idx) \ + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ + add_history(lua_tostring(L, idx)); /* add it to history */ +#define lua_freeline(L,b) ((void)L, free(b)) +#else +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,idx) { (void)L; (void)idx; } +#define lua_freeline(L,b) { (void)L; (void)b; } +#endif + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles +@* as a percentage. +** CHANGE it if you want the GC to run faster or slower (higher values +** mean larger pauses which mean slower collection.) You can also change +** this value dynamically. +*/ +#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ + + +/* +@@ LUAI_GCMUL defines the default speed of garbage collection relative to +@* memory allocation as a percentage. +** CHANGE it if you want to change the granularity of the garbage +** collection. (Higher values mean coarser collections. 0 represents +** infinity, where each step performs a full collection.) You can also +** change this value dynamically. +*/ +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ + + + +/* +@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. +** CHANGE it (define it) if you want exact compatibility with the +** behavior of setn/getn in Lua 5.0. +*/ +#undef LUA_COMPAT_GETN + +/* +@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. +** CHANGE it to undefined as soon as you do not need a global 'loadlib' +** function (the function is still available as 'package.loadlib'). +*/ +#undef LUA_COMPAT_LOADLIB + +/* +@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. +** CHANGE it to undefined as soon as your programs use only '...' to +** access vararg parameters (instead of the old 'arg' table). +*/ +#define LUA_COMPAT_VARARG + +/* +@@ LUA_COMPAT_MOD controls compatibility with old math.mod function. +** CHANGE it to undefined as soon as your programs use 'math.fmod' or +** the new '%' operator instead of 'math.mod'. +*/ +#define LUA_COMPAT_MOD + +/* +@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting +@* facility. +** CHANGE it to 2 if you want the old behaviour, or undefine it to turn +** off the advisory error when nesting [[...]]. +*/ +#define LUA_COMPAT_LSTR 1 + +/* +@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. +** CHANGE it to undefined as soon as you rename 'string.gfind' to +** 'string.gmatch'. +*/ +#define LUA_COMPAT_GFIND + +/* +@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' +@* behavior. +** CHANGE it to undefined as soon as you replace to 'luaL_register' +** your uses of 'luaL_openlib' +*/ +#define LUA_COMPAT_OPENLIB + + + +/* +@@ luai_apicheck is the assert macro used by the Lua-C API. +** CHANGE luai_apicheck if you want Lua to perform some checks in the +** parameters it gets from API calls. This may slow down the interpreter +** a bit, but may be quite useful when debugging C code that interfaces +** with Lua. A useful redefinition is to use assert.h. +*/ +#if defined(LUA_USE_APICHECK) +#include <assert.h> +#define luai_apicheck(L,o) { (void)L; assert(o); } +#else +#define luai_apicheck(L,o) { (void)L; } +#endif + + +/* +@@ LUAI_BITSINT defines the number of bits in an int. +** CHANGE here if Lua cannot automatically detect the number of bits of +** your machine. Probably you do not need to change this. +*/ +/* avoid overflows in comparison */ +#if INT_MAX-20 < 32760 +#define LUAI_BITSINT 16 +#elif INT_MAX > 2147483640L +/* int has at least 32 bits */ +#define LUAI_BITSINT 32 +#else +#error "you must define LUA_BITSINT with number of bits in an integer" +#endif + + +/* +@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. +@@ LUAI_INT32 is an signed integer with at least 32 bits. +@@ LUAI_UMEM is an unsigned integer big enough to count the total +@* memory used by Lua. +@@ LUAI_MEM is a signed integer big enough to count the total memory +@* used by Lua. +** CHANGE here if for some weird reason the default definitions are not +** good enough for your machine. (The definitions in the 'else' +** part always works, but may waste space on machines with 64-bit +** longs.) Probably you do not need to change this. +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_UINT32 unsigned int +#define LUAI_INT32 int +#define LUAI_MAXINT32 INT_MAX +#define LUAI_UMEM size_t +#define LUAI_MEM ptrdiff_t +#else +/* 16-bit ints */ +#define LUAI_UINT32 unsigned long +#define LUAI_INT32 long +#define LUAI_MAXINT32 LONG_MAX +#define LUAI_UMEM unsigned long +#define LUAI_MEM long +#endif + + +/* +@@ LUAI_MAXCALLS limits the number of nested calls. +** CHANGE it if you need really deep recursive calls. This limit is +** arbitrary; its only purpose is to stop infinite recursion before +** exhausting memory. +*/ +#define LUAI_MAXCALLS 20000 + + +/* +@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function +@* can use. +** CHANGE it if you need lots of (Lua) stack space for your C +** functions. This limit is arbitrary; its only purpose is to stop C +** functions to consume unlimited stack space. (must be smaller than +** -LUA_REGISTRYINDEX) +*/ +#define LUAI_MAXCSTACK 8000 + + + +/* +** {================================================================== +** CHANGE (to smaller values) the following definitions if your system +** has a small C stack. (Or you may want to change them to larger +** values if your system has a large C stack and these limits are +** too rigid for you.) Some of these constants control the size of +** stack-allocated arrays used by the compiler or the interpreter, while +** others limit the maximum number of recursive calls that the compiler +** or the interpreter can perform. Values too large may cause a C stack +** overflow for some forms of deep constructs. +** =================================================================== +*/ + + +/* +@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and +@* syntactical nested non-terminals in a program. +*/ +#define LUAI_MAXCCALLS 200 + + +/* +@@ LUAI_MAXVARS is the maximum number of local variables per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXVARS 200 + + +/* +@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXUPVALUES 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +*/ +#define LUAL_BUFFERSIZE BUFSIZ + +/* }================================================================== */ + + + + +/* +** {================================================================== +@@ LUA_NUMBER is the type of numbers in Lua. +** CHANGE the following definitions only if you want to build Lua +** with a number type different from double. You may also need to +** change lua_number2int & lua_number2integer. +** =================================================================== +*/ + +#define LUA_NUMBER_DOUBLE +#define LUA_NUMBER double + +/* +@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' +@* over a number. +*/ +#define LUAI_UACNUMBER double + + +/* +@@ LUA_NUMBER_SCAN is the format for reading numbers. +@@ LUA_NUMBER_FMT is the format for writing numbers. +@@ lua_number2str converts a number to a string. +@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. +@@ lua_str2number converts a string to a number. +*/ +#define LUA_NUMBER_SCAN "%lf" +#define LUA_NUMBER_FMT "%.14g" +#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) +#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define lua_str2number(s,p) strtod((s), (p)) + + +/* +@@ The luai_num* macros define the primitive operations over numbers. +*/ +#if defined(LUA_CORE) +#include <math.h> +#define luai_numadd(a,b) ((a)+(b)) +#define luai_numsub(a,b) ((a)-(b)) +#define luai_nummul(a,b) ((a)*(b)) +#define luai_numdiv(a,b) ((a)/(b)) +#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) +#define luai_numpow(a,b) (pow(a,b)) +#define luai_numunm(a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + +/* +@@ lua_number2int is a macro to convert lua_Number to int. +@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. +** CHANGE them if you know a faster way to convert a lua_Number to +** int (with any rounding method and without throwing errors) in your +** system. In Pentium machines, a naive typecast from double to int +** in C is extremely slow, so any alternative is worth trying. +*/ + +/* On a Pentium, resort to a trick */ +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ + (defined(__i386) || defined (_M_IX86) || defined(__i386__)) + +/* On a Microsoft compiler, use assembler */ +#if defined(_MSC_VER) + +#define lua_number2int(i,d) __asm fld d __asm fistp i +#define lua_number2integer(i,n) lua_number2int(i, n) + +/* the next trick should work on any Pentium, but sometimes clashes + with a DirectX idiosyncrasy */ +#else + +union luai_Cast { double l_d; long l_l; }; +#define lua_number2int(i,d) \ + { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } +#define lua_number2integer(i,n) lua_number2int(i, n) + +#endif + + +/* this option always works, but may be slow */ +#else +#define lua_number2int(i,d) ((i)=(int)(d)) +#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. +** CHANGE it if your system requires alignments larger than double. (For +** instance, if your system supports long doubles and they must be +** aligned in 16-byte boundaries, then you should add long double in the +** union.) Probably you do not need to change this. +*/ +#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } + + +/* +@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. +** CHANGE them if you prefer to use longjmp/setjmp even with C++ +** or if want/don't to use _longjmp/_setjmp instead of regular +** longjmp/setjmp. By default, Lua handles errors with exceptions when +** compiling as C++ code, with _longjmp/_setjmp when asked to use them, +** and with longjmp/setjmp otherwise. +*/ +#if defined(__cplusplus) +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) try { a } catch(...) \ + { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_ULONGJMP) +/* in Unix, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else +/* default handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif + + +/* +@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern +@* can do during pattern-matching. +** CHANGE it if you need more captures. This limit is arbitrary. +*/ +#define LUA_MAXCAPTURES 32 + + +/* +@@ lua_tmpnam is the function that the OS library uses to create a +@* temporary name. +@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. +** CHANGE them if you have an alternative to tmpnam (which is considered +** insecure) or if you want the original tmpnam anyway. By default, Lua +** uses tmpnam except when POSIX is available, where it uses mkstemp. +*/ +#if defined(loslib_c) || defined(luaall_c) + +#if defined(LUA_USE_MKSTEMP) +#include <unistd.h> +#define LUA_TMPNAMBUFSIZE 32 +#define lua_tmpnam(b,e) { \ + strcpy(b, "/tmp/lua_XXXXXX"); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } + +#else +#define LUA_TMPNAMBUFSIZE L_tmpnam +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } +#endif + +#endif + + +/* +@@ lua_popen spawns a new process connected to the current one through +@* the file streams. +** CHANGE it if you have a way to implement it in your system. +*/ +#if defined(LUA_USE_POPEN) + +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) +#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) + +#elif defined(LUA_WIN) + +#define lua_popen(L,c,m) ((void)L, _popen(c,m)) +#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) + +#else + +#define lua_popen(L,c,m) ((void)((void)c, m), \ + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) +#define lua_pclose(L,file) ((void)((void)L, file), 0) + +#endif + +/* +@@ LUA_DL_* define which dynamic-library system Lua should use. +** CHANGE here if Lua has problems choosing the appropriate +** dynamic-library system for your platform (either Windows' DLL, Mac's +** dyld, or Unix's dlopen). If your system is some kind of Unix, there +** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for +** it. To use dlopen you also need to adapt the src/Makefile (probably +** adding -ldl to the linker options), so Lua does not select it +** automatically. (When you change the makefile to add -ldl, you must +** also add -DLUA_USE_DLOPEN.) +** If you do not want any kind of dynamic library, undefine all these +** options. +** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. +*/ +#if defined(LUA_USE_DLOPEN) +#define LUA_DL_DLOPEN +#endif + +#if defined(LUA_WIN) +#define LUA_DL_DLL +#endif + + +/* +@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State +@* (the data goes just *before* the lua_State pointer). +** CHANGE (define) this if you really need that. This value must be +** a multiple of the maximum alignment required for your machine. +*/ +#define LUAI_EXTRASPACE 0 + + +/* +@@ luai_userstate* allow user-specific actions on threads. +** CHANGE them if you defined LUAI_EXTRASPACE and need to do something +** extra when a thread is created/deleted/resumed/yielded. +*/ +#define luai_userstateopen(L) ((void)L) +#define luai_userstateclose(L) ((void)L) +#define luai_userstatethread(L,L1) ((void)L) +#define luai_userstatefree(L) ((void)L) +#define luai_userstateresume(L,n) ((void)L) +#define luai_userstateyield(L,n) ((void)L) + + +/* +@@ LUA_INTFRMLEN is the length modifier for integer conversions +@* in 'string.format'. +@@ LUA_INTFRM_T is the integer type correspoding to the previous length +@* modifier. +** CHANGE them if your system supports long long or does not support long. +*/ + +#if defined(LUA_USELONGLONG) + +#define LUA_INTFRMLEN "ll" +#define LUA_INTFRM_T long long + +#else + +#define LUA_INTFRMLEN "l" +#define LUA_INTFRM_T long + +#endif + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + +#endif + diff --git a/lua-5.1.4/src/lualib.h b/lua-5.1.4/src/lualib.h new file mode 100644 index 000000000..469417f67 --- /dev/null +++ b/lua-5.1.4/src/lualib.h @@ -0,0 +1,53 @@ +/* +** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* Key to file-handle type */ +#define LUA_FILEHANDLE "FILE*" + + +#define LUA_COLIBNAME "coroutine" +LUALIB_API int (luaopen_base) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUALIB_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUALIB_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUALIB_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUALIB_API int (luaopen_string) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUALIB_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUALIB_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUALIB_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + + +#ifndef lua_assert +#define lua_assert(x) ((void)0) +#endif + + +#endif diff --git a/lua-5.1.4/src/lundump.c b/lua-5.1.4/src/lundump.c new file mode 100644 index 000000000..8010a4579 --- /dev/null +++ b/lua-5.1.4/src/lundump.c @@ -0,0 +1,227 @@ +/* +** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include <string.h> + +#define lundump_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + +typedef struct { + lua_State* L; + ZIO* Z; + Mbuffer* b; + const char* name; +} LoadState; + +#ifdef LUAC_TRUST_BINARIES +#define IF(c,s) +#define error(S,s) +#else +#define IF(c,s) if (c) error(S,s) + +static void error(LoadState* S, const char* why) +{ + luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why); + luaD_throw(S->L,LUA_ERRSYNTAX); +} +#endif + +#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) +#define LoadByte(S) (lu_byte)LoadChar(S) +#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) +#define LoadVector(S,b,n,size) LoadMem(S,b,n,size) + +static void LoadBlock(LoadState* S, void* b, size_t size) +{ + size_t r=luaZ_read(S->Z,b,size); + IF (r!=0, "unexpected end"); +} + +static int LoadChar(LoadState* S) +{ + char x; + LoadVar(S,x); + return x; +} + +static int LoadInt(LoadState* S) +{ + int x; + LoadVar(S,x); + IF (x<0, "bad integer"); + return x; +} + +static lua_Number LoadNumber(LoadState* S) +{ + lua_Number x; + LoadVar(S,x); + return x; +} + +static TString* LoadString(LoadState* S) +{ + size_t size; + LoadVar(S,size); + if (size==0) + return NULL; + else + { + char* s=luaZ_openspace(S->L,S->b,size); + LoadBlock(S,s,size); + return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ + } +} + +static void LoadCode(LoadState* S, Proto* f) +{ + int n=LoadInt(S); + f->code=luaM_newvector(S->L,n,Instruction); + f->sizecode=n; + LoadVector(S,f->code,n,sizeof(Instruction)); +} + +static Proto* LoadFunction(LoadState* S, TString* p); + +static void LoadConstants(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->k=luaM_newvector(S->L,n,TValue); + f->sizek=n; + for (i=0; i<n; i++) setnilvalue(&f->k[i]); + for (i=0; i<n; i++) + { + TValue* o=&f->k[i]; + int t=LoadChar(S); + switch (t) + { + case LUA_TNIL: + setnilvalue(o); + break; + case LUA_TBOOLEAN: + setbvalue(o,LoadChar(S)!=0); + break; + case LUA_TNUMBER: + setnvalue(o,LoadNumber(S)); + break; + case LUA_TSTRING: + setsvalue2n(S->L,o,LoadString(S)); + break; + default: + error(S,"bad constant"); + break; + } + } + n=LoadInt(S); + f->p=luaM_newvector(S->L,n,Proto*); + f->sizep=n; + for (i=0; i<n; i++) f->p[i]=NULL; + for (i=0; i<n; i++) f->p[i]=LoadFunction(S,f->source); +} + +static void LoadDebug(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->lineinfo=luaM_newvector(S->L,n,int); + f->sizelineinfo=n; + LoadVector(S,f->lineinfo,n,sizeof(int)); + n=LoadInt(S); + f->locvars=luaM_newvector(S->L,n,LocVar); + f->sizelocvars=n; + for (i=0; i<n; i++) f->locvars[i].varname=NULL; + for (i=0; i<n; i++) + { + f->locvars[i].varname=LoadString(S); + f->locvars[i].startpc=LoadInt(S); + f->locvars[i].endpc=LoadInt(S); + } + n=LoadInt(S); + f->upvalues=luaM_newvector(S->L,n,TString*); + f->sizeupvalues=n; + for (i=0; i<n; i++) f->upvalues[i]=NULL; + for (i=0; i<n; i++) f->upvalues[i]=LoadString(S); +} + +static Proto* LoadFunction(LoadState* S, TString* p) +{ + Proto* f; + if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep"); + f=luaF_newproto(S->L); + setptvalue2s(S->L,S->L->top,f); incr_top(S->L); + f->source=LoadString(S); if (f->source==NULL) f->source=p; + f->linedefined=LoadInt(S); + f->lastlinedefined=LoadInt(S); + f->nups=LoadByte(S); + f->numparams=LoadByte(S); + f->is_vararg=LoadByte(S); + f->maxstacksize=LoadByte(S); + LoadCode(S,f); + LoadConstants(S,f); + LoadDebug(S,f); + IF (!luaG_checkcode(f), "bad code"); + S->L->top--; + S->L->nCcalls--; + return f; +} + +static void LoadHeader(LoadState* S) +{ + char h[LUAC_HEADERSIZE]; + char s[LUAC_HEADERSIZE]; + luaU_header(h); + LoadBlock(S,s,LUAC_HEADERSIZE); + IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header"); +} + +/* +** load precompiled chunk +*/ +Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) +{ + LoadState S; + if (*name=='@' || *name=='=') + S.name=name+1; + else if (*name==LUA_SIGNATURE[0]) + S.name="binary string"; + else + S.name=name; + S.L=L; + S.Z=Z; + S.b=buff; + LoadHeader(&S); + return LoadFunction(&S,luaS_newliteral(L,"=?")); +} + +/* +* make header +*/ +void luaU_header (char* h) +{ + int x=1; + memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); + h+=sizeof(LUA_SIGNATURE)-1; + *h++=(char)LUAC_VERSION; + *h++=(char)LUAC_FORMAT; + *h++=(char)*(char*)&x; /* endianness */ + *h++=(char)sizeof(int); + *h++=(char)sizeof(size_t); + *h++=(char)sizeof(Instruction); + *h++=(char)sizeof(lua_Number); + *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */ +} diff --git a/lua-5.1.4/src/lundump.h b/lua-5.1.4/src/lundump.h new file mode 100644 index 000000000..c80189dbf --- /dev/null +++ b/lua-5.1.4/src/lundump.h @@ -0,0 +1,36 @@ +/* +** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#ifndef lundump_h +#define lundump_h + +#include "lobject.h" +#include "lzio.h" + +/* load one chunk; from lundump.c */ +LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); + +/* make header; from lundump.c */ +LUAI_FUNC void luaU_header (char* h); + +/* dump one chunk; from ldump.c */ +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); + +#ifdef luac_c +/* print one chunk; from print.c */ +LUAI_FUNC void luaU_print (const Proto* f, int full); +#endif + +/* for header of binary files -- this is Lua 5.1 */ +#define LUAC_VERSION 0x51 + +/* for header of binary files -- this is the official format */ +#define LUAC_FORMAT 0 + +/* size of header of binary files */ +#define LUAC_HEADERSIZE 12 + +#endif diff --git a/lua-5.1.4/src/lvm.c b/lua-5.1.4/src/lvm.c new file mode 100644 index 000000000..ee3256ab9 --- /dev/null +++ b/lua-5.1.4/src/lvm.c @@ -0,0 +1,763 @@ +/* +** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define lvm_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +/* limit for table tag-method chains (to avoid loops) */ +#define MAXTAGLOOP 100 + + +const TValue *luaV_tonumber (const TValue *obj, TValue *n) { + lua_Number num; + if (ttisnumber(obj)) return obj; + if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) { + setnvalue(n, num); + return n; + } + else + return NULL; +} + + +int luaV_tostring (lua_State *L, StkId obj) { + if (!ttisnumber(obj)) + return 0; + else { + char s[LUAI_MAXNUMBER2STR]; + lua_Number n = nvalue(obj); + lua_number2str(s, n); + setsvalue2s(L, obj, luaS_new(L, s)); + return 1; + } +} + + +static void traceexec (lua_State *L, const Instruction *pc) { + lu_byte mask = L->hookmask; + const Instruction *oldpc = L->savedpc; + L->savedpc = pc; + if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { + resethookcount(L); + luaD_callhook(L, LUA_HOOKCOUNT, -1); + } + if (mask & LUA_MASKLINE) { + Proto *p = ci_func(L->ci)->l.p; + int npc = pcRel(pc, p); + int newline = getline(p, npc); + /* call linehook when enter a new function, when jump back (loop), + or when enter a new line */ + if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p))) + luaD_callhook(L, LUA_HOOKLINE, newline); + } +} + + +static void callTMres (lua_State *L, StkId res, const TValue *f, + const TValue *p1, const TValue *p2) { + ptrdiff_t result = savestack(L, res); + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + luaD_checkstack(L, 3); + L->top += 3; + luaD_call(L, L->top - 3, 1); + res = restorestack(L, result); + L->top--; + setobjs2s(L, res, L->top); +} + + + +static void callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, const TValue *p3) { + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + setobj2s(L, L->top+3, p3); /* 3th argument */ + luaD_checkstack(L, 4); + L->top += 4; + luaD_call(L, L->top - 4, 0); +} + + +void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + const TValue *res = luaH_get(h, key); /* do a primitive get */ + if (!ttisnil(res) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ + setobj2s(L, val, res); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTMres(L, val, tm, t, key); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in gettable"); +} + + +void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + TValue *oldval = luaH_set(L, h, key); /* do a primitive set */ + if (!ttisnil(oldval) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ + setobj2t(L, oldval, val); + luaC_barriert(L, h, val); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTM(L, tm, t, key, val); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in settable"); +} + + +static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (ttisnil(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (ttisnil(tm)) return 0; + callTMres(L, res, tm, p1, p2); + return 1; +} + + +static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2, + TMS event) { + const TValue *tm1 = fasttm(L, mt1, event); + const TValue *tm2; + if (tm1 == NULL) return NULL; /* no metamethod */ + if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ + tm2 = fasttm(L, mt2, event); + if (tm2 == NULL) return NULL; /* no metamethod */ + if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */ + return tm1; + return NULL; +} + + +static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, + TMS event) { + const TValue *tm1 = luaT_gettmbyobj(L, p1, event); + const TValue *tm2; + if (ttisnil(tm1)) return -1; /* no metamethod? */ + tm2 = luaT_gettmbyobj(L, p2, event); + if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */ + return -1; + callTMres(L, L->top, tm1, p1, p2); + return !l_isfalse(L->top); +} + + +static int l_strcmp (const TString *ls, const TString *rs) { + const char *l = getstr(ls); + size_t ll = ls->tsv.len; + const char *r = getstr(rs); + size_t lr = rs->tsv.len; + for (;;) { + int temp = strcoll(l, r); + if (temp != 0) return temp; + else { /* strings are equal up to a `\0' */ + size_t len = strlen(l); /* index of first `\0' in both strings */ + if (len == lr) /* r is finished? */ + return (len == ll) ? 0 : 1; + else if (len == ll) /* l is finished? */ + return -1; /* l is smaller than r (because r is not finished) */ + /* both strings longer than `len'; go on comparing (after the `\0') */ + len++; + l += len; ll -= len; r += len; lr -= len; + } + } +} + + +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numlt(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; + else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) + return res; + return luaG_ordererror(L, l, r); +} + + +static int lessequal (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numle(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; + else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ + return res; + else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ + return !res; + return luaG_ordererror(L, l, r); +} + + +int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + lua_assert(ttype(t1) == ttype(t2)); + switch (ttype(t1)) { + case LUA_TNIL: return 1; + case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ + case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_TUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, + TM_EQ); + break; /* will try TM */ + } + case LUA_TTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) return 0; /* no TM? */ + callTMres(L, L->top, tm, t1, t2); /* call TM */ + return !l_isfalse(L->top); +} + + +void luaV_concat (lua_State *L, int total, int last) { + do { + StkId top = L->base + last + 1; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { + if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) + luaG_concaterror(L, top-2, top-1); + } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ + (void)tostring(L, top - 2); /* result is first op (as string) */ + else { + /* at least two string values; get as many as possible */ + size_t tl = tsvalue(top-1)->len; + char *buffer; + int i; + /* collect total length */ + for (n = 1; n < total && tostring(L, top-n-1); n++) { + size_t l = tsvalue(top-n-1)->len; + if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow"); + tl += l; + } + buffer = luaZ_openspace(L, &G(L)->buff, tl); + tl = 0; + for (i=n; i>0; i--) { /* concat all strings */ + size_t l = tsvalue(top-i)->len; + memcpy(buffer+tl, svalue(top-i), l); + tl += l; + } + setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); + } + total -= n-1; /* got `n' strings to create 1 new */ + last -= n-1; + } while (total > 1); /* repeat until only 1 result left */ +} + + +static void Arith (lua_State *L, StkId ra, const TValue *rb, + const TValue *rc, TMS op) { + TValue tempb, tempc; + const TValue *b, *c; + if ((b = luaV_tonumber(rb, &tempb)) != NULL && + (c = luaV_tonumber(rc, &tempc)) != NULL) { + lua_Number nb = nvalue(b), nc = nvalue(c); + switch (op) { + case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break; + case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break; + case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break; + case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break; + case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break; + case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break; + case TM_UNM: setnvalue(ra, luai_numunm(nb)); break; + default: lua_assert(0); break; + } + } + else if (!call_binTM(L, rb, rc, ra, op)) + luaG_aritherror(L, rb, rc); +} + + + +/* +** some macros for common tasks in `luaV_execute' +*/ + +#define runtime_check(L, c) { if (!(c)) break; } + +#define RA(i) (base+GETARG_A(i)) +/* to be used after possible stack reallocation */ +#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) +#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) +#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) +#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) +#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i)) + + +#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);} + + +#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } + + +#define arith_op(op,tm) { \ + TValue *rb = RKB(i); \ + TValue *rc = RKC(i); \ + if (ttisnumber(rb) && ttisnumber(rc)) { \ + lua_Number nb = nvalue(rb), nc = nvalue(rc); \ + setnvalue(ra, op(nb, nc)); \ + } \ + else \ + Protect(Arith(L, ra, rb, rc, tm)); \ + } + + + +void luaV_execute (lua_State *L, int nexeccalls) { + LClosure *cl; + StkId base; + TValue *k; + const Instruction *pc; + reentry: /* entry point */ + lua_assert(isLua(L->ci)); + pc = L->savedpc; + cl = &clvalue(L->ci->func)->l; + base = L->base; + k = cl->p->k; + /* main loop of interpreter */ + for (;;) { + const Instruction i = *pc++; + StkId ra; + if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && + (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { + traceexec(L, pc); + if (L->status == LUA_YIELD) { /* did hook yield? */ + L->savedpc = pc - 1; + return; + } + base = L->base; + } + /* warning!! several calls may realloc the stack and invalidate `ra' */ + ra = RA(i); + lua_assert(base == L->base && L->base == L->ci->base); + lua_assert(base <= L->top && L->top <= L->stack + L->stacksize); + lua_assert(L->top == L->ci->top || luaG_checkopenop(i)); + switch (GET_OPCODE(i)) { + case OP_MOVE: { + setobjs2s(L, ra, RB(i)); + continue; + } + case OP_LOADK: { + setobj2s(L, ra, KBx(i)); + continue; + } + case OP_LOADBOOL: { + setbvalue(ra, GETARG_B(i)); + if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ + continue; + } + case OP_LOADNIL: { + TValue *rb = RB(i); + do { + setnilvalue(rb--); + } while (rb >= ra); + continue; + } + case OP_GETUPVAL: { + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v); + continue; + } + case OP_GETGLOBAL: { + TValue g; + TValue *rb = KBx(i); + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(rb)); + Protect(luaV_gettable(L, &g, rb, ra)); + continue; + } + case OP_GETTABLE: { + Protect(luaV_gettable(L, RB(i), RKC(i), ra)); + continue; + } + case OP_SETGLOBAL: { + TValue g; + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(KBx(i))); + Protect(luaV_settable(L, &g, KBx(i), ra)); + continue; + } + case OP_SETUPVAL: { + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v, ra); + luaC_barrier(L, uv, ra); + continue; + } + case OP_SETTABLE: { + Protect(luaV_settable(L, ra, RKB(i), RKC(i))); + continue; + } + case OP_NEWTABLE: { + int b = GETARG_B(i); + int c = GETARG_C(i); + sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))); + Protect(luaC_checkGC(L)); + continue; + } + case OP_SELF: { + StkId rb = RB(i); + setobjs2s(L, ra+1, rb); + Protect(luaV_gettable(L, rb, RKC(i), ra)); + continue; + } + case OP_ADD: { + arith_op(luai_numadd, TM_ADD); + continue; + } + case OP_SUB: { + arith_op(luai_numsub, TM_SUB); + continue; + } + case OP_MUL: { + arith_op(luai_nummul, TM_MUL); + continue; + } + case OP_DIV: { + arith_op(luai_numdiv, TM_DIV); + continue; + } + case OP_MOD: { + arith_op(luai_nummod, TM_MOD); + continue; + } + case OP_POW: { + arith_op(luai_numpow, TM_POW); + continue; + } + case OP_UNM: { + TValue *rb = RB(i); + if (ttisnumber(rb)) { + lua_Number nb = nvalue(rb); + setnvalue(ra, luai_numunm(nb)); + } + else { + Protect(Arith(L, ra, rb, rb, TM_UNM)); + } + continue; + } + case OP_NOT: { + int res = l_isfalse(RB(i)); /* next assignment may change this value */ + setbvalue(ra, res); + continue; + } + case OP_LEN: { + const TValue *rb = RB(i); + switch (ttype(rb)) { + case LUA_TTABLE: { + setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))); + break; + } + case LUA_TSTRING: { + setnvalue(ra, cast_num(tsvalue(rb)->len)); + break; + } + default: { /* try metamethod */ + Protect( + if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) + luaG_typeerror(L, rb, "get length of"); + ) + } + } + continue; + } + case OP_CONCAT: { + int b = GETARG_B(i); + int c = GETARG_C(i); + Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)); + setobjs2s(L, RA(i), base+b); + continue; + } + case OP_JMP: { + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_EQ: { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + Protect( + if (equalobj(L, rb, rc) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LT: { + Protect( + if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LE: { + Protect( + if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_TEST: { + if (l_isfalse(ra) != GETARG_C(i)) + dojump(L, pc, GETARG_sBx(*pc)); + pc++; + continue; + } + case OP_TESTSET: { + TValue *rb = RB(i); + if (l_isfalse(rb) != GETARG_C(i)) { + setobjs2s(L, ra, rb); + dojump(L, pc, GETARG_sBx(*pc)); + } + pc++; + continue; + } + case OP_CALL: { + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + switch (luaD_precall(L, ra, nresults)) { + case PCRLUA: { + nexeccalls++; + goto reentry; /* restart luaV_execute over new Lua function */ + } + case PCRC: { + /* it was a C function (`precall' called it); adjust results */ + if (nresults >= 0) L->top = L->ci->top; + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_TAILCALL: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); + switch (luaD_precall(L, ra, LUA_MULTRET)) { + case PCRLUA: { + /* tail call: put new frame in place of previous one */ + CallInfo *ci = L->ci - 1; /* previous frame */ + int aux; + StkId func = ci->func; + StkId pfunc = (ci+1)->func; /* previous function index */ + if (L->openupval) luaF_close(L, ci->base); + L->base = ci->base = ci->func + ((ci+1)->base - pfunc); + for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ + setobjs2s(L, func+aux, pfunc+aux); + ci->top = L->top = func+aux; /* correct top */ + lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); + ci->savedpc = L->savedpc; + ci->tailcalls++; /* one more call lost */ + L->ci--; /* remove new frame */ + goto reentry; + } + case PCRC: { /* it was a C function (`precall' called it) */ + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_RETURN: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b-1; + if (L->openupval) luaF_close(L, base); + L->savedpc = pc; + b = luaD_poscall(L, ra); + if (--nexeccalls == 0) /* was previous function running `here'? */ + return; /* no: return */ + else { /* yes: continue its execution */ + if (b) L->top = L->ci->top; + lua_assert(isLua(L->ci)); + lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL); + goto reentry; + } + } + case OP_FORLOOP: { + lua_Number step = nvalue(ra+2); + lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */ + lua_Number limit = nvalue(ra+1); + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + dojump(L, pc, GETARG_sBx(i)); /* jump back */ + setnvalue(ra, idx); /* update internal index... */ + setnvalue(ra+3, idx); /* ...and external index */ + } + continue; + } + case OP_FORPREP: { + const TValue *init = ra; + const TValue *plimit = ra+1; + const TValue *pstep = ra+2; + L->savedpc = pc; /* next steps may throw errors */ + if (!tonumber(init, ra)) + luaG_runerror(L, LUA_QL("for") " initial value must be a number"); + else if (!tonumber(plimit, ra+1)) + luaG_runerror(L, LUA_QL("for") " limit must be a number"); + else if (!tonumber(pstep, ra+2)) + luaG_runerror(L, LUA_QL("for") " step must be a number"); + setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_TFORLOOP: { + StkId cb = ra + 3; /* call base */ + setobjs2s(L, cb+2, ra+2); + setobjs2s(L, cb+1, ra+1); + setobjs2s(L, cb, ra); + L->top = cb+3; /* func. + 2 args (state and index) */ + Protect(luaD_call(L, cb, GETARG_C(i))); + L->top = L->ci->top; + cb = RA(i) + 3; /* previous call may change the stack */ + if (!ttisnil(cb)) { /* continue loop? */ + setobjs2s(L, cb-1, cb); /* save control variable */ + dojump(L, pc, GETARG_sBx(*pc)); /* jump back */ + } + pc++; + continue; + } + case OP_SETLIST: { + int n = GETARG_B(i); + int c = GETARG_C(i); + int last; + Table *h; + if (n == 0) { + n = cast_int(L->top - ra) - 1; + L->top = L->ci->top; + } + if (c == 0) c = cast_int(*pc++); + runtime_check(L, ttistable(ra)); + h = hvalue(ra); + last = ((c-1)*LFIELDS_PER_FLUSH) + n; + if (last > h->sizearray) /* needs more space? */ + luaH_resizearray(L, h, last); /* pre-alloc it at once */ + for (; n > 0; n--) { + TValue *val = ra+n; + setobj2t(L, luaH_setnum(L, h, last--), val); + luaC_barriert(L, h, val); + } + continue; + } + case OP_CLOSE: { + luaF_close(L, ra); + continue; + } + case OP_CLOSURE: { + Proto *p; + Closure *ncl; + int nup, j; + p = cl->p->p[GETARG_Bx(i)]; + nup = p->nups; + ncl = luaF_newLclosure(L, nup, cl->env); + ncl->l.p = p; + for (j=0; j<nup; j++, pc++) { + if (GET_OPCODE(*pc) == OP_GETUPVAL) + ncl->l.upvals[j] = cl->upvals[GETARG_B(*pc)]; + else { + lua_assert(GET_OPCODE(*pc) == OP_MOVE); + ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc)); + } + } + setclvalue(L, ra, ncl); + Protect(luaC_checkGC(L)); + continue; + } + case OP_VARARG: { + int b = GETARG_B(i) - 1; + int j; + CallInfo *ci = L->ci; + int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1; + if (b == LUA_MULTRET) { + Protect(luaD_checkstack(L, n)); + ra = RA(i); /* previous call may change the stack */ + b = n; + L->top = ra + n; + } + for (j = 0; j < b; j++) { + if (j < n) { + setobjs2s(L, ra + j, ci->base - n + j); + } + else { + setnilvalue(ra + j); + } + } + continue; + } + } + } +} + diff --git a/lua-5.1.4/src/lvm.h b/lua-5.1.4/src/lvm.h new file mode 100644 index 000000000..bfe4f5678 --- /dev/null +++ b/lua-5.1.4/src/lvm.h @@ -0,0 +1,36 @@ +/* +** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) + +#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ + (((o) = luaV_tonumber(o,n)) != NULL)) + +#define equalobj(L,o1,o2) \ + (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) + + +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); +LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); +LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); +LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); + +#endif diff --git a/lua-5.1.4/src/lzio.c b/lua-5.1.4/src/lzio.c new file mode 100644 index 000000000..293edd59b --- /dev/null +++ b/lua-5.1.4/src/lzio.c @@ -0,0 +1,82 @@ +/* +** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** a generic input stream interface +** See Copyright Notice in lua.h +*/ + + +#include <string.h> + +#define lzio_c +#define LUA_CORE + +#include "lua.h" + +#include "llimits.h" +#include "lmem.h" +#include "lstate.h" +#include "lzio.h" + + +int luaZ_fill (ZIO *z) { + size_t size; + lua_State *L = z->L; + const char *buff; + lua_unlock(L); + buff = z->reader(L, z->data, &size); + lua_lock(L); + if (buff == NULL || size == 0) return EOZ; + z->n = size - 1; + z->p = buff; + return char2int(*(z->p++)); +} + + +int luaZ_lookahead (ZIO *z) { + if (z->n == 0) { + if (luaZ_fill(z) == EOZ) + return EOZ; + else { + z->n++; /* luaZ_fill removed first byte; put back it */ + z->p--; + } + } + return char2int(*z->p); +} + + +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { + z->L = L; + z->reader = reader; + z->data = data; + z->n = 0; + z->p = NULL; +} + + +/* --------------------------------------------------------------- read --- */ +size_t luaZ_read (ZIO *z, void *b, size_t n) { + while (n) { + size_t m; + if (luaZ_lookahead(z) == EOZ) + return n; /* return number of missing bytes */ + m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ + memcpy(b, z->p, m); + z->n -= m; + z->p += m; + b = (char *)b + m; + n -= m; + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { + if (n > buff->buffsize) { + if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; + luaZ_resizebuffer(L, buff, n); + } + return buff->buffer; +} + + diff --git a/lua-5.1.4/src/lzio.h b/lua-5.1.4/src/lzio.h new file mode 100644 index 000000000..51d695d8c --- /dev/null +++ b/lua-5.1.4/src/lzio.h @@ -0,0 +1,67 @@ +/* +** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + +#include "lmem.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define char2int(c) cast(int, cast(unsigned char, (c))) + +#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) + +#define luaZ_resetbuffer(buff) ((buff)->n = 0) + + +#define luaZ_resizebuffer(L, buff, size) \ + (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ + (buff)->buffsize = size) + +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) + + +LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ +LUAI_FUNC int luaZ_lookahead (ZIO *z); + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; + void* data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int luaZ_fill (ZIO *z); + +#endif diff --git a/lua-5.1.4/src/print.c b/lua-5.1.4/src/print.c new file mode 100644 index 000000000..e240cfc3c --- /dev/null +++ b/lua-5.1.4/src/print.c @@ -0,0 +1,227 @@ +/* +** $Id: print.c,v 1.55a 2006/05/31 13:30:05 lhf Exp $ +** print bytecodes +** See Copyright Notice in lua.h +*/ + +#include <ctype.h> +#include <stdio.h> + +#define luac_c +#define LUA_CORE + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lundump.h" + +#define PrintFunction luaU_print + +#define Sizeof(x) ((int)sizeof(x)) +#define VOID(p) ((const void*)(p)) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=ts->tsv.len; + putchar('"'); + for (i=0; i<n; i++) + { + int c=s[i]; + switch (c) + { + case '"': printf("\\\""); break; + case '\\': printf("\\\\"); break; + case '\a': printf("\\a"); break; + case '\b': printf("\\b"); break; + case '\f': printf("\\f"); break; + case '\n': printf("\\n"); break; + case '\r': printf("\\r"); break; + case '\t': printf("\\t"); break; + case '\v': printf("\\v"); break; + default: if (isprint((unsigned char)c)) + putchar(c); + else + printf("\\%03u",(unsigned char)c); + } + } + putchar('"'); +} + +static void PrintConstant(const Proto* f, int i) +{ + const TValue* o=&f->k[i]; + switch (ttype(o)) + { + case LUA_TNIL: + printf("nil"); + break; + case LUA_TBOOLEAN: + printf(bvalue(o) ? "true" : "false"); + break; + case LUA_TNUMBER: + printf(LUA_NUMBER_FMT,nvalue(o)); + break; + case LUA_TSTRING: + PrintString(rawtsvalue(o)); + break; + default: /* cannot happen */ + printf("? type=%d",ttype(o)); + break; + } +} + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc<n; pc++) + { + Instruction i=code[pc]; + OpCode o=GET_OPCODE(i); + int a=GETARG_A(i); + int b=GETARG_B(i); + int c=GETARG_C(i); + int bx=GETARG_Bx(i); + int sbx=GETARG_sBx(i); + int line=getline(f,pc); + printf("\t%d\t",pc+1); + if (line>0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",luaP_opnames[o]); + switch (getOpMode(o)) + { + case iABC: + printf("%d",a); + if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (-1-INDEXK(b)) : b); + if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (-1-INDEXK(c)) : c); + break; + case iABx: + if (getBMode(o)==OpArgK) printf("%d %d",a,-1-bx); else printf("%d %d",a,bx); + break; + case iAsBx: + if (o==OP_JMP) printf("%d",sbx); else printf("%d %d",a,sbx); + break; + } + switch (o) + { + case OP_LOADK: + printf("\t; "); PrintConstant(f,bx); + break; + case OP_GETUPVAL: + case OP_SETUPVAL: + printf("\t; %s", (f->sizeupvalues>0) ? getstr(f->upvalues[b]) : "-"); + break; + case OP_GETGLOBAL: + case OP_SETGLOBAL: + printf("\t; %s",svalue(&f->k[bx])); + break; + case OP_GETTABLE: + case OP_SELF: + if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABLE: + case OP_ADD: + case OP_SUB: + case OP_MUL: + case OP_DIV: + case OP_POW: + case OP_EQ: + case OP_LT: + case OP_LE: + if (ISK(b) || ISK(c)) + { + printf("\t; "); + if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); + printf(" "); + if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); + } + break; + case OP_JMP: + case OP_FORLOOP: + case OP_FORPREP: + printf("\t; to %d",sbx+pc+2); + break; + case OP_CLOSURE: + printf("\t; %p",VOID(f->p[bx])); + break; + case OP_SETLIST: + if (c==0) printf("\t; %d",(int)code[++pc]); + else printf("\t; %d",c); + break; + default: + break; + } + printf("\n"); + } +} + +#define SS(x) (x==1)?"":"s" +#define S(x) x,SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=getstr(f->source); + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + f->numparams,f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->nups)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintConstants(const Proto* f) +{ + int i,n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; i<n; i++) + { + printf("\t%d\t",i+1); + PrintConstant(f,i); + printf("\n"); + } +} + +static void PrintLocals(const Proto* f) +{ + int i,n=f->sizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; i<n; i++) + { + printf("\t%d\t%s\t%d\t%d\n", + i,getstr(f->locvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } +} + +static void PrintUpvalues(const Proto* f) +{ + int i,n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + if (f->upvalues==NULL) return; + for (i=0; i<n; i++) + { + printf("\t%d\t%s\n",i,getstr(f->upvalues[i])); + } +} + +void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) + { + PrintConstants(f); + PrintLocals(f); + PrintUpvalues(f); + } + for (i=0; i<n; i++) PrintFunction(f->p[i],full); +} diff --git a/tolua++-1.0.93/COPYRIGHT b/tolua++-1.0.93/COPYRIGHT new file mode 100644 index 000000000..9e99e0080 --- /dev/null +++ b/tolua++-1.0.93/COPYRIGHT @@ -0,0 +1,33 @@ +tolua++ License +--------------- + +tolua++ is based on toLua (www.tecgraf.puc-rio.br/~celes/tolua), and +it's licensed under the terms of the MIT license reproduced below. +This means that Lua is free software and can be used for both academic +and commercial purposes at absolutely no cost. + +=============================================================================== + +Copyright (C) 2009 Ariel Manzur. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +=============================================================================== + +(end of COPYRIGHT) diff --git a/tolua++-1.0.93/INSTALL b/tolua++-1.0.93/INSTALL new file mode 100644 index 000000000..5ee408f9e --- /dev/null +++ b/tolua++-1.0.93/INSTALL @@ -0,0 +1,42 @@ +This version of tolua++ uses SCons to compile (http://www.scons.org). SCons uses +pythin. If you don't want to install python, check "Installation without scons" +below. + +* Installation + + 1. Edit the "config" file for your platform to suit your environment, + if at all necessary (for cygwin, mingw, BSD and mac OSX use + 'config_posix') + 2. Then, type "scons". + + You can use 'scons -h' to see a list of available command line options. + +* What you get + + If "scons" succeeds, you get: + * an executable to generate binding code in ./bin; + * the C library to be linked in your application in ./lib; + * the include file needed to compile your application in ./include. + These are the only directories you need for development, besides Lua. + + You can use 'scons install' to install the files, see the 'prefix' option. + +* Installation without scons + + The instructions for building tolua++ without scons depend on the particular + compiler you are using. + The simplest way is to create a folder with all .c and .h files except + 'toluabind_default.c', and then create a project for the executable and the + library, as follows: + + tolua.exe: all *.c *.h in src/bin (except toluabind_default.c) + tolua.lib: all *.c *.h in src/lib. + +* Installation with Microsoft Visual Studio + + The directory 'win32' contains project files for Microsoft Visual Studio 7 + (contributed by Makoto Hamanaka). The project has 4 different build options: + withLua50_Release, withLua51_Release, withLua50_Debug and withLua51_Debug. + They all expect the lua library names used by the LuaBinaries packages + (http://luabinaries.luaforge.net/). The resulting files are built on /lib and + /bin (for the library and tolua++.exe). diff --git a/tolua++-1.0.93/Makefile b/tolua++-1.0.93/Makefile new file mode 100644 index 000000000..92ded6c4e --- /dev/null +++ b/tolua++-1.0.93/Makefile @@ -0,0 +1,5 @@ +# makefile for tolua hierarchy + +all: + @echo "Makefile is deprecated ;)" + @echo "see INSTALL for details on how to build tolua++" diff --git a/tolua++-1.0.93/README b/tolua++-1.0.93/README new file mode 100644 index 000000000..cee381fb3 --- /dev/null +++ b/tolua++-1.0.93/README @@ -0,0 +1,30 @@ +This is tolua++-1.0 + +* What is tolua++? + tolua++ is an extension of toLua, a tool to integrate C/C++ code with + Lua. tolua++ includes new features oriented to c++, such as class + templates. + + tolua is a tool that greatly simplifies the integration of C/C++ code + with Lua. Based on a "cleaned" header file, tolua automatically generates + the binding code to access C/C++ features from Lua. Using Lua-5.0 API and + metamethod facilities, the current version automatically maps C/C++ + constants, external variables, functions, namespace, classes, and methods + to Lua. It also provides facilities to create Lua modules. + +* Availability + + tolua++ is freely available for both academic and commercial purposes. + See COPYRIGHT for details. + + tolua++ can be downloaded from the sites below: + http://www.codenix.com/~tolua/ + +* Installation + See INSTALL. + +* Contacting the author + tolua has been designed and implemented by Waldemar Celes. + tolua++ is maintained by Ariel Manzur. + Send your comments, bug reports and anything else to + tolua@codenix.com diff --git a/tolua++-1.0.93/README-5.1 b/tolua++-1.0.93/README-5.1 new file mode 100644 index 000000000..f06f785e3 --- /dev/null +++ b/tolua++-1.0.93/README-5.1 @@ -0,0 +1,50 @@ +Compiling for lua 5.1 +--------------------- + +Starting from version 1.0.8pre1, tolua++ can be compiled with both lua 5.0 and +5.1. Both versions will output the same code, and the C API (tolua++.h) is the +same. + +The build system is not yet ready to detect/decide when to compile for 5.1, +the easiest way right now is to add a file called 'custom.py' on the root of +the package, with the following: + +## BEGIN custom.py + +CCFLAGS = ['-I/usr/local/include/lua5.1', '-O2', '-ansi'] +LIBPATH = ['/usr/local/lib'] +LIBS = ['lua5.1', 'dl', 'm'] +tolua_bin = 'tolua++5.1' +tolua_lib = 'tolua++5.1' +TOLUAPP = 'tolua++5.1' + +## END custom.py + +This will build the binary as 'tolua++5.1' and the library as 'libtolua++5.1.a' +(taken from tolua_bin and tolua_lib), and take the lua headers and libraries +from /usr/local/include/lua5.1 and /usr/local/lib. It will also link with +'-llua5.1'. Modify the parameters acording to your system. + +Compatibility +------------- + +There are a couple of things to keep in mind when running code inside tolua +using the -L option: + +* `...' and arg: you can still use 'arg' on 5.1, this is done automatically by +adding the 'arg' declaration to functions on files loaded with dofile. + +For example, the line: + +function foo( ... ) + +becomes + +function foo( ... ) local arg = {n=select('#', ...), ...}; + +This lets you use the same code on both versions without having to make any +modifications. + +* keep in mind that there are slight differences on the way string.gsub works, +and the original version of the function is always kept, so it will behave +diffently depending on which version of lua you're using. diff --git a/tolua++-1.0.93/SConstruct b/tolua++-1.0.93/SConstruct new file mode 100644 index 000000000..5c1e7746e --- /dev/null +++ b/tolua++-1.0.93/SConstruct @@ -0,0 +1,180 @@ +import sys; +import os + +tools = ['default'] +if os.name == 'nt': + tools = ['mingw'] + +env = Environment(tools = tools) + +options_file = None +if sys.platform == 'linux2': + options_file = "linux" + +elif 'msvc' in env['TOOLS']: + options_file = "msvc" +else: + options_file = "posix" + +opts = Options(["config_"+options_file+".py", "custom.py", "custom_"+options_file+".py"], ARGUMENTS) +opts.Add('CC', 'The C compiler.') +opts.Add('CXX', 'The C++ compiler (for the tests)') +opts.Add('CCFLAGS', 'Flags for the compiler.', ['-O2', '-Wall']) +opts.Add('LINK', 'The linker.') +opts.Add('LINKFLAGS', 'Linker flags.', []) +opts.Add('no_cygwin', 'Use -mno-cygwin to build using the mingw compiler on cygwin', 0) +opts.Add('LIBS', 'libraries', []) +opts.Add('LIBPATH', 'library path', []) + +opts.Add('tolua_bin', 'the resulting binary', 'tolua++') +opts.Add('tolua_lib', 'the resulting library', 'tolua++') +opts.Add('TOLUAPP', 'the name of the tolua++ binary (to use with built_dev=1)', 'tolua++') + +opts.Add('prefix', 'The installation prefix') +opts.Add('build_dev', 'Build for development (uses tolua to rebuild toluabind.c with the embeded scripts', 0) +opts.Add('build_failsafe', "Build using 'factory default' toluabind file (in case build_dev fails)", 0) +opts.Add('ENV', 'The environment variables') +opts.Add('shared', 'Build a shared object', False) +opts.Update(env) +Help(opts.GenerateHelpText(env)) + +def save_config(target, source, env): + opts.Save('custom.py', env) + +cust = env.Command('custom.py', [], save_config) +env.Alias('configure', [cust]) + +env['TOLUAPP_BOOTSTRAP'] = env['tolua_bin']+"_bootstrap"+env['PROGSUFFIX'] + +env['build_dev'] = int(env['build_dev']) + +## detecting the install directory on win32 +if 'msvc' in env['TOOLS'] and not (env.has_key('prefix') or env['prefix']): + + if env['MSVS'].has_key('PLATFORMSDKDIR'): + env['prefix'] = env['MSVS']['PLATFORMSDKDIR'] + + +SConscriptChdir(0) + +############ helper builders +def pkg_scan_dep(self, target, source): + + import re + + ## TODO: detectar si el archivo existe antes de abrirlo asi nomas + pkg = open(source, "rt") + + for linea in pkg.xreadlines(): + dep = re.search("^[\t\w]*\$[cphl]file\s*\"([^\"]+)\"", linea) + if dep: + self.Depends(target, '#' + dep.groups()[0]); + + if dep.groups()[0][-4:] == '.pkg': + # recursividad + self.pkg_scan_dep(target, dep.groups()[0]) + + +def make_tolua_code(self, target, source, pkgname = None, bootstrap = False, use_own = False, use_typeid=None): + + ptarget = Dir('.').path + '/' + target + psource = Dir('.').path + '/' + source + header = target[:-2] + '.h' + pheader = Dir('.').path + '/' + header + + tolua = "" + if bootstrap: + if os.name == 'nt': + tolua = 'bin\\'+self['TOLUAPP_BOOTSTRAP'] + else: + tolua = 'bin/'+self['TOLUAPP_BOOTSTRAP'] + print("********* tolua is ", tolua) + else: + if use_own: + if 'msvc' in self['TOOLS']: + tolua = 'bin\\$tolua_bin' + else: + tolua = 'bin/$tolua_bin' + else: + tolua = "$TOLUAPP" + + if pkgname: + pkgname = ' -n '+pkgname + else: + pkgname = '' + + if use_typeid: + tolua = tolua+' -t' + + comando = tolua + ' -C -H ' + pheader + ' -o ' + ptarget + pkgname + ' ' + psource + command = self.Command(target, source, comando) + + self.SideEffect(header, target) + self.Depends(target, source) + + self.pkg_scan_dep(target, psource) + + if bootstrap: + self.Depends(target, "#/bin/$TOLUAPP_BOOTSTRAP") + if use_own: + self.Depends(target, "#/bin/$tolua_bin") + + return command + + +env.__class__.LuaBinding = make_tolua_code; +env.__class__.pkg_scan_dep = pkg_scan_dep; + +def print_install_error(target, source, env): + + msg = """Error: no install prefix was specified, or detected. + +you can use the 'prefix' option on command line to specify one. Examples: + + scons prefix=/usr/local install + +or on Windows: + + scons "prefix=c:\\program files\\visual basic" install + +Files will be installed on <prefix>/bin, <prefix>/lib and <prefix>/include +""" + import SCons.Errors + raise SCons.Errors.UserError(msg) + +########### end of helper builders + +env['CPPPATH'] = '#/include' +env['LIBPATH'] = ['#/lib'] + env['LIBPATH'] + +if env['no_cygwin']: + + env['CCFLAGS'] += ['-mno-cygwin'] + env['LINKFLAGS'] += ['-mno-cygwin'] + +import string + +Export('env') + +SConscript('src/lib/SCsub') +SConscript('src/bin/SCsub') +#SConscript('src/lib/SCsub') +SConscript('src/tests/SCsub') + +env.Alias('all', [env.bin_target, env.lib_target]) +env.Alias('test', env.test_targets) + +Default('all') + +if env['prefix']: + env.Install(env['prefix']+'/bin', env.bin_target) + env.Install(env['prefix']+'/lib', env.lib_target) + env.Install(env['prefix']+'/include', '#include/tolua++.h') + + env.Alias('install', [env['prefix']+'/bin', env['prefix']+'/include', env['prefix']+'/lib']) +else: + env.Command('install', [], print_install_error) + env.Depends('install', 'all') + +env.Command('deb', [], 'dpkg-buildpackage -I.svn -Icustom.py -Itoluabind_dev.c -Itoluabind_dev.h -Itoluabind_default.o -Icustom.lua -I.sconsign', ENV=os.environ) + diff --git a/tolua++-1.0.93/include/tolua++.h b/tolua++-1.0.93/include/tolua++.h new file mode 100644 index 000000000..ed5344926 --- /dev/null +++ b/tolua++-1.0.93/include/tolua++.h @@ -0,0 +1,186 @@ +/* tolua +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + + +#ifndef TOLUA_H +#define TOLUA_H + +#ifndef TOLUA_API +#define TOLUA_API extern +#endif + +#define TOLUA_VERSION "tolua++-1.0.92" + +#ifdef __cplusplus +extern "C" { +#endif + +#define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str()) +#define tolua_iscppstring tolua_isstring + +#define tolua_iscppstringarray tolua_isstringarray +#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str()) + +#ifndef TEMPLATE_BIND + #define TEMPLATE_BIND(p) +#endif + +#define TOLUA_TEMPLATE_BIND(p) + +#define TOLUA_PROTECTED_DESTRUCTOR +#define TOLUA_PROPERTY_TYPE(p) + +typedef int lua_Object; + +#include "lua.h" +#include "lauxlib.h" + +struct tolua_Error +{ + int index; + int array; + const char* type; +}; +typedef struct tolua_Error tolua_Error; + +#define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */ + +TOLUA_API const char* tolua_typename (lua_State* L, int lo); +TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err); +TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err); +TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err); +TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err); +TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err); +TOLUA_API int tolua_isvaluearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isbooleanarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isnumberarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isstringarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_istablearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isuserdataarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isusertypearray + (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err); + +TOLUA_API void tolua_open (lua_State* L); + +TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size); +TOLUA_API int tolua_register_gc (lua_State* L, int lo); +TOLUA_API int tolua_default_collect (lua_State* tolua_S); + +TOLUA_API void tolua_usertype (lua_State* L, const char* type); +TOLUA_API void tolua_beginmodule (lua_State* L, const char* name); +TOLUA_API void tolua_endmodule (lua_State* L); +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar); +TOLUA_API void tolua_class (lua_State* L, const char* name, const char* base); +TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col); +TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func); +TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value); +TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set); +TOLUA_API void tolua_array (lua_State* L,const char* name, lua_CFunction get, lua_CFunction set); + +/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */ +/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */ + +TOLUA_API void tolua_pushvalue (lua_State* L, int lo); +TOLUA_API void tolua_pushboolean (lua_State* L, int value); +TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value); +TOLUA_API void tolua_pushstring (lua_State* L, const char* value); +TOLUA_API void tolua_pushuserdata (lua_State* L, void* value); +TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type); +TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type); +TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v); +TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v); +TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v); +TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v); +TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v); +TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type); +TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type); + +TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def); +TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); +TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); +TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); +TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def); +TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def); +TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def); +TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def); +TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def); +TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def); +TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def); +TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def); + +TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name); + +TOLUA_API int class_gc_event (lua_State* L); + +#ifdef __cplusplus +static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) { + + const char* s = tolua_tostring(L, narg, def); + return s?s:""; +}; + +static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) { + + const char* s = tolua_tofieldstring(L, lo, index, def); + return s?s:""; +}; + +#else +#define tolua_tocppstring tolua_tostring +#define tolua_tofieldcppstring tolua_tofieldstring +#endif + +TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index); + +#ifndef Mtolua_new +#define Mtolua_new(EXP) new EXP +#endif + +#ifndef Mtolua_delete +#define Mtolua_delete(EXP) delete EXP +#endif + +#ifndef Mtolua_new_dim +#define Mtolua_new_dim(EXP, len) new EXP[len] +#endif + +#ifndef Mtolua_delete_dim +#define Mtolua_delete_dim(EXP) delete [] EXP +#endif + +#ifndef tolua_outside +#define tolua_outside +#endif + +#ifndef tolua_owned +#define tolua_owned +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tolua++-1.0.93/src/bin/SCsub b/tolua++-1.0.93/src/bin/SCsub new file mode 100644 index 000000000..35ccd7a24 --- /dev/null +++ b/tolua++-1.0.93/src/bin/SCsub @@ -0,0 +1,12 @@ +Import('env') + +src = [ + env.Object('tolua.c'), + ] + + +toluabind = env.LuaBinding('toluabind.c', 'tolua_scons.pkg', 'tolua', bootstrap = True) + +env.bin_target = env.Program('#/bin/'+env['tolua_bin'], src + [toluabind], LIBS = ['$tolua_lib'] + env['LIBS']) + +env.bootstrap_target = env.Program('#/bin/'+env['TOLUAPP_BOOTSTRAP'], src + ['toluabind_default.c', env.lib_target_static], LIBS = env['LIBS']) diff --git a/tolua++-1.0.93/src/bin/lua/all.lua b/tolua++-1.0.93/src/bin/lua/all.lua new file mode 100644 index 000000000..83f8a3cb9 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/all.lua @@ -0,0 +1,30 @@ +dofile(path.."compat-5.1.lua") +dofile(path.."compat.lua") +dofile(path.."basic.lua") +dofile(path.."feature.lua") +dofile(path.."verbatim.lua") +dofile(path.."code.lua") +dofile(path.."typedef.lua") +dofile(path.."container.lua") +dofile(path.."package.lua") +dofile(path.."module.lua") +dofile(path.."namespace.lua") +dofile(path.."define.lua") +dofile(path.."enumerate.lua") +dofile(path.."declaration.lua") +dofile(path.."variable.lua") +dofile(path.."array.lua") +dofile(path.."function.lua") +dofile(path.."operator.lua") +dofile(path.."template_class.lua") +dofile(path.."class.lua") +dofile(path.."clean.lua") +--dofile(path.."custom.lua") +dofile(path.."doit.lua") + +local err,msg = xpcall(doit, debug.traceback) +if not err then +--print("**** msg is "..tostring(msg)) + local _,_,label,msg = strfind(msg,"(.-:.-:%s*)(.*)") + tolua_error(msg,label) +end diff --git a/tolua++-1.0.93/src/bin/lua/array.lua b/tolua++-1.0.93/src/bin/lua/array.lua new file mode 100644 index 000000000..f35aa98ce --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/array.lua @@ -0,0 +1,233 @@ +-- tolua: array class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1999 +-- $Id: array.lua,v 1.1 2000/11/06 22:03:57 celes Exp $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Array class +-- Represents a extern array variable or a public member of a class. +-- Stores all fields present in a declaration. +classArray = { +} +classArray.__index = classArray +setmetatable(classArray,classDeclaration) + +-- Print method +function classArray:print (ident,close) + print(ident.."Array{") + print(ident.." mod = '"..self.mod.."',") + print(ident.." type = '"..self.type.."',") + print(ident.." ptr = '"..self.ptr.."',") + print(ident.." name = '"..self.name.."',") + print(ident.." def = '"..self.def.."',") + print(ident.." dim = '"..self.dim.."',") + print(ident.." ret = '"..self.ret.."',") + print(ident.."}"..close) +end + +-- check if it is a variable +function classArray:isvariable () + return true +end + + +-- get variable value +function classArray:getvalue (class,static) + if class and static then + return class..'::'..self.name..'[tolua_index]' + elseif class then + return 'self->'..self.name..'[tolua_index]' + else + return self.name..'[tolua_index]' + end +end + +-- Write binding functions +function classArray:supcode () + local class = self:inclass() + + -- get function ------------------------------------------------ + if class then + output("/* get function:",self.name," of class ",class," */") + else + output("/* get function:",self.name," */") + end + self.cgetname = self:cfuncname("tolua_get") + output("#ifndef TOLUA_DISABLE_"..self.cgetname) + output("\nstatic int",self.cgetname,"(lua_State* tolua_S)") + output("{") + output(" int tolua_index;") + + -- declare self, if the case + local _,_,static = strfind(self.mod,'^%s*(static)') + if class and static==nil then + output(' ',self.parent.type,'*','self;') + output(' lua_pushstring(tolua_S,".self");') + output(' lua_rawget(tolua_S,1);') + output(' self = ') + output('(',self.parent.type,'*) ') + output('lua_touserdata(tolua_S,-1);') + elseif static then + _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)') + end + + -- check index + output('#ifndef TOLUA_RELEASE\n') + output(' {') + output(' tolua_Error tolua_err;') + output(' if (!tolua_isnumber(tolua_S,2,0,&tolua_err))') + output(' tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);') + output(' }') + output('#endif\n') + if flags['1'] then -- for compatibility with tolua5 ? + output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;') + else + output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);') + end + output('#ifndef TOLUA_RELEASE\n') + if self.dim and self.dim ~= '' then + output(' if (tolua_index<0 || tolua_index>='..self.dim..')') + else + output(' if (tolua_index<0)') + end + output(' tolua_error(tolua_S,"array indexing out of range.",NULL);') + output('#endif\n') + + -- return value + local t,ct = isbasic(self.type) + local push_func = get_push_function(t) + if t then + output(' tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static)..');') + else + t = self.type + if self.ptr == '&' or self.ptr == '' then + output(' ',push_func,'(tolua_S,(void*)&'..self:getvalue(class,static)..',"',t,'");') + else + output(' ',push_func,'(tolua_S,(void*)'..self:getvalue(class,static)..',"',t,'");') + end + end + output(' return 1;') + output('}') + output('#endif //#ifndef TOLUA_DISABLE\n') + output('\n') + + -- set function ------------------------------------------------ + if not strfind(self.type,'const') then + if class then + output("/* set function:",self.name," of class ",class," */") + else + output("/* set function:",self.name," */") + end + self.csetname = self:cfuncname("tolua_set") + output("#ifndef TOLUA_DISABLE_"..self.csetname) + output("\nstatic int",self.csetname,"(lua_State* tolua_S)") + output("{") + + -- declare index + output(' int tolua_index;') + + -- declare self, if the case + local _,_,static = strfind(self.mod,'^%s*(static)') + if class and static==nil then + output(' ',self.parent.type,'*','self;') + output(' lua_pushstring(tolua_S,".self");') + output(' lua_rawget(tolua_S,1);') + output(' self = ') + output('(',self.parent.type,'*) ') + output('lua_touserdata(tolua_S,-1);') + elseif static then + _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)') + end + + -- check index + output('#ifndef TOLUA_RELEASE\n') + output(' {') + output(' tolua_Error tolua_err;') + output(' if (!tolua_isnumber(tolua_S,2,0,&tolua_err))') + output(' tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);') + output(' }') + output('#endif\n') + + if flags['1'] then -- for compatibility with tolua5 ? + output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;') + else + output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);') + end + + output('#ifndef TOLUA_RELEASE\n') + if self.dim and self.dim ~= '' then + output(' if (tolua_index<0 || tolua_index>='..self.dim..')') + else + output(' if (tolua_index<0)') + end + output(' tolua_error(tolua_S,"array indexing out of range.",NULL);') + output('#endif\n') + + -- assign value + local ptr = '' + if self.ptr~='' then ptr = '*' end + output(' ') + if class and static then + output(class..'::'..self.name..'[tolua_index]') + elseif class then + output('self->'..self.name..'[tolua_index]') + else + output(self.name..'[tolua_index]') + end + local t = isbasic(self.type) + output(' = ') + if not t and ptr=='' then output('*') end + output('((',self.mod,self.type) + if not t then + output('*') + end + output(') ') + local def = 0 + if self.def ~= '' then def = self.def end + if t then + output('tolua_to'..t,'(tolua_S,3,',def,'));') + else + local to_func = get_to_function(self.type) + output(to_func,'(tolua_S,3,',def,'));') + end + output(' return 0;') + output('}') + output('#endif //#ifndef TOLUA_DISABLE\n') + output('\n') + end + +end + +function classArray:register (pre) + if not self:check_public_access() then + return + end + + pre = pre or '' + if self.csetname then + output(pre..'tolua_array(tolua_S,"'..self.lname..'",'..self.cgetname..','..self.csetname..');') + else + output(pre..'tolua_array(tolua_S,"'..self.lname..'",'..self.cgetname..',NULL);') + end +end + +-- Internal constructor +function _Array (t) + setmetatable(t,classArray) + append(t) + return t +end + +-- Constructor +-- Expects a string representing the variable declaration. +function Array (s) + return _Array (Declaration(s,'var')) +end + + diff --git a/tolua++-1.0.93/src/bin/lua/basic.lua b/tolua++-1.0.93/src/bin/lua/basic.lua new file mode 100644 index 000000000..f651f1fe6 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/basic.lua @@ -0,0 +1,414 @@ +-- tolua: basic utility functions +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- Last update: Apr 2003 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Basic C types and their corresponding Lua types +-- All occurrences of "char*" will be replaced by "_cstring", +-- and all occurrences of "void*" will be replaced by "_userdata" +_basic = { + ['void'] = '', + ['char'] = 'number', + ['int'] = 'number', + ['short'] = 'number', + ['long'] = 'number', + ['unsigned'] = 'number', + ['float'] = 'number', + ['double'] = 'number', + ['_cstring'] = 'string', + ['_userdata'] = 'userdata', + ['char*'] = 'string', + ['void*'] = 'userdata', + ['bool'] = 'boolean', + ['lua_Object'] = 'value', + ['LUA_VALUE'] = 'value', -- for compatibility with tolua 4.0 + ['lua_State*'] = 'state', + ['_lstate'] = 'state', + ['lua_Function'] = 'value', +} + +_basic_ctype = { + number = "lua_Number", + string = "const char*", + userdata = "void*", + boolean = "bool", + value = "int", + state = "lua_State*", +} + +-- functions the are used to do a 'raw push' of basic types +_basic_raw_push = {} + +-- List of user defined types +-- Each type corresponds to a variable name that stores its tag value. +_usertype = {} + +-- List of types that have to be collected +_collect = {} + +-- List of types +_global_types = {n=0} +_global_types_hash = {} + +-- list of classes +_global_classes = {} + +-- List of enum constants +_global_enums = {} + +-- List of auto renaming +_renaming = {} +function appendrenaming (s) + local b,e,old,new = strfind(s,"%s*(.-)%s*@%s*(.-)%s*$") + if not b then + error("#Invalid renaming syntax; it should be of the form: pattern@pattern") + end + tinsert(_renaming,{old=old, new=new}) +end + +function applyrenaming (s) + for i=1,getn(_renaming) do + local m,n = gsub(s,_renaming[i].old,_renaming[i].new) + if n ~= 0 then + return m + end + end + return nil +end + +-- Error handler +function tolua_error (s,f) +if _curr_code then + print("***curr code for error is "..tostring(_curr_code)) + print(debug.traceback()) +end + local out = _OUTPUT + _OUTPUT = _STDERR + if strsub(s,1,1) == '#' then + write("\n** tolua: "..strsub(s,2)..".\n\n") + if _curr_code then + local _,_,s = strfind(_curr_code,"^%s*(.-\n)") -- extract first line + if s==nil then s = _curr_code end + s = gsub(s,"_userdata","void*") -- return with 'void*' + s = gsub(s,"_cstring","char*") -- return with 'char*' + s = gsub(s,"_lstate","lua_State*") -- return with 'lua_State*' + write("Code being processed:\n"..s.."\n") + end + else + if not f then f = "(f is nil)" end + print("\n** tolua internal error: "..f..s..".\n\n") + return + end + _OUTPUT = out +end + +function warning (msg) + if flags.q then return end + local out = _OUTPUT + _OUTPUT = _STDERR + write("\n** tolua warning: "..msg..".\n\n") + _OUTPUT = out +end + +-- register an user defined type: returns full type +function regtype (t) + --if isbasic(t) then + -- return t + --end + local ft = findtype(t) + + if not _usertype[ft] then + return appendusertype(t) + end + return ft +end + +-- return type name: returns full type +function typevar(type) + if type == '' or type == 'void' then + return type + else + local ft = findtype(type) + if ft then + return ft + end + _usertype[type] = type + return type + end +end + +-- check if basic type +function isbasic (type) + local t = gsub(type,'const ','') + local m,t = applytypedef('', t) + local b = _basic[t] + if b then + return b,_basic_ctype[b] + end + return nil +end + +-- split string using a token +function split (s,t) + local l = {n=0} + local f = function (s) + l.n = l.n + 1 + l[l.n] = s + return "" + end + local p = "%s*(.-)%s*"..t.."%s*" + s = gsub(s,"^%s+","") + s = gsub(s,"%s+$","") + s = gsub(s,p,f) + l.n = l.n + 1 + l[l.n] = gsub(s,"(%s%s*)$","") + return l +end + +-- splits a string using a pattern, considering the spacial cases of C code (templates, function parameters, etc) +-- pattern can't contain the '^' (as used to identify the begining of the line) +-- also strips whitespace +function split_c_tokens(s, pat) + + s = string.gsub(s, "^%s*", "") + s = string.gsub(s, "%s*$", "") + + local token_begin = 1 + local token_end = 1 + local ofs = 1 + local ret = {n=0} + + function add_token(ofs) + + local t = string.sub(s, token_begin, ofs) + t = string.gsub(t, "^%s*", "") + t = string.gsub(t, "%s*$", "") + ret.n = ret.n + 1 + ret[ret.n] = t + end + + while ofs <= string.len(s) do + + local sub = string.sub(s, ofs, -1) + local b,e = string.find(sub, "^"..pat) + if b then + add_token(ofs-1) + ofs = ofs+e + token_begin = ofs + else + local char = string.sub(s, ofs, ofs) + if char == "(" or char == "<" then + + local block + if char == "(" then block = "^%b()" end + if char == "<" then block = "^%b<>" end + + b,e = string.find(sub, block) + if not b then + -- unterminated block? + ofs = ofs+1 + else + ofs = ofs + e + end + + else + ofs = ofs+1 + end + end + + end + add_token(ofs) + --if ret.n == 0 then + + -- ret.n=1 + -- ret[1] = "" + --end + + return ret + +end + +-- concatenate strings of a table +function concat (t,f,l,jstr) + jstr = jstr or " " + local s = '' + local i=f + while i<=l do + s = s..t[i] + i = i+1 + if i <= l then s = s..jstr end + end + return s +end + +-- concatenate all parameters, following output rules +function concatparam (line, ...) + local i=1 + while i<=arg.n do + if _cont and not strfind(_cont,'[%(,"]') and + strfind(arg[i],"^[%a_~]") then + line = line .. ' ' + end + line = line .. arg[i] + if arg[i] ~= '' then + _cont = strsub(arg[i],-1,-1) + end + i = i+1 + end + if strfind(arg[arg.n],"[%/%)%;%{%}]$") then + _cont=nil line = line .. '\n' + end + return line +end + +-- output line +function output (...) + local i=1 + while i<=arg.n do + if _cont and not strfind(_cont,'[%(,"]') and + strfind(arg[i],"^[%a_~]") then + write(' ') + end + write(arg[i]) + if arg[i] ~= '' then + _cont = strsub(arg[i],-1,-1) + end + i = i+1 + end + if strfind(arg[arg.n],"[%/%)%;%{%}]$") then + _cont=nil write('\n') + end +end + +function get_property_methods(ptype, name) + + if get_property_methods_hook and get_property_methods_hook(ptype,name) then + return get_property_methods_hook(ptype, name) + end + + if ptype == "default" then -- get_name, set_name + return "get_"..name, "set_"..name + end + + if ptype == "qt" then -- name, setName + return name, "set"..string.upper(string.sub(name, 1, 1))..string.sub(name, 2, -1) + end + + if ptype == "overload" then -- name, name + return name,name + end + + return nil +end + +-------------- the hooks + +-- called right after processing the $[ichl]file directives, +-- right before processing anything else +-- takes the package object as the parameter +function preprocess_hook(p) + -- p.code has all the input code from the pkg +end + + +-- called for every $ifile directive +-- takes a table with a string called 'code' inside, the filename, and any extra arguments +-- passed to $ifile. no return value +function include_file_hook(t, filename, ...) + +end + +-- called after processing anything that's not code (like '$renaming', comments, etc) +-- and right before parsing the actual code. +-- takes the Package object with all the code on the 'code' key. no return value +function preparse_hook(package) + +end + +-- called before starting output +function pre_output_hook(package) + +end + +-- called after writing all the output. +-- takes the Package object +function post_output_hook(package) + +end + + +-- called from 'get_property_methods' to get the methods to retrieve a property +-- according to its type +function get_property_methods_hook(property_type, name) + +end + +-- called from ClassContainer:doparse with the string being parsed +-- return nil, or a substring +function parser_hook(s) + + return nil +end + +-- called from classFunction:supcode, before the call to the function is output +function pre_call_hook(f) + +end + +-- called from classFunction:supcode, after the call to the function is output +function post_call_hook(f) + +end + +-- called before the register code is output +function pre_register_hook(package) + +end + +-- called to output an error message +function output_error_hook(...) + return string.format(...) +end + +-- custom pushers + +_push_functions = {} +_is_functions = {} +_to_functions = {} + +_base_push_functions = {} +_base_is_functions = {} +_base_to_functions = {} + +local function search_base(t, funcs) + + local class = _global_classes[t] + + while class do + if funcs[class.type] then + return funcs[class.type] + end + class = _global_classes[class.btype] + end + return nil +end + +function get_push_function(t) + return _push_functions[t] or search_base(t, _base_push_functions) or "tolua_pushusertype" +end + +function get_to_function(t) + return _to_functions[t] or search_base(t, _base_to_functions) or "tolua_tousertype" +end + +function get_is_function(t) + return _is_functions[t] or search_base(t, _base_is_functions) or "tolua_isusertype" +end diff --git a/tolua++-1.0.93/src/bin/lua/class.lua b/tolua++-1.0.93/src/bin/lua/class.lua new file mode 100644 index 000000000..592705282 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/class.lua @@ -0,0 +1,202 @@ +-- tolua: class class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Class class +-- Represents a class definition. +-- Stores the following fields: +-- name = class name +-- base = class base, if any (only single inheritance is supported) +-- {i} = list of members +classClass = { + classtype = 'class', + name = '', + base = '', + type = '', + btype = '', + ctype = '', +} +classClass.__index = classClass +setmetatable(classClass,classContainer) + + +-- register class +function classClass:register (pre) + + if not self:check_public_access() then + return + end + + pre = pre or '' + push(self) + if _collect[self.type] then + output(pre,'#ifdef __cplusplus\n') + output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",'.._collect[self.type]..');') + output(pre,'#else\n') + output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",NULL);') + output(pre,'#endif\n') + else + output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",NULL);') + end + if self.extra_bases then + for k,base in ipairs(self.extra_bases) do + -- not now + --output(pre..' tolua_addbase(tolua_S, "'..self.type..'", "'..base..'");') + end + end + output(pre..'tolua_beginmodule(tolua_S,"'..self.lname..'");') + local i=1 + while self[i] do + self[i]:register(pre..' ') + i = i+1 + end + output(pre..'tolua_endmodule(tolua_S);') + pop() +end + +-- return collection requirement +function classClass:requirecollection (t) + if self.flags.protected_destructor or (not self:check_public_access()) then + return false + end + push(self) + local r = false + local i=1 + while self[i] do + r = self[i]:requirecollection(t) or r + i = i+1 + end + pop() + -- only class that exports destructor can be appropriately collected + -- classes that export constructors need to have a collector (overrided by -D flag on command line) + if self._delete or ((not flags['D']) and self._new) then + --t[self.type] = "tolua_collect_" .. gsub(self.type,"::","_") + t[self.type] = "tolua_collect_" .. clean_template(self.type) + r = true + end + return r +end + +-- output tags +function classClass:decltype () + push(self) + self.type = regtype(self.original_name or self.name) + self.btype = typevar(self.base) + self.ctype = 'const '..self.type + if self.extra_bases then + for i=1,table.getn(self.extra_bases) do + self.extra_bases[i] = typevar(self.extra_bases[i]) + end + end + local i=1 + while self[i] do + self[i]:decltype() + i = i+1 + end + pop() +end + + +-- Print method +function classClass:print (ident,close) + print(ident.."Class{") + print(ident.." name = '"..self.name.."',") + print(ident.." base = '"..self.base.."';") + print(ident.." lname = '"..self.lname.."',") + print(ident.." type = '"..self.type.."',") + print(ident.." btype = '"..self.btype.."',") + print(ident.." ctype = '"..self.ctype.."',") + local i=1 + while self[i] do + self[i]:print(ident.." ",",") + i = i+1 + end + print(ident.."}"..close) +end + +function classClass:set_protected_destructor(p) + self.flags.protected_destructor = self.flags.protected_destructor or p +end + +-- Internal constructor +function _Class (t) + setmetatable(t,classClass) + t:buildnames() + append(t) + return t +end + +-- Constructor +-- Expects the name, the base (array) and the body of the class. +function Class (n,p,b) + + if table.getn(p) > 1 then + b = string.sub(b, 1, -2) + for i=2,table.getn(p),1 do + b = b.."\n tolua_inherits "..p[i].." __"..p[i].."__;\n" + end + b = b.."\n}" + end + + -- check for template + b = string.gsub(b, "^{%s*TEMPLATE_BIND", "{\nTOLUA_TEMPLATE_BIND") + local t,_,T,I = string.find(b, '^{%s*TOLUA_TEMPLATE_BIND%s*%(+%s*\"?([^\",]*)\"?%s*,%s*([^%)]*)%s*%)+') + if t then + + -- remove quotes + I = string.gsub(I, "\"", "") + T = string.gsub(T, "\"", "") + -- get type list + local types = split_c_tokens(I, ",") + -- remove TEMPLATE_BIND line + local bs = string.gsub(b, "^{%s*TOLUA_TEMPLATE_BIND[^\n]*\n", "{\n") + + local Tl = split(T, " ") + local tc = TemplateClass(n, p, bs, Tl) + + + tc:throw(types, true) + --for i=1,types.n do + -- tc:throw(split_c_tokens(types[i], " "), true) + --end + return + end + + local mbase + + if p then + mbase = table.remove(p, 1) + if not p[1] then p = nil end + end + + mbase = mbase and resolve_template_types(mbase) + + local c + local oname = string.gsub(n, "@.*$", "") + oname = getnamespace(classContainer.curr)..oname + + if _global_classes[oname] then + c = _global_classes[oname] + if mbase and ((not c.base) or c.base == "") then + c.base = mbase + end + else + c = _Class(_Container{name=n, base=mbase, extra_bases=p}) + + local ft = getnamespace(c.parent)..c.original_name + append_global_type(ft, c) + end + + push(c) + c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces + pop() +end + diff --git a/tolua++-1.0.93/src/bin/lua/clean.lua b/tolua++-1.0.93/src/bin/lua/clean.lua new file mode 100644 index 000000000..fd5b7b635 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/clean.lua @@ -0,0 +1,79 @@ +-- mark up comments and strings +STR1 = "\001" +STR2 = "\002" +STR3 = "\003" +STR4 = "\004" +REM = "\005" +ANY = "([\001-\005])" +ESC1 = "\006" +ESC2 = "\007" + +MASK = { -- the substitution order is important + {ESC1, "\\'"}, + {ESC2, '\\"'}, + {STR1, "'"}, + {STR2, '"'}, + {STR3, "%[%["}, + {STR4, "%]%]"}, + {REM , "%-%-"}, +} + +function mask (s) + for i = 1,getn(MASK) do + s = gsub(s,MASK[i][2],MASK[i][1]) + end + return s +end + +function unmask (s) + for i = 1,getn(MASK) do + s = gsub(s,MASK[i][1],MASK[i][2]) + end + return s +end + +function clean (s) + -- check for compilation error + local code = "return function ()\n" .. s .. "\n end" + if not dostring(code) then + return nil + end + + if flags['C'] then + return s + end + + local S = "" -- saved string + + s = mask(s) + + -- remove blanks and comments + while 1 do + local b,e,d = strfind(s,ANY) + if b then + S = S..strsub(s,1,b-1) + s = strsub(s,b+1) + if d==STR1 or d==STR2 then + e = strfind(s,d) + S = S ..d..strsub(s,1,e) + s = strsub(s,e+1) + elseif d==STR3 then + e = strfind(s,STR4) + S = S..d..strsub(s,1,e) + s = strsub(s,e+1) + elseif d==REM then + s = gsub(s,"[^\n]*(\n?)","%1",1) + end + else + S = S..s + break + end + end + -- eliminate unecessary spaces + S = gsub(S,"[ \t]+"," ") + S = gsub(S,"[ \t]*\n[ \t]*","\n") + S = gsub(S,"\n+","\n") + S = unmask(S) + return S +end + diff --git a/tolua++-1.0.93/src/bin/lua/code.lua b/tolua++-1.0.93/src/bin/lua/code.lua new file mode 100644 index 000000000..5e19b6bbf --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/code.lua @@ -0,0 +1,105 @@ +-- tolua: code class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1999 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + +-- global +code_n = 1 + +-- Code class +-- Represents Lua code to be compiled and included +-- in the initialization function. +-- The following fields are stored: +-- text = text code +classCode = { + text = '', +} +classCode.__index = classCode +setmetatable(classCode,classFeature) + +-- register code +function classCode:register (pre) + pre = pre or '' + -- clean Lua code + local s = clean(self.text) + if not s then + --print(self.text) + error("parser error in embedded code") + end + + -- get first line + local _, _, first_line=string.find(self.text, "^([^\n\r]*)") + if string.find(first_line, "^%s*%-%-") then + if string.find(first_line, "^%-%-##") then + first_line = string.gsub(first_line, "^%-%-##", "") + if flags['C'] then + s = string.gsub(s, "^%-%-##[^\n\r]*\n", "") + end + end + else + first_line = "" + end + + -- pad to 16 bytes + local npad = 16 - (#s % 16) + local spad = "" + for i=1,npad do + spad = spad .. "-" + end + s = s..spad + + -- convert to C + output('\n'..pre..'{ /* begin embedded lua code */\n') + output(pre..' int top = lua_gettop(tolua_S);') + output(pre..' static const unsigned char B[] = {\n ') + local t={n=0} + + local b = gsub(s,'(.)',function (c) + local e = '' + t.n=t.n+1 if t.n==15 then t.n=0 e='\n'..pre..' ' end + return format('%3u,%s',strbyte(c),e) + end + ) + output(b..strbyte(" ")) + output('\n'..pre..' };\n') + if first_line and first_line ~= "" then + output(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: '..first_line..'");') + else + output(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code '..code_n..'");') + end + output(pre..' lua_settop(tolua_S, top);') + output(pre..'} /* end of embedded lua code */\n\n') + code_n = code_n +1 +end + + +-- Print method +function classCode:print (ident,close) + print(ident.."Code{") + print(ident.." text = [["..self.text.."]],") + print(ident.."}"..close) +end + + +-- Internal constructor +function _Code (t) + setmetatable(t,classCode) + append(t) + return t +end + +-- Constructor +-- Expects a string representing the code text +function Code (l) + return _Code { + text = l + } +end + + diff --git a/tolua++-1.0.93/src/bin/lua/compat-5.1.lua b/tolua++-1.0.93/src/bin/lua/compat-5.1.lua new file mode 100644 index 000000000..c2642d3a6 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/compat-5.1.lua @@ -0,0 +1,57 @@ +if string.find(_VERSION, "5%.0") then
+ return
+end
+
+-- "loadfile"
+local function pp_dofile(path)
+
+ local loaded = false
+ local getfile = function()
+
+ if loaded then
+ return
+ else
+ local file,err = io.open(path)
+ if not file then
+ error("error loading file "..path..": "..err)
+ end
+ local ret = file:read("*a")
+ file:close()
+
+ ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};")
+
+ loaded = true
+ return ret
+ end
+ end
+
+ local f = load(getfile, path)
+ if not f then
+
+ error("error loading file "..path)
+ end
+ return f()
+end
+
+old_dofile = dofile
+dofile = pp_dofile
+
+
+-- string.gsub
+--[[
+local ogsub = string.gsub
+local function compgsub(a,b,c,d)
+ if type(c) == "function" then
+ local oc = c
+ c = function (...) return oc(...) or '' end
+ end
+ return ogsub(a,b,c,d)
+end
+string.repl = ogsub
+--]]
+
+--string.gsub = compgsub
+
+
+
+
diff --git a/tolua++-1.0.93/src/bin/lua/compat.lua b/tolua++-1.0.93/src/bin/lua/compat.lua new file mode 100644 index 000000000..45d6ae1ba --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/compat.lua @@ -0,0 +1,193 @@ +------------------------------------------------------------------- +-- Real globals +-- _ALERT +-- _ERRORMESSAGE +-- _VERSION +-- _G +-- assert +-- error +-- metatable +-- next +-- print +-- require +-- tonumber +-- tostring +-- type +-- unpack + +------------------------------------------------------------------- +-- collectgarbage +-- gcinfo + +-- globals + +-- call -> protect(f, err) +-- loadfile +-- loadstring + +-- rawget +-- rawset + +-- getargs = Main.getargs ?? + +rawtype = type + +function do_ (f, err) + if not f then print(err); return end + local a,b = pcall(f) + if not a then print(b); return nil + else return b or true + end +end + +function dostring(s) return do_(loadstring(s)) end +-- function dofile(s) return do_(loadfile(s)) end + +------------------------------------------------------------------- +-- Table library +local tab = table +foreach = tab.foreach +foreachi = tab.foreachi +getn = tab.getn +tinsert = tab.insert +tremove = tab.remove +sort = tab.sort + +------------------------------------------------------------------- +-- Debug library +local dbg = debug +getinfo = dbg.getinfo +getlocal = dbg.getlocal +setcallhook = function () error"`setcallhook' is deprecated" end +setlinehook = function () error"`setlinehook' is deprecated" end +setlocal = dbg.setlocal + +------------------------------------------------------------------- +-- math library +local math = math +abs = math.abs +acos = function (x) return math.deg(math.acos(x)) end +asin = function (x) return math.deg(math.asin(x)) end +atan = function (x) return math.deg(math.atan(x)) end +atan2 = function (x,y) return math.deg(math.atan2(x,y)) end +ceil = math.ceil +cos = function (x) return math.cos(math.rad(x)) end +deg = math.deg +exp = math.exp +floor = math.floor +frexp = math.frexp +ldexp = math.ldexp +log = math.log +log10 = math.log10 +max = math.max +min = math.min +mod = math.mod +PI = math.pi +--??? pow = math.pow +rad = math.rad +random = math.random +randomseed = math.randomseed +sin = function (x) return math.sin(math.rad(x)) end +sqrt = math.sqrt +tan = function (x) return math.tan(math.rad(x)) end + +------------------------------------------------------------------- +-- string library +local str = string +strbyte = str.byte +strchar = str.char +strfind = str.find +format = str.format +gsub = str.gsub +strlen = str.len +strlower = str.lower +strrep = str.rep +strsub = str.sub +strupper = str.upper + +------------------------------------------------------------------- +-- os library +clock = os.clock +date = os.date +difftime = os.difftime +execute = os.execute --? +exit = os.exit +getenv = os.getenv +remove = os.remove +rename = os.rename +setlocale = os.setlocale +time = os.time +tmpname = os.tmpname + +------------------------------------------------------------------- +-- compatibility only +getglobal = function (n) return _G[n] end +setglobal = function (n,v) _G[n] = v end + +------------------------------------------------------------------- + +local io, tab = io, table + +-- IO library (files) +_STDIN = io.stdin +_STDERR = io.stderr +_STDOUT = io.stdout +_INPUT = io.stdin +_OUTPUT = io.stdout +seek = io.stdin.seek -- sick ;-) +tmpfile = io.tmpfile +closefile = io.close +openfile = io.open + +function flush (f) + if f then f:flush() + else _OUTPUT:flush() + end +end + +function readfrom (name) + if name == nil then + local f, err, cod = io.close(_INPUT) + _INPUT = io.stdin + return f, err, cod + else + local f, err, cod = io.open(name, "r") + _INPUT = f or _INPUT + return f, err, cod + end +end + +function writeto (name) + if name == nil then + local f, err, cod = io.close(_OUTPUT) + _OUTPUT = io.stdout + return f, err, cod + else + local f, err, cod = io.open(name, "w") + _OUTPUT = f or _OUTPUT + return f, err, cod + end +end + +function appendto (name) + local f, err, cod = io.open(name, "a") + _OUTPUT = f or _OUTPUT + return f, err, cod +end + +function read (...) + local f = _INPUT + if rawtype(arg[1]) == 'userdata' then + f = tab.remove(arg, 1) + end + return f:read(unpack(arg)) +end + +function write (...) + local f = _OUTPUT + if rawtype(arg[1]) == 'userdata' then + f = tab.remove(arg, 1) + end + return f:write(unpack(arg)) +end + diff --git a/tolua++-1.0.93/src/bin/lua/container.lua b/tolua++-1.0.93/src/bin/lua/container.lua new file mode 100644 index 000000000..2d11db7df --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/container.lua @@ -0,0 +1,786 @@ +-- tolua: container abstract class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + +-- table to store namespaced typedefs/enums in global scope +global_typedefs = {} +global_enums = {} + +-- Container class +-- Represents a container of features to be bound +-- to lua. +classContainer = +{ + curr = nil, +} +classContainer.__index = classContainer +setmetatable(classContainer,classFeature) + +-- output tags +function classContainer:decltype () + push(self) + local i=1 + while self[i] do + self[i]:decltype() + i = i+1 + end + pop() +end + + +-- write support code +function classContainer:supcode () + + if not self:check_public_access() then + return + end + + push(self) + local i=1 + while self[i] do + if self[i]:check_public_access() then + self[i]:supcode() + end + i = i+1 + end + pop() +end + +function classContainer:hasvar () + local i=1 + while self[i] do + if self[i]:isvariable() then + return 1 + end + i = i+1 + end + return 0 +end + +-- Internal container constructor +function _Container (self) + setmetatable(self,classContainer) + self.n = 0 + self.typedefs = {tolua_n=0} + self.usertypes = {} + self.enums = {tolua_n=0} + self.lnames = {} + return self +end + +-- push container +function push (t) + t.prox = classContainer.curr + classContainer.curr = t +end + +-- pop container +function pop () +--print("name",classContainer.curr.name) +--foreach(classContainer.curr.usertypes,print) +--print("______________") + classContainer.curr = classContainer.curr.prox +end + +-- get current namespace +function getcurrnamespace () + return getnamespace(classContainer.curr) +end + +-- append to current container +function append (t) + return classContainer.curr:append(t) +end + +-- append typedef to current container +function appendtypedef (t) + return classContainer.curr:appendtypedef(t) +end + +-- append usertype to current container +function appendusertype (t) + return classContainer.curr:appendusertype(t) +end + +-- append enum to current container +function appendenum (t) + return classContainer.curr:appendenum(t) +end + +-- substitute typedef +function applytypedef (mod,type) + return classContainer.curr:applytypedef(mod,type) +end + +-- check if is type +function findtype (type) + local t = classContainer.curr:findtype(type) + return t +end + +-- check if is typedef +function istypedef (type) + return classContainer.curr:istypedef(type) +end + +-- get fulltype (with namespace) +function fulltype (t) + local curr = classContainer.curr + while curr do + if curr then + if curr.typedefs and curr.typedefs[t] then + return curr.typedefs[t] + elseif curr.usertypes and curr.usertypes[t] then + return curr.usertypes[t] + end + end + curr = curr.prox + end + return t +end + +-- checks if it requires collection +function classContainer:requirecollection (t) + push(self) + local i=1 + local r = false + while self[i] do + r = self[i]:requirecollection(t) or r + i = i+1 + end + pop() + return r +end + + +-- get namesapce +function getnamespace (curr) + local namespace = '' + while curr do + if curr and + ( curr.classtype == 'class' or curr.classtype == 'namespace') + then + namespace = (curr.original_name or curr.name) .. '::' .. namespace + --namespace = curr.name .. '::' .. namespace + end + curr = curr.prox + end + return namespace +end + +-- get namespace (only namespace) +function getonlynamespace () + local curr = classContainer.curr + local namespace = '' + while curr do + if curr.classtype == 'class' then + return namespace + elseif curr.classtype == 'namespace' then + namespace = curr.name .. '::' .. namespace + end + curr = curr.prox + end + return namespace +end + +-- check if is enum +function isenum (type) + return classContainer.curr:isenum(type) +end + +-- append feature to container +function classContainer:append (t) + self.n = self.n + 1 + self[self.n] = t + t.parent = self +end + +-- append typedef +function classContainer:appendtypedef (t) + local namespace = getnamespace(classContainer.curr) + self.typedefs.tolua_n = self.typedefs.tolua_n + 1 + self.typedefs[self.typedefs.tolua_n] = t + self.typedefs[t.utype] = namespace .. t.utype + global_typedefs[namespace..t.utype] = t + t.ftype = findtype(t.type) or t.type + --print("appending typedef "..t.utype.." as "..namespace..t.utype.." with ftype "..t.ftype) + append_global_type(namespace..t.utype) + if t.ftype and isenum(t.ftype) then + + global_enums[namespace..t.utype] = true + end +end + +-- append usertype: return full type +function classContainer:appendusertype (t) + local container + if t == (self.original_name or self.name) then + container = self.prox + else + container = self + end + local ft = getnamespace(container) .. t + container.usertypes[t] = ft + _usertype[ft] = ft + return ft +end + +-- append enum +function classContainer:appendenum (t) + local namespace = getnamespace(classContainer.curr) + self.enums.tolua_n = self.enums.tolua_n + 1 + self.enums[self.enums.tolua_n] = t + global_enums[namespace..t.name] = t +end + +-- determine lua function name overload +function classContainer:overload (lname) + if not self.lnames[lname] then + self.lnames[lname] = 0 + else + self.lnames[lname] = self.lnames[lname] + 1 + end + return format("%02d",self.lnames[lname]) +end + +-- applies typedef: returns the 'the facto' modifier and type +function classContainer:applytypedef (mod,type) + if global_typedefs[type] then + --print("found typedef "..global_typedefs[type].type) + local mod1, type1 = global_typedefs[type].mod, global_typedefs[type].ftype + local mod2, type2 = applytypedef(mod.." "..mod1, type1) + --return mod2 .. ' ' .. mod1, type2 + return mod2, type2 + end + do return mod,type end +end + +-- check if it is a typedef +function classContainer:istypedef (type) + local env = self + while env do + if env.typedefs then + local i=1 + while env.typedefs[i] do + if env.typedefs[i].utype == type then + return type + end + i = i+1 + end + end + env = env.parent + end + return nil +end + +function find_enum_var(var) + + if tonumber(var) then return var end + + local c = classContainer.curr + while c do + local ns = getnamespace(c) + for k,v in pairs(_global_enums) do + if match_type(var, v, ns) then + return v + end + end + if c.base and c.base ~= '' then + c = _global_classes[c:findtype(c.base)] + else + c = nil + end + end + + return var +end + +-- check if is a registered type: return full type or nil +function classContainer:findtype (t) + + t = string.gsub(t, "=.*", "") + if _basic[t] then + return t + end + + local _,_,em = string.find(t, "([&%*])%s*$") + t = string.gsub(t, "%s*([&%*])%s*$", "") + p = self + while p and type(p)=='table' do + local st = getnamespace(p) + + for i=_global_types.n,1,-1 do -- in reverse order + + if match_type(t, _global_types[i], st) then + return _global_types[i]..(em or "") + end + end + if p.base and p.base ~= '' and p.base ~= t then + --print("type is "..t..", p is "..p.base.." self.type is "..self.type.." self.name is "..self.name) + p = _global_classes[p:findtype(p.base)] + else + p = nil + end + end + + return nil +end + +function append_global_type(t, class) + _global_types.n = _global_types.n +1 + _global_types[_global_types.n] = t + _global_types_hash[t] = 1 + if class then append_class_type(t, class) end +end + +function append_class_type(t,class) + if _global_classes[t] then + class.flags = _global_classes[t].flags + class.lnames = _global_classes[t].lnames + if _global_classes[t].base and (_global_classes[t].base ~= '') then + class.base = _global_classes[t].base or class.base + end + end + _global_classes[t] = class + class.flags = class.flags or {} +end + +function match_type(childtype, regtype, st) +--print("findtype "..childtype..", "..regtype..", "..st) + local b,e = string.find(regtype, childtype, -string.len(childtype), true) + if b then + + if e == string.len(regtype) and + (b == 1 or (string.sub(regtype, b-1, b-1) == ':' and + string.sub(regtype, 1, b-1) == string.sub(st, 1, b-1))) then + return true + end + end + + return false +end + +function findtype_on_childs(self, t) + + local tchild + if self.classtype == 'class' or self.classtype == 'namespace' then + for k,v in ipairs(self) do + if v.classtype == 'class' or v.classtype == 'namespace' then + if v.typedefs and v.typedefs[t] then + return v.typedefs[t] + elseif v.usertypes and v.usertypes[t] then + return v.usertypes[t] + end + tchild = findtype_on_childs(v, t) + if tchild then return tchild end + end + end + end + return nil + +end + +function classContainer:isenum (type) + if global_enums[type] then + return type + else + return false + end + + local basetype = gsub(type,"^.*::","") + local env = self + while env do + if env.enums then + local i=1 + while env.enums[i] do + if env.enums[i].name == basetype then + return true + end + i = i+1 + end + end + env = env.parent + end + return false +end + +methodisvirtual = false -- a global + +-- parse chunk +function classContainer:doparse (s) +--print ("parse "..s) + + -- try the parser hook + do + local sub = parser_hook(s) + if sub then + return sub + end + end + + -- try the null statement + do + local b,e,code = string.find(s, "^%s*;") + if b then + return strsub(s,e+1) + end + end + + -- try empty verbatim line + do + local b,e,code = string.find(s, "^%s*$\n") + if b then + return strsub(s,e+1) + end + end + + -- try Lua code + do + local b,e,code = strfind(s,"^%s*(%b\1\2)") + if b then + Code(strsub(code,2,-2)) + return strsub(s,e+1) + end + end + + -- try C code + do + local b,e,code = strfind(s,"^%s*(%b\3\4)") + if b then + code = '{'..strsub(code,2,-2)..'\n}\n' + Verbatim(code,'r') -- verbatim code for 'r'egister fragment + return strsub(s,e+1) + end + end + + -- try C code for preamble section + do + local b,e,code = string.find(s, "^%s*(%b\5\6)") + if b then + code = string.sub(code, 2, -2).."\n" + Verbatim(code, '') + return string.sub(s, e+1) + end + end + + -- try default_property directive + do + local b,e,ptype = strfind(s, "^%s*TOLUA_PROPERTY_TYPE%s*%(+%s*([^%)%s]*)%s*%)+%s*;?") + if b then + if not ptype or ptype == "" then + ptype = "default" + end + self:set_property_type(ptype) + return strsub(s, e+1) + end + end + + -- try protected_destructor directive + do + local b,e = string.find(s, "^%s*TOLUA_PROTECTED_DESTRUCTOR%s*;?") + if b then + if self.set_protected_destructor then + self:set_protected_destructor(true) + end + return strsub(s, e+1) + end + end + + -- try 'extern' keyword + do + local b,e = string.find(s, "^%s*extern%s+") + if b then + -- do nothing + return strsub(s, e+1) + end + end + + -- try 'virtual' keyworkd + do + local b,e = string.find(s, "^%s*virtual%s+") + if b then + methodisvirtual = true + return strsub(s, e+1) + end + end + + -- try labels (public, private, etc) + do + local b,e = string.find(s, "^%s*%w*%s*:[^:]") + if b then + return strsub(s, e) -- preserve the [^:] + end + end + + -- try module + do + local b,e,name,body = strfind(s,"^%s*module%s%s*([_%w][_%w]*)%s*(%b{})%s*") + if b then + _curr_code = strsub(s,b,e) + Module(name,body) + return strsub(s,e+1) + end + end + + -- try namesapce + do + local b,e,name,body = strfind(s,"^%s*namespace%s%s*([_%w][_%w]*)%s*(%b{})%s*;?") + if b then + _curr_code = strsub(s,b,e) + Namespace(name,body) + return strsub(s,e+1) + end + end + + -- try define + do + local b,e,name = strfind(s,"^%s*#define%s%s*([^%s]*)[^\n]*\n%s*") + if b then + _curr_code = strsub(s,b,e) + Define(name) + return strsub(s,e+1) + end + end + + -- try enumerates + + do + local b,e,name,body,varname = strfind(s,"^%s*enum%s+(%S*)%s*(%b{})%s*([^%s;]*)%s*;?%s*") + if b then + --error("#Sorry, declaration of enums and variables on the same statement is not supported.\nDeclare your variable separately (example: '"..name.." "..varname..";')") + _curr_code = strsub(s,b,e) + Enumerate(name,body,varname) + return strsub(s,e+1) + end + end + +-- do +-- local b,e,name,body = strfind(s,"^%s*enum%s+(%S*)%s*(%b{})%s*;?%s*") +-- if b then +-- _curr_code = strsub(s,b,e) +-- Enumerate(name,body) +-- return strsub(s,e+1) +-- end +-- end + + do + local b,e,body,name = strfind(s,"^%s*typedef%s+enum[^{]*(%b{})%s*([%w_][^%s]*)%s*;%s*") + if b then + _curr_code = strsub(s,b,e) + Enumerate(name,body) + return strsub(s,e+1) + end + end + + -- try operator + do + local b,e,decl,kind,arg,const = strfind(s,"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)%s*;%s*") + if not b then + -- try inline + b,e,decl,kind,arg,const = strfind(s,"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)[%s\n]*%b{}%s*;?%s*") + end + if not b then + -- try cast operator + b,e,decl,kind,arg,const = strfind(s, "^%s*(operator)%s+([%w_:%d<>%*%&%s]+)%s*(%b())%s*(c?o?n?s?t?)"); + if b then + local _,ie = string.find(s, "^%s*%b{}", e+1) + if ie then + e = ie + end + end + end + if b then + _curr_code = strsub(s,b,e) + Operator(decl,kind,arg,const) + return strsub(s,e+1) + end + end + + -- try function + do + --local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w])%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*") + local b,e,decl,arg,const,virt = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)%s*(=?%s*0?)%s*;%s*") + if not b then + -- try function with template + b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w]%b<>)%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*") + end + if not b then + -- try a single letter function name + b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)%s*;%s*") + end + if not b then + -- try function pointer + b,e,decl,arg,const = strfind(s,"^%s*([^%(;\n]+%b())%s*(%b())%s*;%s*") + if b then + decl = string.gsub(decl, "%(%s*%*([^%)]*)%s*%)", " %1 ") + end + end + if b then + if virt and string.find(virt, "[=0]") then + if self.flags then + self.flags.pure_virtual = true + end + end + _curr_code = strsub(s,b,e) + Function(decl,arg,const) + return strsub(s,e+1) + end + end + + -- try inline function + do + local b,e,decl,arg,const = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)[^;{]*%b{}%s*;?%s*") + --local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w>])%s*(%b())%s*(c?o?n?s?t?)[^;]*%b{}%s*;?%s*") + if not b then + -- try a single letter function name + b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?).-%b{}%s*;?%s*") + end + if b then + _curr_code = strsub(s,b,e) + Function(decl,arg,const) + return strsub(s,e+1) + end + end + + -- try class + do + local b,e,name,base,body + base = '' body = '' + b,e,name = strfind(s,"^%s*class%s*([_%w][_%w@]*)%s*;") -- dummy class + local dummy = false + if not b then + b,e,name = strfind(s,"^%s*struct%s*([_%w][_%w@]*)%s*;") -- dummy struct + if not b then + b,e,name,base,body = strfind(s,"^%s*class%s*([_%w][_%w@]*)%s*([^{]-)%s*(%b{})%s*") + if not b then + b,e,name,base,body = strfind(s,"^%s*struct%s+([_%w][_%w@]*)%s*([^{]-)%s*(%b{})%s*") + if not b then + b,e,name,base,body = strfind(s,"^%s*union%s*([_%w][_%w@]*)%s*([^{]-)%s*(%b{})%s*") + if not b then + base = '' + b,e,body,name = strfind(s,"^%s*typedef%s%s*struct%s%s*[_%w]*%s*(%b{})%s*([_%w][_%w@]*)%s*;") + end + end + end + else dummy = 1 end + else dummy = 1 end + if b then + if base ~= '' then + base = string.gsub(base, "^%s*:%s*", "") + base = string.gsub(base, "%s*public%s*", "") + base = split(base, ",") + --local b,e + --b,e,base = strfind(base,".-([_%w][_%w<>,:]*)$") + else + base = {} + end + _curr_code = strsub(s,b,e) + Class(name,base,body) + if not dummy then + varb,vare,varname = string.find(s, "^%s*([_%w]+)%s*;", e+1) + if varb then + Variable(name.." "..varname) + e = vare + end + end + return strsub(s,e+1) + end + end + + -- try typedef + do + local b,e,types = strfind(s,"^%s*typedef%s%s*(.-)%s*;%s*") + if b then + _curr_code = strsub(s,b,e) + Typedef(types) + return strsub(s,e+1) + end + end + + -- try variable + do + local b,e,decl = strfind(s,"^%s*([_%w][_@%s%w%d%*&:<>,]*[_%w%d])%s*;%s*") + if b then + _curr_code = strsub(s,b,e) + + local list = split_c_tokens(decl, ",") + Variable(list[1]) + if list.n > 1 then + local _,_,type = strfind(list[1], "(.-)%s+([^%s]*)$"); + + local i =2; + while list[i] do + Variable(type.." "..list[i]) + i=i+1 + end + end + --Variable(decl) + return strsub(s,e+1) + end + end + + -- try string + do + local b,e,decl = strfind(s,"^%s*([_%w]?[_%s%w%d]-char%s+[_@%w%d]*%s*%[%s*%S+%s*%])%s*;%s*") + if b then + _curr_code = strsub(s,b,e) + Variable(decl) + return strsub(s,e+1) + end + end + + -- try array + do + local b,e,decl = strfind(s,"^%s*([_%w][][_@%s%w%d%*&:<>]*[]_%w%d])%s*;%s*") + if b then + _curr_code = strsub(s,b,e) + Array(decl) + return strsub(s,e+1) + end + end + + -- no matching + if gsub(s,"%s%s*","") ~= "" then + _curr_code = s + error("#parse error") + else + return "" + end + +end + +function classContainer:parse (s) + + --self.curr_member_access = nil + + while s ~= '' do + s = self:doparse(s) + methodisvirtual = false + end +end + + +-- property types + +function get_property_type() + + return classContainer.curr:get_property_type() +end + +function classContainer:set_property_type(ptype) + ptype = string.gsub(ptype, "^%s*", "") + ptype = string.gsub(ptype, "%s*$", "") + + self.property_type = ptype +end + +function classContainer:get_property_type() + return self.property_type or (self.parent and self.parent:get_property_type()) or "default" +end diff --git a/tolua++-1.0.93/src/bin/lua/custom.lua b/tolua++-1.0.93/src/bin/lua/custom.lua new file mode 100644 index 000000000..293175ef9 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/custom.lua @@ -0,0 +1,45 @@ +
+function extract_code(fn,s)
+ local code = ""
+ if fn then
+ code = '\n$#include "'..fn..'"\n'
+ end
+ s= "\n" .. s .. "\n" -- add blank lines as sentinels
+ local _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n")
+ while e do
+ t = strlower(t)
+ if t == "bind_begin" then
+ _,e,c = strfind(s,"(.-)\n[^\n]*SCRIPT_BIND_END[^\n]*\n",e)
+ if not e then
+ tolua_error("Unbalanced 'SCRIPT_BIND_BEGIN' directive in header file")
+ end
+ end
+ if t == "bind_class" or t == "bind_block" then
+ local b
+ _,e,c,b = string.find(s, "([^{]-)(%b{})", e)
+ c = c..'{\n'..extract_code(nil, b)..'\n};\n'
+ end
+ code = code .. c .. "\n"
+ _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n",e)
+ end
+ return code
+end
+
+function preprocess_hook(p)
+end
+
+function preparse_hook(p)
+end
+
+function include_file_hook(p, filename)
+ do return end
+--print("FILENAME is "..filename)
+ p.code = string.gsub(p.code, "\n%s*SigC::Signal", "\n\ttolua_readonly SigC::Signal")
+ p.code = string.gsub(p.code, "#ifdef __cplusplus\nextern \"C\" {\n#endif", "")
+ p.code = string.gsub(p.code, "#ifdef __cplusplus\n};?\n#endif", "")
+ p.code = string.gsub(p.code, "DECLSPEC", "")
+ p.code = string.gsub(p.code, "SDLCALL", "")
+ p.code = string.gsub(p.code, "DLLINTERFACE", "")
+ p.code = string.gsub(p.code, "#define[^\n]*_[hH]_?%s*\n", "\n")
+--print("code is "..p.code)
+end
diff --git a/tolua++-1.0.93/src/bin/lua/declaration.lua b/tolua++-1.0.93/src/bin/lua/declaration.lua new file mode 100644 index 000000000..73bbe910e --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/declaration.lua @@ -0,0 +1,579 @@ +-- tolua: declaration class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Declaration class +-- Represents variable, function, or argument declaration. +-- Stores the following fields: +-- mod = type modifiers +-- type = type +-- ptr = "*" or "&", if representing a pointer or a reference +-- name = name +-- dim = dimension, if a vector +-- def = default value, if any (only for arguments) +-- ret = "*" or "&", if value is to be returned (only for arguments) +classDeclaration = { + mod = '', + type = '', + ptr = '', + name = '', + dim = '', + ret = '', + def = '' +} +classDeclaration.__index = classDeclaration +setmetatable(classDeclaration,classFeature) + +-- Create an unique variable name +function create_varname () + if not _varnumber then _varnumber = 0 end + _varnumber = _varnumber + 1 + return "tolua_var_".._varnumber +end + +-- Check declaration name +-- It also identifies default values +function classDeclaration:checkname () + + if strsub(self.name,1,1) == '[' and not findtype(self.type) then + self.name = self.type..self.name + local m = split(self.mod,'%s%s*') + self.type = m[m.n] + self.mod = concat(m,1,m.n-1) + end + + local t = split(self.name,'=') + if t.n==2 then + self.name = t[1] + self.def = find_enum_var(t[t.n]) + end + + local b,e,d = strfind(self.name,"%[(.-)%]") + if b then + self.name = strsub(self.name,1,b-1) + self.dim = find_enum_var(d) + end + + + if self.type ~= '' and self.type ~= 'void' and self.name == '' then + self.name = create_varname() + elseif self.kind=='var' then + if self.type=='' and self.name~='' then + self.type = self.type..self.name + self.name = create_varname() + elseif findtype(self.name) then + if self.type=='' then self.type = self.name + else self.type = self.type..' '..self.name end + self.name = create_varname() + end + end + + -- adjust type of string + if self.type == 'char' and self.dim ~= '' then + self.type = 'char*' + end + + if self.kind and self.kind == 'var' then + self.name = string.gsub(self.name, ":.*$", "") -- ??? + end +end + +-- Check declaration type +-- Substitutes typedef's. +function classDeclaration:checktype () + + -- check if there is a pointer to basic type + local basic = isbasic(self.type) + if self.kind == 'func' and basic=='number' and string.find(self.ptr, "%*") then + self.type = '_userdata' + self.ptr = "" + end + if basic and self.ptr~='' then + self.ret = self.ptr + self.ptr = nil + if isbasic(self.type) == 'number' then + self.return_userdata = true + end + end + + -- check if there is array to be returned + if self.dim~='' and self.ret~='' then + error('#invalid parameter: cannot return an array of values') + end + -- restore 'void*' and 'string*' + if self.type == '_userdata' then self.type = 'void*' + elseif self.type == '_cstring' then self.type = 'char*' + elseif self.type == '_lstate' then self.type = 'lua_State*' + end + + -- resolve types inside the templates + if self.type then + self.type = resolve_template_types(self.type) + end + +-- +-- -- if returning value, automatically set default value +-- if self.ret ~= '' and self.def == '' then +-- self.def = '0' +-- end +-- + +end + +function resolve_template_types(type) + + if isbasic(type) then + return type + end + local b,_,m = string.find(type, "(%b<>)") + if b then + + m = split_c_tokens(string.sub(m, 2, -2), ",") + for i=1, table.getn(m) do + m[i] = string.gsub(m[i],"%s*([%*&])", "%1") + if not isbasic(m[i]) then + if not isenum(m[i]) then _, m[i] = applytypedef("", m[i]) end + m[i] = findtype(m[i]) or m[i] + m[i] = resolve_template_types(m[i]) + end + end + + local b,i + type,b,i = break_template(type) +--print("concat is ",concat(m, 1, m.n)) + local template_part = "<"..concat(m, 1, m.n, ",")..">" + type = rebuild_template(type, b, template_part) + type = string.gsub(type, ">>", "> >") + end + return type +end + +function break_template(s) + local b,e,timpl = string.find(s, "(%b<>)") + if timpl then + s = string.gsub(s, "%b<>", "") + return s, b, timpl + else + return s, 0, nil + end +end + +function rebuild_template(s, b, timpl) + + if b == 0 then + return s + end + + return string.sub(s, 1, b-1)..timpl..string.sub(s, b, -1) +end + +-- Print method +function classDeclaration:print (ident,close) + print(ident.."Declaration{") + print(ident.." mod = '"..self.mod.."',") + print(ident.." type = '"..self.type.."',") + print(ident.." ptr = '"..self.ptr.."',") + print(ident.." name = '"..self.name.."',") + print(ident.." dim = '"..self.dim.."',") + print(ident.." def = '"..self.def.."',") + print(ident.." ret = '"..self.ret.."',") + print(ident.."}"..close) +end + +-- check if array of values are returned to Lua +function classDeclaration:requirecollection (t) + if self.mod ~= 'const' and + self.dim and self.dim ~= '' and + not isbasic(self.type) and + self.ptr == '' and self:check_public_access() then + local type = gsub(self.type,"%s*const%s+","") + t[type] = "tolua_collect_" .. clean_template(type) + return true + end + return false +end + +-- declare tag +function classDeclaration:decltype () + + self.type = typevar(self.type) + if strfind(self.mod,'const') then + self.type = 'const '..self.type + self.mod = gsub(self.mod,'const%s*','') + end +end + + +-- output type checking +function classDeclaration:outchecktype (narg) + local def + local t = isbasic(self.type) + if self.def~='' then + def = 1 + else + def = 0 + end + if self.dim ~= '' then + --if t=='string' then + -- return 'tolua_isstringarray(tolua_S,'..narg..','..def..',&tolua_err)' + --else + return '!tolua_istable(tolua_S,'..narg..',0,&tolua_err)' + --end + elseif t then + return '!tolua_is'..t..'(tolua_S,'..narg..','..def..',&tolua_err)' + else + local is_func = get_is_function(self.type) + if self.ptr == '&' or self.ptr == '' then + return '(tolua_isvaluenil(tolua_S,'..narg..',&tolua_err) || !'..is_func..'(tolua_S,'..narg..',"'..self.type..'",'..def..',&tolua_err))' + else + return '!'..is_func..'(tolua_S,'..narg..',"'..self.type..'",'..def..',&tolua_err)' + end + end +end + +function classDeclaration:builddeclaration (narg, cplusplus) + local array = self.dim ~= '' and tonumber(self.dim)==nil + local line = "" + local ptr = '' + local mod + local type = self.type + local nctype = gsub(self.type,'const%s+','') + if self.dim ~= '' then + type = gsub(self.type,'const%s+','') -- eliminates const modifier for arrays + end + if self.ptr~='' and not isbasic(type) then ptr = '*' end + line = concatparam(line," ",self.mod,type,ptr) + if array then + line = concatparam(line,'*') + end + line = concatparam(line,self.name) + if self.dim ~= '' then + if tonumber(self.dim)~=nil then + line = concatparam(line,'[',self.dim,'];') + else + if cplusplus then + line = concatparam(line,' = Mtolua_new_dim(',type,ptr,', '..self.dim..');') + else + line = concatparam(line,' = (',type,ptr,'*)', + 'malloc((',self.dim,')*sizeof(',type,ptr,'));') + end + end + else + local t = isbasic(type) + line = concatparam(line,' = ') + if t == 'state' then + line = concatparam(line, 'tolua_S;') + else + --print("t is "..tostring(t)..", ptr is "..tostring(self.ptr)) + if t == 'number' and string.find(self.ptr, "%*") then + t = 'userdata' + end + if not t and ptr=='' then line = concatparam(line,'*') end + line = concatparam(line,'((',self.mod,type) + if not t then + line = concatparam(line,'*') + end + line = concatparam(line,') ') + if isenum(nctype) then + line = concatparam(line,'(int) ') + end + local def = 0 + if self.def ~= '' then + def = self.def + if (ptr == '' or self.ptr == '&') and not t then + def = "(void*)&(const "..type..")"..def + end + end + if t then + line = concatparam(line,'tolua_to'..t,'(tolua_S,',narg,',',def,'));') + else + local to_func = get_to_function(type) + line = concatparam(line,to_func..'(tolua_S,',narg,',',def,'));') + end + end + end + return line +end + +-- Declare variable +function classDeclaration:declare (narg) + if self.dim ~= '' and tonumber(self.dim)==nil then + output('#ifdef __cplusplus\n') + output(self:builddeclaration(narg,true)) + output('#else\n') + output(self:builddeclaration(narg,false)) + output('#endif\n') + else + output(self:builddeclaration(narg,false)) + end +end + +-- Get parameter value +function classDeclaration:getarray (narg) + if self.dim ~= '' then + local type = gsub(self.type,'const ','') + output(' {') + output('#ifndef TOLUA_RELEASE\n') + local def; if self.def~='' then def=1 else def=0 end + local t = isbasic(type) + if (t) then + output(' if (!tolua_is'..t..'array(tolua_S,',narg,',',self.dim,',',def,',&tolua_err))') + else + output(' if (!tolua_isusertypearray(tolua_S,',narg,',"',type,'",',self.dim,',',def,',&tolua_err))') + end + output(' goto tolua_lerror;') + output(' else\n') + output('#endif\n') + output(' {') + output(' int i;') + output(' for(i=0; i<'..self.dim..';i++)') + local t = isbasic(type) + local ptr = '' + if self.ptr~='' then ptr = '*' end + output(' ',self.name..'[i] = ') + if not t and ptr=='' then output('*') end + output('((',type) + if not t then + output('*') + end + output(') ') + local def = 0 + if self.def ~= '' then def = self.def end + if t then + output('tolua_tofield'..t..'(tolua_S,',narg,',i+1,',def,'));') + else + output('tolua_tofieldusertype(tolua_S,',narg,',i+1,',def,'));') + end + output(' }') + output(' }') + end +end + +-- Get parameter value +function classDeclaration:setarray (narg) + if not strfind(self.type,'const%s+') and self.dim ~= '' then + local type = gsub(self.type,'const ','') + output(' {') + output(' int i;') + output(' for(i=0; i<'..self.dim..';i++)') + local t,ct = isbasic(type) + if t then + output(' tolua_pushfield'..t..'(tolua_S,',narg,',i+1,(',ct,')',self.name,'[i]);') + else + if self.ptr == '' then + output(' {') + output('#ifdef __cplusplus\n') + output(' void* tolua_obj = Mtolua_new((',type,')(',self.name,'[i]));') + output(' tolua_pushfieldusertype_and_takeownership(tolua_S,',narg,',i+1,tolua_obj,"',type,'");') + output('#else\n') + output(' void* tolua_obj = tolua_copy(tolua_S,(void*)&',self.name,'[i],sizeof(',type,'));') + output(' tolua_pushfieldusertype(tolua_S,',narg,',i+1,tolua_obj,"',type,'");') + output('#endif\n') + output(' }') + else + output(' tolua_pushfieldusertype(tolua_S,',narg,',i+1,(void*)',self.name,'[i],"',type,'");') + end + end + output(' }') + end +end + +-- Free dynamically allocated array +function classDeclaration:freearray () + if self.dim ~= '' and tonumber(self.dim)==nil then + output('#ifdef __cplusplus\n') + output(' Mtolua_delete_dim(',self.name,');') + output('#else\n') + output(' free(',self.name,');') + output('#endif\n') + end +end + +-- Pass parameter +function classDeclaration:passpar () + if self.ptr=='&' and not isbasic(self.type) then + output('*'..self.name) + elseif self.ret=='*' then + output('&'..self.name) + else + output(self.name) + end +end + +-- Return parameter value +function classDeclaration:retvalue () + if self.ret ~= '' then + local t,ct = isbasic(self.type) + if t and t~='' then + output(' tolua_push'..t..'(tolua_S,(',ct,')'..self.name..');') + else + local push_func = get_push_function(self.type) + output(' ',push_func,'(tolua_S,(void*)'..self.name..',"',self.type,'");') + end + return 1 + end + return 0 +end + +-- Internal constructor +function _Declaration (t) + + setmetatable(t,classDeclaration) + t:buildnames() + t:checkname() + t:checktype() + local ft = findtype(t.type) or t.type + if not isenum(ft) then + t.mod, t.type = applytypedef(t.mod, ft) + end + + if t.kind=="var" and (string.find(t.mod, "tolua_property%s") or string.find(t.mod, "tolua_property$")) then + t.mod = string.gsub(t.mod, "tolua_property", "tolua_property__"..get_property_type()) + end + + return t +end + +-- Constructor +-- Expects the string declaration. +-- The kind of declaration can be "var" or "func". +function Declaration (s,kind,is_parameter) + + -- eliminate spaces if default value is provided + s = gsub(s,"%s*=%s*","=") + s = gsub(s, "%s*<", "<") + + local defb,tmpdef + defb,_,tmpdef = string.find(s, "(=.*)$") + if defb then + s = string.gsub(s, "=.*$", "") + else + tmpdef = '' + end + if kind == "var" then + -- check the form: void + if s == '' or s == 'void' then + return _Declaration{type = 'void', kind = kind, is_parameter = is_parameter} + end + end + + -- check the form: mod type*& name + local t = split_c_tokens(s,'%*%s*&') + if t.n == 2 then + if kind == 'func' then + error("#invalid function return type: "..s) + end + --local m = split(t[1],'%s%s*') + local m = split_c_tokens(t[1],'%s+') + return _Declaration{ + name = t[2]..tmpdef, + ptr = '*', + ret = '&', + --type = rebuild_template(m[m.n], tb, timpl), + type = m[m.n], + mod = concat(m,1,m.n-1), + is_parameter = is_parameter, + kind = kind + } + end + + -- check the form: mod type** name + t = split_c_tokens(s,'%*%s*%*') + if t.n == 2 then + if kind == 'func' then + error("#invalid function return type: "..s) + end + --local m = split(t[1],'%s%s*') + local m = split_c_tokens(t[1],'%s+') + return _Declaration{ + name = t[2]..tmpdef, + ptr = '*', + ret = '*', + --type = rebuild_template(m[m.n], tb, timpl), + type = m[m.n], + mod = concat(m,1,m.n-1), + is_parameter = is_parameter, + kind = kind + } + end + + -- check the form: mod type& name + t = split_c_tokens(s,'&') + if t.n == 2 then + --local m = split(t[1],'%s%s*') + local m = split_c_tokens(t[1],'%s+') + return _Declaration{ + name = t[2]..tmpdef, + ptr = '&', + --type = rebuild_template(m[m.n], tb, timpl), + type = m[m.n], + mod = concat(m,1,m.n-1), + is_parameter = is_parameter, + kind = kind + } + end + + -- check the form: mod type* name + local s1 = gsub(s,"(%b\[\])",function (n) return gsub(n,'%*','\1') end) + t = split_c_tokens(s1,'%*') + if t.n == 2 then + t[2] = gsub(t[2],'\1','%*') -- restore * in dimension expression + --local m = split(t[1],'%s%s*') + local m = split_c_tokens(t[1],'%s+') + return _Declaration{ + name = t[2]..tmpdef, + ptr = '*', + type = m[m.n], + --type = rebuild_template(m[m.n], tb, timpl), + mod = concat(m,1,m.n-1) , + is_parameter = is_parameter, + kind = kind + } + end + + if kind == 'var' then + -- check the form: mod type name + --t = split(s,'%s%s*') + t = split_c_tokens(s,'%s+') + local v + if findtype(t[t.n]) then v = create_varname() else v = t[t.n]; t.n = t.n-1 end + return _Declaration{ + name = v..tmpdef, + --type = rebuild_template(t[t.n], tb, timpl), + type = t[t.n], + mod = concat(t,1,t.n-1), + is_parameter = is_parameter, + kind = kind + } + + else -- kind == "func" + + -- check the form: mod type name + --t = split(s,'%s%s*') + t = split_c_tokens(s,'%s+') + local v = t[t.n] -- last word is the function name + local tp,md + if t.n>1 then + tp = t[t.n-1] + md = concat(t,1,t.n-2) + end + --if tp then tp = rebuild_template(tp, tb, timpl) end + return _Declaration{ + name = v, + type = tp, + mod = md, + is_parameter = is_parameter, + kind = kind + } + end + +end + diff --git a/tolua++-1.0.93/src/bin/lua/define.lua b/tolua++-1.0.93/src/bin/lua/define.lua new file mode 100644 index 000000000..96a28d878 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/define.lua @@ -0,0 +1,63 @@ +-- tolua: define class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: define.lua,v 1.2 1999/07/28 22:21:08 celes Exp $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Define class +-- Represents a numeric const definition +-- The following filds are stored: +-- name = constant name +classDefine = { + name = '', +} +classDefine.__index = classDefine +setmetatable(classDefine,classFeature) + +-- register define +function classDefine:register (pre) + if not self:check_public_access() then + return + end + + pre = pre or '' + output(pre..'tolua_constant(tolua_S,"'..self.lname..'",'..self.name..');') +end + +-- Print method +function classDefine:print (ident,close) + print(ident.."Define{") + print(ident.." name = '"..self.name.."',") + print(ident.." lname = '"..self.lname.."',") + print(ident.."}"..close) +end + + +-- Internal constructor +function _Define (t) + setmetatable(t,classDefine) + t:buildnames() + + if t.name == '' then + error("#invalid define") + end + + append(t) + return t +end + +-- Constructor +-- Expects a string representing the constant name +function Define (n) + return _Define{ + name = n + } +end + + diff --git a/tolua++-1.0.93/src/bin/lua/doit.lua b/tolua++-1.0.93/src/bin/lua/doit.lua new file mode 100644 index 000000000..4ddfc61fa --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/doit.lua @@ -0,0 +1,101 @@ +-- Generate binding code +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- Last update: Apr 2003 +-- $Id: $ + + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + +function parse_extra() + + for k,v in ipairs(_extra_parameters or {}) do + + local b,e,name,value = string.find(v, "^([^=]*)=(.*)$") + if b then + _extra_parameters[name] = value + else + _extra_parameters[v] = true + end + end +end + +function doit () + -- define package name, if not provided + if not flags.n then + if flags.f then + flags.n = gsub(flags.f,"%..*$","") + _,_,flags.n = string.find(flags.n, "([^/\\]*)$") + else + error("#no package name nor input file provided") + end + end + + -- parse table with extra paramters + parse_extra() + + -- do this after setting the package name + if flags['L'] then + dofile(flags['L']) + end + + -- add cppstring + if not flags['S'] then + _basic['string'] = 'cppstring' + _basic['std::string'] = 'cppstring' + _basic_ctype.cppstring = 'const char*' + end + + -- proccess package + local p = Package(flags.n,flags.f) + + if flags.p then + return -- only parse + end + + if flags.o then + local st,msg = writeto(flags.o) + if not st then + error('#'..msg) + end + end + + p:decltype() + if flags.P then + p:print() + else + push(p) + pre_output_hook(p) + pop() + p:preamble() + p:supcode() + push(p) + pre_register_hook(p) + pop() + p:register() + push(p) + post_output_hook(p) + pop() + end + + if flags.o then + writeto() + end + + -- write header file + if not flags.P then + if flags.H then + local st,msg = writeto(flags.H) + if not st then + error('#'..msg) + end + p:header() + writeto() + end + end +end + diff --git a/tolua++-1.0.93/src/bin/lua/enumerate.lua b/tolua++-1.0.93/src/bin/lua/enumerate.lua new file mode 100644 index 000000000..99fe74629 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/enumerate.lua @@ -0,0 +1,106 @@ +-- tolua: enumerate class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: enumerate.lua,v 1.3 2000/01/24 20:41:15 celes Exp $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Enumerate class +-- Represents enumeration +-- The following fields are stored: +-- {i} = list of constant names +classEnumerate = { +} +classEnumerate.__index = classEnumerate +setmetatable(classEnumerate,classFeature) + +-- register enumeration +function classEnumerate:register (pre) + if not self:check_public_access() then + return + end + pre = pre or '' + local nspace = getnamespace(classContainer.curr) + local i=1 + while self[i] do + if self.lnames[i] and self.lnames[i] ~= "" then + + output(pre..'tolua_constant(tolua_S,"'..self.lnames[i]..'",'..nspace..self[i]..');') + end + i = i+1 + end +end + +-- Print method +function classEnumerate:print (ident,close) + print(ident.."Enumerate{") + print(ident.." name = "..self.name) + local i=1 + while self[i] do + print(ident.." '"..self[i].."'("..self.lnames[i].."),") + i = i+1 + end + print(ident.."}"..close) +end + +-- Internal constructor +function _Enumerate (t,varname) + setmetatable(t,classEnumerate) + append(t) + appendenum(t) + if varname and varname ~= "" then + if t.name ~= "" then + Variable(t.name.." "..varname) + else + local ns = getcurrnamespace() + warning("Variable "..ns..varname.." of type <anonymous enum> is declared as read-only") + Variable("tolua_readonly int "..varname) + end + end + local parent = classContainer.curr + if parent then + t.access = parent.curr_member_access + t.global_access = t:check_public_access() + end +return t +end + +-- Constructor +-- Expects a string representing the enumerate body +function Enumerate (n,b,varname) + b = string.gsub(b, ",[%s\n]*}", "\n}") -- eliminate last ',' + local t = split(strsub(b,2,-2),',') -- eliminate braces + local i = 1 + local e = {n=0} + while t[i] do + local tt = split(t[i],'=') -- discard initial value + e.n = e.n + 1 + e[e.n] = tt[1] + i = i+1 + end + -- set lua names + i = 1 + e.lnames = {} + local ns = getcurrnamespace() + while e[i] do + local t = split(e[i],'@') + e[i] = t[1] + if not t[2] then + t[2] = applyrenaming(t[1]) + end + e.lnames[i] = t[2] or t[1] + _global_enums[ ns..e[i] ] = (ns..e[i]) + i = i+1 + end + e.name = n + if n ~= "" then + Typedef("int "..n) + end + return _Enumerate(e, varname) +end + diff --git a/tolua++-1.0.93/src/bin/lua/feature.lua b/tolua++-1.0.93/src/bin/lua/feature.lua new file mode 100644 index 000000000..042b5d28e --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/feature.lua @@ -0,0 +1,139 @@ +-- tolua: abstract feature class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Feature class +-- Represents the base class of all mapped feature. +classFeature = { +} +classFeature.__index = classFeature + +-- write support code +function classFeature:supcode () +end + +-- output tag +function classFeature:decltype () +end + +-- register feature +function classFeature:register (pre) +end + +-- translate verbatim +function classFeature:preamble () +end + +-- check if it is a variable +function classFeature:isvariable () + return false +end + +-- check if it requires collection +function classFeature:requirecollection (t) + return false +end + +-- build names +function classFeature:buildnames () + if self.name and self.name~='' then + local n = split(self.name,'@') + self.name = n[1] + self.name = string.gsub(self.name, ":%d*$", "") + if not n[2] then + n[2] = applyrenaming(n[1]) + end + self.lname = n[2] or gsub(n[1],"%[.-%]","") + self.lname = string.gsub(self.lname, ":%d*$", "") + self.original_name = self.name + self.lname = clean_template(self.lname) + end + if not self.is_parameter then + self.name = getonlynamespace() .. self.name + end + + local parent = classContainer.curr + if parent then + self.access = parent.curr_member_access + self.global_access = self:check_public_access() + else + end +end + +function classFeature:check_public_access() + + if type(self.global_access) == "boolean" then + return self.global_access + end + + if self.access and self.access ~= 0 then + return false + end + + local parent = classContainer.curr + while parent do + if parent.access and parent.access ~= 0 then + return false + end + parent = parent.prox + end + return true +end + +function clean_template(t) + + return string.gsub(t, "[<>:, %*]", "_") +end + +-- check if feature is inside a container definition +-- it returns the container class name or nil. +function classFeature:incontainer (which) + if self.parent then + local parent = self.parent + while parent do + if parent.classtype == which then + return parent.name + end + parent = parent.parent + end + end + return nil +end + +function classFeature:inclass () + return self:incontainer('class') +end + +function classFeature:inmodule () + return self:incontainer('module') +end + +function classFeature:innamespace () + return self:incontainer('namespace') +end + +-- return C binding function name based on name +-- the client specifies a prefix +function classFeature:cfuncname (n) + + if self.parent then + n = self.parent:cfuncname(n) + end + + local fname = self.lname + if not fname or fname == '' then + fname = self.name + end + n = string.gsub(n..'_'.. (fname), "[<>:, \.%*&]", "_") + + return n +end + diff --git a/tolua++-1.0.93/src/bin/lua/function.lua b/tolua++-1.0.93/src/bin/lua/function.lua new file mode 100644 index 000000000..2358e9ff7 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/function.lua @@ -0,0 +1,577 @@ +-- tolua: function class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + + +-- Function class +-- Represents a function or a class method. +-- The following fields are stored: +-- mod = type modifiers +-- type = type +-- ptr = "*" or "&", if representing a pointer or a reference +-- name = name +-- lname = lua name +-- args = list of argument declarations +-- const = if it is a method receiving a const "this". +classFunction = { + mod = '', + type = '', + ptr = '', + name = '', + args = {n=0}, + const = '', +} +classFunction.__index = classFunction +setmetatable(classFunction,classFeature) + +-- declare tags +function classFunction:decltype () + self.type = typevar(self.type) + if strfind(self.mod,'const') then + self.type = 'const '..self.type + self.mod = gsub(self.mod,'const','') + end + local i=1 + while self.args[i] do + self.args[i]:decltype() + i = i+1 + end +end + + +-- Write binding function +-- Outputs C/C++ binding function. +function classFunction:supcode (local_constructor) + + local overload = strsub(self.cname,-2,-1) - 1 -- indicate overloaded func + local nret = 0 -- number of returned values + local class = self:inclass() + local _,_,static = strfind(self.mod,'^%s*(static)') + if class then + + if self.name == 'new' and self.parent.flags.pure_virtual then + -- no constructor for classes with pure virtual methods + return + end + + if local_constructor then + output("/* method: new_local of class ",class," */") + else + output("/* method:",self.name," of class ",class," */") + end + else + output("/* function:",self.name," */") + end + + if local_constructor then + output("#ifndef TOLUA_DISABLE_"..self.cname.."_local") + output("\nstatic int",self.cname.."_local","(lua_State* tolua_S)") + else + output("#ifndef TOLUA_DISABLE_"..self.cname) + output("\nstatic int",self.cname,"(lua_State* tolua_S)") + end + output("{") + + -- check types + if overload < 0 then + output('#ifndef TOLUA_RELEASE\n') + end + output(' tolua_Error tolua_err;') + output(' if (\n') + -- check self + local narg + if class then narg=2 else narg=1 end + if class then + local func = get_is_function(self.parent.type) + local type = self.parent.type + if self.name=='new' or static~=nil then + func = 'tolua_isusertable' + type = self.parent.type + end + if self.const ~= '' then + type = "const "..type + end + output(' !'..func..'(tolua_S,1,"'..type..'",0,&tolua_err) ||\n') + end + -- check args + if self.args[1].type ~= 'void' then + local i=1 + while self.args[i] do + local btype = isbasic(self.args[i].type) + if btype ~= 'value' and btype ~= 'state' then + output(' '..self.args[i]:outchecktype(narg)..' ||\n') + end + if btype ~= 'state' then + narg = narg+1 + end + i = i+1 + end + end + -- check end of list + output(' !tolua_isnoobj(tolua_S,'..narg..',&tolua_err)\n )') + output(' goto tolua_lerror;') + + output(' else\n') + if overload < 0 then + output('#endif\n') + end + output(' {') + + -- declare self, if the case + local narg + if class then narg=2 else narg=1 end + if class and self.name~='new' and static==nil then + output(' ',self.const,self.parent.type,'*','self = ') + output('(',self.const,self.parent.type,'*) ') + local to_func = get_to_function(self.parent.type) + output(to_func,'(tolua_S,1,0);') + elseif static then + _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)') + end + -- declare parameters + if self.args[1].type ~= 'void' then + local i=1 + while self.args[i] do + self.args[i]:declare(narg) + if isbasic(self.args[i].type) ~= "state" then + narg = narg+1 + end + i = i+1 + end + end + + -- check self + if class and self.name~='new' and static==nil then + output('#ifndef TOLUA_RELEASE\n') + output(' if (!self) tolua_error(tolua_S,"'..output_error_hook("invalid \'self\' in function \'%s\'", self.name)..'", NULL);'); + output('#endif\n') + end + + -- get array element values + if class then narg=2 else narg=1 end + if self.args[1].type ~= 'void' then + local i=1 + while self.args[i] do + self.args[i]:getarray(narg) + narg = narg+1 + i = i+1 + end + end + + pre_call_hook(self) + + local out = string.find(self.mod, "tolua_outside") + -- call function + if class and self.name=='delete' then + output(' Mtolua_delete(self);') + elseif class and self.name == 'operator&[]' then + if flags['1'] then -- for compatibility with tolua5 ? + output(' self->operator[](',self.args[1].name,'-1) = ',self.args[2].name,';') + else + output(' self->operator[](',self.args[1].name,') = ',self.args[2].name,';') + end + else + output(' {') + if self.type ~= '' and self.type ~= 'void' then + output(' ',self.mod,self.type,self.ptr,'tolua_ret = ') + output('(',self.mod,self.type,self.ptr,') ') + else + output(' ') + end + if class and self.name=='new' then + output('Mtolua_new((',self.type,')(') + elseif class and static then + if out then + output(self.name,'(') + else + output(class..'::'..self.name,'(') + end + elseif class then + if out then + output(self.name,'(') + else + if self.cast_operator then + --output('static_cast<',self.mod,self.type,self.ptr,' >(*self') + output('self->operator ',self.mod,self.type,'(') + else + output('self->'..self.name,'(') + end + end + else + output(self.name,'(') + end + + if out and not static then + output('self') + if self.args[1] and self.args[1].name ~= '' then + output(',') + end + end + -- write parameters + local i=1 + while self.args[i] do + self.args[i]:passpar() + i = i+1 + if self.args[i] then + output(',') + end + end + + if class and self.name == 'operator[]' and flags['1'] then + output('-1);') + else + if class and self.name=='new' then + output('));') -- close Mtolua_new( + else + output(');') + end + end + + -- return values + if self.type ~= '' and self.type ~= 'void' then + nret = nret + 1 + local t,ct = isbasic(self.type) + if t and self.name ~= "new" then + if self.cast_operator and _basic_raw_push[t] then + output(' ',_basic_raw_push[t],'(tolua_S,(',ct,')tolua_ret);') + else + output(' tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);') + end + else + t = self.type + new_t = string.gsub(t, "const%s+", "") + local owned = false + if string.find(self.mod, "tolua_owned") then + owned = true + end + local push_func = get_push_function(t) + if self.ptr == '' then + output(' {') + output('#ifdef __cplusplus\n') + output(' void* tolua_obj = Mtolua_new((',new_t,')(tolua_ret));') + output(' ',push_func,'(tolua_S,tolua_obj,"',t,'");') + output(' tolua_register_gc(tolua_S,lua_gettop(tolua_S));') + output('#else\n') + output(' void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));') + output(' ',push_func,'(tolua_S,tolua_obj,"',t,'");') + output(' tolua_register_gc(tolua_S,lua_gettop(tolua_S));') + output('#endif\n') + output(' }') + elseif self.ptr == '&' then + output(' ',push_func,'(tolua_S,(void*)&tolua_ret,"',t,'");') + else + output(' ',push_func,'(tolua_S,(void*)tolua_ret,"',t,'");') + if owned or local_constructor then + output(' tolua_register_gc(tolua_S,lua_gettop(tolua_S));') + end + end + end + end + local i=1 + while self.args[i] do + nret = nret + self.args[i]:retvalue() + i = i+1 + end + output(' }') + + -- set array element values + if class then narg=2 else narg=1 end + if self.args[1].type ~= 'void' then + local i=1 + while self.args[i] do + self.args[i]:setarray(narg) + narg = narg+1 + i = i+1 + end + end + + -- free dynamically allocated array + if self.args[1].type ~= 'void' then + local i=1 + while self.args[i] do + self.args[i]:freearray() + i = i+1 + end + end + end + + post_call_hook(self) + + output(' }') + output(' return '..nret..';') + + -- call overloaded function or generate error + if overload < 0 then + + output('#ifndef TOLUA_RELEASE\n') + output('tolua_lerror:\n') + output(' tolua_error(tolua_S,"'..output_error_hook("#ferror in function \'%s\'.", self.lname)..'",&tolua_err);') + output(' return 0;') + output('#endif\n') + else + local _local = "" + if local_constructor then + _local = "_local" + end + output('tolua_lerror:\n') + output(' return '..strsub(self.cname,1,-3)..format("%02d",overload).._local..'(tolua_S);') + end + output('}') + output('#endif //#ifndef TOLUA_DISABLE\n') + output('\n') + + -- recursive call to write local constructor + if class and self.name=='new' and not local_constructor then + + self:supcode(1) + end + +end + + +-- register function +function classFunction:register (pre) + + if not self:check_public_access() then + return + end + + if self.name == 'new' and self.parent.flags.pure_virtual then + -- no constructor for classes with pure virtual methods + return + end + + output(pre..'tolua_function(tolua_S,"'..self.lname..'",'..self.cname..');') + if self.name == 'new' then + output(pre..'tolua_function(tolua_S,"new_local",'..self.cname..'_local);') + output(pre..'tolua_function(tolua_S,".call",'..self.cname..'_local);') + --output(' tolua_set_call_event(tolua_S,'..self.cname..'_local, "'..self.parent.type..'");') + end +end + +-- Print method +function classFunction:print (ident,close) + print(ident.."Function{") + print(ident.." mod = '"..self.mod.."',") + print(ident.." type = '"..self.type.."',") + print(ident.." ptr = '"..self.ptr.."',") + print(ident.." name = '"..self.name.."',") + print(ident.." lname = '"..self.lname.."',") + print(ident.." const = '"..self.const.."',") + print(ident.." cname = '"..self.cname.."',") + print(ident.." lname = '"..self.lname.."',") + print(ident.." args = {") + local i=1 + while self.args[i] do + self.args[i]:print(ident.." ",",") + i = i+1 + end + print(ident.." }") + print(ident.."}"..close) +end + +-- check if it returns an object by value +function classFunction:requirecollection (t) + local r = false + if self.type ~= '' and not isbasic(self.type) and self.ptr=='' then + local type = gsub(self.type,"%s*const%s+","") + t[type] = "tolua_collect_" .. clean_template(type) + r = true + end + local i=1 + while self.args[i] do + r = self.args[i]:requirecollection(t) or r + i = i+1 + end + return r +end + +-- determine lua function name overload +function classFunction:overload () + return self.parent:overload(self.lname) +end + + +function param_object(par) -- returns true if the parameter has an object as its default value + + if not string.find(par, '=') then return false end -- it has no default value + + local _,_,def = string.find(par, "=(.*)$") + + if string.find(par, "|") then -- a list of flags + + return true + end + + if string.find(par, "%*") then -- it's a pointer with a default value + + if string.find(par, '=%s*new') or string.find(par, "%(") then -- it's a pointer with an instance as default parameter.. is that valid? + return true + end + return false -- default value is 'NULL' or something + end + + + if string.find(par, "[%(&]") then + return true + end -- default value is a constructor call (most likely for a const reference) + + --if string.find(par, "&") then + + -- if string.find(def, ":") or string.find(def, "^%s*new%s+") then + + -- -- it's a reference with default to something like Class::member, or 'new Class' + -- return true + -- end + --end + + return false -- ? +end + +function strip_last_arg(all_args, last_arg) -- strips the default value from the last argument + + local _,_,s_arg = string.find(last_arg, "^([^=]+)") + last_arg = string.gsub(last_arg, "([%%%(%)])", "%%%1"); + all_args = string.gsub(all_args, "%s*,%s*"..last_arg.."%s*%)%s*$", ")") + return all_args, s_arg +end + + + +-- Internal constructor +function _Function (t) + setmetatable(t,classFunction) + + if t.const ~= 'const' and t.const ~= '' then + error("#invalid 'const' specification") + end + + append(t) + if t:inclass() then + --print ('t.name is '..t.name..', parent.name is '..t.parent.name) + if string.gsub(t.name, "%b<>", "") == string.gsub(t.parent.original_name or t.parent.name, "%b<>", "") then + t.name = 'new' + t.lname = 'new' + t.parent._new = true + t.type = t.parent.name + t.ptr = '*' + elseif string.gsub(t.name, "%b<>", "") == '~'..string.gsub(t.parent.original_name or t.parent.name, "%b<>", "") then + t.name = 'delete' + t.lname = 'delete' + t.parent._delete = true + end + end + t.cname = t:cfuncname("tolua")..t:overload(t) + return t +end + +-- Constructor +-- Expects three strings: one representing the function declaration, +-- another representing the argument list, and the third representing +-- the "const" or empty string. +function Function (d,a,c) + --local t = split(strsub(a,2,-2),',') -- eliminate braces + --local t = split_params(strsub(a,2,-2)) + + if not flags['W'] and string.find(a, "%.%.%.%s*%)") then + + warning("Functions with variable arguments (`...') are not supported. Ignoring "..d..a..c) + return nil + end + + + local i=1 + local l = {n=0} + + a = string.gsub(a, "%s*([%(%)])%s*", "%1") + local t,strip,last = strip_pars(strsub(a,2,-2)); + if strip then + --local ns = string.sub(strsub(a,1,-2), 1, -(string.len(last)+1)) + local ns = join(t, ",", 1, last-1) + + ns = "("..string.gsub(ns, "%s*,%s*$", "")..')' + --ns = strip_defaults(ns) + + local f = Function(d, ns, c) + for i=1,last do + t[i] = string.gsub(t[i], "=.*$", "") + end + end + + while t[i] do + l.n = l.n+1 + l[l.n] = Declaration(t[i],'var',true) + i = i+1 + end + local f = Declaration(d,'func') + f.args = l + f.const = c + return _Function(f) +end + +function join(t, sep, first, last) + + first = first or 1 + last = last or table.getn(t) + local lsep = "" + local ret = "" + local loop = false + for i = first,last do + + ret = ret..lsep..t[i] + lsep = sep + loop = true + end + if not loop then + return "" + end + + return ret +end + +function strip_pars(s) + + local t = split_c_tokens(s, ',') + local strip = false + local last + + for i=t.n,1,-1 do + + if not strip and param_object(t[i]) then + last = i + strip = true + end + --if strip then + -- t[i] = string.gsub(t[i], "=.*$", "") + --end + end + + return t,strip,last + +end + +function strip_defaults(s) + + s = string.gsub(s, "^%(", "") + s = string.gsub(s, "%)$", "") + + local t = split_c_tokens(s, ",") + local sep, ret = "","" + for i=1,t.n do + t[i] = string.gsub(t[i], "=.*$", "") + ret = ret..sep..t[i] + sep = "," + end + + return "("..ret..")" +end + + diff --git a/tolua++-1.0.93/src/bin/lua/module.lua b/tolua++-1.0.93/src/bin/lua/module.lua new file mode 100644 index 000000000..57dceb7d5 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/module.lua @@ -0,0 +1,68 @@ +-- tolua: module class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + + +-- Module class +-- Represents module. +-- The following fields are stored: +-- {i} = list of objects in the module. +classModule = { + classtype = 'module' +} +classModule.__index = classModule +setmetatable(classModule,classContainer) + +-- register module +function classModule:register (pre) + pre = pre or '' + push(self) + output(pre..'tolua_module(tolua_S,"'..self.name..'",',self:hasvar(),');') + output(pre..'tolua_beginmodule(tolua_S,"'..self.name..'");') + local i=1 + while self[i] do + self[i]:register(pre..' ') + i = i+1 + end + output(pre..'tolua_endmodule(tolua_S);') + pop() +end + +-- Print method +function classModule:print (ident,close) + print(ident.."Module{") + print(ident.." name = '"..self.name.."';") + local i=1 + while self[i] do + self[i]:print(ident.." ",",") + i = i+1 + end + print(ident.."}"..close) +end + +-- Internal constructor +function _Module (t) + setmetatable(t,classModule) + append(t) + return t +end + +-- Constructor +-- Expects two string representing the module name and body. +function Module (n,b) + local t = _Module(_Container{name=n}) + push(t) + t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces + pop() + return t +end + + diff --git a/tolua++-1.0.93/src/bin/lua/namespace.lua b/tolua++-1.0.93/src/bin/lua/namespace.lua new file mode 100644 index 000000000..6ca80e6e3 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/namespace.lua @@ -0,0 +1,52 @@ +-- tolua: namespace class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 2003 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Namespace class +-- Represents a namesapce definition. +-- Stores the following fields: +-- name = class name +-- {i} = list of members +classNamespace = { + classtype = 'namespace', + name = '', +} +classNamespace.__index = classNamespace +setmetatable(classNamespace,classModule) + +-- Print method +function classNamespace:print (ident,close) + print(ident.."Namespace{") + print(ident.." name = '"..self.name.."',") + local i=1 + while self[i] do + self[i]:print(ident.." ",",") + i = i+1 + end + print(ident.."}"..close) +end + +-- Internal constructor +function _Namespace (t) + setmetatable(t,classNamespace) + append(t) + return t +end + +-- Constructor +-- Expects the name and the body of the namespace. +function Namespace (n,b) + local c = _Namespace(_Container{name=n}) + push(c) + c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces + pop() +end + diff --git a/tolua++-1.0.93/src/bin/lua/operator.lua b/tolua++-1.0.93/src/bin/lua/operator.lua new file mode 100644 index 000000000..675027cd7 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/operator.lua @@ -0,0 +1,220 @@ +-- tolua: operator class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Operator class +-- Represents an operator function or a class operator method. +-- It stores the same fields as functions do plus: +-- kind = set of character representing the operator (as it appers in C++ code) +classOperator = { + kind = '', +} +classOperator.__index = classOperator +setmetatable(classOperator,classFunction) + +-- table to transform operator kind into the appropriate tag method name +_TM = {['+'] = 'add', + ['-'] = 'sub', + ['*'] = 'mul', + ['/'] = 'div', + ['<'] = 'lt', + ['<='] = 'le', + ['=='] = 'eq', + ['[]'] = 'geti', + ['&[]'] = 'seti', + --['->'] = 'flechita', + } + + +-- Print method +function classOperator:print (ident,close) + print(ident.."Operator{") + print(ident.." kind = '"..self.kind.."',") + print(ident.." mod = '"..self.mod.."',") + print(ident.." type = '"..self.type.."',") + print(ident.." ptr = '"..self.ptr.."',") + print(ident.." name = '"..self.name.."',") + print(ident.." const = '"..self.const.."',") + print(ident.." cname = '"..self.cname.."',") + print(ident.." lname = '"..self.lname.."',") + print(ident.." args = {") + local i=1 + while self.args[i] do + self.args[i]:print(ident.." ",",") + i = i+1 + end + print(ident.." }") + print(ident.."}"..close) +end + +function classOperator:supcode_tmp() + + if not _TM[self.kind] then + return classFunction.supcode(self) + end + + -- no overload, no parameters, always inclass + output("/* method:",self.name," of class ",self:inclass()," */") + + output("#ifndef TOLUA_DISABLE_"..self.cname) + output("\nstatic int",self.cname,"(lua_State* tolua_S)") + + if overload < 0 then + output('#ifndef TOLUA_RELEASE\n') + end + output(' tolua_Error tolua_err;') + output(' if (\n') + -- check self + local is_func = get_is_function(self.parent.type) + output(' !'..is_func..'(tolua_S,1,"'..self.parent.type..'",0,&tolua_err) ||\n') + output(' !tolua_isnoobj(tolua_S,2,&tolua_err)\n )') + output(' goto tolua_lerror;') + + output(' else\n') + output('#endif\n') -- tolua_release + output(' {') + + -- declare self + output(' ',self.const,self.parent.type,'*','self = ') + output('(',self.const,self.parent.type,'*) ') + local to_func = get_to_func(self.parent.type) + output(to_func,'(tolua_S,1,0);') + + -- check self + output('#ifndef TOLUA_RELEASE\n') + output(' if (!self) tolua_error(tolua_S,"'..output_error_hook("invalid \'self\' in function \'%s\'", self.name)..'",NULL);'); + output('#endif\n') + + -- cast self + output(' ',self.mod,self.type,self.ptr,'tolua_ret = ') + output('(',self.mod,self.type,self.ptr,')(*self);') + + -- return value + local t,ct = isbasic(self.type) + if t then + output(' tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);') + else + t = self.type + local push_func = get_push_function(t) + new_t = string.gsub(t, "const%s+", "") + if self.ptr == '' then + output(' {') + output('#ifdef __cplusplus\n') + output(' void* tolua_obj = Mtolua_new((',new_t,')(tolua_ret));') + output(' ',push_func,'(tolua_S,tolua_obj,"',t,'");') + output(' tolua_register_gc(tolua_S,lua_gettop(tolua_S));') + output('#else\n') + output(' void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));') + output(' ',push_func,'(tolua_S,tolua_obj,"',t,'");') + output(' tolua_register_gc(tolua_S,lua_gettop(tolua_S));') + output('#endif\n') + output(' }') + elseif self.ptr == '&' then + output(' ',push_func,'(tolua_S,(void*)&tolua_ret,"',t,'");') + else + if local_constructor then + output(' ',push_func,'(tolua_S,(void *)tolua_ret,"',t,'");') + output(' tolua_register_gc(tolua_S,lua_gettop(tolua_S));') + else + output(' ',push_func,'(tolua_S,(void*)tolua_ret,"',t,'");') + end + end + end + + output(' }') + output(' return 1;') + + output('#ifndef TOLUA_RELEASE\n') + output('tolua_lerror:\n') + output(' tolua_error(tolua_S,"'..output_error_hook("#ferror in function \'%s\'.", self.lname)..'",&tolua_err);') + output(' return 0;') + output('#endif\n') + + + output('}') + output('#endif //#ifndef TOLUA_DISABLE\n') + output('\n') +end + +-- Internal constructor +function _Operator (t) + setmetatable(t,classOperator) + + if t.const ~= 'const' and t.const ~= '' then + error("#invalid 'const' specification") + end + + append(t) + if not t:inclass() then + error("#operator can only be defined as class member") + end + + --t.name = t.name .. "_" .. (_TM[t.kind] or t.kind) + t.cname = t:cfuncname("tolua")..t:overload(t) + t.name = "operator" .. t.kind -- set appropriate calling name + return t +end + +-- Constructor +function Operator (d,k,a,c) + + local op_k = string.gsub(k, "^%s*", "") + op_k = string.gsub(k, "%s*$", "") + --if string.find(k, "^[%w_:%d<>%*%&]+$") then + if d == "operator" and k ~= '' then + + d = k.." operator" + elseif not _TM[op_k] then + + if flags['W'] then + error("tolua: no support for operator" .. f.kind) + else + warning("No support for operator "..op_k..", ignoring") + return nil + end + end + + local ref = '' + local t = split_c_tokens(strsub(a,2,strlen(a)-1),',') -- eliminate braces + local i=1 + local l = {n=0} + while t[i] do + l.n = l.n+1 + l[l.n] = Declaration(t[i],'var') + i = i+1 + end + if k == '[]' then + local _ + _, _, ref = strfind(d,'(&)') + d = gsub(d,'&','') + elseif k=='&[]' then + l.n = l.n+1 + l[l.n] = Declaration(d,'var') + l[l.n].name = 'tolua_value' + end + local f = Declaration(d,'func') + if k == '[]' and (l[1]==nil or isbasic(l[1].type)~='number') then + error('operator[] can only be defined for numeric index.') + end + f.args = l + f.const = c + f.kind = op_k + f.lname = "."..(_TM[f.kind] or f.kind) + if not _TM[f.kind] then + f.cast_operator = true + end + if f.kind == '[]' and ref=='&' and f.const~='const' then + Operator(d,'&'..k,a,c) -- create correspoding set operator + end + return _Operator(f) +end + + diff --git a/tolua++-1.0.93/src/bin/lua/package.lua b/tolua++-1.0.93/src/bin/lua/package.lua new file mode 100644 index 000000000..eec136904 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/package.lua @@ -0,0 +1,343 @@ +-- tolua: package class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + + +-- Package class +-- Represents the whole package being bound. +-- The following fields are stored: +-- {i} = list of objects in the package. +classPackage = { + classtype = 'package' +} +classPackage.__index = classPackage +setmetatable(classPackage,classContainer) + +-- Print method +function classPackage:print () + print("Package: "..self.name) + local i=1 + while self[i] do + self[i]:print("","") + i = i+1 + end +end + +function classPackage:preprocess () + + -- avoid preprocessing embedded Lua code + local L = {} + self.code = gsub(self.code,"\n%s*%$%[","\1") -- deal with embedded lua code + self.code = gsub(self.code,"\n%s*%$%]","\2") + self.code = gsub(self.code,"(%b\1\2)", function (c) + tinsert(L,c) + return "\n#["..getn(L).."]#" + end) + -- avoid preprocessing embedded C code + local C = {} + self.code = gsub(self.code,"\n%s*%$%<","\3") -- deal with embedded C code + self.code = gsub(self.code,"\n%s*%$%>","\4") + self.code = gsub(self.code,"(%b\3\4)", function (c) + tinsert(C,c) + return "\n#<"..getn(C)..">#" + end) + -- avoid preprocessing embedded C code + self.code = gsub(self.code,"\n%s*%$%{","\5") -- deal with embedded C code + self.code = gsub(self.code,"\n%s*%$%}","\6") + self.code = gsub(self.code,"(%b\5\6)", function (c) + tinsert(C,c) + return "\n#<"..getn(C)..">#" + end) + + --self.code = gsub(self.code,"\n%s*#[^d][^\n]*\n", "\n\n") -- eliminate preprocessor directives that don't start with 'd' + self.code = gsub(self.code,"\n[ \t]*#[ \t]*[^d%<%[]", "\n//") -- eliminate preprocessor directives that don't start with 'd' + + -- avoid preprocessing verbatim lines + local V = {} + self.code = gsub(self.code,"\n(%s*%$[^%[%]][^\n]*)",function (v) + tinsert(V,v) + return "\n#"..getn(V).."#" + end) + + -- perform global substitution + + self.code = gsub(self.code,"(//[^\n]*)","") -- eliminate C++ comments + self.code = gsub(self.code,"/%*","\1") + self.code = gsub(self.code,"%*/","\2") + self.code = gsub(self.code,"%b\1\2","") + self.code = gsub(self.code,"\1","/%*") + self.code = gsub(self.code,"\2","%*/") + self.code = gsub(self.code,"%s*@%s*","@") -- eliminate spaces beside @ + self.code = gsub(self.code,"%s?inline(%s)","%1") -- eliminate 'inline' keyword + --self.code = gsub(self.code,"%s?extern(%s)","%1") -- eliminate 'extern' keyword + --self.code = gsub(self.code,"%s?virtual(%s)","%1") -- eliminate 'virtual' keyword + --self.code = gsub(self.code,"public:","") -- eliminate 'public:' keyword + self.code = gsub(self.code,"([^%w_])void%s*%*","%1_userdata ") -- substitute 'void*' + self.code = gsub(self.code,"([^%w_])void%s*%*","%1_userdata ") -- substitute 'void*' + self.code = gsub(self.code,"([^%w_])char%s*%*","%1_cstring ") -- substitute 'char*' + self.code = gsub(self.code,"([^%w_])lua_State%s*%*","%1_lstate ") -- substitute 'lua_State*' + + -- restore embedded Lua code + self.code = gsub(self.code,"%#%[(%d+)%]%#",function (n) + return L[tonumber(n)] + end) + -- restore embedded C code + self.code = gsub(self.code,"%#%<(%d+)%>%#",function (n) + return C[tonumber(n)] + end) + -- restore verbatim lines + self.code = gsub(self.code,"%#(%d+)%#",function (n) + return V[tonumber(n)] + end) + + self.code = string.gsub(self.code, "\n%s*%$([^\n]+)", function (l) + Verbatim(l.."\n") + return "\n" + end) +end + +-- translate verbatim +function classPackage:preamble () + output('/*\n') + output('** Lua binding: '..self.name..'\n') + output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n') + output('*/\n\n') + + output('#ifndef __cplusplus\n') + output('#include "stdlib.h"\n') + output('#endif\n') + output('#include "string.h"\n\n') + output('#include "tolua++.h"\n\n') + + if not flags.h then + output('/* Exported function */') + output('TOLUA_API int tolua_'..self.name..'_open (lua_State* tolua_S);') + output('\n') + end + + local i=1 + while self[i] do + self[i]:preamble() + i = i+1 + end + + if self:requirecollection(_collect) then + output('\n') + output('/* function to release collected object via destructor */') + output('#ifdef __cplusplus\n') + for i,v in pairs(_collect) do + output('\nstatic int '..v..' (lua_State* tolua_S)') + output('{') + output(' '..i..'* self = ('..i..'*) tolua_tousertype(tolua_S,1,0);') + output(' Mtolua_delete(self);') + output(' return 0;') + output('}') + end + output('#endif\n\n') + end + + output('\n') + output('/* function to register type */') + output('static void tolua_reg_types (lua_State* tolua_S)') + output('{') + + if flags.t then + output("#ifndef Mtolua_typeid\n#define Mtolua_typeid(L,TI,T)\n#endif\n") + end + foreach(_usertype,function(n,v) + if (not _global_classes[v]) or _global_classes[v]:check_public_access() then + output(' tolua_usertype(tolua_S,"',v,'");') + if flags.t then + output(' Mtolua_typeid(tolua_S,typeid(',v,'), "',v,'");') + end + end + end) + output('}') + output('\n') +end + +-- register package +-- write package open function +function classPackage:register (pre) + pre = pre or '' + push(self) + output(pre.."/* Open function */") + output(pre.."TOLUA_API int tolua_"..self.name.."_open (lua_State* tolua_S)") + output(pre.."{") + output(pre.." tolua_open(tolua_S);") + output(pre.." tolua_reg_types(tolua_S);") + output(pre.." tolua_module(tolua_S,NULL,",self:hasvar(),");") + output(pre.." tolua_beginmodule(tolua_S,NULL);") + local i=1 + while self[i] do + self[i]:register(pre.." ") + i = i+1 + end + output(pre.." tolua_endmodule(tolua_S);") + output(pre.." return 1;") + output(pre.."}") + + output("\n\n") + output("#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501\n"); + output(pre.."TOLUA_API int luaopen_"..self.name.." (lua_State* tolua_S) {") + output(pre.." return tolua_"..self.name.."_open(tolua_S);") + output(pre.."};") + output("#endif\n\n") + + pop() +end + +-- write header file +function classPackage:header () + output('/*\n') output('** Lua binding: '..self.name..'\n') + output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n') + output('*/\n\n') + + if not flags.h then + output('/* Exported function */') + output('TOLUA_API int tolua_'..self.name..'_open (lua_State* tolua_S);') + output('\n') + end +end + +-- Internal constructor +function _Package (self) + setmetatable(self,classPackage) + return self +end + +-- Parse C header file with tolua directives +-- *** Thanks to Ariel Manzur for fixing bugs in nested directives *** +function extract_code(fn,s) + local code = '\n$#include "'..fn..'"\n' + s= "\n" .. s .. "\n" -- add blank lines as sentinels + local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n") + while e do + t = strlower(t) + if t == "begin" then + _,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e) + if not e then + tolua_error("Unbalanced 'tolua_begin' directive in header file") + end + end + code = code .. c .. "\n" + _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e) + end + return code +end + +-- Constructor +-- Expects the package name, the file extension, and the file text. +function Package (name,fn) + local ext = "pkg" + + -- open input file, if any + local st,msg + if fn then + st, msg = readfrom(flags.f) + if not st then + error('#'..msg) + end + local _; _, _, ext = strfind(fn,".*%.(.*)$") + end + local code + if ext == 'pkg' then + code = prep(st) + else + code = "\n" .. read('*a') + if ext == 'h' or ext == 'hpp' then + code = extract_code(fn,code) + end + end + + -- close file + if fn then + readfrom() + end + + -- deal with include directive + local nsubst + repeat + code,nsubst = gsub(code,'\n%s*%$(.)file%s*"(.-)"([^\n]*)\n', + function (kind,fn,extra) + local _, _, ext = strfind(fn,".*%.(.*)$") + local fp,msg = openfile(fn,'r') + if not fp then + error('#'..msg..': '..fn) + end + if kind == 'p' then + local s = prep(fp) + closefile(fp) + return s + end + local s = read(fp,'*a') + closefile(fp) + if kind == 'c' or kind == 'h' then + return extract_code(fn,s) + elseif kind == 'l' then + return "\n$[--##"..fn.."\n" .. s .. "\n$]\n" + elseif kind == 'i' then + local t = {code=s} + extra = string.gsub(extra, "^%s*,%s*", "") + local pars = split_c_tokens(extra, ",") + include_file_hook(t, fn, unpack(pars)) + return "\n\n" .. t.code + else + error('#Invalid include directive (use $cfile, $pfile, $lfile or $ifile)') + end + end) + until nsubst==0 + + -- deal with renaming directive + repeat -- I don't know why this is necesary + code,nsubst = gsub(code,'\n%s*%$renaming%s*(.-)%s*\n', function (r) appendrenaming(r) return "\n" end) + until nsubst == 0 + + local t = _Package(_Container{name=name, code=code}) + push(t) + preprocess_hook(t) + t:preprocess() + preparse_hook(t) + t:parse(t.code) + pop() + return t +end + + +setmetatable(_extra_parameters, { __index = _G }) + +function prep(file) + + local chunk = {'local __ret = {"\\n"}\n'} + for line in file:lines() do + if string.find(line, "^##") then + table.insert(chunk, string.sub(line, 3) .. "\n") + else + local last = 1 + for text, expr, index in string.gfind(line, "(.-)$(%b())()") do + last = index + if text ~= "" then + table.insert(chunk, string.format('table.insert(__ret, %q )', text)) + end + table.insert(chunk, string.format('table.insert(__ret, %s )', expr)) + end + table.insert(chunk, string.format('table.insert(__ret, %q)\n', + string.sub(line, last).."\n")) + end + end + table.insert(chunk, '\nreturn table.concat(__ret)\n') + local f,e = loadstring(table.concat(chunk)) + if e then + error("#"..e) + end + setfenv(f, _extra_parameters) + return f() +end diff --git a/tolua++-1.0.93/src/bin/lua/template_class.lua b/tolua++-1.0.93/src/bin/lua/template_class.lua new file mode 100644 index 000000000..b1ed05abe --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/template_class.lua @@ -0,0 +1,82 @@ + +_global_templates = {} + +classTemplateClass = { + + name = '', + body = '', + parents = {}, + args = {}, -- the template arguments +} + +classTemplateClass.__index = classTemplateClass + + +function classTemplateClass:throw(types, local_scope) + + --if table.getn(types) ~= table.getn(self.args) then + -- error("#invalid parameter count") + --end + + -- replace + for i =1 , types.n do + + local Il = split_c_tokens(types[i], " ") + if table.getn(Il) ~= table.getn(self.args) then + error("#invalid parameter count for "..types[i]) + end + local bI = self.body + local pI = {} + for j = 1,self.args.n do + --Tl[j] = findtype(Tl[j]) or Tl[j] + bI = string.gsub(bI, "([^_%w])"..self.args[j].."([^_%w])", "%1"..Il[j].."%2") + if self.parents then + for i=1,table.getn(self.parents) do + pI[i] = string.gsub(self.parents[i], "([^_%w]?)"..self.args[j].."([^_%w]?)", "%1"..Il[j].."%2") + end + end + end + --local append = "<"..string.gsub(types[i], "%s+", ",")..">" + local append = "<"..concat(Il, 1, table.getn(Il), ",")..">" + append = string.gsub(append, "%s*,%s*", ",") + append = string.gsub(append, ">>", "> >") + for i=1,table.getn(pI) do + --pI[i] = string.gsub(pI[i], ">>", "> >") + pI[i] = resolve_template_types(pI[i]) + end + bI = string.gsub(bI, ">>", "> >") + local n = self.name + if local_scope then + n = self.local_name + end + + Class(n..append, pI, bI) + end +end + + +function TemplateClass(name, parents, body, parameters) + + local o = { + + parents = parents, + body = body, + args = parameters, + } + + local oname = string.gsub(name, "@.*$", "") + oname = getnamespace(classContainer.curr)..oname + o.name = oname + + o.local_name = name + + setmetatable(o, classTemplateClass) + + if _global_templates[oname] then + warning("Duplicate declaration of template "..oname) + else + _global_templates[oname] = o + end + + return o +end diff --git a/tolua++-1.0.93/src/bin/lua/typedef.lua b/tolua++-1.0.93/src/bin/lua/typedef.lua new file mode 100644 index 000000000..a78a84155 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/typedef.lua @@ -0,0 +1,71 @@ +-- tolua: typedef class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + + +-- Typedef class +-- Represents a type synonym. +-- The 'de facto' type replaces the typedef before the +-- remaining code is parsed. +-- The following fields are stored: +-- utype = typedef name +-- type = 'the facto' type +-- mod = modifiers to the 'de facto' type +classTypedef = { + utype = '', + mod = '', + type = '' +} +classTypedef.__index = classTypedef + +-- Print method +function classTypedef:print (ident,close) + print(ident.."Typedef{") + print(ident.." utype = '"..self.utype.."',") + print(ident.." mod = '"..self.mod.."',") + print(ident.." type = '"..self.type.."',") + print(ident.."}"..close) +end + +-- Return it's not a variable +function classTypedef:isvariable () + return false +end + +-- Internal constructor +function _Typedef (t) + setmetatable(t,classTypedef) + t.type = resolve_template_types(t.type) + appendtypedef(t) + return t +end + +-- Constructor +-- Expects one string representing the type definition. +function Typedef (s) + if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then + tolua_error("#invalid typedef: pointers (and references) are not supported") + end + local o = {mod = ''} + if string.find(s, "[<>]") then + _,_,o.type,o.utype = string.find(s, "^%s*([^<>]+%b<>[^%s]*)%s+(.-)$") + else + local t = split(gsub(s,"%s%s*"," ")," ") + o = { + utype = t[t.n], + type = t[t.n-1], + mod = concat(t,1,t.n-2), + } + end + return _Typedef(o) +end + + diff --git a/tolua++-1.0.93/src/bin/lua/variable.lua b/tolua++-1.0.93/src/bin/lua/variable.lua new file mode 100644 index 000000000..fbc705dd8 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/variable.lua @@ -0,0 +1,300 @@ +-- tolua: variable class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + +-- Variable class +-- Represents a extern variable or a public member of a class. +-- Stores all fields present in a declaration. +classVariable = { + _get = {}, -- mapped get functions + _set = {}, -- mapped set functions +} +classVariable.__index = classVariable +setmetatable(classVariable,classDeclaration) + +-- Print method +function classVariable:print (ident,close) + print(ident.."Variable{") + print(ident.." mod = '"..self.mod.."',") + print(ident.." type = '"..self.type.."',") + print(ident.." ptr = '"..self.ptr.."',") + print(ident.." name = '"..self.name.."',") + if self.dim then print(ident.." dim = '"..self.dim.."',") end + print(ident.." def = '"..self.def.."',") + print(ident.." ret = '"..self.ret.."',") + print(ident.."}"..close) +end + +-- Generates C function name +function classVariable:cfuncname (prefix) + local parent = "" + local unsigned = "" + local ptr = "" + + local p = self:inmodule() or self:innamespace() or self:inclass() + + if p then + if self.parent.classtype == 'class' then + parent = "_" .. self.parent.type + else + parent = "_" .. p + end + end + + if strfind(self.mod,"(unsigned)") then + unsigned = "_unsigned" + end + + if self.ptr == "*" then ptr = "_ptr" + elseif self.ptr == "&" then ptr = "_ref" + end + + local name = prefix .. parent .. unsigned .. "_" .. gsub(self.lname or self.name,".*::","") .. ptr + + name = clean_template(name) + return name + +end + +-- check if it is a variable +function classVariable:isvariable () + return true +end + +-- get variable value +function classVariable:getvalue (class,static, prop_get) + + local name + if prop_get then + + name = prop_get.."()" + else + name = self.name + end + + if class and static then + return self.parent.type..'::'..name + elseif class then + return 'self->'..name + else + return name + end +end + +-- get variable pointer value +function classVariable:getpointervalue (class,static) + if class and static then + return class..'::p' + elseif class then + return 'self->p' + else + return 'p' + end +end + +-- Write binding functions +function classVariable:supcode () + + local class = self:inclass() + + local prop_get,prop_set + if string.find(self.mod, 'tolua_property') then + + local _,_,type = string.find(self.mod, "tolua_property__([^%s]*)") + type = type or "default" + prop_get,prop_set = get_property_methods(type, self.name) + self.mod = string.gsub(self.mod, "tolua_property[^%s]*", "") + end + + -- get function ------------------------------------------------ + if class then + output("/* get function:",self.name," of class ",class," */") + else + output("/* get function:",self.name," */") + end + self.cgetname = self:cfuncname("tolua_get") + output("#ifndef TOLUA_DISABLE_"..self.cgetname) + output("\nstatic int",self.cgetname,"(lua_State* tolua_S)") + output("{") + + -- declare self, if the case + local _,_,static = strfind(self.mod,'^%s*(static)') + if class and static==nil then + output(' ',self.parent.type,'*','self = ') + output('(',self.parent.type,'*) ') + local to_func = get_to_function(self.parent.type) + output(to_func,'(tolua_S,1,0);') + elseif static then + _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)') + end + + + -- check self value + if class and static==nil then + output('#ifndef TOLUA_RELEASE\n') + output(' if (!self) tolua_error(tolua_S,"'..output_error_hook("invalid \'self\' in accessing variable \'%s\'", self.name)..'",NULL);'); + output('#endif\n') + end + + -- return value + if string.find(self.mod, 'tolua_inherits') then + local push_func = get_push_function(self.type) + output('#ifdef __cplusplus\n') + output(' ',push_func,'(tolua_S,(void*)static_cast<'..self.type..'*>(self), "',self.type,'");') + output('#else\n') + output(' ',push_func,'(tolua_S,(void*)(('..self.type..'*)self), "',self.type,'");') + output('#endif\n') + else + local t,ct = isbasic(self.type) + if t then + output(' tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static,prop_get)..');') + else + local push_func = get_push_function(self.type) + t = self.type + if self.ptr == '&' or self.ptr == '' then + output(' ',push_func,'(tolua_S,(void*)&'..self:getvalue(class,static,prop_get)..',"',t,'");') + else + output(' ',push_func,'(tolua_S,(void*)'..self:getvalue(class,static,prop_get)..',"',t,'");') + end + end + end + output(' return 1;') + output('}') + output('#endif //#ifndef TOLUA_DISABLE\n') + output('\n') + + -- set function ------------------------------------------------ + if not (strfind(self.type,'const%s+') or string.find(self.mod, 'tolua_readonly') or string.find(self.mod, 'tolua_inherits')) then + if class then + output("/* set function:",self.name," of class ",class," */") + else + output("/* set function:",self.name," */") + end + self.csetname = self:cfuncname("tolua_set") + output("#ifndef TOLUA_DISABLE_"..self.csetname) + output("\nstatic int",self.csetname,"(lua_State* tolua_S)") + output("{") + + -- declare self, if the case + if class and static==nil then + output(' ',self.parent.type,'*','self = ') + output('(',self.parent.type,'*) ') + local to_func = get_to_function(self.parent.type) + output(to_func,'(tolua_S,1,0);') + -- check self value + end + -- check types + output('#ifndef TOLUA_RELEASE\n') + output(' tolua_Error tolua_err;') + if class and static==nil then + output(' if (!self) tolua_error(tolua_S,"'..output_error_hook("invalid \'self\' in accessing variable \'%s\'", self.name)..'",NULL);'); + elseif static then + _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)') + end + + -- check variable type + output(' if ('..self:outchecktype(2)..')') + output(' tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);') + output('#endif\n') + + -- assign value + local def = 0 + if self.def ~= '' then def = self.def end + if self.type == 'char*' and self.dim ~= '' then -- is string + output(' strncpy((char*)') + if class and static then + output(self.parent.type..'::'..self.name) + elseif class then + output('self->'..self.name) + else + output(self.name) + end + output(',(const char*)tolua_tostring(tolua_S,2,',def,'),',self.dim,'-1);') + else + local ptr = '' + if self.ptr~='' then ptr = '*' end + output(' ') + local name = prop_set or self.name + if class and static then + output(self.parent.type..'::'..name) + elseif class then + output('self->'..name) + else + output(name) + end + local t = isbasic(self.type) + if prop_set then + output('(') + else + output(' = ') + end + if not t and ptr=='' then output('*') end + output('((',self.mod,self.type) + if not t then + output('*') + end + output(') ') + if t then + if isenum(self.type) then + output('(int) ') + end + output('tolua_to'..t,'(tolua_S,2,',def,'))') + else + local to_func = get_to_function(self.type) + output(to_func,'(tolua_S,2,',def,'))') + end + if prop_set then + output(")") + end + output(";") + end + output(' return 0;') + output('}') + output('#endif //#ifndef TOLUA_DISABLE\n') + output('\n') + end + +end + +function classVariable:register (pre) + + if not self:check_public_access() then + return + end + pre = pre or '' + local parent = self:inmodule() or self:innamespace() or self:inclass() + if not parent then + if classVariable._warning==nil then + warning("Mapping variable to global may degrade performance") + classVariable._warning = 1 + end + end + if self.csetname then + output(pre..'tolua_variable(tolua_S,"'..self.lname..'",'..self.cgetname..','..self.csetname..');') + else + output(pre..'tolua_variable(tolua_S,"'..self.lname..'",'..self.cgetname..',NULL);') + end +end + +-- Internal constructor +function _Variable (t) + setmetatable(t,classVariable) + append(t) + return t +end + +-- Constructor +-- Expects a string representing the variable declaration. +function Variable (s) + return _Variable (Declaration(s,'var')) +end + + diff --git a/tolua++-1.0.93/src/bin/lua/verbatim.lua b/tolua++-1.0.93/src/bin/lua/verbatim.lua new file mode 100644 index 000000000..fd3b29b35 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/verbatim.lua @@ -0,0 +1,78 @@ +-- tolua: verbatim class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 1998 +-- $Id: verbatim.lua,v 1.3 2000/01/24 20:41:16 celes Exp $ + +-- This code is free software; you can redistribute it and/or modify it. +-- The software provided hereunder is on an "as is" basis, and +-- the author has no obligation to provide maintenance, support, updates, +-- enhancements, or modifications. + + + +-- Verbatim class +-- Represents a line translated directed to the binding file. +-- The following filds are stored: +-- line = line text +classVerbatim = { + line = '', + cond = nil, -- condition: where to generate the code (s=suport, r=register) +} +classVerbatim.__index = classVerbatim +setmetatable(classVerbatim,classFeature) + +-- preamble verbatim +function classVerbatim:preamble () + if self.cond == '' then + write(self.line) + end +end + +-- support code +function classVerbatim:supcode () + if strfind(self.cond,'s') then + write(self.line) + write('\n') + end +end + +-- register code +function classVerbatim:register (pre) + if strfind(self.cond,'r') then + write(self.line) + end +end + + +-- Print method +function classVerbatim:print (ident,close) + print(ident.."Verbatim{") + print(ident.." line = '"..self.line.."',") + print(ident.."}"..close) +end + + +-- Internal constructor +function _Verbatim (t) + setmetatable(t,classVerbatim) + append(t) + return t +end + +-- Constructor +-- Expects a string representing the text line +function Verbatim (l,cond) + if strsub(l,1,1) == "'" then + l = strsub(l,2) + elseif strsub(l,1,1) == '$' then + cond = 'sr' -- generates in both suport and register fragments + l = strsub(l,2) + end + return _Verbatim { + line = l, + cond = cond or '', + } +end + + diff --git a/tolua++-1.0.93/src/bin/tolua.c b/tolua++-1.0.93/src/bin/tolua.c new file mode 100644 index 000000000..cc9f9adcd --- /dev/null +++ b/tolua++-1.0.93/src/bin/tolua.c @@ -0,0 +1,169 @@ +/* tolua +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Aug 2003 +** $Id:$ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" + +#include "lua.h" +#include "lualib.h" +#include "lauxlib.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +static void help (void) +{ + fprintf(stderr,"\n" + "usage: tolua++ [options] input_file\n" + "\n" + "Command line options are:\n" + " -v : print version information.\n" + " -o file : set output file; default is stdout.\n" + " -H file : create include file.\n" + " -n name : set package name; default is input file root name.\n" + " -p : parse only.\n" + " -P : parse and print structure information (for debug).\n" + " -S : disable support for c++ strings.\n" + " -1 : substract 1 to operator[] index (for compatibility with tolua5).\n" + " -L file : run lua file (with dofile()) before doing anything.\n" + " -D : disable automatic exporting of destructors for classes that have\n" + " constructors (for compatibility with tolua5)\n" + " -W : disable warnings for unsupported features (for compatibility\n" + " with tolua5)\n" + " -C : disable cleanup of included lua code (for easier debugging)\n" + " -E value[=value] : add extra values to the luastate\n" + " -t : export a list of types asociates with the C++ typeid name\n" + " -q : don't print warnings to the console\n" + " -h : print this message.\n" + "Should the input file be omitted, stdin is assumed;\n" + "in that case, the package name must be explicitly set.\n\n" + ); +} + +static void version (void) +{ + fprintf(stderr, "%s (written by W. Celes, A. Manzur)\n",TOLUA_VERSION); +} + +static void setfield (lua_State* L, int table, char* f, char* v) +{ + lua_pushstring(L,f); + lua_pushstring(L,v); + lua_settable(L,table); +} + +static void add_extra (lua_State* L, char* value) { + int len; + lua_getglobal(L, "_extra_parameters"); + len = luaL_getn(L, -1); + lua_pushstring(L, value); + lua_rawseti(L, -2, len+1); + lua_pop(L, 1); +}; + +static void error (char* o) +{ + fprintf(stderr,"tolua: unknown option '%s'\n",o); + help(); + exit(1); +} + +int main (int argc, char* argv[]) +{ + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + lua_State* L = luaL_newstate(); + luaL_openlibs(L); + #else + lua_State* L = lua_open(); + luaopen_base(L); + luaopen_io(L); + luaopen_string(L); + luaopen_table(L); + luaopen_math(L); + luaopen_debug(L); + #endif + + lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION"); + lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION"); + + if (argc==1) + { + help(); + return 0; + } + else + { + int i, t; + lua_newtable(L); + lua_setglobal(L, "_extra_parameters"); + lua_newtable(L); + lua_pushvalue(L,-1); + lua_setglobal(L,"flags"); + t = lua_gettop(L); + for (i=1; i<argc; ++i) + { + if (*argv[i] == '-') + { + switch (argv[i][1]) + { + case 'v': version(); return 0; + case 'h': help(); return 0; + case 'p': setfield(L,t,"p",""); break; + case 'P': setfield(L,t,"P",""); break; + case 'o': setfield(L,t,"o",argv[++i]); break; + case 'n': setfield(L,t,"n",argv[++i]); break; + case 'H': setfield(L,t,"H",argv[++i]); break; + case 'S': setfield(L,t,"S",""); break; + case '1': setfield(L,t,"1",""); break; + case 'L': setfield(L,t,"L",argv[++i]); break; + case 'D': setfield(L,t,"D",""); break; + case 'W': setfield(L,t,"W",""); break; + case 'C': setfield(L,t,"C",""); break; + case 'E': add_extra(L,argv[++i]); break; + case 't': setfield(L,t,"t",""); break; + case 'q': setfield(L,t,"q",""); break; + default: error(argv[i]); break; + } + } + else + { + setfield(L,t,"f",argv[i]); + break; + } + } + lua_pop(L,1); + } +/* #define TOLUA_SCRIPT_RUN */ +#ifndef TOLUA_SCRIPT_RUN + { + int tolua_tolua_open (lua_State* L); + tolua_tolua_open(L); + } +#else + { + char* p; + char path[BUFSIZ]; + strcpy(path,argv[0]); + p = strrchr(path,'/'); + if (p==NULL) p = strrchr(path,'\\'); + p = (p==NULL) ? path : p+1; + sprintf(p,"%s","../src/bin/lua/"); + lua_pushstring(L,path); lua_setglobal(L,"path"); + strcat(path,"all.lua"); + lua_dofile(L,path); + } +#endif + return 0; +} diff --git a/tolua++-1.0.93/src/bin/tolua_scons.pkg b/tolua++-1.0.93/src/bin/tolua_scons.pkg new file mode 100644 index 000000000..da458ea7c --- /dev/null +++ b/tolua++-1.0.93/src/bin/tolua_scons.pkg @@ -0,0 +1,31 @@ +$lfile "src/bin/lua/compat-5.1.lua" +$lfile "src/bin/lua/compat.lua" +$lfile "src/bin/lua/basic.lua" +$lfile "src/bin/lua/feature.lua" +$lfile "src/bin/lua/verbatim.lua" +$lfile "src/bin/lua/code.lua" +$lfile "src/bin/lua/typedef.lua" +$lfile "src/bin/lua/container.lua" +$lfile "src/bin/lua/package.lua" +$lfile "src/bin/lua/module.lua" +$lfile "src/bin/lua/namespace.lua" +$lfile "src/bin/lua/define.lua" +$lfile "src/bin/lua/enumerate.lua" +$lfile "src/bin/lua/declaration.lua" +$lfile "src/bin/lua/variable.lua" +$lfile "src/bin/lua/array.lua" +$lfile "src/bin/lua/function.lua" +$lfile "src/bin/lua/operator.lua" +$lfile "src/bin/lua/template_class.lua" +$lfile "src/bin/lua/class.lua" +$lfile "src/bin/lua/clean.lua" +$lfile "src/bin/lua/doit.lua" + +$[ +local err,msg = pcall(doit) +if not err then + local _,_,label,msg = strfind(msg,"(.-:.-:%s*)(.*)") + tolua_error(msg,label) + print(debug.traceback()) +end +$] diff --git a/tolua++-1.0.93/src/bin/toluabind.c b/tolua++-1.0.93/src/bin/toluabind.c new file mode 100644 index 000000000..b684c06c3 --- /dev/null +++ b/tolua++-1.0.93/src/bin/toluabind.c @@ -0,0 +1,8072 @@ +/* +** Lua binding: tolua +** Generated automatically by tolua++-1.0.92 on Sun Feb 15 22:29:47 2009. +*/ + +#ifndef __cplusplus +#include "stdlib.h" +#endif +#include "string.h" + +#include "tolua++.h" + +/* Exported function */ +TOLUA_API int tolua_tolua_open (lua_State* tolua_S); + + +/* function to register type */ +static void tolua_reg_types (lua_State* tolua_S) +{ +} + +/* Open function */ +TOLUA_API int tolua_tolua_open (lua_State* tolua_S) +{ + tolua_open(tolua_S); + tolua_reg_types(tolua_S); + tolua_module(tolua_S,NULL,0); + tolua_beginmodule(tolua_S,NULL); + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 95, 86, 69, 82, 83, 73, 79, 78, 44, 32, 34, 53, 37, 46, 48, + 34, 41, 32,116,104,101,110, 13, 10, 9,114,101,116,117,114, + 110, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 32, 34,108, + 111, 97,100,102,105,108,101, 34, 13, 10,108,111, 99, 97,108, + 32,102,117,110, 99,116,105,111,110, 32,112,112, 95,100,111, + 102,105,108,101, 40,112, 97,116,104, 41, 13, 10, 13, 10, 9, + 108,111, 99, 97,108, 32,108,111, 97,100,101,100, 32, 61, 32, + 102, 97,108,115,101, 13, 10, 9,108,111, 99, 97,108, 32,103, + 101,116,102,105,108,101, 32, 61, 32,102,117,110, 99,116,105, + 111,110, 40, 41, 13, 10, 13, 10, 9, 9,105,102, 32,108,111, + 97,100,101,100, 32,116,104,101,110, 13, 10, 9, 9, 9,114, + 101,116,117,114,110, 13, 10, 9, 9,101,108,115,101, 13, 10, + 9, 9, 9,108,111, 99, 97,108, 32,102,105,108,101, 44,101, + 114,114, 32, 61, 32,105,111, 46,111,112,101,110, 40,112, 97, + 116,104, 41, 13, 10, 9, 9, 9,105,102, 32,110,111,116, 32, + 102,105,108,101, 32,116,104,101,110, 13, 10, 9, 9, 9, 9, + 101,114,114,111,114, 40, 34,101,114,114,111,114, 32,108,111, + 97,100,105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112, + 97,116,104, 46, 46, 34, 58, 32, 34, 46, 46,101,114,114, 41, + 13, 10, 9, 9, 9,101,110,100, 13, 10, 9, 9, 9,108,111, + 99, 97,108, 32,114,101,116, 32, 61, 32,102,105,108,101, 58, + 114,101, 97,100, 40, 34, 42, 97, 34, 41, 13, 10, 9, 9, 9, + 102,105,108,101, 58, 99,108,111,115,101, 40, 41, 13, 10, 13, + 10, 9, 9, 9,114,101,116, 32, 61, 32,115,116,114,105,110, + 103, 46,103,115,117, 98, 40,114,101,116, 44, 32, 34, 37, 46, + 37, 46, 37, 46, 37,115, 42, 37, 41, 34, 44, 32, 34, 46, 46, + 46, 41, 32,108,111, 99, 97,108, 32, 97,114,103, 32, 61, 32, + 123,110, 61,115,101,108,101, 99,116, 40, 39, 35, 39, 44, 32, + 46, 46, 46, 41, 44, 32, 46, 46, 46,125, 59, 34, 41, 13, 10, + 13, 10, 9, 9, 9,108,111, 97,100,101,100, 32, 61, 32,116, + 114,117,101, 13, 10, 9, 9, 9,114,101,116,117,114,110, 32, + 114,101,116, 13, 10, 9, 9,101,110,100, 13, 10, 9,101,110, + 100, 13, 10, 13, 10, 9,108,111, 99, 97,108, 32,102, 32, 61, + 32,108,111, 97,100, 40,103,101,116,102,105,108,101, 44, 32, + 112, 97,116,104, 41, 13, 10, 9,105,102, 32,110,111,116, 32, + 102, 32,116,104,101,110, 13, 10, 9, 13, 10, 9, 9,101,114, + 114,111,114, 40, 34,101,114,114,111,114, 32,108,111, 97,100, + 105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112, 97,116, + 104, 41, 13, 10, 9,101,110,100, 13, 10, 9,114,101,116,117, + 114,110, 32,102, 40, 41, 13, 10,101,110,100, 13, 10, 13, 10, + 111,108,100, 95,100,111,102,105,108,101, 32, 61, 32,100,111, + 102,105,108,101, 13, 10,100,111,102,105,108,101, 32, 61, 32, + 112,112, 95,100,111,102,105,108,101, 13, 10, 13, 10, 13, 10, + 45, 45, 32,115,116,114,105,110,103, 46,103,115,117, 98, 13, + 10, 45, 45, 91, 91, 13, 10,108,111, 99, 97,108, 32,111,103, + 115,117, 98, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 13, 10,108,111, 99, 97,108, 32,102,117,110, 99,116, + 105,111,110, 32, 99,111,109,112,103,115,117, 98, 40, 97, 44, + 98, 44, 99, 44,100, 41, 13, 10, 32, 32,105,102, 32,116,121, + 112,101, 40, 99, 41, 32, 61, 61, 32, 34,102,117,110, 99,116, + 105,111,110, 34, 32,116,104,101,110, 13, 10, 32, 32, 32, 32, + 108,111, 99, 97,108, 32,111, 99, 32, 61, 32, 99, 13, 10, 32, + 32, 32, 32, 99, 32, 61, 32,102,117,110, 99,116,105,111,110, + 32, 40, 46, 46, 46, 41, 32,114,101,116,117,114,110, 32,111, + 99, 40, 46, 46, 46, 41, 32,111,114, 32, 39, 39, 32,101,110, + 100, 13, 10, 32, 32,101,110,100, 13, 10, 32, 32,114,101,116, + 117,114,110, 32,111,103,115,117, 98, 40, 97, 44, 98, 44, 99, + 44,100, 41, 13, 10,101,110,100, 13, 10,115,116,114,105,110, + 103, 46,114,101,112,108, 32, 61, 32,111,103,115,117, 98, 13, + 10, 45, 45, 93, 93, 13, 10, 13, 10, 45, 45,115,116,114,105, + 110,103, 46,103,115,117, 98, 32, 61, 32, 99,111,109,112,103, + 115,117, 98, 13,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/compat-5.1.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 82,101, 97,108, + 32,103,108,111, 98, 97,108,115, 10, 45, 45, 32, 95, 65, 76, + 69, 82, 84, 10, 45, 45, 32, 95, 69, 82, 82, 79, 82, 77, 69, + 83, 83, 65, 71, 69, 10, 45, 45, 32, 95, 86, 69, 82, 83, 73, + 79, 78, 10, 45, 45, 32, 95, 71, 10, 45, 45, 32, 97,115,115, + 101,114,116, 10, 45, 45, 32,101,114,114,111,114, 10, 45, 45, + 32,109,101,116, 97,116, 97, 98,108,101, 10, 45, 45, 32,110, + 101,120,116, 10, 45, 45, 32,112,114,105,110,116, 10, 45, 45, + 32,114,101,113,117,105,114,101, 10, 45, 45, 32,116,111,110, + 117,109, 98,101,114, 10, 45, 45, 32,116,111,115,116,114,105, + 110,103, 10, 45, 45, 32,116,121,112,101, 10, 45, 45, 32,117, + 110,112, 97, 99,107, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, + 45, 45, 32, 99,111,108,108,101, 99,116,103, 97,114, 98, 97, + 103,101, 10, 45, 45, 32,103, 99,105,110,102,111, 10, 10, 45, + 45, 32,103,108,111, 98, 97,108,115, 10, 10, 45, 45, 32, 99, + 97,108,108, 32, 32, 32, 45, 62, 32,112,114,111,116,101, 99, + 116, 40,102, 44, 32,101,114,114, 41, 10, 45, 45, 32,108,111, + 97,100,102,105,108,101, 10, 45, 45, 32,108,111, 97,100,115, + 116,114,105,110,103, 10, 10, 45, 45, 32,114, 97,119,103,101, + 116, 10, 45, 45, 32,114, 97,119,115,101,116, 10, 10, 45, 45, + 32,103,101,116, 97,114,103,115, 32, 61, 32, 77, 97,105,110, + 46,103,101,116, 97,114,103,115, 32, 63, 63, 10, 10,114, 97, + 119,116,121,112,101, 32, 61, 32,116,121,112,101, 10, 10,102, + 117,110, 99,116,105,111,110, 32,100,111, 95, 32, 40,102, 44, + 32,101,114,114, 41, 10, 32, 32,105,102, 32,110,111,116, 32, + 102, 32,116,104,101,110, 32,112,114,105,110,116, 40,101,114, + 114, 41, 59, 32,114,101,116,117,114,110, 32,101,110,100, 10, + 32, 32,108,111, 99, 97,108, 32, 97, 44, 98, 32, 61, 32,112, + 99, 97,108,108, 40,102, 41, 10, 32, 32,105,102, 32,110,111, + 116, 32, 97, 32,116,104,101,110, 32,112,114,105,110,116, 40, + 98, 41, 59, 32,114,101,116,117,114,110, 32,110,105,108, 10, + 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32, 98, + 32,111,114, 32,116,114,117,101, 10, 32, 32,101,110,100, 10, + 101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,100, + 111,115,116,114,105,110,103, 40,115, 41, 32,114,101,116,117, + 114,110, 32,100,111, 95, 40,108,111, 97,100,115,116,114,105, + 110,103, 40,115, 41, 41, 32,101,110,100, 10, 45, 45, 32,102, + 117,110, 99,116,105,111,110, 32,100,111,102,105,108,101, 40, + 115, 41, 32,114,101,116,117,114,110, 32,100,111, 95, 40,108, + 111, 97,100,102,105,108,101, 40,115, 41, 41, 32,101,110,100, + 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 84, 97, + 98,108,101, 32,108,105, 98,114, 97,114,121, 10,108,111, 99, + 97,108, 32,116, 97, 98, 32, 61, 32,116, 97, 98,108,101, 10, + 102,111,114,101, 97, 99,104, 32, 61, 32,116, 97, 98, 46,102, + 111,114,101, 97, 99,104, 10,102,111,114,101, 97, 99,104,105, + 32, 61, 32,116, 97, 98, 46,102,111,114,101, 97, 99,104,105, + 10,103,101,116,110, 32, 61, 32,116, 97, 98, 46,103,101,116, + 110, 10,116,105,110,115,101,114,116, 32, 61, 32,116, 97, 98, + 46,105,110,115,101,114,116, 10,116,114,101,109,111,118,101, + 32, 61, 32,116, 97, 98, 46,114,101,109,111,118,101, 10,115, + 111,114,116, 32, 61, 32,116, 97, 98, 46,115,111,114,116, 10, + 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 98, + 117,103, 32,108,105, 98,114, 97,114,121, 10,108,111, 99, 97, + 108, 32,100, 98,103, 32, 61, 32,100,101, 98,117,103, 10,103, + 101,116,105,110,102,111, 32, 61, 32,100, 98,103, 46,103,101, + 116,105,110,102,111, 10,103,101,116,108,111, 99, 97,108, 32, + 61, 32,100, 98,103, 46,103,101,116,108,111, 99, 97,108, 10, + 115,101,116, 99, 97,108,108,104,111,111,107, 32, 61, 32,102, + 117,110, 99,116,105,111,110, 32, 40, 41, 32,101,114,114,111, + 114, 34, 96,115,101,116, 99, 97,108,108,104,111,111,107, 39, + 32,105,115, 32,100,101,112,114,101, 99, 97,116,101,100, 34, + 32,101,110,100, 10,115,101,116,108,105,110,101,104,111,111, + 107, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40, 41, + 32,101,114,114,111,114, 34, 96,115,101,116,108,105,110,101, + 104,111,111,107, 39, 32,105,115, 32,100,101,112,114,101, 99, + 97,116,101,100, 34, 32,101,110,100, 10,115,101,116,108,111, + 99, 97,108, 32, 61, 32,100, 98,103, 46,115,101,116,108,111, + 99, 97,108, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, + 32,109, 97,116,104, 32,108,105, 98,114, 97,114,121, 10,108, + 111, 99, 97,108, 32,109, 97,116,104, 32, 61, 32,109, 97,116, + 104, 10, 97, 98,115, 32, 61, 32,109, 97,116,104, 46, 97, 98, + 115, 10, 97, 99,111,115, 32, 61, 32,102,117,110, 99,116,105, + 111,110, 32, 40,120, 41, 32,114,101,116,117,114,110, 32,109, + 97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97, 99, + 111,115, 40,120, 41, 41, 32,101,110,100, 10, 97,115,105,110, + 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,120, 41, + 32,114,101,116,117,114,110, 32,109, 97,116,104, 46,100,101, + 103, 40,109, 97,116,104, 46, 97,115,105,110, 40,120, 41, 41, + 32,101,110,100, 10, 97,116, 97,110, 32, 61, 32,102,117,110, + 99,116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114, + 110, 32,109, 97,116,104, 46,100,101,103, 40,109, 97,116,104, + 46, 97,116, 97,110, 40,120, 41, 41, 32,101,110,100, 10, 97, + 116, 97,110, 50, 32, 61, 32,102,117,110, 99,116,105,111,110, + 32, 40,120, 44,121, 41, 32,114,101,116,117,114,110, 32,109, + 97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97,116, + 97,110, 50, 40,120, 44,121, 41, 41, 32,101,110,100, 10, 99, + 101,105,108, 32, 61, 32,109, 97,116,104, 46, 99,101,105,108, + 10, 99,111,115, 32, 61, 32,102,117,110, 99,116,105,111,110, + 32, 40,120, 41, 32,114,101,116,117,114,110, 32,109, 97,116, + 104, 46, 99,111,115, 40,109, 97,116,104, 46,114, 97,100, 40, + 120, 41, 41, 32,101,110,100, 10,100,101,103, 32, 61, 32,109, + 97,116,104, 46,100,101,103, 10,101,120,112, 32, 61, 32,109, + 97,116,104, 46,101,120,112, 10,102,108,111,111,114, 32, 61, + 32,109, 97,116,104, 46,102,108,111,111,114, 10,102,114,101, + 120,112, 32, 61, 32,109, 97,116,104, 46,102,114,101,120,112, + 10,108,100,101,120,112, 32, 61, 32,109, 97,116,104, 46,108, + 100,101,120,112, 10,108,111,103, 32, 61, 32,109, 97,116,104, + 46,108,111,103, 10,108,111,103, 49, 48, 32, 61, 32,109, 97, + 116,104, 46,108,111,103, 49, 48, 10,109, 97,120, 32, 61, 32, + 109, 97,116,104, 46,109, 97,120, 10,109,105,110, 32, 61, 32, + 109, 97,116,104, 46,109,105,110, 10,109,111,100, 32, 61, 32, + 109, 97,116,104, 46,109,111,100, 10, 80, 73, 32, 61, 32,109, + 97,116,104, 46,112,105, 10, 45, 45, 63, 63, 63, 32,112,111, + 119, 32, 61, 32,109, 97,116,104, 46,112,111,119, 32, 32, 10, + 114, 97,100, 32, 61, 32,109, 97,116,104, 46,114, 97,100, 10, + 114, 97,110,100,111,109, 32, 61, 32,109, 97,116,104, 46,114, + 97,110,100,111,109, 10,114, 97,110,100,111,109,115,101,101, + 100, 32, 61, 32,109, 97,116,104, 46,114, 97,110,100,111,109, + 115,101,101,100, 10,115,105,110, 32, 61, 32,102,117,110, 99, + 116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114,110, + 32,109, 97,116,104, 46,115,105,110, 40,109, 97,116,104, 46, + 114, 97,100, 40,120, 41, 41, 32,101,110,100, 10,115,113,114, + 116, 32, 61, 32,109, 97,116,104, 46,115,113,114,116, 10,116, + 97,110, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40, + 120, 41, 32,114,101,116,117,114,110, 32,109, 97,116,104, 46, + 116, 97,110, 40,109, 97,116,104, 46,114, 97,100, 40,120, 41, + 41, 32,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, + 45, 45, 32,115,116,114,105,110,103, 32,108,105, 98,114, 97, + 114,121, 10,108,111, 99, 97,108, 32,115,116,114, 32, 61, 32, + 115,116,114,105,110,103, 10,115,116,114, 98,121,116,101, 32, + 61, 32,115,116,114, 46, 98,121,116,101, 10,115,116,114, 99, + 104, 97,114, 32, 61, 32,115,116,114, 46, 99,104, 97,114, 10, + 115,116,114,102,105,110,100, 32, 61, 32,115,116,114, 46,102, + 105,110,100, 10,102,111,114,109, 97,116, 32, 61, 32,115,116, + 114, 46,102,111,114,109, 97,116, 10,103,115,117, 98, 32, 61, + 32,115,116,114, 46,103,115,117, 98, 10,115,116,114,108,101, + 110, 32, 61, 32,115,116,114, 46,108,101,110, 10,115,116,114, + 108,111,119,101,114, 32, 61, 32,115,116,114, 46,108,111,119, + 101,114, 10,115,116,114,114,101,112, 32, 61, 32,115,116,114, + 46,114,101,112, 10,115,116,114,115,117, 98, 32, 61, 32,115, + 116,114, 46,115,117, 98, 10,115,116,114,117,112,112,101,114, + 32, 61, 32,115,116,114, 46,117,112,112,101,114, 10, 10, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 10, 45, 45, 32,111,115, 32,108,105, + 98,114, 97,114,121, 10, 99,108,111, 99,107, 32, 61, 32,111, + 115, 46, 99,108,111, 99,107, 10,100, 97,116,101, 32, 61, 32, + 111,115, 46,100, 97,116,101, 10,100,105,102,102,116,105,109, + 101, 32, 61, 32,111,115, 46,100,105,102,102,116,105,109,101, + 10,101,120,101, 99,117,116,101, 32, 61, 32,111,115, 46,101, + 120,101, 99,117,116,101, 32, 45, 45, 63, 10,101,120,105,116, + 32, 61, 32,111,115, 46,101,120,105,116, 10,103,101,116,101, + 110,118, 32, 61, 32,111,115, 46,103,101,116,101,110,118, 10, + 114,101,109,111,118,101, 32, 61, 32,111,115, 46,114,101,109, + 111,118,101, 10,114,101,110, 97,109,101, 32, 61, 32,111,115, + 46,114,101,110, 97,109,101, 10,115,101,116,108,111, 99, 97, + 108,101, 32, 61, 32,111,115, 46,115,101,116,108,111, 99, 97, + 108,101, 10,116,105,109,101, 32, 61, 32,111,115, 46,116,105, + 109,101, 10,116,109,112,110, 97,109,101, 32, 61, 32,111,115, + 46,116,109,112,110, 97,109,101, 10, 10, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 10, 45, 45, 32, 99,111,109,112, 97,116,105, 98,105, + 108,105,116,121, 32,111,110,108,121, 10,103,101,116,103,108, + 111, 98, 97,108, 32, 61, 32,102,117,110, 99,116,105,111,110, + 32, 40,110, 41, 32,114,101,116,117,114,110, 32, 95, 71, 91, + 110, 93, 32,101,110,100, 10,115,101,116,103,108,111, 98, 97, + 108, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,110, + 44,118, 41, 32, 95, 71, 91,110, 93, 32, 61, 32,118, 32,101, + 110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10,108,111, + 99, 97,108, 32,105,111, 44, 32,116, 97, 98, 32, 61, 32,105, + 111, 44, 32,116, 97, 98,108,101, 10, 10, 45, 45, 32, 73, 79, + 32,108,105, 98,114, 97,114,121, 32, 40,102,105,108,101,115, + 41, 10, 95, 83, 84, 68, 73, 78, 32, 61, 32,105,111, 46,115, + 116,100,105,110, 10, 95, 83, 84, 68, 69, 82, 82, 32, 61, 32, + 105,111, 46,115,116,100,101,114,114, 10, 95, 83, 84, 68, 79, + 85, 84, 32, 61, 32,105,111, 46,115,116,100,111,117,116, 10, + 95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115,116,100, + 105,110, 10, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105,111, + 46,115,116,100,111,117,116, 10,115,101,101,107, 32, 61, 32, + 105,111, 46,115,116,100,105,110, 46,115,101,101,107, 32, 32, + 32, 45, 45, 32,115,105, 99,107, 32, 59, 45, 41, 10,116,109, + 112,102,105,108,101, 32, 61, 32,105,111, 46,116,109,112,102, + 105,108,101, 10, 99,108,111,115,101,102,105,108,101, 32, 61, + 32,105,111, 46, 99,108,111,115,101, 10,111,112,101,110,102, + 105,108,101, 32, 61, 32,105,111, 46,111,112,101,110, 10, 10, + 102,117,110, 99,116,105,111,110, 32,102,108,117,115,104, 32, + 40,102, 41, 10, 32, 32,105,102, 32,102, 32,116,104,101,110, + 32,102, 58,102,108,117,115,104, 40, 41, 10, 32, 32,101,108, + 115,101, 32, 95, 79, 85, 84, 80, 85, 84, 58,102,108,117,115, + 104, 40, 41, 10, 32, 32,101,110,100, 10,101,110,100, 10, 10, + 102,117,110, 99,116,105,111,110, 32,114,101, 97,100,102,114, + 111,109, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102, 32, + 110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104,101, + 110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44, 32, + 101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46, 99, + 108,111,115,101, 40, 95, 73, 78, 80, 85, 84, 41, 10, 32, 32, + 32, 32, 95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115, + 116,100,105,110, 10, 32, 32, 32, 32,114,101,116,117,114,110, + 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32, + 101,108,115,101, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, + 102, 44, 32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105, + 111, 46,111,112,101,110, 40,110, 97,109,101, 44, 32, 34,114, + 34, 41, 10, 32, 32, 32, 32, 95, 73, 78, 80, 85, 84, 32, 61, + 32,102, 32,111,114, 32, 95, 73, 78, 80, 85, 84, 10, 32, 32, + 32, 32,114,101,116,117,114,110, 32,102, 44, 32,101,114,114, + 44, 32, 99,111,100, 10, 32, 32,101,110,100, 10,101,110,100, + 10, 10,102,117,110, 99,116,105,111,110, 32,119,114,105,116, + 101,116,111, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102, + 32,110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104, + 101,110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44, + 32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46, + 99,108,111,115,101, 40, 95, 79, 85, 84, 80, 85, 84, 41, 10, + 32, 32, 32, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105, + 111, 46,115,116,100,111,117,116, 10, 32, 32, 32, 32,114,101, + 116,117,114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111, + 100, 10, 32, 32,101,108,115,101, 10, 32, 32, 32, 32,108,111, + 99, 97,108, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, + 32, 61, 32,105,111, 46,111,112,101,110, 40,110, 97,109,101, + 44, 32, 34,119, 34, 41, 10, 32, 32, 32, 32, 95, 79, 85, 84, + 80, 85, 84, 32, 61, 32,102, 32,111,114, 32, 95, 79, 85, 84, + 80, 85, 84, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, + 102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32,101, + 110,100, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, + 110, 32, 97,112,112,101,110,100,116,111, 32, 40,110, 97,109, + 101, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44, 32,101, + 114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46,111,112, + 101,110, 40,110, 97,109,101, 44, 32, 34, 97, 34, 41, 10, 32, + 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,102, 32,111,114, + 32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,114,101,116,117, + 114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, + 101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114, + 101, 97,100, 32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99, + 97,108, 32,102, 32, 61, 32, 95, 73, 78, 80, 85, 84, 10, 32, + 32,105,102, 32,114, 97,119,116,121,112,101, 40, 97,114,103, + 91, 49, 93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97, + 116, 97, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32, + 61, 32,116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114, + 103, 44, 32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114, + 101,116,117,114,110, 32,102, 58,114,101, 97,100, 40,117,110, + 112, 97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100, 10, + 10,102,117,110, 99,116,105,111,110, 32,119,114,105,116,101, + 32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99, 97,108, 32, + 102, 32, 61, 32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,105, + 102, 32,114, 97,119,116,121,112,101, 40, 97,114,103, 91, 49, + 93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97,116, 97, + 39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32, 61, 32, + 116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114,103, 44, + 32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114,101,116, + 117,114,110, 32,102, 58,119,114,105,116,101, 40,117,110,112, + 97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/compat.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 98, 97,115,105, 99, + 32,117,116,105,108,105,116,121, 32,102,117,110, 99,116,105, + 111,110,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32, + 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108, + 101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80, + 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49, + 57, 57, 56, 10, 45, 45, 32, 76, 97,115,116, 32,117,112,100, + 97,116,101, 58, 32, 65,112,114, 32, 50, 48, 48, 51, 10, 45, + 45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104, + 105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, + 32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, + 99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116, + 101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100, + 105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32, + 115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100, + 101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, + 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, + 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116, + 104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110, + 111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, + 32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101, + 110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, + 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110, + 104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32, + 109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, + 10, 10, 45, 45, 32, 66, 97,115,105, 99, 32, 67, 32,116,121, + 112,101,115, 32, 97,110,100, 32,116,104,101,105,114, 32, 99, + 111,114,114,101,115,112,111,110,100,105,110,103, 32, 76,117, + 97, 32,116,121,112,101,115, 10, 45, 45, 32, 65,108,108, 32, + 111, 99, 99,117,114,114,101,110, 99,101,115, 32,111,102, 32, + 34, 99,104, 97,114, 42, 34, 32,119,105,108,108, 32, 98,101, + 32,114,101,112,108, 97, 99,101,100, 32, 98,121, 32, 34, 95, + 99,115,116,114,105,110,103, 34, 44, 10, 45, 45, 32, 97,110, + 100, 32, 97,108,108, 32,111, 99, 99,117,114,114,101,110, 99, + 101,115, 32,111,102, 32, 34,118,111,105,100, 42, 34, 32,119, + 105,108,108, 32, 98,101, 32,114,101,112,108, 97, 99,101,100, + 32, 98,121, 32, 34, 95,117,115,101,114,100, 97,116, 97, 34, + 10, 95, 98, 97,115,105, 99, 32, 61, 32,123, 10, 32, 91, 39, + 118,111,105,100, 39, 93, 32, 61, 32, 39, 39, 44, 10, 32, 91, + 39, 99,104, 97,114, 39, 93, 32, 61, 32, 39,110,117,109, 98, + 101,114, 39, 44, 10, 32, 91, 39,105,110,116, 39, 93, 32, 61, + 32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,115, + 104,111,114,116, 39, 93, 32, 61, 32, 39,110,117,109, 98,101, + 114, 39, 44, 10, 32, 91, 39,108,111,110,103, 39, 93, 32, 61, + 32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,117, + 110,115,105,103,110,101,100, 39, 93, 32, 61, 32, 39,110,117, + 109, 98,101,114, 39, 44, 10, 32, 91, 39,102,108,111, 97,116, + 39, 93, 32, 61, 32, 39,110,117,109, 98,101,114, 39, 44, 10, + 32, 91, 39,100,111,117, 98,108,101, 39, 93, 32, 61, 32, 39, + 110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39, 95, 99,115, + 116,114,105,110,103, 39, 93, 32, 61, 32, 39,115,116,114,105, + 110,103, 39, 44, 10, 32, 91, 39, 95,117,115,101,114,100, 97, + 116, 97, 39, 93, 32, 61, 32, 39,117,115,101,114,100, 97,116, + 97, 39, 44, 10, 32, 91, 39, 99,104, 97,114, 42, 39, 93, 32, + 61, 32, 39,115,116,114,105,110,103, 39, 44, 10, 32, 91, 39, + 118,111,105,100, 42, 39, 93, 32, 61, 32, 39,117,115,101,114, + 100, 97,116, 97, 39, 44, 10, 32, 91, 39, 98,111,111,108, 39, + 93, 32, 61, 32, 39, 98,111,111,108,101, 97,110, 39, 44, 10, + 32, 91, 39,108,117, 97, 95, 79, 98,106,101, 99,116, 39, 93, + 32, 61, 32, 39,118, 97,108,117,101, 39, 44, 10, 32, 91, 39, + 76, 85, 65, 95, 86, 65, 76, 85, 69, 39, 93, 32, 61, 32, 39, + 118, 97,108,117,101, 39, 44, 32, 32, 32, 32, 45, 45, 32,102, + 111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,116, + 121, 32,119,105,116,104, 32,116,111,108,117, 97, 32, 52, 46, + 48, 10, 32, 91, 39,108,117, 97, 95, 83,116, 97,116,101, 42, + 39, 93, 32, 61, 32, 39,115,116, 97,116,101, 39, 44, 10, 32, + 91, 39, 95,108,115,116, 97,116,101, 39, 93, 32, 61, 32, 39, + 115,116, 97,116,101, 39, 44, 10, 32, 91, 39,108,117, 97, 95, + 70,117,110, 99,116,105,111,110, 39, 93, 32, 61, 32, 39,118, + 97,108,117,101, 39, 44, 10,125, 10, 10, 95, 98, 97,115,105, + 99, 95, 99,116,121,112,101, 32, 61, 32,123, 10, 32,110,117, + 109, 98,101,114, 32, 61, 32, 34,108,117, 97, 95, 78,117,109, + 98,101,114, 34, 44, 10, 32,115,116,114,105,110,103, 32, 61, + 32, 34, 99,111,110,115,116, 32, 99,104, 97,114, 42, 34, 44, + 10, 32,117,115,101,114,100, 97,116, 97, 32, 61, 32, 34,118, + 111,105,100, 42, 34, 44, 10, 32, 98,111,111,108,101, 97,110, + 32, 61, 32, 34, 98,111,111,108, 34, 44, 10, 32,118, 97,108, + 117,101, 32, 61, 32, 34,105,110,116, 34, 44, 10, 32,115,116, + 97,116,101, 32, 61, 32, 34,108,117, 97, 95, 83,116, 97,116, + 101, 42, 34, 44, 10,125, 10, 10, 45, 45, 32,102,117,110, 99, + 116,105,111,110,115, 32,116,104,101, 32, 97,114,101, 32,117, + 115,101,100, 32,116,111, 32,100,111, 32, 97, 32, 39,114, 97, + 119, 32,112,117,115,104, 39, 32,111,102, 32, 98, 97,115,105, + 99, 32,116,121,112,101,115, 10, 95, 98, 97,115,105, 99, 95, + 114, 97,119, 95,112,117,115,104, 32, 61, 32,123,125, 10, 10, + 45, 45, 32, 76,105,115,116, 32,111,102, 32,117,115,101,114, + 32,100,101,102,105,110,101,100, 32,116,121,112,101,115, 10, + 45, 45, 32, 69, 97, 99,104, 32,116,121,112,101, 32, 99,111, + 114,114,101,115,112,111,110,100,115, 32,116,111, 32, 97, 32, + 118, 97,114,105, 97, 98,108,101, 32,110, 97,109,101, 32,116, + 104, 97,116, 32,115,116,111,114,101,115, 32,105,116,115, 32, + 116, 97,103, 32,118, 97,108,117,101, 46, 10, 95,117,115,101, + 114,116,121,112,101, 32, 61, 32,123,125, 10, 10, 45, 45, 32, + 76,105,115,116, 32,111,102, 32,116,121,112,101,115, 32,116, + 104, 97,116, 32,104, 97,118,101, 32,116,111, 32, 98,101, 32, + 99,111,108,108,101, 99,116,101,100, 10, 95, 99,111,108,108, + 101, 99,116, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105, + 115,116, 32,111,102, 32,116,121,112,101,115, 10, 95,103,108, + 111, 98, 97,108, 95,116,121,112,101,115, 32, 61, 32,123,110, + 61, 48,125, 10, 95,103,108,111, 98, 97,108, 95,116,121,112, + 101,115, 95,104, 97,115,104, 32, 61, 32,123,125, 10, 10, 45, + 45, 32,108,105,115,116, 32,111,102, 32, 99,108, 97,115,115, + 101,115, 10, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115, + 115,101,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105, + 115,116, 32,111,102, 32,101,110,117,109, 32, 99,111,110,115, + 116, 97,110,116,115, 10, 95,103,108,111, 98, 97,108, 95,101, + 110,117,109,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76, + 105,115,116, 32,111,102, 32, 97,117,116,111, 32,114,101,110, + 97,109,105,110,103, 10, 95,114,101,110, 97,109,105,110,103, + 32, 61, 32,123,125, 10,102,117,110, 99,116,105,111,110, 32, + 97,112,112,101,110,100,114,101,110, 97,109,105,110,103, 32, + 40,115, 41, 10, 32,108,111, 99, 97,108, 32, 98, 44,101, 44, + 111,108,100, 44,110,101,119, 32, 61, 32,115,116,114,102,105, + 110,100, 40,115, 44, 34, 37,115, 42, 40, 46, 45, 41, 37,115, + 42, 64, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 36, 34, 41, + 10, 9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, + 10, 9, 32,101,114,114,111,114, 40, 34, 35, 73,110,118, 97, + 108,105,100, 32,114,101,110, 97,109,105,110,103, 32,115,121, + 110,116, 97,120, 59, 32,105,116, 32,115,104,111,117,108,100, + 32, 98,101, 32,111,102, 32,116,104,101, 32,102,111,114,109, + 58, 32,112, 97,116,116,101,114,110, 64,112, 97,116,116,101, + 114,110, 34, 41, 10, 9,101,110,100, 10, 9,116,105,110,115, + 101,114,116, 40, 95,114,101,110, 97,109,105,110,103, 44,123, + 111,108,100, 61,111,108,100, 44, 32,110,101,119, 61,110,101, + 119,125, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105, + 111,110, 32, 97,112,112,108,121,114,101,110, 97,109,105,110, + 103, 32, 40,115, 41, 10, 9,102,111,114, 32,105, 61, 49, 44, + 103,101,116,110, 40, 95,114,101,110, 97,109,105,110,103, 41, + 32,100,111, 10, 9, 32,108,111, 99, 97,108, 32,109, 44,110, + 32, 61, 32,103,115,117, 98, 40,115, 44, 95,114,101,110, 97, + 109,105,110,103, 91,105, 93, 46,111,108,100, 44, 95,114,101, + 110, 97,109,105,110,103, 91,105, 93, 46,110,101,119, 41, 10, + 9, 9,105,102, 32,110, 32,126, 61, 32, 48, 32,116,104,101, + 110, 10, 9, 9, 32,114,101,116,117,114,110, 32,109, 10, 9, + 9,101,110,100, 10, 9,101,110,100, 10, 9,114,101,116,117, + 114,110, 32,110,105,108, 10,101,110,100, 10, 10, 45, 45, 32, + 69,114,114,111,114, 32,104, 97,110,100,108,101,114, 10,102, + 117,110, 99,116,105,111,110, 32,116,111,108,117, 97, 95,101, + 114,114,111,114, 32, 40,115, 44,102, 41, 10,105,102, 32, 95, + 99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110, 10, + 9,112,114,105,110,116, 40, 34, 42, 42, 42, 99,117,114,114, + 32, 99,111,100,101, 32,102,111,114, 32,101,114,114,111,114, + 32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103, + 40, 95, 99,117,114,114, 95, 99,111,100,101, 41, 41, 10, 9, + 112,114,105,110,116, 40,100,101, 98,117,103, 46,116,114, 97, + 99,101, 98, 97, 99,107, 40, 41, 41, 10,101,110,100, 10, 32, + 108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79, 85, + 84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, + 32, 95, 83, 84, 68, 69, 82, 82, 10, 32,105,102, 32,115,116, + 114,115,117, 98, 40,115, 44, 49, 44, 49, 41, 32, 61, 61, 32, + 39, 35, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116, + 101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 58, 32, + 34, 46, 46,115,116,114,115,117, 98, 40,115, 44, 50, 41, 46, + 46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 32,105,102, 32, + 95, 99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110, + 10, 32, 32, 32,108,111, 99, 97,108, 32, 95, 44, 95, 44,115, + 32, 61, 32,115,116,114,102,105,110,100, 40, 95, 99,117,114, + 114, 95, 99,111,100,101, 44, 34, 94, 37,115, 42, 40, 46, 45, + 92,110, 41, 34, 41, 32, 45, 45, 32,101,120,116,114, 97, 99, + 116, 32,102,105,114,115,116, 32,108,105,110,101, 10, 32, 32, + 32,105,102, 32,115, 61, 61,110,105,108, 32,116,104,101,110, + 32,115, 32, 61, 32, 95, 99,117,114,114, 95, 99,111,100,101, + 32,101,110,100, 10, 32, 32, 32,115, 32, 61, 32,103,115,117, + 98, 40,115, 44, 34, 95,117,115,101,114,100, 97,116, 97, 34, + 44, 34,118,111,105,100, 42, 34, 41, 32, 45, 45, 32,114,101, + 116,117,114,110, 32,119,105,116,104, 32, 39,118,111,105,100, + 42, 39, 10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40, + 115, 44, 34, 95, 99,115,116,114,105,110,103, 34, 44, 34, 99, + 104, 97,114, 42, 34, 41, 32, 32, 45, 45, 32,114,101,116,117, + 114,110, 32,119,105,116,104, 32, 39, 99,104, 97,114, 42, 39, + 10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, + 34, 95,108,115,116, 97,116,101, 34, 44, 34,108,117, 97, 95, + 83,116, 97,116,101, 42, 34, 41, 32, 32, 45, 45, 32,114,101, + 116,117,114,110, 32,119,105,116,104, 32, 39,108,117, 97, 95, + 83,116, 97,116,101, 42, 39, 10, 32, 32, 32,119,114,105,116, + 101, 40, 34, 67,111,100,101, 32, 98,101,105,110,103, 32,112, + 114,111, 99,101,115,115,101,100, 58, 92,110, 34, 46, 46,115, + 46, 46, 34, 92,110, 34, 41, 10, 32, 32,101,110,100, 10, 32, + 101,108,115,101, 10, 32,105,102, 32,110,111,116, 32,102, 32, + 116,104,101,110, 32,102, 32, 61, 32, 34, 40,102, 32,105,115, + 32,110,105,108, 41, 34, 32,101,110,100, 10, 32, 32,112,114, + 105,110,116, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, + 32,105,110,116,101,114,110, 97,108, 32,101,114,114,111,114, + 58, 32, 34, 46, 46,102, 46, 46,115, 46, 46, 34, 46, 92,110, + 92,110, 34, 41, 10, 32, 32,114,101,116,117,114,110, 10, 32, + 101,110,100, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32, + 111,117,116, 10,101,110,100, 10, 10,102,117,110, 99,116,105, + 111,110, 32,119, 97,114,110,105,110,103, 32, 40,109,115,103, + 41, 10, 32,105,102, 32,102,108, 97,103,115, 46,113, 32,116, + 104,101,110, 32,114,101,116,117,114,110, 32,101,110,100, 10, + 32,108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79, + 85, 84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, + 61, 32, 95, 83, 84, 68, 69, 82, 82, 10, 32,119,114,105,116, + 101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 32,119, + 97,114,110,105,110,103, 58, 32, 34, 46, 46,109,115,103, 46, + 46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 95, 79, 85, 84, + 80, 85, 84, 32, 61, 32,111,117,116, 10,101,110,100, 10, 10, + 45, 45, 32,114,101,103,105,115,116,101,114, 32, 97,110, 32, + 117,115,101,114, 32,100,101,102,105,110,101,100, 32,116,121, + 112,101, 58, 32,114,101,116,117,114,110,115, 32,102,117,108, + 108, 32,116,121,112,101, 10,102,117,110, 99,116,105,111,110, + 32,114,101,103,116,121,112,101, 32, 40,116, 41, 10, 9, 45, + 45,105,102, 32,105,115, 98, 97,115,105, 99, 40,116, 41, 32, + 116,104,101,110, 10, 9, 45, 45, 9,114,101,116,117,114,110, + 32,116, 10, 9, 45, 45,101,110,100, 10, 9,108,111, 99, 97, + 108, 32,102,116, 32, 61, 32,102,105,110,100,116,121,112,101, + 40,116, 41, 10, 10, 9,105,102, 32,110,111,116, 32, 95,117, + 115,101,114,116,121,112,101, 91,102,116, 93, 32,116,104,101, + 110, 10, 9, 9,114,101,116,117,114,110, 32, 97,112,112,101, + 110,100,117,115,101,114,116,121,112,101, 40,116, 41, 10, 9, + 101,110,100, 10, 9,114,101,116,117,114,110, 32,102,116, 10, + 101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110, 32, + 116,121,112,101, 32,110, 97,109,101, 58, 32,114,101,116,117, + 114,110,115, 32,102,117,108,108, 32,116,121,112,101, 10,102, + 117,110, 99,116,105,111,110, 32,116,121,112,101,118, 97,114, + 40,116,121,112,101, 41, 10, 9,105,102, 32,116,121,112,101, + 32, 61, 61, 32, 39, 39, 32,111,114, 32,116,121,112,101, 32, + 61, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10, + 9, 9,114,101,116,117,114,110, 32,116,121,112,101, 10, 9, + 101,108,115,101, 10, 9, 9,108,111, 99, 97,108, 32,102,116, + 32, 61, 32,102,105,110,100,116,121,112,101, 40,116,121,112, + 101, 41, 10, 9, 9,105,102, 32,102,116, 32,116,104,101,110, + 10, 9, 9, 9,114,101,116,117,114,110, 32,102,116, 10, 9, + 9,101,110,100, 10, 9, 9, 95,117,115,101,114,116,121,112, + 101, 91,116,121,112,101, 93, 32, 61, 32,116,121,112,101, 10, + 9, 9,114,101,116,117,114,110, 32,116,121,112,101, 10, 9, + 101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, + 99,107, 32,105,102, 32, 98, 97,115,105, 99, 32,116,121,112, + 101, 10,102,117,110, 99,116,105,111,110, 32,105,115, 98, 97, + 115,105, 99, 32, 40,116,121,112,101, 41, 10, 32,108,111, 99, + 97,108, 32,116, 32, 61, 32,103,115,117, 98, 40,116,121,112, + 101, 44, 39, 99,111,110,115,116, 32, 39, 44, 39, 39, 41, 10, + 32,108,111, 99, 97,108, 32,109, 44,116, 32, 61, 32, 97,112, + 112,108,121,116,121,112,101,100,101,102, 40, 39, 39, 44, 32, + 116, 41, 10, 32,108,111, 99, 97,108, 32, 98, 32, 61, 32, 95, + 98, 97,115,105, 99, 91,116, 93, 10, 32,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 98, + 44, 95, 98, 97,115,105, 99, 95, 99,116,121,112,101, 91, 98, + 93, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110, 32, + 110,105,108, 10,101,110,100, 10, 10, 45, 45, 32,115,112,108, + 105,116, 32,115,116,114,105,110,103, 32,117,115,105,110,103, + 32, 97, 32,116,111,107,101,110, 10,102,117,110, 99,116,105, + 111,110, 32,115,112,108,105,116, 32, 40,115, 44,116, 41, 10, + 32,108,111, 99, 97,108, 32,108, 32, 61, 32,123,110, 61, 48, + 125, 10, 32,108,111, 99, 97,108, 32,102, 32, 61, 32,102,117, + 110, 99,116,105,111,110, 32, 40,115, 41, 10, 32, 32,108, 46, + 110, 32, 61, 32,108, 46,110, 32, 43, 32, 49, 10, 32, 32,108, + 91,108, 46,110, 93, 32, 61, 32,115, 10, 32, 32,114,101,116, + 117,114,110, 32, 34, 34, 10, 32,101,110,100, 10, 32,108,111, + 99, 97,108, 32,112, 32, 61, 32, 34, 37,115, 42, 40, 46, 45, + 41, 37,115, 42, 34, 46, 46,116, 46, 46, 34, 37,115, 42, 34, + 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 94, + 37,115, 43, 34, 44, 34, 34, 41, 10, 32,115, 32, 61, 32,103, + 115,117, 98, 40,115, 44, 34, 37,115, 43, 36, 34, 44, 34, 34, + 41, 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44,112, + 44,102, 41, 10, 32,108, 46,110, 32, 61, 32,108, 46,110, 32, + 43, 32, 49, 10, 32,108, 91,108, 46,110, 93, 32, 61, 32,103, + 115,117, 98, 40,115, 44, 34, 40, 37,115, 37,115, 42, 41, 36, + 34, 44, 34, 34, 41, 10, 32,114,101,116,117,114,110, 32,108, + 10,101,110,100, 10, 10, 45, 45, 32,115,112,108,105,116,115, + 32, 97, 32,115,116,114,105,110,103, 32,117,115,105,110,103, + 32, 97, 32,112, 97,116,116,101,114,110, 44, 32, 99,111,110, + 115,105,100,101,114,105,110,103, 32,116,104,101, 32,115,112, + 97, 99,105, 97,108, 32, 99, 97,115,101,115, 32,111,102, 32, + 67, 32, 99,111,100,101, 32, 40,116,101,109,112,108, 97,116, + 101,115, 44, 32,102,117,110, 99,116,105,111,110, 32,112, 97, + 114, 97,109,101,116,101,114,115, 44, 32,101,116, 99, 41, 10, + 45, 45, 32,112, 97,116,116,101,114,110, 32, 99, 97,110, 39, + 116, 32, 99,111,110,116, 97,105,110, 32,116,104,101, 32, 39, + 94, 39, 32, 40, 97,115, 32,117,115,101,100, 32,116,111, 32, + 105,100,101,110,116,105,102,121, 32,116,104,101, 32, 98,101, + 103,105,110,105,110,103, 32,111,102, 32,116,104,101, 32,108, + 105,110,101, 41, 10, 45, 45, 32, 97,108,115,111, 32,115,116, + 114,105,112,115, 32,119,104,105,116,101,115,112, 97, 99,101, + 10,102,117,110, 99,116,105,111,110, 32,115,112,108,105,116, + 95, 99, 95,116,111,107,101,110,115, 40,115, 44, 32,112, 97, + 116, 41, 10, 10, 9,115, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,115, 44, 32, 34, 94, 37,115, 42, 34, + 44, 32, 34, 34, 41, 10, 9,115, 32, 61, 32,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 37,115, 42, + 36, 34, 44, 32, 34, 34, 41, 10, 10, 9,108,111, 99, 97,108, + 32,116,111,107,101,110, 95, 98,101,103,105,110, 32, 61, 32, + 49, 10, 9,108,111, 99, 97,108, 32,116,111,107,101,110, 95, + 101,110,100, 32, 61, 32, 49, 10, 9,108,111, 99, 97,108, 32, + 111,102,115, 32, 61, 32, 49, 10, 9,108,111, 99, 97,108, 32, + 114,101,116, 32, 61, 32,123,110, 61, 48,125, 10, 10, 9,102, + 117,110, 99,116,105,111,110, 32, 97,100,100, 95,116,111,107, + 101,110, 40,111,102,115, 41, 10, 10, 9, 9,108,111, 99, 97, + 108, 32,116, 32, 61, 32,115,116,114,105,110,103, 46,115,117, + 98, 40,115, 44, 32,116,111,107,101,110, 95, 98,101,103,105, + 110, 44, 32,111,102,115, 41, 10, 9, 9,116, 32, 61, 32,115, + 116,114,105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, + 94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10, 9, 9,116, 32, + 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116, + 44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, 41, 10, 9, + 9,114,101,116, 46,110, 32, 61, 32,114,101,116, 46,110, 32, + 43, 32, 49, 10, 9, 9,114,101,116, 91,114,101,116, 46,110, + 93, 32, 61, 32,116, 10, 9,101,110,100, 10, 10, 9,119,104, + 105,108,101, 32,111,102,115, 32, 60, 61, 32,115,116,114,105, + 110,103, 46,108,101,110, 40,115, 41, 32,100,111, 10, 10, 9, + 9,108,111, 99, 97,108, 32,115,117, 98, 32, 61, 32,115,116, + 114,105,110,103, 46,115,117, 98, 40,115, 44, 32,111,102,115, + 44, 32, 45, 49, 41, 10, 9, 9,108,111, 99, 97,108, 32, 98, + 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110, + 100, 40,115,117, 98, 44, 32, 34, 94, 34, 46, 46,112, 97,116, + 41, 10, 9, 9,105,102, 32, 98, 32,116,104,101,110, 10, 9, + 9, 9, 97,100,100, 95,116,111,107,101,110, 40,111,102,115, + 45, 49, 41, 10, 9, 9, 9,111,102,115, 32, 61, 32,111,102, + 115, 43,101, 10, 9, 9, 9,116,111,107,101,110, 95, 98,101, + 103,105,110, 32, 61, 32,111,102,115, 10, 9, 9,101,108,115, + 101, 10, 9, 9, 9,108,111, 99, 97,108, 32, 99,104, 97,114, + 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115, + 44, 32,111,102,115, 44, 32,111,102,115, 41, 10, 9, 9, 9, + 105,102, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32, + 111,114, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 60, 34, 32, + 116,104,101,110, 10, 10, 9, 9, 9, 9,108,111, 99, 97,108, + 32, 98,108,111, 99,107, 10, 9, 9, 9, 9,105,102, 32, 99, + 104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32,116,104,101,110, + 32, 98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 40, 41, + 34, 32,101,110,100, 10, 9, 9, 9, 9,105,102, 32, 99,104, + 97,114, 32, 61, 61, 32, 34, 60, 34, 32,116,104,101,110, 32, + 98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 60, 62, 34, + 32,101,110,100, 10, 10, 9, 9, 9, 9, 98, 44,101, 32, 61, + 32,115,116,114,105,110,103, 46,102,105,110,100, 40,115,117, + 98, 44, 32, 98,108,111, 99,107, 41, 10, 9, 9, 9, 9,105, + 102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 9, 9, + 9, 9, 9, 45, 45, 32,117,110,116,101,114,109,105,110, 97, + 116,101,100, 32, 98,108,111, 99,107, 63, 10, 9, 9, 9, 9, + 9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10, 9, 9, + 9, 9,101,108,115,101, 10, 9, 9, 9, 9, 9,111,102,115, + 32, 61, 32,111,102,115, 32, 43, 32,101, 10, 9, 9, 9, 9, + 101,110,100, 10, 10, 9, 9, 9,101,108,115,101, 10, 9, 9, + 9, 9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10, 9, + 9, 9,101,110,100, 10, 9, 9,101,110,100, 10, 10, 9,101, + 110,100, 10, 9, 97,100,100, 95,116,111,107,101,110, 40,111, + 102,115, 41, 10, 9, 45, 45,105,102, 32,114,101,116, 46,110, + 32, 61, 61, 32, 48, 32,116,104,101,110, 10, 10, 9, 45, 45, + 9,114,101,116, 46,110, 61, 49, 10, 9, 45, 45, 9,114,101, + 116, 91, 49, 93, 32, 61, 32, 34, 34, 10, 9, 45, 45,101,110, + 100, 10, 10, 9,114,101,116,117,114,110, 32,114,101,116, 10, + 10,101,110,100, 10, 10, 45, 45, 32, 99,111,110, 99, 97,116, + 101,110, 97,116,101, 32,115,116,114,105,110,103,115, 32,111, + 102, 32, 97, 32,116, 97, 98,108,101, 10,102,117,110, 99,116, + 105,111,110, 32, 99,111,110, 99, 97,116, 32, 40,116, 44,102, + 44,108, 44,106,115,116,114, 41, 10, 9,106,115,116,114, 32, + 61, 32,106,115,116,114, 32,111,114, 32, 34, 32, 34, 10, 32, + 108,111, 99, 97,108, 32,115, 32, 61, 32, 39, 39, 10, 32,108, + 111, 99, 97,108, 32,105, 61,102, 10, 32,119,104,105,108,101, + 32,105, 60, 61,108, 32,100,111, 10, 32, 32,115, 32, 61, 32, + 115, 46, 46,116, 91,105, 93, 10, 32, 32,105, 32, 61, 32,105, + 43, 49, 10, 32, 32,105,102, 32,105, 32, 60, 61, 32,108, 32, + 116,104,101,110, 32,115, 32, 61, 32,115, 46, 46,106,115,116, + 114, 32,101,110,100, 10, 32,101,110,100, 10, 32,114,101,116, + 117,114,110, 32,115, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 111,110, 99, 97,116,101,110, 97,116,101, 32, 97,108,108, 32, + 112, 97,114, 97,109,101,116,101,114,115, 44, 32,102,111,108, + 108,111,119,105,110,103, 32,111,117,116,112,117,116, 32,114, + 117,108,101,115, 10,102,117,110, 99,116,105,111,110, 32, 99, + 111,110, 99, 97,116,112, 97,114, 97,109, 32, 40,108,105,110, + 101, 44, 32, 46, 46, 46, 41, 10, 32,108,111, 99, 97,108, 32, + 105, 61, 49, 10, 32,119,104,105,108,101, 32,105, 60, 61, 97, + 114,103, 46,110, 32,100,111, 10, 32, 32,105,102, 32, 95, 99, + 111,110,116, 32, 97,110,100, 32,110,111,116, 32,115,116,114, + 102,105,110,100, 40, 95, 99,111,110,116, 44, 39, 91, 37, 40, + 44, 34, 93, 39, 41, 32, 97,110,100, 10, 32, 32, 32, 32, 32, + 115,116,114,102,105,110,100, 40, 97,114,103, 91,105, 93, 44, + 34, 94, 91, 37, 97, 95,126, 93, 34, 41, 32,116,104,101,110, + 10, 9, 32, 32, 32, 32,108,105,110,101, 32, 61, 32,108,105, + 110,101, 32, 46, 46, 32, 39, 32, 39, 10, 32, 32,101,110,100, + 10, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32, + 46, 46, 32, 97,114,103, 91,105, 93, 10, 32, 32,105,102, 32, + 97,114,103, 91,105, 93, 32,126, 61, 32, 39, 39, 32,116,104, + 101,110, 10, 32, 32, 32, 95, 99,111,110,116, 32, 61, 32,115, + 116,114,115,117, 98, 40, 97,114,103, 91,105, 93, 44, 45, 49, + 44, 45, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,105, 32, + 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,105,102, 32, + 115,116,114,102,105,110,100, 40, 97,114,103, 91, 97,114,103, + 46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37, 59, 37,123, 37, + 125, 93, 36, 34, 41, 32,116,104,101,110, 10, 32, 32, 95, 99, + 111,110,116, 61,110,105,108, 32,108,105,110,101, 32, 61, 32, + 108,105,110,101, 32, 46, 46, 32, 39, 92,110, 39, 10, 32,101, + 110,100, 10, 9,114,101,116,117,114,110, 32,108,105,110,101, + 10,101,110,100, 10, 10, 45, 45, 32,111,117,116,112,117,116, + 32,108,105,110,101, 10,102,117,110, 99,116,105,111,110, 32, + 111,117,116,112,117,116, 32, 40, 46, 46, 46, 41, 10, 32,108, + 111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101, + 32,105, 60, 61, 97,114,103, 46,110, 32,100,111, 10, 32, 32, + 105,102, 32, 95, 99,111,110,116, 32, 97,110,100, 32,110,111, + 116, 32,115,116,114,102,105,110,100, 40, 95, 99,111,110,116, + 44, 39, 91, 37, 40, 44, 34, 93, 39, 41, 32, 97,110,100, 10, + 32, 32, 32, 32, 32,115,116,114,102,105,110,100, 40, 97,114, + 103, 91,105, 93, 44, 34, 94, 91, 37, 97, 95,126, 93, 34, 41, + 32,116,104,101,110, 10, 9, 32, 32, 32, 32,119,114,105,116, + 101, 40, 39, 32, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32, + 119,114,105,116,101, 40, 97,114,103, 91,105, 93, 41, 10, 32, + 32,105,102, 32, 97,114,103, 91,105, 93, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,111,110,116, + 32, 61, 32,115,116,114,115,117, 98, 40, 97,114,103, 91,105, + 93, 44, 45, 49, 44, 45, 49, 41, 10, 32, 32,101,110,100, 10, + 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, + 32,105,102, 32,115,116,114,102,105,110,100, 40, 97,114,103, + 91, 97,114,103, 46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37, + 59, 37,123, 37,125, 93, 36, 34, 41, 32,116,104,101,110, 10, + 32, 32, 95, 99,111,110,116, 61,110,105,108, 32,119,114,105, + 116,101, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101, + 110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,103,101, + 116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104, + 111,100,115, 40,112,116,121,112,101, 44, 32,110, 97,109,101, + 41, 10, 10, 9,105,102, 32,103,101,116, 95,112,114,111,112, + 101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,111, + 111,107, 32, 97,110,100, 32,103,101,116, 95,112,114,111,112, + 101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,111, + 111,107, 40,112,116,121,112,101, 44,110, 97,109,101, 41, 32, + 116,104,101,110, 10, 9, 9,114,101,116,117,114,110, 32,103, + 101,116, 95,112,114,111,112,101,114,116,121, 95,109,101,116, + 104,111,100,115, 95,104,111,111,107, 40,112,116,121,112,101, + 44, 32,110, 97,109,101, 41, 10, 9,101,110,100, 10, 10, 9, + 105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34,100,101, + 102, 97,117,108,116, 34, 32,116,104,101,110, 32, 45, 45, 32, + 103,101,116, 95,110, 97,109,101, 44, 32,115,101,116, 95,110, + 97,109,101, 10, 9, 9,114,101,116,117,114,110, 32, 34,103, + 101,116, 95, 34, 46, 46,110, 97,109,101, 44, 32, 34,115,101, + 116, 95, 34, 46, 46,110, 97,109,101, 10, 9,101,110,100, 10, + 10, 9,105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34, + 113,116, 34, 32,116,104,101,110, 32, 45, 45, 32,110, 97,109, + 101, 44, 32,115,101,116, 78, 97,109,101, 10, 9, 9,114,101, + 116,117,114,110, 32,110, 97,109,101, 44, 32, 34,115,101,116, + 34, 46, 46,115,116,114,105,110,103, 46,117,112,112,101,114, + 40,115,116,114,105,110,103, 46,115,117, 98, 40,110, 97,109, + 101, 44, 32, 49, 44, 32, 49, 41, 41, 46, 46,115,116,114,105, + 110,103, 46,115,117, 98, 40,110, 97,109,101, 44, 32, 50, 44, + 32, 45, 49, 41, 10, 9,101,110,100, 10, 10, 9,105,102, 32, + 112,116,121,112,101, 32, 61, 61, 32, 34,111,118,101,114,108, + 111, 97,100, 34, 32,116,104,101,110, 32, 45, 45, 32,110, 97, + 109,101, 44, 32,110, 97,109,101, 10, 9, 9,114,101,116,117, + 114,110, 32,110, 97,109,101, 44,110, 97,109,101, 10, 9,101, + 110,100, 10, 10, 9,114,101,116,117,114,110, 32,110,105,108, + 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 32,116,104,101, 32,104,111,111,107,115, + 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32,114,105,103, + 104,116, 32, 97,102,116,101,114, 32,112,114,111, 99,101,115, + 115,105,110,103, 32,116,104,101, 32, 36, 91,105, 99,104,108, + 93,102,105,108,101, 32,100,105,114,101, 99,116,105,118,101, + 115, 44, 10, 45, 45, 32,114,105,103,104,116, 32, 98,101,102, + 111,114,101, 32,112,114,111, 99,101,115,115,105,110,103, 32, + 97,110,121,116,104,105,110,103, 32,101,108,115,101, 10, 45, + 45, 32,116, 97,107,101,115, 32,116,104,101, 32,112, 97, 99, + 107, 97,103,101, 32,111, 98,106,101, 99,116, 32, 97,115, 32, + 116,104,101, 32,112, 97,114, 97,109,101,116,101,114, 10,102, + 117,110, 99,116,105,111,110, 32,112,114,101,112,114,111, 99, + 101,115,115, 95,104,111,111,107, 40,112, 41, 10, 9, 45, 45, + 32,112, 46, 99,111,100,101, 32,104, 97,115, 32, 97,108,108, + 32,116,104,101, 32,105,110,112,117,116, 32, 99,111,100,101, + 32,102,114,111,109, 32,116,104,101, 32,112,107,103, 10,101, + 110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32, + 102,111,114, 32,101,118,101,114,121, 32, 36,105,102,105,108, + 101, 32,100,105,114,101, 99,116,105,118,101, 10, 45, 45, 32, + 116, 97,107,101,115, 32, 97, 32,116, 97, 98,108,101, 32,119, + 105,116,104, 32, 97, 32,115,116,114,105,110,103, 32, 99, 97, + 108,108,101,100, 32, 39, 99,111,100,101, 39, 32,105,110,115, + 105,100,101, 44, 32,116,104,101, 32,102,105,108,101,110, 97, + 109,101, 44, 32, 97,110,100, 32, 97,110,121, 32,101,120,116, + 114, 97, 32, 97,114,103,117,109,101,110,116,115, 10, 45, 45, + 32,112, 97,115,115,101,100, 32,116,111, 32, 36,105,102,105, + 108,101, 46, 32,110,111, 32,114,101,116,117,114,110, 32,118, + 97,108,117,101, 10,102,117,110, 99,116,105,111,110, 32,105, + 110, 99,108,117,100,101, 95,102,105,108,101, 95,104,111,111, + 107, 40,116, 44, 32,102,105,108,101,110, 97,109,101, 44, 32, + 46, 46, 46, 41, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 97,108,108,101,100, 32, 97,102,116,101,114, 32,112,114,111, + 99,101,115,115,105,110,103, 32, 97,110,121,116,104,105,110, + 103, 32,116,104, 97,116, 39,115, 32,110,111,116, 32, 99,111, + 100,101, 32, 40,108,105,107,101, 32, 39, 36,114,101,110, 97, + 109,105,110,103, 39, 44, 32, 99,111,109,109,101,110,116,115, + 44, 32,101,116, 99, 41, 10, 45, 45, 32, 97,110,100, 32,114, + 105,103,104,116, 32, 98,101,102,111,114,101, 32,112, 97,114, + 115,105,110,103, 32,116,104,101, 32, 97, 99,116,117, 97,108, + 32, 99,111,100,101, 46, 10, 45, 45, 32,116, 97,107,101,115, + 32,116,104,101, 32, 80, 97, 99,107, 97,103,101, 32,111, 98, + 106,101, 99,116, 32,119,105,116,104, 32, 97,108,108, 32,116, + 104,101, 32, 99,111,100,101, 32,111,110, 32,116,104,101, 32, + 39, 99,111,100,101, 39, 32,107,101,121, 46, 32,110,111, 32, + 114,101,116,117,114,110, 32,118, 97,108,117,101, 10,102,117, + 110, 99,116,105,111,110, 32,112,114,101,112, 97,114,115,101, + 95,104,111,111,107, 40,112, 97, 99,107, 97,103,101, 41, 10, + 10,101,110,100, 10, 10, 45, 45, 32, 99, 97,108,108,101,100, + 32, 98,101,102,111,114,101, 32,115,116, 97,114,116,105,110, + 103, 32,111,117,116,112,117,116, 10,102,117,110, 99,116,105, + 111,110, 32,112,114,101, 95,111,117,116,112,117,116, 95,104, + 111,111,107, 40,112, 97, 99,107, 97,103,101, 41, 10, 10,101, + 110,100, 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32, 97, + 102,116,101,114, 32,119,114,105,116,105,110,103, 32, 97,108, + 108, 32,116,104,101, 32,111,117,116,112,117,116, 46, 10, 45, + 45, 32,116, 97,107,101,115, 32,116,104,101, 32, 80, 97, 99, + 107, 97,103,101, 32,111, 98,106,101, 99,116, 10,102,117,110, + 99,116,105,111,110, 32,112,111,115,116, 95,111,117,116,112, + 117,116, 95,104,111,111,107, 40,112, 97, 99,107, 97,103,101, + 41, 10, 10,101,110,100, 10, 10, 10, 45, 45, 32, 99, 97,108, + 108,101,100, 32,102,114,111,109, 32, 39,103,101,116, 95,112, + 114,111,112,101,114,116,121, 95,109,101,116,104,111,100,115, + 39, 32,116,111, 32,103,101,116, 32,116,104,101, 32,109,101, + 116,104,111,100,115, 32,116,111, 32,114,101,116,114,105,101, + 118,101, 32, 97, 32,112,114,111,112,101,114,116,121, 10, 45, + 45, 32, 97, 99, 99,111,114,100,105,110,103, 32,116,111, 32, + 105,116,115, 32,116,121,112,101, 10,102,117,110, 99,116,105, + 111,110, 32,103,101,116, 95,112,114,111,112,101,114,116,121, + 95,109,101,116,104,111,100,115, 95,104,111,111,107, 40,112, + 114,111,112,101,114,116,121, 95,116,121,112,101, 44, 32,110, + 97,109,101, 41, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 97,108,108,101,100, 32,102,114,111,109, 32, 67,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 58,100,111,112, 97, + 114,115,101, 32,119,105,116,104, 32,116,104,101, 32,115,116, + 114,105,110,103, 32, 98,101,105,110,103, 32,112, 97,114,115, + 101,100, 10, 45, 45, 32,114,101,116,117,114,110, 32,110,105, + 108, 44, 32,111,114, 32, 97, 32,115,117, 98,115,116,114,105, + 110,103, 10,102,117,110, 99,116,105,111,110, 32,112, 97,114, + 115,101,114, 95,104,111,111,107, 40,115, 41, 10, 10, 9,114, + 101,116,117,114,110, 32,110,105,108, 10,101,110,100, 10, 10, + 45, 45, 32, 99, 97,108,108,101,100, 32,102,114,111,109, 32, + 99,108, 97,115,115, 70,117,110, 99,116,105,111,110, 58,115, + 117,112, 99,111,100,101, 44, 32, 98,101,102,111,114,101, 32, + 116,104,101, 32, 99, 97,108,108, 32,116,111, 32,116,104,101, + 32,102,117,110, 99,116,105,111,110, 32,105,115, 32,111,117, + 116,112,117,116, 10,102,117,110, 99,116,105,111,110, 32,112, + 114,101, 95, 99, 97,108,108, 95,104,111,111,107, 40,102, 41, + 10, 10,101,110,100, 10, 10, 45, 45, 32, 99, 97,108,108,101, + 100, 32,102,114,111,109, 32, 99,108, 97,115,115, 70,117,110, + 99,116,105,111,110, 58,115,117,112, 99,111,100,101, 44, 32, + 97,102,116,101,114, 32,116,104,101, 32, 99, 97,108,108, 32, + 116,111, 32,116,104,101, 32,102,117,110, 99,116,105,111,110, + 32,105,115, 32,111,117,116,112,117,116, 10,102,117,110, 99, + 116,105,111,110, 32,112,111,115,116, 95, 99, 97,108,108, 95, + 104,111,111,107, 40,102, 41, 10, 10,101,110,100, 10, 10, 45, + 45, 32, 99, 97,108,108,101,100, 32, 98,101,102,111,114,101, + 32,116,104,101, 32,114,101,103,105,115,116,101,114, 32, 99, + 111,100,101, 32,105,115, 32,111,117,116,112,117,116, 10,102, + 117,110, 99,116,105,111,110, 32,112,114,101, 95,114,101,103, + 105,115,116,101,114, 95,104,111,111,107, 40,112, 97, 99,107, + 97,103,101, 41, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 97,108,108,101,100, 32,116,111, 32,111,117,116,112,117,116, + 32, 97,110, 32,101,114,114,111,114, 32,109,101,115,115, 97, + 103,101, 10,102,117,110, 99,116,105,111,110, 32,111,117,116, + 112,117,116, 95,101,114,114,111,114, 95,104,111,111,107, 40, + 46, 46, 46, 41, 10, 9,114,101,116,117,114,110, 32,115,116, + 114,105,110,103, 46,102,111,114,109, 97,116, 40, 46, 46, 46, + 41, 10,101,110,100, 10, 10, 45, 45, 32, 99,117,115,116,111, + 109, 32,112,117,115,104,101,114,115, 10, 10, 95,112,117,115, + 104, 95,102,117,110, 99,116,105,111,110,115, 32, 61, 32,123, + 125, 10, 95,105,115, 95,102,117,110, 99,116,105,111,110,115, + 32, 61, 32,123,125, 10, 95,116,111, 95,102,117,110, 99,116, + 105,111,110,115, 32, 61, 32,123,125, 10, 10, 95, 98, 97,115, + 101, 95,112,117,115,104, 95,102,117,110, 99,116,105,111,110, + 115, 32, 61, 32,123,125, 10, 95, 98, 97,115,101, 95,105,115, + 95,102,117,110, 99,116,105,111,110,115, 32, 61, 32,123,125, + 10, 95, 98, 97,115,101, 95,116,111, 95,102,117,110, 99,116, + 105,111,110,115, 32, 61, 32,123,125, 10, 10,108,111, 99, 97, + 108, 32,102,117,110, 99,116,105,111,110, 32,115,101, 97,114, + 99,104, 95, 98, 97,115,101, 40,116, 44, 32,102,117,110, 99, + 115, 41, 10, 10, 9,108,111, 99, 97,108, 32, 99,108, 97,115, + 115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97, + 115,115,101,115, 91,116, 93, 10, 10, 9,119,104,105,108,101, + 32, 99,108, 97,115,115, 32,100,111, 10, 9, 9,105,102, 32, + 102,117,110, 99,115, 91, 99,108, 97,115,115, 46,116,121,112, + 101, 93, 32,116,104,101,110, 10, 9, 9, 9,114,101,116,117, + 114,110, 32,102,117,110, 99,115, 91, 99,108, 97,115,115, 46, + 116,121,112,101, 93, 10, 9, 9,101,110,100, 10, 9, 9, 99, + 108, 97,115,115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95, + 99,108, 97,115,115,101,115, 91, 99,108, 97,115,115, 46, 98, + 116,121,112,101, 93, 10, 9,101,110,100, 10, 9,114,101,116, + 117,114,110, 32,110,105,108, 10,101,110,100, 10, 10,102,117, + 110, 99,116,105,111,110, 32,103,101,116, 95,112,117,115,104, + 95,102,117,110, 99,116,105,111,110, 40,116, 41, 10, 9,114, + 101,116,117,114,110, 32, 95,112,117,115,104, 95,102,117,110, + 99,116,105,111,110,115, 91,116, 93, 32,111,114, 32,115,101, + 97,114, 99,104, 95, 98, 97,115,101, 40,116, 44, 32, 95, 98, + 97,115,101, 95,112,117,115,104, 95,102,117,110, 99,116,105, + 111,110,115, 41, 32,111,114, 32, 34,116,111,108,117, 97, 95, + 112,117,115,104,117,115,101,114,116,121,112,101, 34, 10,101, + 110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,103,101, + 116, 95,116,111, 95,102,117,110, 99,116,105,111,110, 40,116, + 41, 10, 9,114,101,116,117,114,110, 32, 95,116,111, 95,102, + 117,110, 99,116,105,111,110,115, 91,116, 93, 32,111,114, 32, + 115,101, 97,114, 99,104, 95, 98, 97,115,101, 40,116, 44, 32, + 95, 98, 97,115,101, 95,116,111, 95,102,117,110, 99,116,105, + 111,110,115, 41, 32,111,114, 32, 34,116,111,108,117, 97, 95, + 116,111,117,115,101,114,116,121,112,101, 34, 10,101,110,100, + 10, 10,102,117,110, 99,116,105,111,110, 32,103,101,116, 95, + 105,115, 95,102,117,110, 99,116,105,111,110, 40,116, 41, 10, + 9,114,101,116,117,114,110, 32, 95,105,115, 95,102,117,110, + 99,116,105,111,110,115, 91,116, 93, 32,111,114, 32,115,101, + 97,114, 99,104, 95, 98, 97,115,101, 40,116, 44, 32, 95, 98, + 97,115,101, 95,105,115, 95,102,117,110, 99,116,105,111,110, + 115, 41, 32,111,114, 32, 34,116,111,108,117, 97, 95,105,115, + 117,115,101,114,116,121,112,101, 34, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/basic.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 97, 98,115,116,114, + 97, 99,116, 32,102,101, 97,116,117,114,101, 32, 99,108, 97, + 115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32, 98, + 121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108,101, + 115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80, 85, + 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49, 57, + 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45, + 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105,115, 32, + 102,114,101,101, 32,115,111,102,116,119, 97,114,101, 59, 32, + 121,111,117, 32, 99, 97,110, 32,114,101,100,105,115,116,114, + 105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47,111,114, + 32,109,111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32, + 84,104,101, 32,115,111,102,116,119, 97,114,101, 32,112,114, + 111,118,105,100,101,100, 32,104,101,114,101,117,110,100,101, + 114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32, + 105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10, + 45, 45, 32,116,104,101, 32, 97,117,116,104,111,114, 32,104, + 97,115, 32,110,111, 32,111, 98,108,105,103, 97,116,105,111, + 110, 32,116,111, 32,112,114,111,118,105,100,101, 32,109, 97, + 105,110,116,101,110, 97,110, 99,101, 44, 32,115,117,112,112, + 111,114,116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45, + 45, 32,101,110,104, 97,110, 99,101,109,101,110,116,115, 44, + 32,111,114, 32,109,111,100,105,102,105, 99, 97,116,105,111, + 110,115, 46, 10, 10, 10, 45, 45, 32, 70,101, 97,116,117,114, + 101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114, + 101,115,101,110,116,115, 32,116,104,101, 32, 98, 97,115,101, + 32, 99,108, 97,115,115, 32,111,102, 32, 97,108,108, 32,109, + 97,112,112,101,100, 32,102,101, 97,116,117,114,101, 46, 10, + 99,108, 97,115,115, 70,101, 97,116,117,114,101, 32, 61, 32, + 123, 10,125, 10, 99,108, 97,115,115, 70,101, 97,116,117,114, + 101, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97, + 115,115, 70,101, 97,116,117,114,101, 10, 10, 45, 45, 32,119, + 114,105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111, + 100,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 70,101, 97,116,117,114,101, 58,115,117,112, 99,111, + 100,101, 32, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,111, + 117,116,112,117,116, 32,116, 97,103, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114, + 101, 58,100,101, 99,108,116,121,112,101, 32, 40, 41, 10,101, + 110,100, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,114, + 32,102,101, 97,116,117,114,101, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, + 58,114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41, + 10,101,110,100, 10, 10, 45, 45, 32,116,114, 97,110,115,108, + 97,116,101, 32,118,101,114, 98, 97,116,105,109, 10,102,117, + 110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97, + 116,117,114,101, 58,112,114,101, 97,109, 98,108,101, 32, 40, + 41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, + 32,105,102, 32,105,116, 32,105,115, 32, 97, 32,118, 97,114, + 105, 97, 98,108,101, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,115, + 118, 97,114,105, 97, 98,108,101, 32, 40, 41, 10, 32,114,101, + 116,117,114,110, 32,102, 97,108,115,101, 10,101,110,100, 10, + 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,105,116, + 32,114,101,113,117,105,114,101,115, 32, 99,111,108,108,101, + 99,116,105,111,110, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,114,101, + 113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,110, + 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,102, 97, + 108,115,101, 10,101,110,100, 10, 10, 45, 45, 32, 98,117,105, + 108,100, 32,110, 97,109,101,115, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, + 58, 98,117,105,108,100,110, 97,109,101,115, 32, 40, 41, 10, + 32,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32, 97, + 110,100, 32,115,101,108,102, 46,110, 97,109,101,126, 61, 39, + 39, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32, + 110, 32, 61, 32,115,112,108,105,116, 40,115,101,108,102, 46, + 110, 97,109,101, 44, 39, 64, 39, 41, 10, 32, 32,115,101,108, + 102, 46,110, 97,109,101, 32, 61, 32,110, 91, 49, 93, 10, 32, + 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32,115,116, + 114,105,110,103, 46,103,115,117, 98, 40,115,101,108,102, 46, + 110, 97,109,101, 44, 32, 34, 58, 37,100, 42, 36, 34, 44, 32, + 34, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32,110, 91, + 50, 93, 32,116,104,101,110, 10, 32, 32, 32,110, 91, 50, 93, + 32, 61, 32, 97,112,112,108,121,114,101,110, 97,109,105,110, + 103, 40,110, 91, 49, 93, 41, 10, 32, 32,101,110,100, 10, 32, + 32,115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32,110, + 91, 50, 93, 32,111,114, 32,103,115,117, 98, 40,110, 91, 49, + 93, 44, 34, 37, 91, 46, 45, 37, 93, 34, 44, 34, 34, 41, 10, + 32, 32,115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32, + 115,116,114,105,110,103, 46,103,115,117, 98, 40,115,101,108, + 102, 46,108,110, 97,109,101, 44, 32, 34, 58, 37,100, 42, 36, + 34, 44, 32, 34, 34, 41, 10, 32, 32,115,101,108,102, 46,111, + 114,105,103,105,110, 97,108, 95,110, 97,109,101, 32, 61, 32, + 115,101,108,102, 46,110, 97,109,101, 10, 32, 32,115,101,108, + 102, 46,108,110, 97,109,101, 32, 61, 32, 99,108,101, 97,110, + 95,116,101,109,112,108, 97,116,101, 40,115,101,108,102, 46, + 108,110, 97,109,101, 41, 10, 32,101,110,100, 10, 32,105,102, + 32,110,111,116, 32,115,101,108,102, 46,105,115, 95,112, 97, + 114, 97,109,101,116,101,114, 32,116,104,101,110, 10, 9, 32, + 115,101,108,102, 46,110, 97,109,101, 32, 61, 32,103,101,116, + 111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 40, 41, + 32, 46, 46, 32,115,101,108,102, 46,110, 97,109,101, 10, 32, + 101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,112, 97,114, + 101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116, + 97,105,110,101,114, 46, 99,117,114,114, 10, 32,105,102, 32, + 112, 97,114,101,110,116, 32,116,104,101,110, 10, 32, 9,115, + 101,108,102, 46, 97, 99, 99,101,115,115, 32, 61, 32,112, 97, + 114,101,110,116, 46, 99,117,114,114, 95,109,101,109, 98,101, + 114, 95, 97, 99, 99,101,115,115, 10, 9,115,101,108,102, 46, + 103,108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 32, 61, + 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98, + 108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 32,101, + 108,115,101, 10, 32,101,110,100, 10,101,110,100, 10, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, + 97,116,117,114,101, 58, 99,104,101, 99,107, 95,112,117, 98, + 108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 10, 9, + 105,102, 32,116,121,112,101, 40,115,101,108,102, 46,103,108, + 111, 98, 97,108, 95, 97, 99, 99,101,115,115, 41, 32, 61, 61, + 32, 34, 98,111,111,108,101, 97,110, 34, 32,116,104,101,110, + 10, 9, 9,114,101,116,117,114,110, 32,115,101,108,102, 46, + 103,108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 10, 9, + 101,110,100, 10, 10, 9,105,102, 32,115,101,108,102, 46, 97, + 99, 99,101,115,115, 32, 97,110,100, 32,115,101,108,102, 46, + 97, 99, 99,101,115,115, 32,126, 61, 32, 48, 32,116,104,101, + 110, 10, 9, 9,114,101,116,117,114,110, 32,102, 97,108,115, + 101, 10, 9,101,110,100, 10, 10, 9,108,111, 99, 97,108, 32, + 112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, 9, + 119,104,105,108,101, 32,112, 97,114,101,110,116, 32,100,111, + 10, 9, 9,105,102, 32,112, 97,114,101,110,116, 46, 97, 99, + 99,101,115,115, 32, 97,110,100, 32,112, 97,114,101,110,116, + 46, 97, 99, 99,101,115,115, 32,126, 61, 32, 48, 32,116,104, + 101,110, 10, 9, 9, 9,114,101,116,117,114,110, 32,102, 97, + 108,115,101, 10, 9, 9,101,110,100, 10, 9, 9,112, 97,114, + 101,110,116, 32, 61, 32,112, 97,114,101,110,116, 46,112,114, + 111,120, 10, 9,101,110,100, 10, 9,114,101,116,117,114,110, + 32,116,114,117,101, 10,101,110,100, 10, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108,101, 97,110, 95,116,101,109,112, + 108, 97,116,101, 40,116, 41, 10, 10, 9,114,101,116,117,114, + 110, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116, + 44, 32, 34, 91, 60, 62, 58, 44, 32, 37, 42, 93, 34, 44, 32, + 34, 95, 34, 41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104, + 101, 99,107, 32,105,102, 32,102,101, 97,116,117,114,101, 32, + 105,115, 32,105,110,115,105,100,101, 32, 97, 32, 99,111,110, + 116, 97,105,110,101,114, 32,100,101,102,105,110,105,116,105, + 111,110, 10, 45, 45, 32,105,116, 32,114,101,116,117,114,110, + 115, 32,116,104,101, 32, 99,111,110,116, 97,105,110,101,114, + 32, 99,108, 97,115,115, 32,110, 97,109,101, 32,111,114, 32, + 110,105,108, 46, 10,102,117,110, 99,116,105,111,110, 32, 99, + 108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,110, 99, + 111,110,116, 97,105,110,101,114, 32, 40,119,104,105, 99,104, + 41, 10, 32,105,102, 32,115,101,108,102, 46,112, 97,114,101, + 110,116, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, + 32,112, 97,114,101,110,116, 32, 61, 32,115,101,108,102, 46, + 112, 97,114,101,110,116, 10, 32, 32,119,104,105,108,101, 32, + 112, 97,114,101,110,116, 32,100,111, 10, 32, 32, 32,105,102, + 32,112, 97,114,101,110,116, 46, 99,108, 97,115,115,116,121, + 112,101, 32, 61, 61, 32,119,104,105, 99,104, 32,116,104,101, + 110, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,112, 97, + 114,101,110,116, 46,110, 97,109,101, 10, 32, 32, 32,101,110, + 100, 10, 32, 32, 32,112, 97,114,101,110,116, 32, 61, 32,112, + 97,114,101,110,116, 46,112, 97,114,101,110,116, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10, 32,114,101,116,117,114, + 110, 32,110,105,108, 10,101,110,100, 10, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117, + 114,101, 58,105,110, 99,108, 97,115,115, 32, 40, 41, 10, 32, + 114,101,116,117,114,110, 32,115,101,108,102, 58,105,110, 99, + 111,110,116, 97,105,110,101,114, 40, 39, 99,108, 97,115,115, + 39, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58, + 105,110,109,111,100,117,108,101, 32, 40, 41, 10, 32,114,101, + 116,117,114,110, 32,115,101,108,102, 58,105,110, 99,111,110, + 116, 97,105,110,101,114, 40, 39,109,111,100,117,108,101, 39, + 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105, + 110,110, 97,109,101,115,112, 97, 99,101, 32, 40, 41, 10, 32, + 114,101,116,117,114,110, 32,115,101,108,102, 58,105,110, 99, + 111,110,116, 97,105,110,101,114, 40, 39,110, 97,109,101,115, + 112, 97, 99,101, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32, + 114,101,116,117,114,110, 32, 67, 32, 98,105,110,100,105,110, + 103, 32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101, + 32, 98, 97,115,101,100, 32,111,110, 32,110, 97,109,101, 10, + 45, 45, 32,116,104,101, 32, 99,108,105,101,110,116, 32,115, + 112,101, 99,105,102,105,101,115, 32, 97, 32,112,114,101,102, + 105,120, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 70,101, 97,116,117,114,101, 58, 99,102,117,110, 99, + 110, 97,109,101, 32, 40,110, 41, 10, 10, 32,105,102, 32,115, + 101,108,102, 46,112, 97,114,101,110,116, 32,116,104,101,110, + 10, 32, 32,110, 32, 61, 32,115,101,108,102, 46,112, 97,114, + 101,110,116, 58, 99,102,117,110, 99,110, 97,109,101, 40,110, + 41, 10, 32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32, + 102,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,108,110, + 97,109,101, 10, 32,105,102, 32,110,111,116, 32,102,110, 97, + 109,101, 32,111,114, 32,102,110, 97,109,101, 32, 61, 61, 32, + 39, 39, 32,116,104,101,110, 10, 32, 9,102,110, 97,109,101, + 32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10, 32,101, + 110,100, 10, 32, 32,110, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,110, 46, 46, 39, 95, 39, 46, 46, 32, + 40,102,110, 97,109,101, 41, 44, 32, 34, 91, 60, 62, 58, 44, + 32, 92, 46, 37, 42, 38, 93, 34, 44, 32, 34, 95, 34, 41, 10, + 10, 32, 32,114,101,116,117,114,110, 32,110, 10,101,110,100, + 32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/feature.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,118,101,114, 98, 97, + 116,105,109, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73, + 100, 58, 32,118,101,114, 98, 97,116,105,109, 46,108,117, 97, + 44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48, 49, 47, + 50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 54, 32, 99,101,108, + 101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32, 84,104, + 105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, + 32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, + 99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116, + 101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100, + 105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32, + 115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100, + 101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, + 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, + 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116, + 104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110, + 111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, + 32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101, + 110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, + 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110, + 104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32, + 109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, + 10, 10, 10, 45, 45, 32, 86,101,114, 98, 97,116,105,109, 32, + 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115, + 101,110,116,115, 32, 97, 32,108,105,110,101, 32,116,114, 97, + 110,115,108, 97,116,101,100, 32,100,105,114,101, 99,116,101, + 100, 32,116,111, 32,116,104,101, 32, 98,105,110,100,105,110, + 103, 32,102,105,108,101, 46, 10, 45, 45, 32, 84,104,101, 32, + 102,111,108,108,111,119,105,110,103, 32,102,105,108,100,115, + 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45, + 32, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32, + 116,101,120,116, 10, 99,108, 97,115,115, 86,101,114, 98, 97, + 116,105,109, 32, 61, 32,123, 10, 32,108,105,110,101, 32, 61, + 32, 39, 39, 44, 10, 9, 99,111,110,100, 32, 61, 32,110,105, + 108, 44, 32, 32, 32, 32, 45, 45, 32, 99,111,110,100,105,116, + 105,111,110, 58, 32,119,104,101,114,101, 32,116,111, 32,103, + 101,110,101,114, 97,116,101, 32,116,104,101, 32, 99,111,100, + 101, 32, 40,115, 61,115,117,112,111,114,116, 44, 32,114, 61, + 114,101,103,105,115,116,101,114, 41, 10,125, 10, 99,108, 97, + 115,115, 86,101,114, 98, 97,116,105,109, 46, 95, 95,105,110, + 100,101,120, 32, 61, 32, 99,108, 97,115,115, 86,101,114, 98, + 97,116,105,109, 10,115,101,116,109,101,116, 97,116, 97, 98, + 108,101, 40, 99,108, 97,115,115, 86,101,114, 98, 97,116,105, + 109, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41, + 10, 10, 45, 45, 32,112,114,101, 97,109, 98,108,101, 32,118, + 101,114, 98, 97,116,105,109, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109, + 58,112,114,101, 97,109, 98,108,101, 32, 40, 41, 10, 32,105, + 102, 32,115,101,108,102, 46, 99,111,110,100, 32, 61, 61, 32, + 39, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116,101, + 40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101,110, + 100, 10,101,110,100, 10, 10, 45, 45, 32,115,117,112,112,111, + 114,116, 32, 99,111,100,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109, + 58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,105,102, + 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, 99, + 111,110,100, 44, 39,115, 39, 41, 32,116,104,101,110, 10, 32, + 32,119,114,105,116,101, 40,115,101,108,102, 46,108,105,110, + 101, 41, 10, 32, 32,119,114,105,116,101, 40, 39, 92,110, 39, + 41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, + 114,101,103,105,115,116,101,114, 32, 99,111,100,101, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 86,101, + 114, 98, 97,116,105,109, 58,114,101,103,105,115,116,101,114, + 32, 40,112,114,101, 41, 10, 32,105,102, 32,115,116,114,102, + 105,110,100, 40,115,101,108,102, 46, 99,111,110,100, 44, 39, + 114, 39, 41, 32,116,104,101,110, 10, 32, 32,119,114,105,116, + 101, 40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101, + 110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,114,105, + 110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116, + 105,109, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, + 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 86,101,114, 98, 97,116,105, + 109,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,108,105,110,101, 32, 61, 32, 39, 34, + 46, 46,115,101,108,102, 46,108,105,110,101, 46, 46, 34, 39, + 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10, + 101,110,100, 10, 10, 10, 45, 45, 32, 73,110,116,101,114,110, + 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10, + 102,117,110, 99,116,105,111,110, 32, 95, 86,101,114, 98, 97, + 116,105,109, 32, 40,116, 41, 10, 32,115,101,116,109,101,116, + 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 86, + 101,114, 98, 97,116,105,109, 41, 10, 32, 97,112,112,101,110, + 100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116, 10, + 101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117, + 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,115, + 32, 97, 32,115,116,114,105,110,103, 32,114,101,112,114,101, + 115,101,110,116,105,110,103, 32,116,104,101, 32,116,101,120, + 116, 32,108,105,110,101, 10,102,117,110, 99,116,105,111,110, + 32, 86,101,114, 98, 97,116,105,109, 32, 40,108, 44, 99,111, + 110,100, 41, 10, 32,105,102, 32,115,116,114,115,117, 98, 40, + 108, 44, 49, 44, 49, 41, 32, 61, 61, 32, 34, 39, 34, 32,116, + 104,101,110, 10, 32, 32,108, 32, 61, 32,115,116,114,115,117, + 98, 40,108, 44, 50, 41, 10, 32,101,108,115,101,105,102, 32, + 115,116,114,115,117, 98, 40,108, 44, 49, 44, 49, 41, 32, 61, + 61, 32, 39, 36, 39, 32,116,104,101,110, 10, 32, 32, 99,111, + 110,100, 32, 61, 32, 39,115,114, 39, 32, 32, 32, 32, 32, 32, + 32, 45, 45, 32,103,101,110,101,114, 97,116,101,115, 32,105, + 110, 32, 98,111,116,104, 32,115,117,112,111,114,116, 32, 97, + 110,100, 32,114,101,103,105,115,116,101,114, 32,102,114, 97, + 103,109,101,110,116,115, 10, 32, 32,108, 32, 61, 32,115,116, + 114,115,117, 98, 40,108, 44, 50, 41, 10, 32,101,110,100, 10, + 32,114,101,116,117,114,110, 32, 95, 86,101,114, 98, 97,116, + 105,109, 32,123, 10, 32, 32,108,105,110,101, 32, 61, 32,108, + 44, 10, 32, 32, 99,111,110,100, 32, 61, 32, 99,111,110,100, + 32,111,114, 32, 39, 39, 44, 10, 32,125, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/verbatim.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,100,101, 32, + 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101, + 110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67, + 101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, + 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, + 32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, + 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32, + 105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114, + 101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105, + 115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, + 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, + 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, + 32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117, + 110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, + 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97, + 110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111, + 114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97, + 116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, + 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115, + 117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, + 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110, + 116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97, + 116,105,111,110,115, 46, 10, 10, 45, 45, 32,103,108,111, 98, + 97,108, 10, 99,111,100,101, 95,110, 32, 61, 32, 49, 10, 10, + 45, 45, 32, 67,111,100,101, 32, 99,108, 97,115,115, 10, 45, + 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 76,117, + 97, 32, 99,111,100,101, 32,116,111, 32, 98,101, 32, 99,111, + 109,112,105,108,101,100, 32, 97,110,100, 32,105,110, 99,108, + 117,100,101,100, 10, 45, 45, 32,105,110, 32,116,104,101, 32, + 105,110,105,116,105, 97,108,105,122, 97,116,105,111,110, 32, + 102,117,110, 99,116,105,111,110, 46, 10, 45, 45, 32, 84,104, + 101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,101, + 108,100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, + 10, 45, 45, 32, 32, 32,116,101,120,116, 32, 61, 32,116,101, + 120,116, 32, 99,111,100,101, 10, 99,108, 97,115,115, 67,111, + 100,101, 32, 61, 32,123, 10, 32,116,101,120,116, 32, 61, 32, + 39, 39, 44, 10,125, 10, 99,108, 97,115,115, 67,111,100,101, + 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115, + 115, 67,111,100,101, 10,115,101,116,109,101,116, 97,116, 97, + 98,108,101, 40, 99,108, 97,115,115, 67,111,100,101, 44, 99, + 108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45, + 45, 32,114,101,103,105,115,116,101,114, 32, 99,111,100,101, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 67,111,100,101, 58,114,101,103,105,115,116,101,114, 32, 40, + 112,114,101, 41, 10, 32,112,114,101, 32, 61, 32,112,114,101, + 32,111,114, 32, 39, 39, 10, 32, 45, 45, 32, 99,108,101, 97, + 110, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99, + 97,108, 32,115, 32, 61, 32, 99,108,101, 97,110, 40,115,101, + 108,102, 46,116,101,120,116, 41, 10, 32,105,102, 32,110,111, + 116, 32,115, 32,116,104,101,110, 10, 32, 32, 45, 45,112,114, + 105,110,116, 40,115,101,108,102, 46,116,101,120,116, 41, 10, + 32, 32,101,114,114,111,114, 40, 34,112, 97,114,115,101,114, + 32,101,114,114,111,114, 32,105,110, 32,101,109, 98,101,100, + 100,101,100, 32, 99,111,100,101, 34, 41, 10, 32,101,110,100, + 10, 10, 32, 45, 45, 32,103,101,116, 32,102,105,114,115,116, + 32,108,105,110,101, 10, 32,108,111, 99, 97,108, 32, 95, 44, + 32, 95, 44, 32,102,105,114,115,116, 95,108,105,110,101, 61, + 115,116,114,105,110,103, 46,102,105,110,100, 40,115,101,108, + 102, 46,116,101,120,116, 44, 32, 34, 94, 40, 91, 94, 92,110, + 92,114, 93, 42, 41, 34, 41, 10, 32,105,102, 32,115,116,114, + 105,110,103, 46,102,105,110,100, 40,102,105,114,115,116, 95, + 108,105,110,101, 44, 32, 34, 94, 37,115, 42, 37, 45, 37, 45, + 34, 41, 32,116,104,101,110, 10, 9, 32,105,102, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,102,105,114,115,116, + 95,108,105,110,101, 44, 32, 34, 94, 37, 45, 37, 45, 35, 35, + 34, 41, 32,116,104,101,110, 10, 9, 9,102,105,114,115,116, + 95,108,105,110,101, 32, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40,102,105,114,115,116, 95,108,105,110,101, + 44, 32, 34, 94, 37, 45, 37, 45, 35, 35, 34, 44, 32, 34, 34, + 41, 10, 9, 9,105,102, 32,102,108, 97,103,115, 91, 39, 67, + 39, 93, 32,116,104,101,110, 10, 9, 9, 9,115, 32, 61, 32, + 115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32, + 34, 94, 37, 45, 37, 45, 35, 35, 91, 94, 92,110, 92,114, 93, + 42, 92,110, 34, 44, 32, 34, 34, 41, 10, 9, 9,101,110,100, + 10, 9, 32,101,110,100, 10, 32,101,108,115,101, 10, 32, 9, + 102,105,114,115,116, 95,108,105,110,101, 32, 61, 32, 34, 34, + 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,112, 97,100, 32, + 116,111, 32, 49, 54, 32, 98,121,116,101,115, 10, 32,108,111, + 99, 97,108, 32,110,112, 97,100, 32, 61, 32, 49, 54, 32, 45, + 32, 40, 35,115, 32, 37, 32, 49, 54, 41, 10, 32,108,111, 99, + 97,108, 32,115,112, 97,100, 32, 61, 32, 34, 34, 10, 32,102, + 111,114, 32,105, 61, 49, 44,110,112, 97,100, 32,100,111, 10, + 32, 9,115,112, 97,100, 32, 61, 32,115,112, 97,100, 32, 46, + 46, 32, 34, 45, 34, 10, 32,101,110,100, 10, 32,115, 32, 61, + 32,115, 46, 46,115,112, 97,100, 10, 32, 10, 32, 45, 45, 32, + 99,111,110,118,101,114,116, 32,116,111, 32, 67, 10, 32,111, + 117,116,112,117,116, 40, 39, 92,110, 39, 46, 46,112,114,101, + 46, 46, 39,123, 32, 47, 42, 32, 98,101,103,105,110, 32,101, + 109, 98,101,100,100,101,100, 32,108,117, 97, 32, 99,111,100, + 101, 32, 42, 47, 92,110, 39, 41, 10, 32,111,117,116,112,117, + 116, 40,112,114,101, 46, 46, 39, 32,105,110,116, 32,116,111, + 112, 32, 61, 32,108,117, 97, 95,103,101,116,116,111,112, 40, + 116,111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 32,111,117, + 116,112,117,116, 40,112,114,101, 46, 46, 39, 32,115,116, 97, + 116,105, 99, 32, 99,111,110,115,116, 32,117,110,115,105,103, + 110,101,100, 32, 99,104, 97,114, 32, 66, 91, 93, 32, 61, 32, + 123, 92,110, 32, 32, 32, 39, 41, 10, 32,108,111, 99, 97,108, + 32,116, 61,123,110, 61, 48,125, 10, 10, 32,108,111, 99, 97, + 108, 32, 98, 32, 61, 32,103,115,117, 98, 40,115, 44, 39, 40, + 46, 41, 39, 44,102,117,110, 99,116,105,111,110, 32, 40, 99, + 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99, + 97,108, 32,101, 32, 61, 32, 39, 39, 10, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32,116, 46,110, 61,116, 46,110, 43, 49, 32, + 105,102, 32,116, 46,110, 61, 61, 49, 53, 32,116,104,101,110, + 32,116, 46,110, 61, 48, 32,101, 61, 39, 92,110, 39, 46, 46, + 112,114,101, 46, 46, 39, 32, 32, 39, 32,101,110,100, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110, + 32,102,111,114,109, 97,116, 40, 39, 37, 51,117, 44, 37,115, + 39, 44,115,116,114, 98,121,116,101, 40, 99, 41, 44,101, 41, + 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 41, + 10, 32,111,117,116,112,117,116, 40, 98, 46, 46,115,116,114, + 98,121,116,101, 40, 34, 32, 34, 41, 41, 10, 32,111,117,116, + 112,117,116, 40, 39, 92,110, 39, 46, 46,112,114,101, 46, 46, + 39, 32,125, 59, 92,110, 39, 41, 10, 32,105,102, 32,102,105, + 114,115,116, 95,108,105,110,101, 32, 97,110,100, 32,102,105, + 114,115,116, 95,108,105,110,101, 32,126, 61, 32, 34, 34, 32, + 116,104,101,110, 10, 32, 9,111,117,116,112,117,116, 40,112, + 114,101, 46, 46, 39, 32,116,111,108,117, 97, 95,100,111, 98, + 117,102,102,101,114, 40,116,111,108,117, 97, 95, 83, 44, 40, + 99,104, 97,114, 42, 41, 66, 44,115,105,122,101,111,102, 40, + 66, 41, 44, 34,116,111,108,117, 97, 32,101,109, 98,101,100, + 100,101,100, 58, 32, 39, 46, 46,102,105,114,115,116, 95,108, + 105,110,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32,101,108, + 115,101, 10, 32, 9,111,117,116,112,117,116, 40,112,114,101, + 46, 46, 39, 32,116,111,108,117, 97, 95,100,111, 98,117,102, + 102,101,114, 40,116,111,108,117, 97, 95, 83, 44, 40, 99,104, + 97,114, 42, 41, 66, 44,115,105,122,101,111,102, 40, 66, 41, + 44, 34,116,111,108,117, 97, 58, 32,101,109, 98,101,100,100, + 101,100, 32, 76,117, 97, 32, 99,111,100,101, 32, 39, 46, 46, + 99,111,100,101, 95,110, 46, 46, 39, 34, 41, 59, 39, 41, 10, + 32,101,110,100, 10, 32,111,117,116,112,117,116, 40,112,114, + 101, 46, 46, 39, 32,108,117, 97, 95,115,101,116,116,111,112, + 40,116,111,108,117, 97, 95, 83, 44, 32,116,111,112, 41, 59, + 39, 41, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, + 46, 39,125, 32, 47, 42, 32,101,110,100, 32,111,102, 32,101, + 109, 98,101,100,100,101,100, 32,108,117, 97, 32, 99,111,100, + 101, 32, 42, 47, 92,110, 92,110, 39, 41, 10, 32, 99,111,100, + 101, 95,110, 32, 61, 32, 99,111,100,101, 95,110, 32, 43, 49, + 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,114,105,110,116, + 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 67,111,100,101, 58,112,114,105, + 110,116, 32, 40,105,100,101,110,116, 44, 99,108,111,115,101, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 67,111,100,101,123, 34, 41, 10, 32,112,114,105,110, + 116, 40,105,100,101,110,116, 46, 46, 34, 32,116,101,120,116, + 32, 61, 32, 91, 91, 34, 46, 46,115,101,108,102, 46,116,101, + 120,116, 46, 46, 34, 93, 93, 44, 34, 41, 10, 32,112,114,105, + 110,116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, + 99,108,111,115,101, 41, 10,101,110,100, 10, 10, 10, 45, 45, + 32, 73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116, + 114,117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, + 32, 95, 67,111,100,101, 32, 40,116, 41, 10, 32,115,101,116, + 109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97, + 115,115, 67,111,100,101, 41, 10, 32, 97,112,112,101,110,100, + 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116, 10,101, + 110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117, 99, + 116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,115, 32, + 97, 32,115,116,114,105,110,103, 32,114,101,112,114,101,115, + 101,110,116,105,110,103, 32,116,104,101, 32, 99,111,100,101, + 32,116,101,120,116, 10,102,117,110, 99,116,105,111,110, 32, + 67,111,100,101, 32, 40,108, 41, 10, 32,114,101,116,117,114, + 110, 32, 95, 67,111,100,101, 32,123, 10, 32, 32,116,101,120, + 116, 32, 61, 32,108, 10, 32,125, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/code.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,116,121,112,101,100, + 101,102, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105, + 116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97, + 114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71, + 114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, + 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, + 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111, + 100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116, + 119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114, + 101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, + 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105, + 116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, + 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101, + 114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97, + 110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, + 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117, + 116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108, + 105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118, + 105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, + 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97, + 116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101, + 109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102, + 105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, + 32, 84,121,112,101,100,101,102, 32, 99,108, 97,115,115, 10, + 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97, + 32,116,121,112,101, 32,115,121,110,111,110,121,109, 46, 10, + 45, 45, 32, 84,104,101, 32, 39,100,101, 32,102, 97, 99,116, + 111, 39, 32,116,121,112,101, 32,114,101,112,108, 97, 99,101, + 115, 32,116,104,101, 32,116,121,112,101,100,101,102, 32, 98, + 101,102,111,114,101, 32,116,104,101, 10, 45, 45, 32,114,101, + 109, 97,105,110,105,110,103, 32, 99,111,100,101, 32,105,115, + 32,112, 97,114,115,101,100, 46, 10, 45, 45, 32, 84,104,101, + 32,102,111,108,108,111,119,105,110,103, 32,102,105,101,108, + 100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, + 45, 45, 32, 32, 32,117,116,121,112,101, 32, 61, 32,116,121, + 112,101,100,101,102, 32,110, 97,109,101, 10, 45, 45, 32, 32, + 32,116,121,112,101, 32, 61, 32, 39,116,104,101, 32,102, 97, + 99,116,111, 39, 32,116,121,112,101, 10, 45, 45, 32, 32, 32, + 109,111,100, 32, 61, 32,109,111,100,105,102,105,101,114,115, + 32,116,111, 32,116,104,101, 32, 39,100,101, 32,102, 97, 99, + 116,111, 39, 32,116,121,112,101, 10, 99,108, 97,115,115, 84, + 121,112,101,100,101,102, 32, 61, 32,123, 10, 32,117,116,121, + 112,101, 32, 61, 32, 39, 39, 44, 10, 32,109,111,100, 32, 61, + 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, 39, + 10,125, 10, 99,108, 97,115,115, 84,121,112,101,100,101,102, + 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115, + 115, 84,121,112,101,100,101,102, 10, 10, 45, 45, 32, 80,114, + 105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 84,121,112,101,100, + 101,102, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, + 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 84,121,112,101,100,101,102, + 123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32,117,116,121,112,101, 32, 61, 32, 39, 34, + 46, 46,115,101,108,102, 46,117,116,121,112,101, 46, 46, 34, + 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,109,111,100, 32, 61, 32, 39, 34, 46, + 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, + 10, 10, 45, 45, 32, 82,101,116,117,114,110, 32,105,116, 39, + 115, 32,110,111,116, 32, 97, 32,118, 97,114,105, 97, 98,108, + 101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 84,121,112,101,100,101,102, 58,105,115,118, 97,114,105, + 97, 98,108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110, + 32,102, 97,108,115,101, 10,101,110,100, 10, 10, 45, 45, 32, + 73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114, + 117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, + 95, 84,121,112,101,100,101,102, 32, 40,116, 41, 10, 32,115, + 101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99, + 108, 97,115,115, 84,121,112,101,100,101,102, 41, 10, 32,116, + 46,116,121,112,101, 32, 61, 32,114,101,115,111,108,118,101, + 95,116,101,109,112,108, 97,116,101, 95,116,121,112,101,115, + 40,116, 46,116,121,112,101, 41, 10, 32, 97,112,112,101,110, + 100,116,121,112,101,100,101,102, 40,116, 41, 10, 32,114,101, + 116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, + 67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, + 69,120,112,101, 99,116,115, 32,111,110,101, 32,115,116,114, + 105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110, + 103, 32,116,104,101, 32,116,121,112,101, 32,100,101,102,105, + 110,105,116,105,111,110, 46, 10,102,117,110, 99,116,105,111, + 110, 32, 84,121,112,101,100,101,102, 32, 40,115, 41, 10, 32, + 105,102, 32,115,116,114,102,105,110,100, 40,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,115, 44, 32, 39, 37, 98, 60, + 62, 39, 44, 32, 39, 39, 41, 44, 39, 91, 37, 42, 38, 93, 39, + 41, 32,116,104,101,110, 10, 32, 32,116,111,108,117, 97, 95, + 101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105,100, + 32,116,121,112,101,100,101,102, 58, 32,112,111,105,110,116, + 101,114,115, 32, 40, 97,110,100, 32,114,101,102,101,114,101, + 110, 99,101,115, 41, 32, 97,114,101, 32,110,111,116, 32,115, + 117,112,112,111,114,116,101,100, 34, 41, 10, 32,101,110,100, + 10, 32,108,111, 99, 97,108, 32,111, 32, 61, 32,123,109,111, + 100, 32, 61, 32, 39, 39,125, 10, 32,105,102, 32,115,116,114, + 105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 91, 60, + 62, 93, 34, 41, 32,116,104,101,110, 10, 32, 9, 95, 44, 95, + 44,111, 46,116,121,112,101, 44,111, 46,117,116,121,112,101, + 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 115, 44, 32, 34, 94, 37,115, 42, 40, 91, 94, 60, 62, 93, 43, + 37, 98, 60, 62, 91, 94, 37,115, 93, 42, 41, 37,115, 43, 40, + 46, 45, 41, 36, 34, 41, 10, 32,101,108,115,101, 10, 32, 9, + 108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116, + 40,103,115,117, 98, 40,115, 44, 34, 37,115, 37,115, 42, 34, + 44, 34, 32, 34, 41, 44, 34, 32, 34, 41, 10, 32, 9,111, 32, + 61, 32,123, 10, 9, 32, 32,117,116,121,112,101, 32, 61, 32, + 116, 91,116, 46,110, 93, 44, 10, 9, 32, 32,116,121,112,101, + 32, 61, 32,116, 91,116, 46,110, 45, 49, 93, 44, 10, 9, 32, + 32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,116, + 44, 49, 44,116, 46,110, 45, 50, 41, 44, 10, 9, 32,125, 10, + 32,101,110,100, 10, 32,114,101,116,117,114,110, 32, 95, 84, + 121,112,101,100,101,102, 40,111, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/typedef.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,110,116, 97, + 105,110,101,114, 32, 97, 98,115,116,114, 97, 99,116, 32, 99, + 108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, + 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101, + 108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, + 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, + 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, + 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105, + 115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,101, + 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,115, + 116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47, + 111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, 45, + 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, 32, + 112,114,111,118,105,100,101,100, 32,104,101,114,101,117,110, + 100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97, + 115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110, + 100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,114, + 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,116, + 105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, 32, + 109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,117, + 112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, 44, + 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,116, + 115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,116, + 105,111,110,115, 46, 10, 10, 45, 45, 32,116, 97, 98,108,101, + 32,116,111, 32,115,116,111,114,101, 32,110, 97,109,101,115, + 112, 97, 99,101,100, 32,116,121,112,101,100,101,102,115, 47, + 101,110,117,109,115, 32,105,110, 32,103,108,111, 98, 97,108, + 32,115, 99,111,112,101, 10,103,108,111, 98, 97,108, 95,116, + 121,112,101,100,101,102,115, 32, 61, 32,123,125, 10,103,108, + 111, 98, 97,108, 95,101,110,117,109,115, 32, 61, 32,123,125, + 10, 10, 45, 45, 32, 67,111,110,116, 97,105,110,101,114, 32, + 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115, + 101,110,116,115, 32, 97, 32, 99,111,110,116, 97,105,110,101, + 114, 32,111,102, 32,102,101, 97,116,117,114,101,115, 32,116, + 111, 32, 98,101, 32, 98,111,117,110,100, 10, 45, 45, 32,116, + 111, 32,108,117, 97, 46, 10, 99,108, 97,115,115, 67,111,110, + 116, 97,105,110,101,114, 32, 61, 10,123, 10, 32, 99,117,114, + 114, 32, 61, 32,110,105,108, 44, 10,125, 10, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 46, 95, 95,105,110, + 100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116, + 97,105,110,101,114, 10,115,101,116,109,101,116, 97,116, 97, + 98,108,101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105, + 110,101,114, 44, 99,108, 97,115,115, 70,101, 97,116,117,114, + 101, 41, 10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116, + 97,103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,100,101, + 99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117,115,104, + 40,115,101,108,102, 41, 10, 32,108,111, 99, 97,108, 32,105, + 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91, + 105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105, 93, + 58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32,105, + 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,111, + 112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32,119,114, + 105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111,100, + 101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 58,115,117,112, 99, + 111,100,101, 32, 40, 41, 10, 10, 9,105,102, 32,110,111,116, + 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98, + 108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104, + 101,110, 10, 9, 9,114,101,116,117,114,110, 10, 9,101,110, + 100, 10, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, + 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105, + 108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, + 32,105,102, 32,115,101,108,102, 91,105, 93, 58, 99,104,101, + 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115, + 115, 40, 41, 32,116,104,101,110, 10, 32, 32, 9,115,101,108, + 102, 91,105, 93, 58,115,117,112, 99,111,100,101, 40, 41, 10, + 32, 32,101,110,100, 10, 32, 32,105, 32, 61, 32,105, 43, 49, + 10, 32,101,110,100, 10, 32,112,111,112, 40, 41, 10,101,110, + 100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 58,104, 97,115, + 118, 97,114, 32, 40, 41, 10, 32,108,111, 99, 97,108, 32,105, + 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91, + 105, 93, 32,100,111, 10, 32, 32,105,102, 32,115,101,108,102, + 91,105, 93, 58,105,115,118, 97,114,105, 97, 98,108,101, 40, + 41, 32,116,104,101,110, 10, 9, 9, 32,114,101,116,117,114, + 110, 32, 49, 10, 9, 9,101,110,100, 10, 32, 32,105, 32, 61, + 32,105, 43, 49, 10, 32,101,110,100, 10, 9,114,101,116,117, + 114,110, 32, 48, 10,101,110,100, 10, 10, 45, 45, 32, 73,110, + 116,101,114,110, 97,108, 32, 99,111,110,116, 97,105,110,101, + 114, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102, + 117,110, 99,116,105,111,110, 32, 95, 67,111,110,116, 97,105, + 110,101,114, 32, 40,115,101,108,102, 41, 10, 32,115,101,116, + 109,101,116, 97,116, 97, 98,108,101, 40,115,101,108,102, 44, + 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 41, + 10, 32,115,101,108,102, 46,110, 32, 61, 32, 48, 10, 32,115, + 101,108,102, 46,116,121,112,101,100,101,102,115, 32, 61, 32, + 123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32,115,101, + 108,102, 46,117,115,101,114,116,121,112,101,115, 32, 61, 32, + 123,125, 10, 32,115,101,108,102, 46,101,110,117,109,115, 32, + 61, 32,123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32, + 115,101,108,102, 46,108,110, 97,109,101,115, 32, 61, 32,123, + 125, 10, 32,114,101,116,117,114,110, 32,115,101,108,102, 10, + 101,110,100, 10, 10, 45, 45, 32,112,117,115,104, 32, 99,111, + 110,116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111, + 110, 32,112,117,115,104, 32, 40,116, 41, 10, 9,116, 46,112, + 114,111,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116, + 97,105,110,101,114, 46, 99,117,114,114, 10, 32, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114, + 114, 32, 61, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,112, + 111,112, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117, + 110, 99,116,105,111,110, 32,112,111,112, 32, 40, 41, 10, 45, + 45,112,114,105,110,116, 40, 34,110, 97,109,101, 34, 44, 99, + 108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99, + 117,114,114, 46,110, 97,109,101, 41, 10, 45, 45,102,111,114, + 101, 97, 99,104, 40, 99,108, 97,115,115, 67,111,110,116, 97, + 105,110,101,114, 46, 99,117,114,114, 46,117,115,101,114,116, + 121,112,101,115, 44,112,114,105,110,116, 41, 10, 45, 45,112, + 114,105,110,116, 40, 34, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 34, 41, 10, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 32, 61, + 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, + 46, 99,117,114,114, 46,112,114,111,120, 10,101,110,100, 10, + 10, 45, 45, 32,103,101,116, 32, 99,117,114,114,101,110,116, + 32,110, 97,109,101,115,112, 97, 99,101, 10,102,117,110, 99, + 116,105,111,110, 32,103,101,116, 99,117,114,114,110, 97,109, + 101,115,112, 97, 99,101, 32, 40, 41, 10, 9,114,101,116,117, + 114,110, 32,103,101,116,110, 97,109,101,115,112, 97, 99,101, + 40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, + 46, 99,117,114,114, 41, 10,101,110,100, 10, 10, 45, 45, 32, + 97,112,112,101,110,100, 32,116,111, 32, 99,117,114,114,101, + 110,116, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117, + 110, 99,116,105,111,110, 32, 97,112,112,101,110,100, 32, 40, + 116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, + 58, 97,112,112,101,110,100, 40,116, 41, 10,101,110,100, 10, + 10, 45, 45, 32, 97,112,112,101,110,100, 32,116,121,112,101, + 100,101,102, 32,116,111, 32, 99,117,114,114,101,110,116, 32, + 99,111,110,116, 97,105,110,101,114, 10,102,117,110, 99,116, + 105,111,110, 32, 97,112,112,101,110,100,116,121,112,101,100, + 101,102, 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, + 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, + 99,117,114,114, 58, 97,112,112,101,110,100,116,121,112,101, + 100,101,102, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32, + 97,112,112,101,110,100, 32,117,115,101,114,116,121,112,101, + 32,116,111, 32, 99,117,114,114,101,110,116, 32, 99,111,110, + 116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111,110, + 32, 97,112,112,101,110,100,117,115,101,114,116,121,112,101, + 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108, + 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117, + 114,114, 58, 97,112,112,101,110,100,117,115,101,114,116,121, + 112,101, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32, 97, + 112,112,101,110,100, 32,101,110,117,109, 32,116,111, 32, 99, + 117,114,114,101,110,116, 32, 99,111,110,116, 97,105,110,101, + 114, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112,101, + 110,100,101,110,117,109, 32, 40,116, 41, 10, 32,114,101,116, + 117,114,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105, + 110,101,114, 46, 99,117,114,114, 58, 97,112,112,101,110,100, + 101,110,117,109, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, + 32,115,117, 98,115,116,105,116,117,116,101, 32,116,121,112, + 101,100,101,102, 10,102,117,110, 99,116,105,111,110, 32, 97, + 112,112,108,121,116,121,112,101,100,101,102, 32, 40,109,111, + 100, 44,116,121,112,101, 41, 10, 32,114,101,116,117,114,110, + 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, + 46, 99,117,114,114, 58, 97,112,112,108,121,116,121,112,101, + 100,101,102, 40,109,111,100, 44,116,121,112,101, 41, 10,101, + 110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, + 32,105,115, 32,116,121,112,101, 10,102,117,110, 99,116,105, + 111,110, 32,102,105,110,100,116,121,112,101, 32, 40,116,121, + 112,101, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, + 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, + 99,117,114,114, 58,102,105,110,100,116,121,112,101, 40,116, + 121,112,101, 41, 10, 9,114,101,116,117,114,110, 32,116, 10, + 101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105, + 102, 32,105,115, 32,116,121,112,101,100,101,102, 10,102,117, + 110, 99,116,105,111,110, 32,105,115,116,121,112,101,100,101, + 102, 32, 40,116,121,112,101, 41, 10, 32,114,101,116,117,114, + 110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 46, 99,117,114,114, 58,105,115,116,121,112,101,100,101, + 102, 40,116,121,112,101, 41, 10,101,110,100, 10, 10, 45, 45, + 32,103,101,116, 32,102,117,108,108,116,121,112,101, 32, 40, + 119,105,116,104, 32,110, 97,109,101,115,112, 97, 99,101, 41, + 10,102,117,110, 99,116,105,111,110, 32,102,117,108,108,116, + 121,112,101, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32, + 99,117,114,114, 32, 61, 32, 32, 99,108, 97,115,115, 67,111, + 110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, 9,119, + 104,105,108,101, 32, 99,117,114,114, 32,100,111, 10, 9, 32, + 105,102, 32, 99,117,114,114, 32,116,104,101,110, 10, 9, 9, + 32,105,102, 32, 99,117,114,114, 46,116,121,112,101,100,101, + 102,115, 32, 97,110,100, 32, 99,117,114,114, 46,116,121,112, + 101,100,101,102,115, 91,116, 93, 32,116,104,101,110, 10, 9, + 9, 32, 32,114,101,116,117,114,110, 32, 99,117,114,114, 46, + 116,121,112,101,100,101,102,115, 91,116, 93, 10, 9, 9, 32, + 101,108,115,101,105,102, 32, 99,117,114,114, 46,117,115,101, + 114,116,121,112,101,115, 32, 97,110,100, 32, 99,117,114,114, + 46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116, + 104,101,110, 10, 9, 9, 32, 32,114,101,116,117,114,110, 32, + 99,117,114,114, 46,117,115,101,114,116,121,112,101,115, 91, + 116, 93, 10, 9, 9, 9,101,110,100, 10, 9, 9,101,110,100, + 10, 9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46, + 112,114,111,120, 10, 9,101,110,100, 10, 9,114,101,116,117, + 114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 99,104, + 101, 99,107,115, 32,105,102, 32,105,116, 32,114,101,113,117, + 105,114,101,115, 32, 99,111,108,108,101, 99,116,105,111,110, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 58,114,101,113,117,105, + 114,101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116, + 41, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 9,108,111, 99, 97, + 108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,119,104, + 105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, + 32, 32,114, 32, 61, 32,115,101,108,102, 91,105, 93, 58,114, + 101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111, + 110, 40,116, 41, 32,111,114, 32,114, 10, 32, 32,105, 32, 61, + 32,105, 43, 49, 10, 32,101,110,100, 10, 9,112,111,112, 40, + 41, 10, 9,114,101,116,117,114,110, 32,114, 10,101,110,100, + 10, 10, 10, 45, 45, 32,103,101,116, 32,110, 97,109,101,115, + 97,112, 99,101, 10,102,117,110, 99,116,105,111,110, 32,103, + 101,116,110, 97,109,101,115,112, 97, 99,101, 32, 40, 99,117, + 114,114, 41, 10, 9,108,111, 99, 97,108, 32,110, 97,109,101, + 115,112, 97, 99,101, 32, 61, 32, 39, 39, 10, 9,119,104,105, + 108,101, 32, 99,117,114,114, 32,100,111, 10, 9, 32,105,102, + 32, 99,117,114,114, 32, 97,110,100, 10, 9, 9, 32, 32, 32, + 40, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112, + 101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111,114, + 32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112,101, + 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101, 39, + 41, 10, 9, 9,116,104,101,110, 10, 9, 9, 32,110, 97,109, + 101,115,112, 97, 99,101, 32, 61, 32, 40, 99,117,114,114, 46, + 111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111, + 114, 32, 99,117,114,114, 46,110, 97,109,101, 41, 32, 46, 46, + 32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109,101,115,112, + 97, 99,101, 10, 9, 9, 32, 45, 45,110, 97,109,101,115,112, + 97, 99,101, 32, 61, 32, 99,117,114,114, 46,110, 97,109,101, + 32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109, + 101,115,112, 97, 99,101, 10, 9, 9,101,110,100, 10, 9, 32, + 99,117,114,114, 32, 61, 32, 99,117,114,114, 46,112,114,111, + 120, 10, 9,101,110,100, 10, 9,114,101,116,117,114,110, 32, + 110, 97,109,101,115,112, 97, 99,101, 10,101,110,100, 10, 10, + 45, 45, 32,103,101,116, 32,110, 97,109,101,115,112, 97, 99, + 101, 32, 40,111,110,108,121, 32,110, 97,109,101,115,112, 97, + 99,101, 41, 10,102,117,110, 99,116,105,111,110, 32,103,101, + 116,111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 32, + 40, 41, 10, 32,108,111, 99, 97,108, 32, 99,117,114,114, 32, + 61, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 46, 99,117,114,114, 10, 9,108,111, 99, 97,108, 32,110, + 97,109,101,115,112, 97, 99,101, 32, 61, 32, 39, 39, 10, 9, + 119,104,105,108,101, 32, 99,117,114,114, 32,100,111, 10, 9, + 9,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116, + 121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32, + 116,104,101,110, 10, 9, 9, 32,114,101,116,117,114,110, 32, + 110, 97,109,101,115,112, 97, 99,101, 10, 9, 9,101,108,115, + 101,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116, + 121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, + 99,101, 39, 32,116,104,101,110, 10, 9, 9, 32,110, 97,109, + 101,115,112, 97, 99,101, 32, 61, 32, 99,117,114,114, 46,110, + 97,109,101, 32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32, + 110, 97,109,101,115,112, 97, 99,101, 10, 9, 9,101,110,100, + 10, 9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46, + 112,114,111,120, 10, 9,101,110,100, 10, 9,114,101,116,117, + 114,110, 32,110, 97,109,101,115,112, 97, 99,101, 10,101,110, + 100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32, + 105,115, 32,101,110,117,109, 10,102,117,110, 99,116,105,111, + 110, 32,105,115,101,110,117,109, 32, 40,116,121,112,101, 41, + 10, 32,114,101,116,117,114,110, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 58,105, + 115,101,110,117,109, 40,116,121,112,101, 41, 10,101,110,100, + 10, 10, 45, 45, 32, 97,112,112,101,110,100, 32,102,101, 97, + 116,117,114,101, 32,116,111, 32, 99,111,110,116, 97,105,110, + 101,114, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 58, 97,112,112, + 101,110,100, 32, 40,116, 41, 10, 32,115,101,108,102, 46,110, + 32, 61, 32,115,101,108,102, 46,110, 32, 43, 32, 49, 10, 32, + 115,101,108,102, 91,115,101,108,102, 46,110, 93, 32, 61, 32, + 116, 10, 32,116, 46,112, 97,114,101,110,116, 32, 61, 32,115, + 101,108,102, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112, + 101,110,100, 32,116,121,112,101,100,101,102, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,110,116, + 97,105,110,101,114, 58, 97,112,112,101,110,100,116,121,112, + 101,100,101,102, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, + 32,110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101, + 116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, + 41, 10, 32,115,101,108,102, 46,116,121,112,101,100,101,102, + 115, 46,116,111,108,117, 97, 95,110, 32, 61, 32,115,101,108, + 102, 46,116,121,112,101,100,101,102,115, 46,116,111,108,117, + 97, 95,110, 32, 43, 32, 49, 10, 32,115,101,108,102, 46,116, + 121,112,101,100,101,102,115, 91,115,101,108,102, 46,116,121, + 112,101,100,101,102,115, 46,116,111,108,117, 97, 95,110, 93, + 32, 61, 32,116, 10, 9,115,101,108,102, 46,116,121,112,101, + 100,101,102,115, 91,116, 46,117,116,121,112,101, 93, 32, 61, + 32,110, 97,109,101,115,112, 97, 99,101, 32, 46, 46, 32,116, + 46,117,116,121,112,101, 10, 9,103,108,111, 98, 97,108, 95, + 116,121,112,101,100,101,102,115, 91,110, 97,109,101,115,112, + 97, 99,101, 46, 46,116, 46,117,116,121,112,101, 93, 32, 61, + 32,116, 10, 9,116, 46,102,116,121,112,101, 32, 61, 32,102, + 105,110,100,116,121,112,101, 40,116, 46,116,121,112,101, 41, + 32,111,114, 32,116, 46,116,121,112,101, 10, 9, 45, 45,112, + 114,105,110,116, 40, 34, 97,112,112,101,110,100,105,110,103, + 32,116,121,112,101,100,101,102, 32, 34, 46, 46,116, 46,117, + 116,121,112,101, 46, 46, 34, 32, 97,115, 32, 34, 46, 46,110, + 97,109,101,115,112, 97, 99,101, 46, 46,116, 46,117,116,121, + 112,101, 46, 46, 34, 32,119,105,116,104, 32,102,116,121,112, + 101, 32, 34, 46, 46,116, 46,102,116,121,112,101, 41, 10, 9, + 97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95,116, + 121,112,101, 40,110, 97,109,101,115,112, 97, 99,101, 46, 46, + 116, 46,117,116,121,112,101, 41, 10, 9,105,102, 32,116, 46, + 102,116,121,112,101, 32, 97,110,100, 32,105,115,101,110,117, + 109, 40,116, 46,102,116,121,112,101, 41, 32,116,104,101,110, + 10, 10, 9, 9,103,108,111, 98, 97,108, 95,101,110,117,109, + 115, 91,110, 97,109,101,115,112, 97, 99,101, 46, 46,116, 46, + 117,116,121,112,101, 93, 32, 61, 32,116,114,117,101, 10, 9, + 101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112, + 101,110,100, 32,117,115,101,114,116,121,112,101, 58, 32,114, + 101,116,117,114,110, 32,102,117,108,108, 32,116,121,112,101, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 58, 97,112,112,101,110, + 100,117,115,101,114,116,121,112,101, 32, 40,116, 41, 10, 9, + 108,111, 99, 97,108, 32, 99,111,110,116, 97,105,110,101,114, + 10, 9,105,102, 32,116, 32, 61, 61, 32, 40,115,101,108,102, + 46,111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32, + 111,114, 32,115,101,108,102, 46,110, 97,109,101, 41, 32,116, + 104,101,110, 10, 9, 9, 99,111,110,116, 97,105,110,101,114, + 32, 61, 32,115,101,108,102, 46,112,114,111,120, 10, 9,101, + 108,115,101, 10, 9, 9, 99,111,110,116, 97,105,110,101,114, + 32, 61, 32,115,101,108,102, 10, 9,101,110,100, 10, 9,108, + 111, 99, 97,108, 32,102,116, 32, 61, 32,103,101,116,110, 97, + 109,101,115,112, 97, 99,101, 40, 99,111,110,116, 97,105,110, + 101,114, 41, 32, 46, 46, 32,116, 10, 9, 99,111,110,116, 97, + 105,110,101,114, 46,117,115,101,114,116,121,112,101,115, 91, + 116, 93, 32, 61, 32,102,116, 10, 9, 95,117,115,101,114,116, + 121,112,101, 91,102,116, 93, 32, 61, 32,102,116, 10, 9,114, + 101,116,117,114,110, 32,102,116, 10,101,110,100, 10, 10, 45, + 45, 32, 97,112,112,101,110,100, 32,101,110,117,109, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111, + 110,116, 97,105,110,101,114, 58, 97,112,112,101,110,100,101, + 110,117,109, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32, + 110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101,116, + 110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 41, + 10, 32,115,101,108,102, 46,101,110,117,109,115, 46,116,111, + 108,117, 97, 95,110, 32, 61, 32,115,101,108,102, 46,101,110, + 117,109,115, 46,116,111,108,117, 97, 95,110, 32, 43, 32, 49, + 10, 32,115,101,108,102, 46,101,110,117,109,115, 91,115,101, + 108,102, 46,101,110,117,109,115, 46,116,111,108,117, 97, 95, + 110, 93, 32, 61, 32,116, 10, 9,103,108,111, 98, 97,108, 95, + 101,110,117,109,115, 91,110, 97,109,101,115,112, 97, 99,101, + 46, 46,116, 46,110, 97,109,101, 93, 32, 61, 32,116, 10,101, + 110,100, 10, 10, 45, 45, 32,100,101,116,101,114,109,105,110, + 101, 32,108,117, 97, 32,102,117,110, 99,116,105,111,110, 32, + 110, 97,109,101, 32,111,118,101,114,108,111, 97,100, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111, + 110,116, 97,105,110,101,114, 58,111,118,101,114,108,111, 97, + 100, 32, 40,108,110, 97,109,101, 41, 10, 32,105,102, 32,110, + 111,116, 32,115,101,108,102, 46,108,110, 97,109,101,115, 91, + 108,110, 97,109,101, 93, 32,116,104,101,110, 10, 32, 32,115, + 101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97,109, + 101, 93, 32, 61, 32, 48, 10, 32,101,108,115,101, 10, 32, 32, + 115,101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97, + 109,101, 93, 32, 61, 32,115,101,108,102, 46,108,110, 97,109, + 101,115, 91,108,110, 97,109,101, 93, 32, 43, 32, 49, 10, 32, + 101,110,100, 10, 32,114,101,116,117,114,110, 32,102,111,114, + 109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,115,101,108,102, + 46,108,110, 97,109,101,115, 91,108,110, 97,109,101, 93, 41, + 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,108,105,101, + 115, 32,116,121,112,101,100,101,102, 58, 32,114,101,116,117, + 114,110,115, 32,116,104,101, 32, 39,116,104,101, 32,102, 97, + 99,116,111, 39, 32,109,111,100,105,102,105,101,114, 32, 97, + 110,100, 32,116,121,112,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 58, 97,112,112,108,121,116,121,112,101,100,101,102, 32, + 40,109,111,100, 44,116,121,112,101, 41, 10, 9,105,102, 32, + 103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115, + 91,116,121,112,101, 93, 32,116,104,101,110, 10, 9, 9, 45, + 45,112,114,105,110,116, 40, 34,102,111,117,110,100, 32,116, + 121,112,101,100,101,102, 32, 34, 46, 46,103,108,111, 98, 97, + 108, 95,116,121,112,101,100,101,102,115, 91,116,121,112,101, + 93, 46,116,121,112,101, 41, 10, 9, 9,108,111, 99, 97,108, + 32,109,111,100, 49, 44, 32,116,121,112,101, 49, 32, 61, 32, + 103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115, + 91,116,121,112,101, 93, 46,109,111,100, 44, 32,103,108,111, + 98, 97,108, 95,116,121,112,101,100,101,102,115, 91,116,121, + 112,101, 93, 46,102,116,121,112,101, 10, 9, 9,108,111, 99, + 97,108, 32,109,111,100, 50, 44, 32,116,121,112,101, 50, 32, + 61, 32, 97,112,112,108,121,116,121,112,101,100,101,102, 40, + 109,111,100, 46, 46, 34, 32, 34, 46, 46,109,111,100, 49, 44, + 32,116,121,112,101, 49, 41, 10, 9, 9, 45, 45,114,101,116, + 117,114,110, 32,109,111,100, 50, 32, 46, 46, 32, 39, 32, 39, + 32, 46, 46, 32,109,111,100, 49, 44, 32,116,121,112,101, 50, + 10, 9, 9,114,101,116,117,114,110, 32,109,111,100, 50, 44, + 32,116,121,112,101, 50, 10, 9,101,110,100, 10, 9,100,111, + 32,114,101,116,117,114,110, 32,109,111,100, 44,116,121,112, + 101, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97, + 32,116,121,112,101,100,101,102, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110, + 101,114, 58,105,115,116,121,112,101,100,101,102, 32, 40,116, + 121,112,101, 41, 10, 32,108,111, 99, 97,108, 32,101,110,118, + 32, 61, 32,115,101,108,102, 10, 32,119,104,105,108,101, 32, + 101,110,118, 32,100,111, 10, 32, 32,105,102, 32,101,110,118, + 46,116,121,112,101,100,101,102,115, 32,116,104,101,110, 10, + 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32, + 32,119,104,105,108,101, 32,101,110,118, 46,116,121,112,101, + 100,101,102,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32, + 105,102, 32,101,110,118, 46,116,121,112,101,100,101,102,115, + 91,105, 93, 46,117,116,121,112,101, 32, 61, 61, 32,116,121, + 112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, + 32, 32,114,101,116,117,114,110, 32,116,121,112,101, 10, 32, + 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, + 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32, + 101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118, + 32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32, + 101,110,100, 10, 32,114,101,116,117,114,110, 32,110,105,108, + 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, + 102,105,110,100, 95,101,110,117,109, 95,118, 97,114, 40,118, + 97,114, 41, 10, 10, 9,105,102, 32,116,111,110,117,109, 98, + 101,114, 40,118, 97,114, 41, 32,116,104,101,110, 32,114,101, + 116,117,114,110, 32,118, 97,114, 32,101,110,100, 10, 10, 9, + 108,111, 99, 97,108, 32, 99, 32, 61, 32, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, + 9,119,104,105,108,101, 32, 99, 32,100,111, 10, 9, 9,108, + 111, 99, 97,108, 32,110,115, 32, 61, 32,103,101,116,110, 97, + 109,101,115,112, 97, 99,101, 40, 99, 41, 10, 9, 9,102,111, + 114, 32,107, 44,118, 32,105,110, 32,112, 97,105,114,115, 40, + 95,103,108,111, 98, 97,108, 95,101,110,117,109,115, 41, 32, + 100,111, 10, 9, 9, 9,105,102, 32,109, 97,116, 99,104, 95, + 116,121,112,101, 40,118, 97,114, 44, 32,118, 44, 32,110,115, + 41, 32,116,104,101,110, 10, 9, 9, 9, 9,114,101,116,117, + 114,110, 32,118, 10, 9, 9, 9,101,110,100, 10, 9, 9,101, + 110,100, 10, 9, 9,105,102, 32, 99, 46, 98, 97,115,101, 32, + 97,110,100, 32, 99, 46, 98, 97,115,101, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 9, 9, 9, 99, 32, 61, 32, 95, + 103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91, + 99, 58,102,105,110,100,116,121,112,101, 40, 99, 46, 98, 97, + 115,101, 41, 93, 10, 9, 9,101,108,115,101, 10, 9, 9, 9, + 99, 32, 61, 32,110,105,108, 10, 9, 9,101,110,100, 10, 9, + 101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,118, 97, + 114, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, + 32,105,102, 32,105,115, 32, 97, 32,114,101,103,105,115,116, + 101,114,101,100, 32,116,121,112,101, 58, 32,114,101,116,117, + 114,110, 32,102,117,108,108, 32,116,121,112,101, 32,111,114, + 32,110,105,108, 10,102,117,110, 99,116,105,111,110, 32, 99, + 108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,102, + 105,110,100,116,121,112,101, 32, 40,116, 41, 10, 10, 9,116, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 116, 44, 32, 34, 61, 46, 42, 34, 44, 32, 34, 34, 41, 10, 9, + 105,102, 32, 95, 98, 97,115,105, 99, 91,116, 93, 32,116,104, + 101,110, 10, 9, 32,114,101,116,117,114,110, 32,116, 10, 9, + 101,110,100, 10, 10, 9,108,111, 99, 97,108, 32, 95, 44, 95, + 44,101,109, 32, 61, 32,115,116,114,105,110,103, 46,102,105, + 110,100, 40,116, 44, 32, 34, 40, 91, 38, 37, 42, 93, 41, 37, + 115, 42, 36, 34, 41, 10, 9,116, 32, 61, 32,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, 37,115, 42, + 40, 91, 38, 37, 42, 93, 41, 37,115, 42, 36, 34, 44, 32, 34, + 34, 41, 10, 9,112, 32, 61, 32,115,101,108,102, 10, 9,119, + 104,105,108,101, 32,112, 32, 97,110,100, 32,116,121,112,101, + 40,112, 41, 61, 61, 39,116, 97, 98,108,101, 39, 32,100,111, + 10, 9, 9,108,111, 99, 97,108, 32,115,116, 32, 61, 32,103, + 101,116,110, 97,109,101,115,112, 97, 99,101, 40,112, 41, 10, + 10, 9, 9,102,111,114, 32,105, 61, 95,103,108,111, 98, 97, + 108, 95,116,121,112,101,115, 46,110, 44, 49, 44, 45, 49, 32, + 100,111, 32, 45, 45, 32,105,110, 32,114,101,118,101,114,115, + 101, 32,111,114,100,101,114, 10, 10, 9, 9, 9,105,102, 32, + 109, 97,116, 99,104, 95,116,121,112,101, 40,116, 44, 32, 95, + 103,108,111, 98, 97,108, 95,116,121,112,101,115, 91,105, 93, + 44, 32,115,116, 41, 32,116,104,101,110, 10, 9, 9, 9, 9, + 114,101,116,117,114,110, 32, 95,103,108,111, 98, 97,108, 95, + 116,121,112,101,115, 91,105, 93, 46, 46, 40,101,109, 32,111, + 114, 32, 34, 34, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, + 101,110,100, 10, 9, 9,105,102, 32,112, 46, 98, 97,115,101, + 32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126, 61, 32, + 39, 39, 32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126, + 61, 32,116, 32,116,104,101,110, 10, 9, 9, 9, 45, 45,112, + 114,105,110,116, 40, 34,116,121,112,101, 32,105,115, 32, 34, + 46, 46,116, 46, 46, 34, 44, 32,112, 32,105,115, 32, 34, 46, + 46,112, 46, 98, 97,115,101, 46, 46, 34, 32,115,101,108,102, + 46,116,121,112,101, 32,105,115, 32, 34, 46, 46,115,101,108, + 102, 46,116,121,112,101, 46, 46, 34, 32,115,101,108,102, 46, + 110, 97,109,101, 32,105,115, 32, 34, 46, 46,115,101,108,102, + 46,110, 97,109,101, 41, 10, 9, 9, 9,112, 32, 61, 32, 95, + 103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91, + 112, 58,102,105,110,100,116,121,112,101, 40,112, 46, 98, 97, + 115,101, 41, 93, 10, 9, 9,101,108,115,101, 10, 9, 9, 9, + 112, 32, 61, 32,110,105,108, 10, 9, 9,101,110,100, 10, 9, + 101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,110,105, + 108, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32, 97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95, + 116,121,112,101, 40,116, 44, 32, 99,108, 97,115,115, 41, 10, + 9, 95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 46, + 110, 32, 61, 32, 95,103,108,111, 98, 97,108, 95,116,121,112, + 101,115, 46,110, 32, 43, 49, 10, 9, 95,103,108,111, 98, 97, + 108, 95,116,121,112,101,115, 91, 95,103,108,111, 98, 97,108, + 95,116,121,112,101,115, 46,110, 93, 32, 61, 32,116, 10, 9, + 95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 95,104, + 97,115,104, 91,116, 93, 32, 61, 32, 49, 10, 9,105,102, 32, + 99,108, 97,115,115, 32,116,104,101,110, 32, 97,112,112,101, + 110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40,116, + 44, 32, 99,108, 97,115,115, 41, 32,101,110,100, 10,101,110, + 100, 10, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112, + 101,110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40, + 116, 44, 99,108, 97,115,115, 41, 10, 9,105,102, 32, 95,103, + 108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116, + 93, 32,116,104,101,110, 10, 9, 9, 99,108, 97,115,115, 46, + 102,108, 97,103,115, 32, 61, 32, 95,103,108,111, 98, 97,108, + 95, 99,108, 97,115,115,101,115, 91,116, 93, 46,102,108, 97, + 103,115, 10, 9, 9, 99,108, 97,115,115, 46,108,110, 97,109, + 101,115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, + 97,115,115,101,115, 91,116, 93, 46,108,110, 97,109,101,115, + 10, 9, 9,105,102, 32, 95,103,108,111, 98, 97,108, 95, 99, + 108, 97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32, + 97,110,100, 32, 40, 95,103,108,111, 98, 97,108, 95, 99,108, + 97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32,126, + 61, 32, 39, 39, 41, 32,116,104,101,110, 10, 9, 9, 9, 99, + 108, 97,115,115, 46, 98, 97,115,101, 32, 61, 32, 95,103,108, + 111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116, 93, + 46, 98, 97,115,101, 32,111,114, 32, 99,108, 97,115,115, 46, + 98, 97,115,101, 10, 9, 9,101,110,100, 10, 9,101,110,100, + 10, 9, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115, + 101,115, 91,116, 93, 32, 61, 32, 99,108, 97,115,115, 10, 9, + 99,108, 97,115,115, 46,102,108, 97,103,115, 32, 61, 32, 99, + 108, 97,115,115, 46,102,108, 97,103,115, 32,111,114, 32,123, + 125, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32,109, 97,116, 99,104, 95,116,121,112,101, 40, 99,104,105, + 108,100,116,121,112,101, 44, 32,114,101,103,116,121,112,101, + 44, 32,115,116, 41, 10, 45, 45,112,114,105,110,116, 40, 34, + 102,105,110,100,116,121,112,101, 32, 34, 46, 46, 99,104,105, + 108,100,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,114, + 101,103,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,115, + 116, 41, 10, 9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61, + 32,115,116,114,105,110,103, 46,102,105,110,100, 40,114,101, + 103,116,121,112,101, 44, 32, 99,104,105,108,100,116,121,112, + 101, 44, 32, 45,115,116,114,105,110,103, 46,108,101,110, 40, + 99,104,105,108,100,116,121,112,101, 41, 44, 32,116,114,117, + 101, 41, 10, 9,105,102, 32, 98, 32,116,104,101,110, 10, 10, + 9, 9,105,102, 32,101, 32, 61, 61, 32,115,116,114,105,110, + 103, 46,108,101,110, 40,114,101,103,116,121,112,101, 41, 32, + 97,110,100, 10, 9, 9, 9, 9, 40, 98, 32, 61, 61, 32, 49, + 32,111,114, 32, 40,115,116,114,105,110,103, 46,115,117, 98, + 40,114,101,103,116,121,112,101, 44, 32, 98, 45, 49, 44, 32, + 98, 45, 49, 41, 32, 61, 61, 32, 39, 58, 39, 32, 97,110,100, + 10, 9, 9, 9, 9,115,116,114,105,110,103, 46,115,117, 98, + 40,114,101,103,116,121,112,101, 44, 32, 49, 44, 32, 98, 45, + 49, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46,115,117, + 98, 40,115,116, 44, 32, 49, 44, 32, 98, 45, 49, 41, 41, 41, + 32,116,104,101,110, 10, 9, 9, 9,114,101,116,117,114,110, + 32,116,114,117,101, 10, 9, 9,101,110,100, 10, 9,101,110, + 100, 10, 10, 9,114,101,116,117,114,110, 32,102, 97,108,115, + 101, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32,102,105,110,100,116,121,112,101, 95,111,110, 95, 99,104, + 105,108,100,115, 40,115,101,108,102, 44, 32,116, 41, 10, 10, + 9,108,111, 99, 97,108, 32,116, 99,104,105,108,100, 10, 9, + 105,102, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121, + 112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111, + 114, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121,112, + 101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101, + 39, 32,116,104,101,110, 10, 9, 9,102,111,114, 32,107, 44, + 118, 32,105,110, 32,105,112, 97,105,114,115, 40,115,101,108, + 102, 41, 32,100,111, 10, 9, 9, 9,105,102, 32,118, 46, 99, + 108, 97,115,115,116,121,112,101, 32, 61, 61, 32, 39, 99,108, + 97,115,115, 39, 32,111,114, 32,118, 46, 99,108, 97,115,115, + 116,121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, + 97, 99,101, 39, 32,116,104,101,110, 10, 9, 9, 9, 9,105, + 102, 32,118, 46,116,121,112,101,100,101,102,115, 32, 97,110, + 100, 32,118, 46,116,121,112,101,100,101,102,115, 91,116, 93, + 32,116,104,101,110, 10, 9, 9, 9, 9, 32,114,101,116,117, + 114,110, 32,118, 46,116,121,112,101,100,101,102,115, 91,116, + 93, 10, 9, 9, 9, 9,101,108,115,101,105,102, 32,118, 46, + 117,115,101,114,116,121,112,101,115, 32, 97,110,100, 32,118, + 46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116, + 104,101,110, 10, 9, 9, 9, 9, 32,114,101,116,117,114,110, + 32,118, 46,117,115,101,114,116,121,112,101,115, 91,116, 93, + 10, 9, 9, 9, 9,101,110,100, 10, 9, 9, 9, 9,116, 99, + 104,105,108,100, 32, 61, 32,102,105,110,100,116,121,112,101, + 95,111,110, 95, 99,104,105,108,100,115, 40,118, 44, 32,116, + 41, 10, 9, 9, 9, 9,105,102, 32,116, 99,104,105,108,100, + 32,116,104,101,110, 32,114,101,116,117,114,110, 32,116, 99, + 104,105,108,100, 32,101,110,100, 10, 9, 9, 9,101,110,100, + 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 9,114,101, + 116,117,114,110, 32,110,105,108, 10, 10,101,110,100, 10, 10, + 102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 58,105,115,101,110,117,109, + 32, 40,116,121,112,101, 41, 10, 32,105,102, 32,103,108,111, + 98, 97,108, 95,101,110,117,109,115, 91,116,121,112,101, 93, + 32,116,104,101,110, 10, 9,114,101,116,117,114,110, 32,116, + 121,112,101, 10, 32,101,108,115,101, 10, 32, 9,114,101,116, + 117,114,110, 32,102, 97,108,115,101, 10, 32,101,110,100, 10, + 10, 32,108,111, 99, 97,108, 32, 98, 97,115,101,116,121,112, + 101, 32, 61, 32,103,115,117, 98, 40,116,121,112,101, 44, 34, + 94, 46, 42, 58, 58, 34, 44, 34, 34, 41, 10, 32,108,111, 99, + 97,108, 32,101,110,118, 32, 61, 32,115,101,108,102, 10, 32, + 119,104,105,108,101, 32,101,110,118, 32,100,111, 10, 32, 32, + 105,102, 32,101,110,118, 46,101,110,117,109,115, 32,116,104, + 101,110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, + 10, 32, 32, 32,119,104,105,108,101, 32,101,110,118, 46,101, + 110,117,109,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32, + 105,102, 32,101,110,118, 46,101,110,117,109,115, 91,105, 93, + 46,110, 97,109,101, 32, 61, 61, 32, 98, 97,115,101,116,121, + 112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, + 32, 32,114,101,116,117,114,110, 32,116,114,117,101, 10, 32, + 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, + 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32, + 101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118, + 32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32, + 101,110,100, 10, 32,114,101,116,117,114,110, 32,102, 97,108, + 115,101, 10,101,110,100, 10, 10,109,101,116,104,111,100,105, + 115,118,105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115, + 101, 32, 45, 45, 32, 97, 32,103,108,111, 98, 97,108, 10, 10, + 45, 45, 32,112, 97,114,115,101, 32, 99,104,117,110,107, 10, + 102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 58,100,111,112, 97,114,115, + 101, 32, 40,115, 41, 10, 45, 45,112,114,105,110,116, 32, 40, + 34,112, 97,114,115,101, 32, 34, 46, 46,115, 41, 10, 10, 32, + 45, 45, 32,116,114,121, 32,116,104,101, 32,112, 97,114,115, + 101,114, 32,104,111,111,107, 10, 32,100,111, 10, 32, 9,108, + 111, 99, 97,108, 32,115,117, 98, 32, 61, 32,112, 97,114,115, + 101,114, 95,104,111,111,107, 40,115, 41, 10, 32, 9,105,102, + 32,115,117, 98, 32,116,104,101,110, 10, 32, 9, 9,114,101, + 116,117,114,110, 32,115,117, 98, 10, 32, 9,101,110,100, 10, + 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,116, + 104,101, 32,110,117,108,108, 32,115,116, 97,116,101,109,101, + 110,116, 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, + 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, + 42, 59, 34, 41, 10, 32, 9,105,102, 32, 98, 32,116,104,101, + 110, 10, 32, 9, 9,114,101,116,117,114,110, 32,115,116,114, + 115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 9,101,110, + 100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, + 32,101,109,112,116,121, 32,118,101,114, 98, 97,116,105,109, + 32,108,105,110,101, 10, 32,100,111, 10, 32, 9,108,111, 99, + 97,108, 32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, + 94, 37,115, 42, 36, 92,110, 34, 41, 10, 32, 9,105,102, 32, + 98, 32,116,104,101,110, 10, 32, 9, 9,114,101,116,117,114, + 110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, + 10, 32, 9,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, + 45, 32,116,114,121, 32, 76,117, 97, 32, 99,111,100,101, 10, + 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, + 44, 99,111,100,101, 32, 61, 32,115,116,114,102,105,110,100, + 40,115, 44, 34, 94, 37,115, 42, 40, 37, 98, 92, 49, 92, 50, + 41, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, + 10, 32, 32, 32, 67,111,100,101, 40,115,116,114,115,117, 98, + 40, 99,111,100,101, 44, 50, 44, 45, 50, 41, 41, 10, 32, 32, + 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40, + 115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101, + 110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 67, 32, 99, + 111,100,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, + 32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114, + 102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 37, 98, + 92, 51, 92, 52, 41, 34, 41, 10, 32, 32,105,102, 32, 98, 32, + 116,104,101,110, 10, 9, 99,111,100,101, 32, 61, 32, 39,123, + 39, 46, 46,115,116,114,115,117, 98, 40, 99,111,100,101, 44, + 50, 44, 45, 50, 41, 46, 46, 39, 92,110,125, 92,110, 39, 10, + 9, 86,101,114, 98, 97,116,105,109, 40, 99,111,100,101, 44, + 39,114, 39, 41, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32, + 118,101,114, 98, 97,116,105,109, 32, 99,111,100,101, 32,102, + 111,114, 32, 39,114, 39,101,103,105,115,116,101,114, 32,102, + 114, 97,103,109,101,110,116, 10, 9,114,101,116,117,114,110, + 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, + 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, + 32,116,114,121, 32, 67, 32, 99,111,100,101, 32,102,111,114, + 32,112,114,101, 97,109, 98,108,101, 32,115,101, 99,116,105, + 111,110, 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, + 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, + 42, 40, 37, 98, 92, 53, 92, 54, 41, 34, 41, 10, 32, 9,105, + 102, 32, 98, 32,116,104,101,110, 10, 32, 9, 9, 99,111,100, + 101, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40, + 99,111,100,101, 44, 32, 50, 44, 32, 45, 50, 41, 46, 46, 34, + 92,110, 34, 10, 9, 9, 86,101,114, 98, 97,116,105,109, 40, + 99,111,100,101, 44, 32, 39, 39, 41, 10, 9, 9,114,101,116, + 117,114,110, 32,115,116,114,105,110,103, 46,115,117, 98, 40, + 115, 44, 32,101, 43, 49, 41, 10, 32, 9,101,110,100, 10, 32, + 101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,100,101, + 102, 97,117,108,116, 95,112,114,111,112,101,114,116,121, 32, + 100,105,114,101, 99,116,105,118,101, 10, 32,100,111, 10, 32, + 9,108,111, 99, 97,108, 32, 98, 44,101, 44,112,116,121,112, + 101, 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32, + 34, 94, 37,115, 42, 84, 79, 76, 85, 65, 95, 80, 82, 79, 80, + 69, 82, 84, 89, 95, 84, 89, 80, 69, 37,115, 42, 37, 40, 43, + 37,115, 42, 40, 91, 94, 37, 41, 37,115, 93, 42, 41, 37,115, + 42, 37, 41, 43, 37,115, 42, 59, 63, 34, 41, 10, 32, 9,105, + 102, 32, 98, 32,116,104,101,110, 10, 32, 9, 9,105,102, 32, + 110,111,116, 32,112,116,121,112,101, 32,111,114, 32,112,116, + 121,112,101, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 10, + 32, 9, 9, 9,112,116,121,112,101, 32, 61, 32, 34,100,101, + 102, 97,117,108,116, 34, 10, 32, 9, 9,101,110,100, 10, 32, + 9, 9,115,101,108,102, 58,115,101,116, 95,112,114,111,112, + 101,114,116,121, 95,116,121,112,101, 40,112,116,121,112,101, + 41, 10, 9, 32, 9,114,101,116,117,114,110, 32,115,116,114, + 115,117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32, 9,101, + 110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114, + 121, 32,112,114,111,116,101, 99,116,101,100, 95,100,101,115, + 116,114,117, 99,116,111,114, 32,100,105,114,101, 99,116,105, + 118,101, 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, + 98, 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105, + 110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 84, 79, 76, 85, + 65, 95, 80, 82, 79, 84, 69, 67, 84, 69, 68, 95, 68, 69, 83, + 84, 82, 85, 67, 84, 79, 82, 37,115, 42, 59, 63, 34, 41, 10, + 9,105,102, 32, 98, 32,116,104,101,110, 10, 9, 9,105,102, + 32,115,101,108,102, 46,115,101,116, 95,112,114,111,116,101, + 99,116,101,100, 95,100,101,115,116,114,117, 99,116,111,114, + 32,116,104,101,110, 10, 9, 32, 9, 9,115,101,108,102, 58, + 115,101,116, 95,112,114,111,116,101, 99,116,101,100, 95,100, + 101,115,116,114,117, 99,116,111,114, 40,116,114,117,101, 41, + 10, 9, 32, 9,101,110,100, 10, 32, 9, 9,114,101,116,117, + 114,110, 32,115,116,114,115,117, 98, 40,115, 44, 32,101, 43, + 49, 41, 10, 32, 9,101,110,100, 10, 32,101,110,100, 10, 10, + 32, 45, 45, 32,116,114,121, 32, 39,101,120,116,101,114,110, + 39, 32,107,101,121,119,111,114,100, 10, 32,100,111, 10, 32, + 9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, + 37,115, 42,101,120,116,101,114,110, 37,115, 43, 34, 41, 10, + 32, 9,105,102, 32, 98, 32,116,104,101,110, 10, 9, 9, 45, + 45, 32,100,111, 32,110,111,116,104,105,110,103, 10, 32, 9, + 9,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40, + 115, 44, 32,101, 43, 49, 41, 10, 32, 9,101,110,100, 10, 32, + 101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 39,118, + 105,114,116,117, 97,108, 39, 32,107,101,121,119,111,114,107, + 100, 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, 98, + 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110, + 100, 40,115, 44, 32, 34, 94, 37,115, 42,118,105,114,116,117, + 97,108, 37,115, 43, 34, 41, 10, 32, 9,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 9, 9,109,101,116,104,111,100,105, + 115,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,101, + 10, 32, 9, 9,114,101,116,117,114,110, 32,115,116,114,115, + 117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32, 9,101,110, + 100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, + 32,108, 97, 98,101,108,115, 32, 40,112,117, 98,108,105, 99, + 44, 32,112,114,105,118, 97,116,101, 44, 32,101,116, 99, 41, + 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, 98, 44, + 101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, + 40,115, 44, 32, 34, 94, 37,115, 42, 37,119, 42, 37,115, 42, + 58, 91, 94, 58, 93, 34, 41, 10, 32, 9,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 9, 9,114,101,116,117,114,110, 32, + 115,116,114,115,117, 98, 40,115, 44, 32,101, 41, 32, 45, 45, + 32,112,114,101,115,101,114,118,101, 32,116,104,101, 32, 91, + 94, 58, 93, 10, 32, 9,101,110,100, 10, 32,101,110,100, 10, + 10, 32, 45, 45, 32,116,114,121, 32,109,111,100,117,108,101, + 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44, + 101, 44,110, 97,109,101, 44, 98,111,100,121, 32, 61, 32,115, + 116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,109, + 111,100,117,108,101, 37,115, 37,115, 42, 40, 91, 95, 37,119, + 93, 91, 95, 37,119, 93, 42, 41, 37,115, 42, 40, 37, 98,123, + 125, 41, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99, + 111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, + 98, 44,101, 41, 10, 32, 32, 32, 77,111,100,117,108,101, 40, + 110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114, + 101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115, 44, + 101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, + 10, 10, 32, 45, 45, 32,116,114,121, 32,110, 97,109,101,115, + 97,112, 99,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97, + 108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,121, + 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, + 37,115, 42,110, 97,109,101,115,112, 97, 99,101, 37,115, 37, + 115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 93, 42, 41, + 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 59, 63, 34, + 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, + 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32, + 115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, + 32, 32, 78, 97,109,101,115,112, 97, 99,101, 40,110, 97,109, + 101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114,101,116,117, + 114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, + 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, + 45, 45, 32,116,114,121, 32,100,101,102,105,110,101, 10, 32, + 100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44, + 110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100, 40, + 115, 44, 34, 94, 37,115, 42, 35,100,101,102,105,110,101, 37, + 115, 37,115, 42, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92, + 110, 93, 42, 92,110, 37,115, 42, 34, 41, 10, 32, 32,105,102, + 32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114, + 114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, + 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 68,101,102,105, + 110,101, 40,110, 97,109,101, 41, 10, 32, 32, 32,114,101,116, + 117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, + 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, + 32, 45, 45, 32,116,114,121, 32,101,110,117,109,101,114, 97, + 116,101,115, 10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97, + 108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,121, + 44,118, 97,114,110, 97,109,101, 32, 61, 32,115,116,114,102, + 105,110,100, 40,115, 44, 34, 94, 37,115, 42,101,110,117,109, + 37,115, 43, 40, 37, 83, 42, 41, 37,115, 42, 40, 37, 98,123, + 125, 41, 37,115, 42, 40, 91, 94, 37,115, 59, 93, 42, 41, 37, + 115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, + 98, 32,116,104,101,110, 10, 32, 32, 32, 45, 45,101,114,114, + 111,114, 40, 34, 35, 83,111,114,114,121, 44, 32,100,101, 99, + 108, 97,114, 97,116,105,111,110, 32,111,102, 32,101,110,117, + 109,115, 32, 97,110,100, 32,118, 97,114,105, 97, 98,108,101, + 115, 32,111,110, 32,116,104,101, 32,115, 97,109,101, 32,115, + 116, 97,116,101,109,101,110,116, 32,105,115, 32,110,111,116, + 32,115,117,112,112,111,114,116,101,100, 46, 92,110, 68,101, + 99,108, 97,114,101, 32,121,111,117,114, 32,118, 97,114,105, + 97, 98,108,101, 32,115,101,112, 97,114, 97,116,101,108,121, + 32, 40,101,120, 97,109,112,108,101, 58, 32, 39, 34, 46, 46, + 110, 97,109,101, 46, 46, 34, 32, 34, 46, 46,118, 97,114,110, + 97,109,101, 46, 46, 34, 59, 39, 41, 34, 41, 10, 32, 32, 32, + 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116, + 114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, + 69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101, 44, + 98,111,100,121, 44,118, 97,114,110, 97,109,101, 41, 10, 32, + 32, 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, + 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 10, 45, 45, 32,100,111, 10, 45, 45, 32, 32, + 108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101, 44, + 98,111,100,121, 32, 61, 32,115,116,114,102,105,110,100, 40, + 115, 44, 34, 94, 37,115, 42,101,110,117,109, 37,115, 43, 40, + 37, 83, 42, 41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115, + 42, 59, 63, 37,115, 42, 34, 41, 10, 45, 45, 32, 32,105,102, + 32, 98, 32,116,104,101,110, 10, 45, 45, 32, 32, 32, 95, 99, + 117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115, + 117, 98, 40,115, 44, 98, 44,101, 41, 10, 45, 45, 32, 32, 32, + 69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101, 44, + 98,111,100,121, 41, 10, 45, 45, 32, 32,114,101,116,117,114, + 110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, + 10, 45, 45, 32, 32,101,110,100, 10, 45, 45, 32,101,110,100, + 10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, + 44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, + 116,121,112,101,100,101,102, 37,115, 43,101,110,117,109, 91, + 94,123, 93, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40, 91, + 37,119, 95, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42, 59, + 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104, + 101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100, + 101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44, + 101, 41, 10, 32, 32, 32, 69,110,117,109,101,114, 97,116,101, + 40,110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32, + 114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115, + 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110, + 100, 10, 10, 32, 45, 45, 32,116,114,121, 32,111,112,101,114, + 97,116,111,114, 10, 32,100,111, 10, 32, 32,108,111, 99, 97, + 108, 32, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,100, + 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, + 95, 37,119, 93, 91, 95, 37,119, 37,115, 37, 42, 38, 58, 60, + 62, 44, 93, 45, 37,115, 43,111,112,101,114, 97,116,111,114, + 41, 37,115, 42, 40, 91, 94, 37,115, 93, 91, 94, 37,115, 93, + 42, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, + 99, 63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59, + 37,115, 42, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32, + 98, 32,116,104,101,110, 10, 9, 9, 32, 45, 45, 32,116,114, + 121, 32,105,110,108,105,110,101, 10, 32, 32, 32, 98, 44,101, + 44,100,101, 99,108, 44,107,105,110,100, 44, 97,114,103, 44, + 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110,100, + 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91, + 95, 37,119, 37,115, 37, 42, 38, 58, 60, 62, 44, 93, 45, 37, + 115, 43,111,112,101,114, 97,116,111,114, 41, 37,115, 42, 40, + 91, 94, 37,115, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42, + 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110, + 63,115, 63,116, 63, 41, 91, 37,115, 92,110, 93, 42, 37, 98, + 123,125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32, + 101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32, + 116,104,101,110, 10, 32, 32, 9, 45, 45, 32,116,114,121, 32, + 99, 97,115,116, 32,111,112,101,114, 97,116,111,114, 10, 32, + 32, 9, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,100, + 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 40, + 111,112,101,114, 97,116,111,114, 41, 37,115, 43, 40, 91, 37, + 119, 95, 58, 37,100, 60, 62, 37, 42, 37, 38, 37,115, 93, 43, + 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, + 63,111, 63,110, 63,115, 63,116, 63, 41, 34, 41, 59, 10, 32, + 32, 9,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32, 9, + 9,108,111, 99, 97,108, 32, 95, 44,105,101, 32, 61, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, + 94, 37,115, 42, 37, 98,123,125, 34, 44, 32,101, 43, 49, 41, + 10, 32, 32, 9, 9,105,102, 32,105,101, 32,116,104,101,110, + 10, 32, 32, 9, 9, 9,101, 32, 61, 32,105,101, 10, 32, 32, + 9, 9,101,110,100, 10, 32, 32, 9,101,110,100, 10, 32, 32, + 101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, + 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, + 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, + 10, 32, 32, 32, 79,112,101,114, 97,116,111,114, 40,100,101, + 99,108, 44,107,105,110,100, 44, 97,114,103, 44, 99,111,110, + 115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115, + 116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116, + 114,121, 32,102,117,110, 99,116,105,111,110, 10, 32,100,111, + 10, 32, 32, 45, 45,108,111, 99, 97,108, 32, 98, 44,101, 44, + 100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32, + 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37, + 115, 42, 40, 91,126, 95, 37,119, 93, 91, 95, 64, 37,119, 37, + 115, 37, 42, 38, 58, 60, 62, 93, 42, 91, 95, 37,119, 93, 41, + 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63, + 111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37, + 115, 42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, + 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, + 44, 97,114,103, 44, 99,111,110,115,116, 44,118,105,114,116, + 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, + 37,115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,115, + 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63, + 110, 63,115, 63,116, 63, 41, 37,115, 42, 40, 61, 63, 37,115, + 42, 48, 63, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, + 32,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10, + 32, 32, 9, 45, 45, 32,116,114,121, 32,102,117,110, 99,116, + 105,111,110, 32,119,105,116,104, 32,116,101,109,112,108, 97, + 116,101, 10, 32, 32, 9, 98, 44,101, 44,100,101, 99,108, 44, + 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,114, + 102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,126, + 95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38, 58, + 60, 62, 93, 42, 91, 95, 37,119, 93, 37, 98, 60, 62, 41, 37, + 115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, + 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37,115, + 42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32, + 101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32, + 116,104,101,110, 10, 32, 32, 32, 45, 45, 32,116,114,121, 32, + 97, 32,115,105,110,103,108,101, 32,108,101,116,116,101,114, + 32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 10, + 32, 32, 32, 98, 44,101, 44,100,101, 99,108, 44, 97,114,103, + 44, 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110, + 100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, + 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, + 63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59, 37, + 115, 42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102, + 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, + 45, 45, 32,116,114,121, 32,102,117,110, 99,116,105,111,110, + 32,112,111,105,110,116,101,114, 10, 32, 32, 32, 98, 44,101, + 44,100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, + 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, + 37,115, 42, 40, 91, 94, 37, 40, 59, 92,110, 93, 43, 37, 98, + 40, 41, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, + 59, 37,115, 42, 34, 41, 10, 32, 32, 32,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 32, 32, 32,100,101, 99,108, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,100,101, + 99,108, 44, 32, 34, 37, 40, 37,115, 42, 37, 42, 40, 91, 94, + 37, 41, 93, 42, 41, 37,115, 42, 37, 41, 34, 44, 32, 34, 32, + 37, 49, 32, 34, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32, + 101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, + 10, 32, 32, 9,105,102, 32,118,105,114,116, 32, 97,110,100, + 32,115,116,114,105,110,103, 46,102,105,110,100, 40,118,105, + 114,116, 44, 32, 34, 91, 61, 48, 93, 34, 41, 32,116,104,101, + 110, 10, 32, 32, 9, 9,105,102, 32,115,101,108,102, 46,102, + 108, 97,103,115, 32,116,104,101,110, 10, 32, 32, 9, 9, 9, + 115,101,108,102, 46,102,108, 97,103,115, 46,112,117,114,101, + 95,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,101, + 10, 32, 32, 9, 9,101,110,100, 10, 32, 32, 9,101,110,100, + 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, + 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, + 10, 32, 32, 32, 70,117,110, 99,116,105,111,110, 40,100,101, + 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 41, 10, 32, + 32, 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, + 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,105,110, + 108,105,110,101, 32,102,117,110, 99,116,105,111,110, 10, 32, + 100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44, + 100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32, + 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37, + 115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,115, 42, + 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110, + 63,115, 63,116, 63, 41, 91, 94, 59,123, 93, 42, 37, 98,123, + 125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32, 45, + 45,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, + 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, + 126, 95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38, + 58, 60, 62, 93, 42, 91, 95, 37,119, 62, 93, 41, 37,115, 42, + 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110, + 63,115, 63,116, 63, 41, 91, 94, 59, 93, 42, 37, 98,123,125, + 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102, + 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, + 45, 45, 32,116,114,121, 32, 97, 32,115,105,110,103,108,101, + 32,108,101,116,116,101,114, 32,102,117,110, 99,116,105,111, + 110, 32,110, 97,109,101, 10, 32, 32, 32, 98, 44,101, 44,100, + 101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, + 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, + 42, 40, 91, 95, 37,119, 93, 41, 37,115, 42, 40, 37, 98, 40, + 41, 41, 37,115, 42, 40, 99, 63,111, 63,110, 63,115, 63,116, + 63, 41, 46, 45, 37, 98,123,125, 37,115, 42, 59, 63, 37,115, + 42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102, 32, + 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, + 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40, + 115, 44, 98, 44,101, 41, 10, 32, 32, 32, 70,117,110, 99,116, + 105,111,110, 40,100,101, 99,108, 44, 97,114,103, 44, 99,111, + 110,115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32, + 115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, + 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, + 116,114,121, 32, 99,108, 97,115,115, 10, 32,100,111, 10, 9, + 32,108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101, + 44, 98, 97,115,101, 44, 98,111,100,121, 10, 9, 9, 98, 97, + 115,101, 32, 61, 32, 39, 39, 32, 98,111,100,121, 32, 61, 32, + 39, 39, 10, 9, 9, 98, 44,101, 44,110, 97,109,101, 32, 61, + 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, + 42, 99,108, 97,115,115, 37,115, 42, 40, 91, 95, 37,119, 93, + 91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 59, 34, 41, 32, + 32, 45, 45, 32,100,117,109,109,121, 32, 99,108, 97,115,115, + 10, 9, 9,108,111, 99, 97,108, 32,100,117,109,109,121, 32, + 61, 32,102, 97,108,115,101, 10, 9, 9,105,102, 32,110,111, + 116, 32, 98, 32,116,104,101,110, 10, 9, 9, 9, 98, 44,101, + 44,110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100, + 40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99,116, 37, + 115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42, + 41, 37,115, 42, 59, 34, 41, 32, 32, 32, 32, 45, 45, 32,100, + 117,109,109,121, 32,115,116,114,117, 99,116, 10, 9, 9, 9, + 105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 9, + 9, 9, 9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97,115, + 101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105,110, + 100, 40,115, 44, 34, 94, 37,115, 42, 99,108, 97,115,115, 37, + 115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42, + 41, 37,115, 42, 40, 91, 94,123, 93, 45, 41, 37,115, 42, 40, + 37, 98,123,125, 41, 37,115, 42, 34, 41, 10, 9, 9, 9, 9, + 105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 9, + 9, 9, 9, 9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97, + 115,101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105, + 110,100, 40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99, + 116, 37,115, 43, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, + 93, 42, 41, 37,115, 42, 40, 91, 94,123, 93, 45, 41, 37,115, + 42, 40, 37, 98,123,125, 41, 37,115, 42, 34, 41, 10, 9, 9, + 9, 9, 9,105,102, 32,110,111,116, 32, 98, 32,116,104,101, + 110, 10, 9, 9, 9, 9, 9, 9, 98, 44,101, 44,110, 97,109, + 101, 44, 98, 97,115,101, 44, 98,111,100,121, 32, 61, 32,115, + 116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,117, + 110,105,111,110, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, + 37,119, 64, 93, 42, 41, 37,115, 42, 40, 91, 94,123, 93, 45, + 41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 34, 41, + 10, 9, 9, 9, 9, 9, 9,105,102, 32,110,111,116, 32, 98, + 32,116,104,101,110, 10, 9, 9, 9, 9, 9, 9, 9, 98, 97, + 115,101, 32, 61, 32, 39, 39, 10, 9, 9, 9, 9, 9, 9, 9, + 98, 44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61, + 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, + 42,116,121,112,101,100,101,102, 37,115, 37,115, 42,115,116, + 114,117, 99,116, 37,115, 37,115, 42, 91, 95, 37,119, 93, 42, + 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40, 91, 95, + 37,119, 93, 91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 59, + 34, 41, 10, 9, 9, 9, 9, 9, 9,101,110,100, 10, 9, 9, + 9, 9, 9,101,110,100, 10, 9, 9, 9, 9,101,110,100, 10, + 9, 9, 9,101,108,115,101, 32,100,117,109,109,121, 32, 61, + 32, 49, 32,101,110,100, 10, 9, 9,101,108,115,101, 32,100, + 117,109,109,121, 32, 61, 32, 49, 32,101,110,100, 10, 9, 9, + 105,102, 32, 98, 32,116,104,101,110, 10, 9, 9, 9,105,102, + 32, 98, 97,115,101, 32,126, 61, 32, 39, 39, 32,116,104,101, + 110, 10, 9, 9, 9, 9, 98, 97,115,101, 32, 61, 32,115,116, + 114,105,110,103, 46,103,115,117, 98, 40, 98, 97,115,101, 44, + 32, 34, 94, 37,115, 42, 58, 37,115, 42, 34, 44, 32, 34, 34, + 41, 10, 9, 9, 9, 9, 98, 97,115,101, 32, 61, 32,115,116, + 114,105,110,103, 46,103,115,117, 98, 40, 98, 97,115,101, 44, + 32, 34, 37,115, 42,112,117, 98,108,105, 99, 37,115, 42, 34, + 44, 32, 34, 34, 41, 10, 9, 9, 9, 9, 98, 97,115,101, 32, + 61, 32,115,112,108,105,116, 40, 98, 97,115,101, 44, 32, 34, + 44, 34, 41, 10, 9, 9, 9, 9, 45, 45,108,111, 99, 97,108, + 32, 98, 44,101, 10, 9, 9, 9, 9, 45, 45, 98, 44,101, 44, + 98, 97,115,101, 32, 61, 32,115,116,114,102,105,110,100, 40, + 98, 97,115,101, 44, 34, 46, 45, 40, 91, 95, 37,119, 93, 91, + 95, 37,119, 60, 62, 44, 58, 93, 42, 41, 36, 34, 41, 10, 9, + 9, 9,101,108,115,101, 10, 9, 9, 9, 9, 98, 97,115,101, + 32, 61, 32,123,125, 10, 9, 9, 9,101,110,100, 10, 9, 9, + 9, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115, + 116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 9, 9, + 9, 67,108, 97,115,115, 40,110, 97,109,101, 44, 98, 97,115, + 101, 44, 98,111,100,121, 41, 10, 9, 9, 9,105,102, 32,110, + 111,116, 32,100,117,109,109,121, 32,116,104,101,110, 10, 9, + 9, 9, 9,118, 97,114, 98, 44,118, 97,114,101, 44,118, 97, + 114,110, 97,109,101, 32, 61, 32,115,116,114,105,110,103, 46, + 102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 40, 91, + 95, 37,119, 93, 43, 41, 37,115, 42, 59, 34, 44, 32,101, 43, + 49, 41, 10, 9, 9, 9, 9,105,102, 32,118, 97,114, 98, 32, + 116,104,101,110, 10, 9, 9, 9, 9, 9, 86, 97,114,105, 97, + 98,108,101, 40,110, 97,109,101, 46, 46, 34, 32, 34, 46, 46, + 118, 97,114,110, 97,109,101, 41, 10, 9, 9, 9, 9, 9,101, + 32, 61, 32,118, 97,114,101, 10, 9, 9, 9, 9,101,110,100, + 10, 9, 9, 9,101,110,100, 10, 9, 9, 9,114,101,116,117, + 114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, + 41, 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 10, 32, + 45, 45, 32,116,114,121, 32,116,121,112,101,100,101,102, 10, + 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, + 44,116,121,112,101,115, 32, 61, 32,115,116,114,102,105,110, + 100, 40,115, 44, 34, 94, 37,115, 42,116,121,112,101,100,101, + 102, 37,115, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 59, 37, + 115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101, + 110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, + 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, + 41, 10, 32, 32, 32, 84,121,112,101,100,101,102, 40,116,121, + 112,101,115, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32, + 115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, + 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, + 116,114,121, 32,118, 97,114,105, 97, 98,108,101, 10, 32,100, + 111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100, + 101, 99,108, 32, 61, 32,115,116,114,102,105,110,100, 40,115, + 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, 64, + 37,115, 37,119, 37,100, 37, 42, 38, 58, 60, 62, 44, 93, 42, + 91, 95, 37,119, 37,100, 93, 41, 37,115, 42, 59, 37,115, 42, + 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, + 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, + 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, + 10, 9,108,111, 99, 97,108, 32,108,105,115,116, 32, 61, 32, + 115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40, + 100,101, 99,108, 44, 32, 34, 44, 34, 41, 10, 9, 86, 97,114, + 105, 97, 98,108,101, 40,108,105,115,116, 91, 49, 93, 41, 10, + 9,105,102, 32,108,105,115,116, 46,110, 32, 62, 32, 49, 32, + 116,104,101,110, 10, 9, 9,108,111, 99, 97,108, 32, 95, 44, + 95, 44,116,121,112,101, 32, 61, 32,115,116,114,102,105,110, + 100, 40,108,105,115,116, 91, 49, 93, 44, 32, 34, 40, 46, 45, + 41, 37,115, 43, 40, 91, 94, 37,115, 93, 42, 41, 36, 34, 41, + 59, 10, 10, 9, 9,108,111, 99, 97,108, 32,105, 32, 61, 50, + 59, 10, 9, 9,119,104,105,108,101, 32,108,105,115,116, 91, + 105, 93, 32,100,111, 10, 9, 9, 9, 86, 97,114,105, 97, 98, + 108,101, 40,116,121,112,101, 46, 46, 34, 32, 34, 46, 46,108, + 105,115,116, 91,105, 93, 41, 10, 9, 9, 9,105, 61,105, 43, + 49, 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 32, 32, + 32, 45, 45, 86, 97,114,105, 97, 98,108,101, 40,100,101, 99, + 108, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,116, + 114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101, + 110,100, 10, 32,101,110,100, 10, 10, 9, 45, 45, 32,116,114, + 121, 32,115,116,114,105,110,103, 10, 32,100,111, 10, 32, 32, + 108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 32, + 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37, + 115, 42, 40, 91, 95, 37,119, 93, 63, 91, 95, 37,115, 37,119, + 37,100, 93, 45, 99,104, 97,114, 37,115, 43, 91, 95, 64, 37, + 119, 37,100, 93, 42, 37,115, 42, 37, 91, 37,115, 42, 37, 83, + 43, 37,115, 42, 37, 93, 41, 37,115, 42, 59, 37,115, 42, 34, + 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, + 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32, + 115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, + 32, 32, 86, 97,114,105, 97, 98,108,101, 40,100,101, 99,108, + 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,116,114, + 115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110, + 100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, + 32, 97,114,114, 97,121, 10, 32,100,111, 10, 32, 32,108,111, + 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, + 40, 91, 95, 37,119, 93, 91, 93, 91, 95, 64, 37,115, 37,119, + 37,100, 37, 42, 38, 58, 60, 62, 93, 42, 91, 93, 95, 37,119, + 37,100, 93, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, + 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, + 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114, + 115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 65, + 114,114, 97,121, 40,100,101, 99,108, 41, 10, 32, 32, 32,114, + 101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115, 44, + 101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, + 10, 10, 32, 45, 45, 32,110,111, 32,109, 97,116, 99,104,105, + 110,103, 10, 32,105,102, 32,103,115,117, 98, 40,115, 44, 34, + 37,115, 37,115, 42, 34, 44, 34, 34, 41, 32,126, 61, 32, 34, + 34, 32,116,104,101,110, 10, 32, 32, 95, 99,117,114,114, 95, + 99,111,100,101, 32, 61, 32,115, 10, 32, 32,101,114,114,111, + 114, 40, 34, 35,112, 97,114,115,101, 32,101,114,114,111,114, + 34, 41, 10, 32,101,108,115,101, 10, 32, 32,114,101,116,117, + 114,110, 32, 34, 34, 10, 32,101,110,100, 10, 10,101,110,100, + 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 58,112, 97,114,115, + 101, 32, 40,115, 41, 10, 10, 9, 45, 45,115,101,108,102, 46, + 99,117,114,114, 95,109,101,109, 98,101,114, 95, 97, 99, 99, + 101,115,115, 32, 61, 32,110,105,108, 10, 10, 32,119,104,105, + 108,101, 32,115, 32,126, 61, 32, 39, 39, 32,100,111, 10, 32, + 32,115, 32, 61, 32,115,101,108,102, 58,100,111,112, 97,114, + 115,101, 40,115, 41, 10, 32, 32,109,101,116,104,111,100,105, + 115,118,105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115, + 101, 10, 32,101,110,100, 10,101,110,100, 10, 10, 10, 45, 45, + 32,112,114,111,112,101,114,116,121, 32,116,121,112,101,115, + 10, 10,102,117,110, 99,116,105,111,110, 32,103,101,116, 95, + 112,114,111,112,101,114,116,121, 95,116,121,112,101, 40, 41, + 10, 10, 9,114,101,116,117,114,110, 32, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 58, + 103,101,116, 95,112,114,111,112,101,114,116,121, 95,116,121, + 112,101, 40, 41, 10,101,110,100, 10, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105, + 110,101,114, 58,115,101,116, 95,112,114,111,112,101,114,116, + 121, 95,116,121,112,101, 40,112,116,121,112,101, 41, 10, 9, + 112,116,121,112,101, 32, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40,112,116,121,112,101, 44, 32, 34, 94, 37, + 115, 42, 34, 44, 32, 34, 34, 41, 10, 9,112,116,121,112,101, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 112,116,121,112,101, 44, 32, 34, 37,115, 42, 36, 34, 44, 32, + 34, 34, 41, 10, 10, 9,115,101,108,102, 46,112,114,111,112, + 101,114,116,121, 95,116,121,112,101, 32, 61, 32,112,116,121, + 112,101, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 58,103,101,116, 95,112,114,111,112,101,114,116,121, 95, + 116,121,112,101, 40, 41, 10, 9,114,101,116,117,114,110, 32, + 115,101,108,102, 46,112,114,111,112,101,114,116,121, 95,116, + 121,112,101, 32,111,114, 32, 40,115,101,108,102, 46,112, 97, + 114,101,110,116, 32, 97,110,100, 32,115,101,108,102, 46,112, + 97,114,101,110,116, 58,103,101,116, 95,112,114,111,112,101, + 114,116,121, 95,116,121,112,101, 40, 41, 41, 32,111,114, 32, + 34,100,101,102, 97,117,108,116, 34, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/container.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,112, 97, 99,107, 97, + 103,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105, + 116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97, + 114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71, + 114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, + 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, + 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111, + 100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116, + 119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114, + 101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, + 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105, + 116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, + 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101, + 114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97, + 110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, + 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117, + 116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108, + 105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118, + 105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, + 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97, + 116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101, + 109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102, + 105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, + 32, 80, 97, 99,107, 97,103,101, 32, 99,108, 97,115,115, 10, + 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,116, + 104,101, 32,119,104,111,108,101, 32,112, 97, 99,107, 97,103, + 101, 32, 98,101,105,110,103, 32, 98,111,117,110,100, 46, 10, + 45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,110, + 103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115,116, + 111,114,101,100, 58, 10, 45, 45, 32, 32, 32, 32,123,105,125, + 32, 61, 32,108,105,115,116, 32,111,102, 32,111, 98,106,101, + 99,116,115, 32,105,110, 32,116,104,101, 32,112, 97, 99,107, + 97,103,101, 46, 10, 99,108, 97,115,115, 80, 97, 99,107, 97, + 103,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121, + 112,101, 32, 61, 32, 39,112, 97, 99,107, 97,103,101, 39, 10, + 125, 10, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 46, + 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115, + 80, 97, 99,107, 97,103,101, 10,115,101,116,109,101,116, 97, + 116, 97, 98,108,101, 40, 99,108, 97,115,115, 80, 97, 99,107, + 97,103,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105, + 110,101,114, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32, + 109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110, + 32, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112, + 114,105,110,116, 32, 40, 41, 10, 32,112,114,105,110,116, 40, + 34, 80, 97, 99,107, 97,103,101, 58, 32, 34, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 41, 10, 32,108,111, 99, 97,108, + 32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108, + 102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91, + 105, 93, 58,112,114,105,110,116, 40, 34, 34, 44, 34, 34, 41, + 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, + 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114, + 101,112,114,111, 99,101,115,115, 32, 40, 41, 10, 10, 32, 45, + 45, 32, 97,118,111,105,100, 32,112,114,101,112,114,111, 99, + 101,115,115,105,110,103, 32,101,109, 98,101,100,100,101,100, + 32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99, 97, + 108, 32, 76, 32, 61, 32,123,125, 10, 32,115,101,108,102, 46, + 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108, + 102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 37, 36, + 37, 91, 34, 44, 34, 92, 49, 34, 41, 32, 45, 45, 32,100,101, + 97,108, 32,119,105,116,104, 32,101,109, 98,101,100,100,101, + 100, 32,108,117, 97, 32, 99,111,100,101, 10, 32,115,101,108, + 102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115, + 101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, + 37, 36, 37, 93, 34, 44, 34, 92, 50, 34, 41, 10, 32,115,101, + 108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98, 92, + 49, 92, 50, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102,117, + 110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,105, + 110,115,101,114,116, 40, 76, 44, 99, 41, 10, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101, + 116,117,114,110, 32, 34, 92,110, 35, 91, 34, 46, 46,103,101, + 116,110, 40, 76, 41, 46, 46, 34, 93, 35, 34, 10, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110, + 100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114, + 101,112,114,111, 99,101,115,115,105,110,103, 32,101,109, 98, + 101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,108, + 111, 99, 97,108, 32, 67, 32, 61, 32,123,125, 10, 32,115,101, + 108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, + 42, 37, 36, 37, 60, 34, 44, 34, 92, 51, 34, 41, 32, 45, 45, + 32,100,101, 97,108, 32,119,105,116,104, 32,101,109, 98,101, + 100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,115,101, + 108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, + 42, 37, 36, 37, 62, 34, 44, 34, 92, 52, 34, 41, 10, 32,115, + 101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, + 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98, + 92, 51, 92, 52, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102, + 117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116, + 105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114, + 101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46, 46,103, + 101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101, + 110,100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112, + 114,101,112,114,111, 99,101,115,115,105,110,103, 32,101,109, + 98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32, + 115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, + 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, + 37,115, 42, 37, 36, 37,123, 34, 44, 34, 92, 53, 34, 41, 32, + 45, 45, 32,100,101, 97,108, 32,119,105,116,104, 32,101,109, + 98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32, + 115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, + 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, + 37,115, 42, 37, 36, 37,125, 34, 44, 34, 92, 54, 34, 41, 10, + 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115, + 117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, + 37, 98, 92, 53, 92, 54, 41, 34, 44, 32, 32, 32, 32, 32, 32, + 32,102,117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,116,105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,114,101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46, + 46,103,101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,101,110,100, 41, 10, 10, 32, 45, 45,115,101,108,102, 46, + 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108, + 102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 35, 91, + 94,100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34, + 92,110, 92,110, 34, 41, 32, 45, 45, 32,101,108,105,109,105, + 110, 97,116,101, 32,112,114,101,112,114,111, 99,101,115,115, + 111,114, 32,100,105,114,101, 99,116,105,118,101,115, 32,116, + 104, 97,116, 32,100,111,110, 39,116, 32,115,116, 97,114,116, + 32,119,105,116,104, 32, 39,100, 39, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 92,110, 91, 32, 92,116, + 93, 42, 35, 91, 32, 92,116, 93, 42, 91, 94,100, 37, 60, 37, + 91, 93, 34, 44, 32, 34, 92,110, 47, 47, 34, 41, 32, 45, 45, + 32,101,108,105,109,105,110, 97,116,101, 32,112,114,101,112, + 114,111, 99,101,115,115,111,114, 32,100,105,114,101, 99,116, + 105,118,101,115, 32,116,104, 97,116, 32,100,111,110, 39,116, + 32,115,116, 97,114,116, 32,119,105,116,104, 32, 39,100, 39, + 10, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114,101, + 112,114,111, 99,101,115,115,105,110,103, 32,118,101,114, 98, + 97,116,105,109, 32,108,105,110,101,115, 10, 32,108,111, 99, + 97,108, 32, 86, 32, 61, 32,123,125, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 92,110, 40, 37,115, 42, + 37, 36, 91, 94, 37, 91, 37, 93, 93, 91, 94, 92,110, 93, 42, + 41, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,118, 41, + 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32,116,105,110,115,101,114,116, 40, 86, 44,118, 41, + 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32,114,101,116,117,114,110, 32, 34, 92,110, 35, 34, + 46, 46,103,101,116,110, 40, 86, 41, 46, 46, 34, 35, 34, 10, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,101,110,100, 41, 10, 10, 32, 45, 45, 32,112,101,114,102, + 111,114,109, 32,103,108,111, 98, 97,108, 32,115,117, 98,115, + 116,105,116,117,116,105,111,110, 10, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 40, 47, 47, 91, 94, 92, + 110, 93, 42, 41, 34, 44, 34, 34, 41, 32, 32, 32, 32, 32, 45, + 45, 32,101,108,105,109,105,110, 97,116,101, 32, 67, 43, 43, + 32, 99,111,109,109,101,110,116,115, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 47, 37, 42, 34, 44, 34, + 92, 49, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100,101, + 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111, + 100,101, 44, 34, 37, 42, 47, 34, 44, 34, 92, 50, 34, 41, 10, + 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115, + 117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37, + 98, 92, 49, 92, 50, 34, 44, 34, 34, 41, 10, 32,115,101,108, + 102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115, + 101,108,102, 46, 99,111,100,101, 44, 34, 92, 49, 34, 44, 34, + 47, 37, 42, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100, + 101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99, + 111,100,101, 44, 34, 92, 50, 34, 44, 34, 37, 42, 47, 34, 41, + 10, 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103, + 115,117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, + 37,115, 42, 64, 37,115, 42, 34, 44, 34, 64, 34, 41, 32, 45, + 45, 32,101,108,105,109,105,110, 97,116,101, 32,115,112, 97, + 99,101,115, 32, 98,101,115,105,100,101, 32, 64, 10, 32,115, + 101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, + 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63, + 105,110,108,105,110,101, 40, 37,115, 41, 34, 44, 34, 37, 49, + 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 39,105,110,108,105,110,101, 39, 32,107,101,121,119,111, + 114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100,101, + 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111, + 100,101, 44, 34, 37,115, 63,101,120,116,101,114,110, 40, 37, + 115, 41, 34, 44, 34, 37, 49, 34, 41, 32, 45, 45, 32,101,108, + 105,109,105,110, 97,116,101, 32, 39,101,120,116,101,114,110, + 39, 32,107,101,121,119,111,114,100, 10, 32, 45, 45,115,101, + 108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63,118, + 105,114,116,117, 97,108, 40, 37,115, 41, 34, 44, 34, 37, 49, + 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 39,118,105,114,116,117, 97,108, 39, 32,107,101,121,119, + 111,114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100, + 101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99, + 111,100,101, 44, 34,112,117, 98,108,105, 99, 58, 34, 44, 34, + 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 39,112,117, 98,108,105, 99, 58, 39, 32,107,101,121,119, + 111,114,100, 10, 32,115,101,108,102, 46, 99,111,100,101, 32, + 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,100, + 101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,118,111,105,100, + 37,115, 42, 37, 42, 34, 44, 34, 37, 49, 95,117,115,101,114, + 100, 97,116, 97, 32, 34, 41, 32, 45, 45, 32,115,117, 98,115, + 116,105,116,117,116,101, 32, 39,118,111,105,100, 42, 39, 10, + 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115, + 117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, + 91, 94, 37,119, 95, 93, 41,118,111,105,100, 37,115, 42, 37, + 42, 34, 44, 34, 37, 49, 95,117,115,101,114,100, 97,116, 97, + 32, 34, 41, 32, 45, 45, 32,115,117, 98,115,116,105,116,117, + 116,101, 32, 39,118,111,105,100, 42, 39, 10, 32,115,101,108, + 102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115, + 101,108,102, 46, 99,111,100,101, 44, 34, 40, 91, 94, 37,119, + 95, 93, 41, 99,104, 97,114, 37,115, 42, 37, 42, 34, 44, 34, + 37, 49, 95, 99,115,116,114,105,110,103, 32, 34, 41, 32, 32, + 45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39, + 99,104, 97,114, 42, 39, 10, 32,115,101,108,102, 46, 99,111, + 100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, + 99,111,100,101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,108, + 117, 97, 95, 83,116, 97,116,101, 37,115, 42, 37, 42, 34, 44, + 34, 37, 49, 95,108,115,116, 97,116,101, 32, 34, 41, 32, 32, + 45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39, + 108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10, 10, 32, 45, + 45, 32,114,101,115,116,111,114,101, 32,101,109, 98,101,100, + 100,101,100, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,115, + 101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, + 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37, 35, 37, + 91, 40, 37,100, 43, 41, 37, 93, 37, 35, 34, 44,102,117,110, + 99,116,105,111,110, 32, 40,110, 41, 10, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117, + 114,110, 32, 76, 91,116,111,110,117,109, 98,101,114, 40,110, + 41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32,101,110,100, 41, 10, 32, 45, 45, 32,114,101,115,116, + 111,114,101, 32,101,109, 98,101,100,100,101,100, 32, 67, 32, + 99,111,100,101, 10, 32,115,101,108,102, 46, 99,111,100,101, + 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111, + 100,101, 44, 34, 37, 35, 37, 60, 40, 37,100, 43, 41, 37, 62, + 37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,110, + 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32,114,101,116,117,114,110, 32, 67, 91,116,111,110,117, + 109, 98,101,114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 41, 10, 32, 45, + 45, 32,114,101,115,116,111,114,101, 32,118,101,114, 98, 97, + 116,105,109, 32,108,105,110,101,115, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 37, 35, 40, 37,100, 43, + 41, 37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40, + 110, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114, + 101,116,117,114,110, 32, 86, 91,116,111,110,117,109, 98,101, + 114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,101,110,100, 41, 10, 10, 32,115,101,108,102, 46, 99,111, + 100,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 32, 34, 92, + 110, 37,115, 42, 37, 36, 40, 91, 94, 92,110, 93, 43, 41, 34, + 44, 32,102,117,110, 99,116,105,111,110, 32, 40,108, 41, 10, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 86,101,114, 98, + 97,116,105,109, 40,108, 46, 46, 34, 92,110, 34, 41, 10, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,114,101,116,117,114, + 110, 32, 34, 92,110, 34, 10, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 32, 32,101,110,100, 41, 10,101,110,100, 10, 10, 45, + 45, 32,116,114, 97,110,115,108, 97,116,101, 32,118,101,114, + 98, 97,116,105,109, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114, + 101, 97,109, 98,108,101, 32, 40, 41, 10, 32,111,117,116,112, + 117,116, 40, 39, 47, 42, 92,110, 39, 41, 10, 32,111,117,116, + 112,117,116, 40, 39, 42, 42, 32, 76,117, 97, 32, 98,105,110, + 100,105,110,103, 58, 32, 39, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 39, 92,110, 39, 41, 10, 32,111,117,116, + 112,117,116, 40, 39, 42, 42, 32, 71,101,110,101,114, 97,116, + 101,100, 32, 97,117,116,111,109, 97,116,105, 99, 97,108,108, + 121, 32, 98,121, 32, 39, 46, 46, 84, 79, 76, 85, 65, 95, 86, + 69, 82, 83, 73, 79, 78, 46, 46, 39, 32,111,110, 32, 39, 46, + 46,100, 97,116,101, 40, 41, 46, 46, 39, 46, 92,110, 39, 41, + 10, 32,111,117,116,112,117,116, 40, 39, 42, 47, 92,110, 92, + 110, 39, 41, 10, 10, 9,111,117,116,112,117,116, 40, 39, 35, + 105,102,110,100,101,102, 32, 95, 95, 99,112,108,117,115,112, + 108,117,115, 92,110, 39, 41, 10, 9,111,117,116,112,117,116, + 40, 39, 35,105,110, 99,108,117,100,101, 32, 34,115,116,100, + 108,105, 98, 46,104, 34, 92,110, 39, 41, 10, 9,111,117,116, + 112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, + 10, 9,111,117,116,112,117,116, 40, 39, 35,105,110, 99,108, + 117,100,101, 32, 34,115,116,114,105,110,103, 46,104, 34, 92, + 110, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39, + 35,105,110, 99,108,117,100,101, 32, 34,116,111,108,117, 97, + 43, 43, 46,104, 34, 92,110, 92,110, 39, 41, 10, 10, 32,105, + 102, 32,110,111,116, 32,102,108, 97,103,115, 46,104, 32,116, + 104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47, + 42, 32, 69,120,112,111,114,116,101,100, 32,102,117,110, 99, + 116,105,111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116, + 112,117,116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32, + 105,110,116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115, + 101,108,102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101, + 110, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116, + 111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, + 10, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119, + 104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, + 10, 32, 32,115,101,108,102, 91,105, 93, 58,112,114,101, 97, + 109, 98,108,101, 40, 41, 10, 32, 32,105, 32, 61, 32,105, 43, + 49, 10, 32,101,110,100, 10, 10, 9,105,102, 32,115,101,108, + 102, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99, + 116,105,111,110, 40, 95, 99,111,108,108,101, 99,116, 41, 32, + 116,104,101,110, 10, 9, 9,111,117,116,112,117,116, 40, 39, + 92,110, 39, 41, 10, 9, 9,111,117,116,112,117,116, 40, 39, + 47, 42, 32,102,117,110, 99,116,105,111,110, 32,116,111, 32, + 114,101,108,101, 97,115,101, 32, 99,111,108,108,101, 99,116, + 101,100, 32,111, 98,106,101, 99,116, 32,118,105, 97, 32,100, + 101,115,116,114,117, 99,116,111,114, 32, 42, 47, 39, 41, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101, + 102, 32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110, + 39, 41, 10, 9, 9,102,111,114, 32,105, 44,118, 32,105,110, + 32,112, 97,105,114,115, 40, 95, 99,111,108,108,101, 99,116, + 41, 32,100,111, 10, 9, 9, 32,111,117,116,112,117,116, 40, + 39, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 32, 39, + 46, 46,118, 46, 46, 39, 32, 40,108,117, 97, 95, 83,116, 97, + 116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10, + 9, 9, 9,111,117,116,112,117,116, 40, 39,123, 39, 41, 10, + 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, 39, 46, 46, + 105, 46, 46, 39, 42, 32,115,101,108,102, 32, 61, 32, 40, 39, + 46, 46,105, 46, 46, 39, 42, 41, 32,116,111,108,117, 97, 95, + 116,111,117,115,101,114,116,121,112,101, 40,116,111,108,117, + 97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10, 9, 9, 9, + 111,117,116,112,117,116, 40, 39, 9, 77,116,111,108,117, 97, + 95,100,101,108,101,116,101, 40,115,101,108,102, 41, 59, 39, + 41, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 9,114, + 101,116,117,114,110, 32, 48, 59, 39, 41, 10, 9, 9, 9,111, + 117,116,112,117,116, 40, 39,125, 39, 41, 10, 9, 9,101,110, + 100, 10, 9, 9,111,117,116,112,117,116, 40, 39, 35,101,110, + 100,105,102, 92,110, 92,110, 39, 41, 10, 9,101,110,100, 10, + 10, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, + 32,111,117,116,112,117,116, 40, 39, 47, 42, 32,102,117,110, + 99,116,105,111,110, 32,116,111, 32,114,101,103,105,115,116, + 101,114, 32,116,121,112,101, 32, 42, 47, 39, 41, 10, 32,111, + 117,116,112,117,116, 40, 39,115,116, 97,116,105, 99, 32,118, + 111,105,100, 32,116,111,108,117, 97, 95,114,101,103, 95,116, + 121,112,101,115, 32, 40,108,117, 97, 95, 83,116, 97,116,101, + 42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10, 32,111, + 117,116,112,117,116, 40, 39,123, 39, 41, 10, 10, 9,105,102, + 32,102,108, 97,103,115, 46,116, 32,116,104,101,110, 10, 9, + 9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101, + 102, 32, 77,116,111,108,117, 97, 95,116,121,112,101,105,100, + 92,110, 35,100,101,102,105,110,101, 32, 77,116,111,108,117, + 97, 95,116,121,112,101,105,100, 40, 76, 44, 84, 73, 44, 84, + 41, 92,110, 35,101,110,100,105,102, 92,110, 34, 41, 10, 9, + 101,110,100, 10, 9,102,111,114,101, 97, 99,104, 40, 95,117, + 115,101,114,116,121,112,101, 44,102,117,110, 99,116,105,111, + 110, 40,110, 44,118, 41, 10, 9, 9,105,102, 32, 40,110,111, + 116, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115, + 101,115, 91,118, 93, 41, 32,111,114, 32, 95,103,108,111, 98, + 97,108, 95, 99,108, 97,115,115,101,115, 91,118, 93, 58, 99, + 104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99, + 101,115,115, 40, 41, 32,116,104,101,110, 10, 9, 9, 9,111, + 117,116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,117, + 115,101,114,116,121,112,101, 40,116,111,108,117, 97, 95, 83, + 44, 34, 39, 44,118, 44, 39, 34, 41, 59, 39, 41, 10, 9, 9, + 9,105,102, 32,102,108, 97,103,115, 46,116, 32,116,104,101, + 110, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, + 77,116,111,108,117, 97, 95,116,121,112,101,105,100, 40,116, + 111,108,117, 97, 95, 83, 44,116,121,112,101,105,100, 40, 39, + 44,118, 44, 39, 41, 44, 32, 34, 39, 44,118, 44, 39, 34, 41, + 59, 39, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9,101,110, + 100, 10, 9, 32,101,110,100, 41, 10, 32,111,117,116,112,117, + 116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40, + 39, 92,110, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32,114, + 101,103,105,115,116,101,114, 32,112, 97, 99,107, 97,103,101, + 10, 45, 45, 32,119,114,105,116,101, 32,112, 97, 99,107, 97, + 103,101, 32,111,112,101,110, 32,102,117,110, 99,116,105,111, + 110, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 80, 97, 99,107, 97,103,101, 58,114,101,103,105,115,116, + 101,114, 32, 40,112,114,101, 41, 10, 32,112,114,101, 32, 61, + 32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,112,117,115, + 104, 40,115,101,108,102, 41, 10, 32,111,117,116,112,117,116, + 40,112,114,101, 46, 46, 34, 47, 42, 32, 79,112,101,110, 32, + 102,117,110, 99,116,105,111,110, 32, 42, 47, 34, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79, + 76, 85, 65, 95, 65, 80, 73, 32,105,110,116, 32,116,111,108, + 117, 97, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101, + 46, 46, 34, 95,111,112,101,110, 32, 40,108,117, 97, 95, 83, + 116, 97,116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, + 41, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, + 34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40,112,114, + 101, 46, 46, 34, 32,116,111,108,117, 97, 95,111,112,101,110, + 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111, + 117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111, + 108,117, 97, 95,114,101,103, 95,116,121,112,101,115, 40,116, + 111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111,117,116, + 112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111,108,117, + 97, 95,109,111,100,117,108,101, 40,116,111,108,117, 97, 95, + 83, 44, 78, 85, 76, 76, 44, 34, 44,115,101,108,102, 58,104, + 97,115,118, 97,114, 40, 41, 44, 34, 41, 59, 34, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116, + 111,108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108, + 101, 40,116,111,108,117, 97, 95, 83, 44, 78, 85, 76, 76, 41, + 59, 34, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, + 32,119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32, + 100,111, 10, 32, 32,115,101,108,102, 91,105, 93, 58,114,101, + 103,105,115,116,101,114, 40,112,114,101, 46, 46, 34, 32, 32, + 34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101, + 110,100, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, + 46, 34, 32,116,111,108,117, 97, 95,101,110,100,109,111,100, + 117,108,101, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, + 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, + 32,114,101,116,117,114,110, 32, 49, 59, 34, 41, 10, 32,111, + 117,116,112,117,116, 40,112,114,101, 46, 46, 34,125, 34, 41, + 10, 10, 32,111,117,116,112,117,116, 40, 34, 92,110, 92,110, + 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102, + 32,100,101,102,105,110,101,100, 40, 76, 85, 65, 95, 86, 69, + 82, 83, 73, 79, 78, 95, 78, 85, 77, 41, 32, 38, 38, 32, 76, + 85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 95, 78, 85, 77, 32, + 62, 61, 32, 53, 48, 49, 92,110, 34, 41, 59, 10, 32,111,117, + 116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79, 76, 85, + 65, 95, 65, 80, 73, 32,105,110,116, 32,108,117, 97,111,112, + 101,110, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101, + 46, 46, 34, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42, + 32,116,111,108,117, 97, 95, 83, 41, 32,123, 34, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,114, + 101,116,117,114,110, 32,116,111,108,117, 97, 95, 34, 46, 46, + 115,101,108,102, 46,110, 97,109,101, 46, 46, 34, 95,111,112, + 101,110, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, + 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34,125, + 59, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,101, + 110,100,105,102, 92,110, 92,110, 34, 41, 10, 10, 9,112,111, + 112, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,119,114,105, + 116,101, 32,104,101, 97,100,101,114, 32,102,105,108,101, 10, + 102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 80, + 97, 99,107, 97,103,101, 58,104,101, 97,100,101,114, 32, 40, + 41, 10, 32,111,117,116,112,117,116, 40, 39, 47, 42, 92,110, + 39, 41, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 76, + 117, 97, 32, 98,105,110,100,105,110,103, 58, 32, 39, 46, 46, + 115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 92,110, 39, + 41, 10, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 71, + 101,110,101,114, 97,116,101,100, 32, 97,117,116,111,109, 97, + 116,105, 99, 97,108,108,121, 32, 98,121, 32, 39, 46, 46, 84, + 79, 76, 85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 46, 46, 39, + 32,111,110, 32, 39, 46, 46,100, 97,116,101, 40, 41, 46, 46, + 39, 46, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, + 39, 42, 47, 92,110, 92,110, 39, 41, 10, 10, 32,105,102, 32, + 110,111,116, 32,102,108, 97,103,115, 46,104, 32,116,104,101, + 110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47, 42, 32, + 69,120,112,111,114,116,101,100, 32,102,117,110, 99,116,105, + 111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116,112,117, + 116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32,105,110, + 116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101,110, 32, + 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108, + 117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101, + 110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, + 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117, + 110, 99,116,105,111,110, 32, 95, 80, 97, 99,107, 97,103,101, + 32, 40,115,101,108,102, 41, 10, 32,115,101,116,109,101,116, + 97,116, 97, 98,108,101, 40,115,101,108,102, 44, 99,108, 97, + 115,115, 80, 97, 99,107, 97,103,101, 41, 10, 32,114,101,116, + 117,114,110, 32,115,101,108,102, 10,101,110,100, 10, 10, 45, + 45, 32, 80, 97,114,115,101, 32, 67, 32,104,101, 97,100,101, + 114, 32,102,105,108,101, 32,119,105,116,104, 32,116,111,108, + 117, 97, 32,100,105,114,101, 99,116,105,118,101,115, 10, 45, + 45, 32, 42, 42, 42, 32, 84,104, 97,110,107,115, 32,116,111, + 32, 65,114,105,101,108, 32, 77, 97,110,122,117,114, 32,102, + 111,114, 32,102,105,120,105,110,103, 32, 98,117,103,115, 32, + 105,110, 32,110,101,115,116,101,100, 32,100,105,114,101, 99, + 116,105,118,101,115, 32, 42, 42, 42, 10,102,117,110, 99,116, + 105,111,110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100, + 101, 40,102,110, 44,115, 41, 10, 9,108,111, 99, 97,108, 32, + 99,111,100,101, 32, 61, 32, 39, 92,110, 36, 35,105,110, 99, + 108,117,100,101, 32, 34, 39, 46, 46,102,110, 46, 46, 39, 34, + 92,110, 39, 10, 9,115, 61, 32, 34, 92,110, 34, 32, 46, 46, + 32,115, 32, 46, 46, 32, 34, 92,110, 34, 32, 45, 45, 32, 97, + 100,100, 32, 98,108, 97,110,107, 32,108,105,110,101,115, 32, + 97,115, 32,115,101,110,116,105,110,101,108,115, 10, 9,108, + 111, 99, 97,108, 32, 95, 44,101, 44, 99, 44,116, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115, 44, 32, 34, 92,110, 40, + 91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91, 79,111, 93, + 91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93, 95, 40, 91, + 94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42, 92,110, 34, + 41, 10, 9,119,104,105,108,101, 32,101, 32,100,111, 10, 9, + 9,116, 32, 61, 32,115,116,114,108,111,119,101,114, 40,116, + 41, 10, 9, 9,105,102, 32,116, 32, 61, 61, 32, 34, 98,101, + 103,105,110, 34, 32,116,104,101,110, 10, 9, 9, 9, 95, 44, + 101, 44, 99, 32, 61, 32,115,116,114,102,105,110,100, 40,115, + 44, 34, 40, 46, 45, 41, 92,110, 91, 94, 92,110, 93, 42, 91, + 84,116, 93, 91, 79,111, 93, 91, 76,108, 93, 91, 85,117, 93, + 91, 65, 97, 93, 95, 91, 69,101, 93, 91, 78,110, 93, 91, 68, + 100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44,101, 41, 10, + 9, 9, 9,105,102, 32,110,111,116, 32,101, 32,116,104,101, + 110, 10, 9, 9, 9, 32,116,111,108,117, 97, 95,101,114,114, + 111,114, 40, 34, 85,110, 98, 97,108, 97,110, 99,101,100, 32, + 39,116,111,108,117, 97, 95, 98,101,103,105,110, 39, 32,100, + 105,114,101, 99,116,105,118,101, 32,105,110, 32,104,101, 97, + 100,101,114, 32,102,105,108,101, 34, 41, 10, 9, 9, 9,101, + 110,100, 10, 9, 9,101,110,100, 10, 9, 9, 99,111,100,101, + 32, 61, 32, 99,111,100,101, 32, 46, 46, 32, 99, 32, 46, 46, + 32, 34, 92,110, 34, 10, 9, 32, 95, 44,101, 44, 99, 44,116, + 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32, 34, + 92,110, 40, 91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91, + 79,111, 93, 91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93, + 95, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42, + 92,110, 34, 44,101, 41, 10, 9,101,110,100, 10, 9,114,101, + 116,117,114,110, 32, 99,111,100,101, 10,101,110,100, 10, 10, + 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10, + 45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,101, 32, + 112, 97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,116, + 104,101, 32,102,105,108,101, 32,101,120,116,101,110,115,105, + 111,110, 44, 32, 97,110,100, 32,116,104,101, 32,102,105,108, + 101, 32,116,101,120,116, 46, 10,102,117,110, 99,116,105,111, + 110, 32, 80, 97, 99,107, 97,103,101, 32, 40,110, 97,109,101, + 44,102,110, 41, 10, 32,108,111, 99, 97,108, 32,101,120,116, + 32, 61, 32, 34,112,107,103, 34, 10, 10, 32, 45, 45, 32,111, + 112,101,110, 32,105,110,112,117,116, 32,102,105,108,101, 44, + 32,105,102, 32, 97,110,121, 10, 32,108,111, 99, 97,108, 32, + 115,116, 44,109,115,103, 10, 32,105,102, 32,102,110, 32,116, + 104,101,110, 10, 32, 32,115,116, 44, 32,109,115,103, 32, 61, + 32,114,101, 97,100,102,114,111,109, 40,102,108, 97,103,115, + 46,102, 41, 10, 32, 32,105,102, 32,110,111,116, 32,115,116, + 32,116,104,101,110, 10, 32, 32, 32,101,114,114,111,114, 40, + 39, 35, 39, 46, 46,109,115,103, 41, 10, 32, 32,101,110,100, + 10, 32, 32,108,111, 99, 97,108, 32, 95, 59, 32, 95, 44, 32, + 95, 44, 32,101,120,116, 32, 61, 32,115,116,114,102,105,110, + 100, 40,102,110, 44, 34, 46, 42, 37, 46, 40, 46, 42, 41, 36, + 34, 41, 10, 32,101,110,100, 10, 32,108,111, 99, 97,108, 32, + 99,111,100,101, 10, 32,105,102, 32,101,120,116, 32, 61, 61, + 32, 39,112,107,103, 39, 32,116,104,101,110, 10, 32, 32, 99, + 111,100,101, 32, 61, 32,112,114,101,112, 40,115,116, 41, 10, + 32,101,108,115,101, 10, 32, 32, 99,111,100,101, 32, 61, 32, + 34, 92,110, 34, 32, 46, 46, 32,114,101, 97,100, 40, 39, 42, + 97, 39, 41, 10, 32, 32,105,102, 32,101,120,116, 32, 61, 61, + 32, 39,104, 39, 32,111,114, 32,101,120,116, 32, 61, 61, 32, + 39,104,112,112, 39, 32,116,104,101,110, 10, 32, 32, 32, 99, + 111,100,101, 32, 61, 32,101,120,116,114, 97, 99,116, 95, 99, + 111,100,101, 40,102,110, 44, 99,111,100,101, 41, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99, + 108,111,115,101, 32,102,105,108,101, 10, 32,105,102, 32,102, + 110, 32,116,104,101,110, 10, 32, 32,114,101, 97,100,102,114, + 111,109, 40, 41, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, + 100,101, 97,108, 32,119,105,116,104, 32,105,110, 99,108,117, + 100,101, 32,100,105,114,101, 99,116,105,118,101, 10, 32,108, + 111, 99, 97,108, 32,110,115,117, 98,115,116, 10, 32,114,101, + 112,101, 97,116, 10, 32, 32, 99,111,100,101, 44,110,115,117, + 98,115,116, 32, 61, 32,103,115,117, 98, 40, 99,111,100,101, + 44, 39, 92,110, 37,115, 42, 37, 36, 40, 46, 41,102,105,108, + 101, 37,115, 42, 34, 40, 46, 45, 41, 34, 40, 91, 94, 92,110, + 93, 42, 41, 92,110, 39, 44, 10, 9, 9,102,117,110, 99,116, + 105,111,110, 32, 40,107,105,110,100, 44,102,110, 44,101,120, + 116,114, 97, 41, 10, 9, 9, 9,108,111, 99, 97,108, 32, 95, + 44, 32, 95, 44, 32,101,120,116, 32, 61, 32,115,116,114,102, + 105,110,100, 40,102,110, 44, 34, 46, 42, 37, 46, 40, 46, 42, + 41, 36, 34, 41, 10, 9, 9, 9,108,111, 99, 97,108, 32,102, + 112, 44,109,115,103, 32, 61, 32,111,112,101,110,102,105,108, + 101, 40,102,110, 44, 39,114, 39, 41, 10, 9, 9, 9,105,102, + 32,110,111,116, 32,102,112, 32,116,104,101,110, 10, 9, 9, + 9, 9,101,114,114,111,114, 40, 39, 35, 39, 46, 46,109,115, + 103, 46, 46, 39, 58, 32, 39, 46, 46,102,110, 41, 10, 9, 9, + 9,101,110,100, 10, 9, 9, 9,105,102, 32,107,105,110,100, + 32, 61, 61, 32, 39,112, 39, 32,116,104,101,110, 10, 9, 9, + 9, 9,108,111, 99, 97,108, 32,115, 32, 61, 32,112,114,101, + 112, 40,102,112, 41, 10, 9, 9, 9, 9, 99,108,111,115,101, + 102,105,108,101, 40,102,112, 41, 10, 9, 9, 9, 9,114,101, + 116,117,114,110, 32,115, 10, 9, 9, 9,101,110,100, 10, 9, + 9, 9,108,111, 99, 97,108, 32,115, 32, 61, 32,114,101, 97, + 100, 40,102,112, 44, 39, 42, 97, 39, 41, 10, 9, 9, 9, 99, + 108,111,115,101,102,105,108,101, 40,102,112, 41, 10, 9, 9, + 9,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39, 99, 39, + 32,111,114, 32,107,105,110,100, 32, 61, 61, 32, 39,104, 39, + 32,116,104,101,110, 10, 9, 9, 9, 9,114,101,116,117,114, + 110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100,101, 40, + 102,110, 44,115, 41, 10, 9, 9, 9,101,108,115,101,105,102, + 32,107,105,110,100, 32, 61, 61, 32, 39,108, 39, 32,116,104, + 101,110, 10, 9, 9, 9, 9,114,101,116,117,114,110, 32, 34, + 92,110, 36, 91, 45, 45, 35, 35, 34, 46, 46,102,110, 46, 46, + 34, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34, 92, + 110, 36, 93, 92,110, 34, 10, 9, 9, 9,101,108,115,101,105, + 102, 32,107,105,110,100, 32, 61, 61, 32, 39,105, 39, 32,116, + 104,101,110, 10, 9, 9, 9, 9,108,111, 99, 97,108, 32,116, + 32, 61, 32,123, 99,111,100,101, 61,115,125, 10, 9, 9, 9, + 9,101,120,116,114, 97, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,101,120,116,114, 97, 44, 32, 34, 94, + 37,115, 42, 44, 37,115, 42, 34, 44, 32, 34, 34, 41, 10, 9, + 9, 9, 9,108,111, 99, 97,108, 32,112, 97,114,115, 32, 61, + 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, + 40,101,120,116,114, 97, 44, 32, 34, 44, 34, 41, 10, 9, 9, + 9, 9,105,110, 99,108,117,100,101, 95,102,105,108,101, 95, + 104,111,111,107, 40,116, 44, 32,102,110, 44, 32,117,110,112, + 97, 99,107, 40,112, 97,114,115, 41, 41, 10, 9, 9, 9, 9, + 114,101,116,117,114,110, 32, 34, 92,110, 92,110, 34, 32, 46, + 46, 32,116, 46, 99,111,100,101, 10, 9, 9, 9,101,108,115, + 101, 10, 9, 9, 9, 9,101,114,114,111,114, 40, 39, 35, 73, + 110,118, 97,108,105,100, 32,105,110, 99,108,117,100,101, 32, + 100,105,114,101, 99,116,105,118,101, 32, 40,117,115,101, 32, + 36, 99,102,105,108,101, 44, 32, 36,112,102,105,108,101, 44, + 32, 36,108,102,105,108,101, 32,111,114, 32, 36,105,102,105, + 108,101, 41, 39, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, + 101,110,100, 41, 10, 32,117,110,116,105,108, 32,110,115,117, + 98,115,116, 61, 61, 48, 10, 10, 32, 45, 45, 32,100,101, 97, + 108, 32,119,105,116,104, 32,114,101,110, 97,109,105,110,103, + 32,100,105,114,101, 99,116,105,118,101, 10, 32,114,101,112, + 101, 97,116, 32, 45, 45, 32, 73, 32,100,111,110, 39,116, 32, + 107,110,111,119, 32,119,104,121, 32,116,104,105,115, 32,105, + 115, 32,110,101, 99,101,115, 97,114,121, 10, 9, 99,111,100, + 101, 44,110,115,117, 98,115,116, 32, 61, 32,103,115,117, 98, + 40, 99,111,100,101, 44, 39, 92,110, 37,115, 42, 37, 36,114, + 101,110, 97,109,105,110,103, 37,115, 42, 40, 46, 45, 41, 37, + 115, 42, 92,110, 39, 44, 32,102,117,110, 99,116,105,111,110, + 32, 40,114, 41, 32, 97,112,112,101,110,100,114,101,110, 97, + 109,105,110,103, 40,114, 41, 32,114,101,116,117,114,110, 32, + 34, 92,110, 34, 32,101,110,100, 41, 10, 32,117,110,116,105, + 108, 32,110,115,117, 98,115,116, 32, 61, 61, 32, 48, 10, 10, + 32,108,111, 99, 97,108, 32,116, 32, 61, 32, 95, 80, 97, 99, + 107, 97,103,101, 40, 95, 67,111,110,116, 97,105,110,101,114, + 123,110, 97,109,101, 61,110, 97,109,101, 44, 32, 99,111,100, + 101, 61, 99,111,100,101,125, 41, 10, 32,112,117,115,104, 40, + 116, 41, 10, 32,112,114,101,112,114,111, 99,101,115,115, 95, + 104,111,111,107, 40,116, 41, 10, 32,116, 58,112,114,101,112, + 114,111, 99,101,115,115, 40, 41, 10, 32,112,114,101,112, 97, + 114,115,101, 95,104,111,111,107, 40,116, 41, 10, 32,116, 58, + 112, 97,114,115,101, 40,116, 46, 99,111,100,101, 41, 10, 32, + 112,111,112, 40, 41, 10, 32,114,101,116,117,114,110, 32,116, + 10,101,110,100, 10, 10, 10,115,101,116,109,101,116, 97,116, + 97, 98,108,101, 40, 95,101,120,116,114, 97, 95,112, 97,114, + 97,109,101,116,101,114,115, 44, 32,123, 32, 95, 95,105,110, + 100,101,120, 32, 61, 32, 95, 71, 32,125, 41, 10, 10,102,117, + 110, 99,116,105,111,110, 32,112,114,101,112, 40,102,105,108, + 101, 41, 10, 10, 32, 32,108,111, 99, 97,108, 32, 99,104,117, + 110,107, 32, 61, 32,123, 39,108,111, 99, 97,108, 32, 95, 95, + 114,101,116, 32, 61, 32,123, 34, 92, 92,110, 34,125, 92,110, + 39,125, 10, 32, 32,102,111,114, 32,108,105,110,101, 32,105, + 110, 32,102,105,108,101, 58,108,105,110,101,115, 40, 41, 32, + 100,111, 10, 32, 32, 32, 32, 32,105,102, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,108,105,110,101, 44, 32, 34, + 94, 35, 35, 34, 41, 32,116,104,101,110, 10, 32, 32, 32, 32, + 32, 32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, + 99,104,117,110,107, 44, 32,115,116,114,105,110,103, 46,115, + 117, 98, 40,108,105,110,101, 44, 32, 51, 41, 32, 46, 46, 32, + 34, 92,110, 34, 41, 10, 32, 32, 32, 32, 32,101,108,115,101, + 10, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,108, 97, + 115,116, 32, 61, 32, 49, 10, 32, 32, 32, 32, 32, 32,102,111, + 114, 32,116,101,120,116, 44, 32,101,120,112,114, 44, 32,105, + 110,100,101,120, 32,105,110, 32,115,116,114,105,110,103, 46, + 103,102,105,110,100, 40,108,105,110,101, 44, 32, 34, 40, 46, + 45, 41, 36, 40, 37, 98, 40, 41, 41, 40, 41, 34, 41, 32,100, + 111, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32,108, 97,115,116, + 32, 61, 32,105,110,100,101,120, 10, 32, 32, 32, 32, 32, 32, + 32, 32,105,102, 32,116,101,120,116, 32,126, 61, 32, 34, 34, + 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 99, + 104,117,110,107, 44, 32,115,116,114,105,110,103, 46,102,111, + 114,109, 97,116, 40, 39,116, 97, 98,108,101, 46,105,110,115, + 101,114,116, 40, 95, 95,114,101,116, 44, 32, 37,113, 32, 41, + 39, 44, 32,116,101,120,116, 41, 41, 10, 32, 32, 32, 32, 32, + 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, + 116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 99,104, + 117,110,107, 44, 32,115,116,114,105,110,103, 46,102,111,114, + 109, 97,116, 40, 39,116, 97, 98,108,101, 46,105,110,115,101, + 114,116, 40, 95, 95,114,101,116, 44, 32, 37,115, 32, 41, 39, + 44, 32,101,120,112,114, 41, 41, 10, 32, 32, 32, 32, 32, 32, + 101,110,100, 10, 32, 32, 32, 32, 32, 32,116, 97, 98,108,101, + 46,105,110,115,101,114,116, 40, 99,104,117,110,107, 44, 32, + 115,116,114,105,110,103, 46,102,111,114,109, 97,116, 40, 39, + 116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 95, 95, + 114,101,116, 44, 32, 37,113, 41, 92,110, 39, 44, 10, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32,115,116,114,105,110,103, + 46,115,117, 98, 40,108,105,110,101, 44, 32,108, 97,115,116, + 41, 46, 46, 34, 92,110, 34, 41, 41, 10, 32, 32, 32, 32,101, + 110,100, 10, 32, 32,101,110,100, 10, 32, 32,116, 97, 98,108, + 101, 46,105,110,115,101,114,116, 40, 99,104,117,110,107, 44, + 32, 39, 92,110,114,101,116,117,114,110, 32,116, 97, 98,108, + 101, 46, 99,111,110, 99, 97,116, 40, 95, 95,114,101,116, 41, + 92,110, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44, + 101, 32, 61, 32,108,111, 97,100,115,116,114,105,110,103, 40, + 116, 97, 98,108,101, 46, 99,111,110, 99, 97,116, 40, 99,104, + 117,110,107, 41, 41, 10, 32, 32,105,102, 32,101, 32,116,104, + 101,110, 10, 32, 32, 9,101,114,114,111,114, 40, 34, 35, 34, + 46, 46,101, 41, 10, 32, 32,101,110,100, 10, 32, 32,115,101, + 116,102,101,110,118, 40,102, 44, 32, 95,101,120,116,114, 97, + 95,112, 97,114, 97,109,101,116,101,114,115, 41, 10, 32, 32, + 114,101,116,117,114,110, 32,102, 40, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/package.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,109,111,100,117,108, + 101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116, + 116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, + 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, + 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74, + 117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, + 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100, + 101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, + 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101, + 100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97, + 110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, + 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97, + 114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114, + 101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, + 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, + 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116, + 104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105, + 103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105, + 100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, + 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116, + 101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109, + 101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, + 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, 32, + 77,111,100,117,108,101, 32, 99,108, 97,115,115, 10, 45, 45, + 32, 82,101,112,114,101,115,101,110,116,115, 32,109,111,100, + 117,108,101, 46, 10, 45, 45, 32, 84,104,101, 32,102,111,108, + 108,111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97, + 114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32, + 32, 32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102, + 32,111, 98,106,101, 99,116,115, 32,105,110, 32,116,104,101, + 32,109,111,100,117,108,101, 46, 10, 99,108, 97,115,115, 77, + 111,100,117,108,101, 32, 61, 32,123, 10, 32, 99,108, 97,115, + 115,116,121,112,101, 32, 61, 32, 39,109,111,100,117,108,101, + 39, 10,125, 10, 99,108, 97,115,115, 77,111,100,117,108,101, + 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115, + 115, 77,111,100,117,108,101, 10,115,101,116,109,101,116, 97, + 116, 97, 98,108,101, 40, 99,108, 97,115,115, 77,111,100,117, + 108,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105,110, + 101,114, 41, 10, 10, 45, 45, 32,114,101,103,105,115,116,101, + 114, 32,109,111,100,117,108,101, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58, + 114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41, 10, + 32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39, + 39, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111, + 108,117, 97, 95,109,111,100,117,108,101, 40,116,111,108,117, + 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,110, 97, + 109,101, 46, 46, 39, 34, 44, 39, 44,115,101,108,102, 58,104, + 97,115,118, 97,114, 40, 41, 44, 39, 41, 59, 39, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111, + 108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108,101, + 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41, + 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104, + 105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, + 32, 32,115,101,108,102, 91,105, 93, 58,114,101,103,105,115, + 116,101,114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32, + 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111, + 108,117, 97, 95,101,110,100,109,111,100,117,108,101, 40,116, + 111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 9,112,111,112, + 40, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110, + 116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58, + 112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108, + 111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 77,111,100,117,108,101,123, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 34, 39, 59, 34, 41, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108, + 101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32, + 115,101,108,102, 91,105, 93, 58,112,114,105,110,116, 40,105, + 100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34, 41, 10, + 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10, + 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111, + 110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116, + 105,111,110, 32, 95, 77,111,100,117,108,101, 32, 40,116, 41, + 10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, + 116, 44, 99,108, 97,115,115, 77,111,100,117,108,101, 41, 10, + 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116, + 117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67, + 111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69, + 120,112,101, 99,116,115, 32,116,119,111, 32,115,116,114,105, + 110,103, 32,114,101,112,114,101,115,101,110,116,105,110,103, + 32,116,104,101, 32,109,111,100,117,108,101, 32,110, 97,109, + 101, 32, 97,110,100, 32, 98,111,100,121, 46, 10,102,117,110, + 99,116,105,111,110, 32, 77,111,100,117,108,101, 32, 40,110, + 44, 98, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, + 95, 77,111,100,117,108,101, 40, 95, 67,111,110,116, 97,105, + 110,101,114,123,110, 97,109,101, 61,110,125, 41, 10, 32,112, + 117,115,104, 40,116, 41, 10, 32,116, 58,112, 97,114,115,101, + 40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115,116,114, + 108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101, + 108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99,101,115, + 10, 32,112,111,112, 40, 41, 10, 32,114,101,116,117,114,110, + 32,116, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/module.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,110, 97,109,101,115, + 112, 97, 99,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87, + 114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101, + 109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, + 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, + 45, 32, 74,117,108, 32, 50, 48, 48, 51, 10, 45, 45, 32, 36, + 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, + 99,111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111, + 102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, + 32,114,101,100,105,115,116,114,105, 98,117,116,101, 32,105, + 116, 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, + 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102, + 116,119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32, + 104,101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, + 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115, + 105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, + 97,117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, + 98,108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114, + 111,118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, + 99,101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112, + 100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, + 99,101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100, + 105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, + 45, 32, 78, 97,109,101,115,112, 97, 99,101, 32, 99,108, 97, + 115,115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116, + 115, 32, 97, 32,110, 97,109,101,115, 97,112, 99,101, 32,100, + 101,102,105,110,105,116,105,111,110, 46, 10, 45, 45, 32, 83, + 116,111,114,101,115, 32,116,104,101, 32,102,111,108,108,111, + 119,105,110,103, 32,102,105,101,108,100,115, 58, 10, 45, 45, + 32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,108, 97,115, + 115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32, 32,123,105, + 125, 32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101, + 109, 98,101,114,115, 10, 99,108, 97,115,115, 78, 97,109,101, + 115,112, 97, 99,101, 32, 61, 32,123, 10, 32, 99,108, 97,115, + 115,116,121,112,101, 32, 61, 32, 39,110, 97,109,101,115,112, + 97, 99,101, 39, 44, 10, 32,110, 97,109,101, 32, 61, 32, 39, + 39, 44, 10,125, 10, 99,108, 97,115,115, 78, 97,109,101,115, + 112, 97, 99,101, 46, 95, 95,105,110,100,101,120, 32, 61, 32, + 99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 10, + 115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, + 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 44, 99,108, + 97,115,115, 77,111,100,117,108,101, 41, 10, 10, 45, 45, 32, + 80,114,105,110,116, 32,109,101,116,104,111,100, 10,102,117, + 110, 99,116,105,111,110, 32, 99,108, 97,115,115, 78, 97,109, + 101,115,112, 97, 99,101, 58,112,114,105,110,116, 32, 40,105, + 100,101,110,116, 44, 99,108,111,115,101, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 78, 97,109, + 101,115,112, 97, 99,101,123, 34, 41, 10, 32,112,114,105,110, + 116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, + 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109, + 101, 46, 46, 34, 39, 44, 34, 41, 10, 32,108,111, 99, 97,108, + 32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108, + 102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91, + 105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, 61, + 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,110, + 116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99, + 108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 73, + 110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117, + 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95, + 78, 97,109,101,115,112, 97, 99,101, 32, 40,116, 41, 10, 32, + 115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, + 99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 41, + 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101, + 116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, + 67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, + 69,120,112,101, 99,116,115, 32,116,104,101, 32,110, 97,109, + 101, 32, 97,110,100, 32,116,104,101, 32, 98,111,100,121, 32, + 111,102, 32,116,104,101, 32,110, 97,109,101,115,112, 97, 99, + 101, 46, 10,102,117,110, 99,116,105,111,110, 32, 78, 97,109, + 101,115,112, 97, 99,101, 32, 40,110, 44, 98, 41, 10, 32,108, + 111, 99, 97,108, 32, 99, 32, 61, 32, 95, 78, 97,109,101,115, + 112, 97, 99,101, 40, 95, 67,111,110,116, 97,105,110,101,114, + 123,110, 97,109,101, 61,110,125, 41, 10, 32,112,117,115,104, + 40, 99, 41, 10, 32, 99, 58,112, 97,114,115,101, 40,115,116, + 114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,108,101,110, + 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,108,105,109, + 105,110, 97,116,101, 32, 98,114, 97, 99,101,115, 10, 32,112, + 111,112, 40, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/namespace.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,100,101,102,105,110, + 101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116, + 116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, + 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, + 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74, + 117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, + 32,100,101,102,105,110,101, 46,108,117, 97, 44,118, 32, 49, + 46, 50, 32, 49, 57, 57, 57, 47, 48, 55, 47, 50, 56, 32, 50, + 50, 58, 50, 49, 58, 48, 56, 32, 99,101,108,101,115, 32, 69, + 120,112, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99, + 111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102, + 116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32, + 114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, + 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32, + 105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116, + 119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104, + 101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, + 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105, + 115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97, + 117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98, + 108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111, + 118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99, + 101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, + 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99, + 101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105, + 102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, + 32, 68,101,102,105,110,101, 32, 99,108, 97,115,115, 10, 45, + 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97, 32, + 110,117,109,101,114,105, 99, 32, 99,111,110,115,116, 32,100, + 101,102,105,110,105,116,105,111,110, 10, 45, 45, 32, 84,104, + 101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,108, + 100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, + 45, 45, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,111,110, + 115,116, 97,110,116, 32,110, 97,109,101, 10, 99,108, 97,115, + 115, 68,101,102,105,110,101, 32, 61, 32,123, 10, 32,110, 97, + 109,101, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97,115, + 115, 68,101,102,105,110,101, 46, 95, 95,105,110,100,101,120, + 32, 61, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 10, + 115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, + 97,115,115, 68,101,102,105,110,101, 44, 99,108, 97,115,115, + 70,101, 97,116,117,114,101, 41, 10, 10, 45, 45, 32,114,101, + 103,105,115,116,101,114, 32,100,101,102,105,110,101, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, + 102,105,110,101, 58,114,101,103,105,115,116,101,114, 32, 40, + 112,114,101, 41, 10, 9,105,102, 32,110,111,116, 32,115,101, + 108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, + 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10, + 9, 9,114,101,116,117,114,110, 10, 9,101,110,100, 10, 10, + 32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39, + 39, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, + 39,116,111,108,117, 97, 95, 99,111,110,115,116, 97,110,116, + 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101, + 108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46, + 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 41, 59, + 39, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110, + 116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 58, + 112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108, + 111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 68,101,102,105,110,101,123, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10, + 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99, + 111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99, + 116,105,111,110, 32, 95, 68,101,102,105,110,101, 32, 40,116, + 41, 10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, + 40,116, 44, 99,108, 97,115,115, 68,101,102,105,110,101, 41, + 10, 32,116, 58, 98,117,105,108,100,110, 97,109,101,115, 40, + 41, 10, 10, 32,105,102, 32,116, 46,110, 97,109,101, 32, 61, + 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,101,114,114, + 111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,100,101, + 102,105,110,101, 34, 41, 10, 32,101,110,100, 10, 10, 32, 97, + 112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114, + 110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110, + 115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112, + 101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114, + 101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101, + 32, 99,111,110,115,116, 97,110,116, 32,110, 97,109,101, 10, + 102,117,110, 99,116,105,111,110, 32, 68,101,102,105,110,101, + 32, 40,110, 41, 10, 32,114,101,116,117,114,110, 32, 95, 68, + 101,102,105,110,101,123, 10, 32, 32,110, 97,109,101, 32, 61, + 32,110, 10, 32,125, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/define.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,101,110,117,109,101, + 114, 97,116,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87, + 114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101, + 109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, + 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, + 45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, + 73,100, 58, 32,101,110,117,109,101,114, 97,116,101, 46,108, + 117, 97, 44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48, + 49, 47, 50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 53, 32, 99, + 101,108,101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32, + 84,104,105,115, 32, 99,111,100,101, 32,105,115, 32,102,114, + 101,101, 32,115,111,102,116,119, 97,114,101, 59, 32,121,111, + 117, 32, 99, 97,110, 32,114,101,100,105,115,116,114,105, 98, + 117,116,101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109, + 111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104, + 101, 32,115,111,102,116,119, 97,114,101, 32,112,114,111,118, + 105,100,101,100, 32,104,101,114,101,117,110,100,101,114, 32, + 105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, + 34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, + 32,116,104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, + 32,110,111, 32,111, 98,108,105,103, 97,116,105,111,110, 32, + 116,111, 32,112,114,111,118,105,100,101, 32,109, 97,105,110, + 116,101,110, 97,110, 99,101, 44, 32,115,117,112,112,111,114, + 116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32, + 101,110,104, 97,110, 99,101,109,101,110,116,115, 44, 32,111, + 114, 32,109,111,100,105,102,105, 99, 97,116,105,111,110,115, + 46, 10, 10, 10, 45, 45, 32, 69,110,117,109,101,114, 97,116, + 101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114, + 101,115,101,110,116,115, 32,101,110,117,109,101,114, 97,116, + 105,111,110, 10, 45, 45, 32, 84,104,101, 32,102,111,108,108, + 111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97,114, + 101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32, 32, + 32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102, 32, + 99,111,110,115,116, 97,110,116, 32,110, 97,109,101,115, 10, + 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 32, + 61, 32,123, 10,125, 10, 99,108, 97,115,115, 69,110,117,109, + 101,114, 97,116,101, 46, 95, 95,105,110,100,101,120, 32, 61, + 32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, + 10,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99, + 108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 44, 99, + 108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45, + 45, 32,114,101,103,105,115,116,101,114, 32,101,110,117,109, + 101,114, 97,116,105,111,110, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116, + 101, 58,114,101,103,105,115,116,101,114, 32, 40,112,114,101, + 41, 10, 9,105,102, 32,110,111,116, 32,115,101,108,102, 58, + 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, + 99,101,115,115, 40, 41, 32,116,104,101,110, 10, 9, 9,114, + 101,116,117,114,110, 10, 9,101,110,100, 10, 32,112,114,101, + 32, 61, 32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,108, + 111, 99, 97,108, 32,110,115,112, 97, 99,101, 32, 61, 32,103, + 101,116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114, + 114, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, + 119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100, + 111, 10, 32, 9,105,102, 32,115,101,108,102, 46,108,110, 97, + 109,101,115, 91,105, 93, 32, 97,110,100, 32,115,101,108,102, + 46,108,110, 97,109,101,115, 91,105, 93, 32,126, 61, 32, 34, + 34, 32,116,104,101,110, 10, 9, 10, 9, 9,111,117,116,112, + 117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95, + 99,111,110,115,116, 97,110,116, 40,116,111,108,117, 97, 95, + 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109, + 101,115, 91,105, 93, 46, 46, 39, 34, 44, 39, 46, 46,110,115, + 112, 97, 99,101, 46, 46,115,101,108,102, 91,105, 93, 46, 46, + 39, 41, 59, 39, 41, 10, 9,101,110,100, 10, 32, 32,105, 32, + 61, 32,105, 43, 49, 10, 32,101,110,100, 10,101,110,100, 10, + 10, 45, 45, 32, 80,114,105,110,116, 32,109,101,116,104,111, + 100, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 69,110,117,109,101,114, 97,116,101, 58,112,114,105,110, + 116, 32, 40,105,100,101,110,116, 44, 99,108,111,115,101, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 69,110,117,109,101,114, 97,116,101,123, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 110, 97,109,101, 32, 61, 32, 34, 46, 46,115,101,108,102, 46, + 110, 97,109,101, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, + 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,105, + 93, 32,100,111, 10, 32, 32,112,114,105,110,116, 40,105,100, + 101,110,116, 46, 46, 34, 32, 39, 34, 46, 46,115,101,108,102, + 91,105, 93, 46, 46, 34, 39, 40, 34, 46, 46,115,101,108,102, + 46,108,110, 97,109,101,115, 91,105, 93, 46, 46, 34, 41, 44, + 34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101, + 110,100, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101, + 110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, + 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117, + 110, 99,116,105,111,110, 32, 95, 69,110,117,109,101,114, 97, + 116,101, 32, 40,116, 44,118, 97,114,110, 97,109,101, 41, 10, + 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, + 44, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, + 41, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32, 97, + 112,112,101,110,100,101,110,117,109, 40,116, 41, 10, 9, 32, + 105,102, 32,118, 97,114,110, 97,109,101, 32, 97,110,100, 32, + 118, 97,114,110, 97,109,101, 32,126, 61, 32, 34, 34, 32,116, + 104,101,110, 10, 9, 9,105,102, 32,116, 46,110, 97,109,101, + 32,126, 61, 32, 34, 34, 32,116,104,101,110, 10, 9, 9, 9, + 86, 97,114,105, 97, 98,108,101, 40,116, 46,110, 97,109,101, + 46, 46, 34, 32, 34, 46, 46,118, 97,114,110, 97,109,101, 41, + 10, 9, 9,101,108,115,101, 10, 9, 9, 9,108,111, 99, 97, + 108, 32,110,115, 32, 61, 32,103,101,116, 99,117,114,114,110, + 97,109,101,115,112, 97, 99,101, 40, 41, 10, 9, 9, 9,119, + 97,114,110,105,110,103, 40, 34, 86, 97,114,105, 97, 98,108, + 101, 32, 34, 46, 46,110,115, 46, 46,118, 97,114,110, 97,109, + 101, 46, 46, 34, 32,111,102, 32,116,121,112,101, 32, 60, 97, + 110,111,110,121,109,111,117,115, 32,101,110,117,109, 62, 32, + 105,115, 32,100,101, 99,108, 97,114,101,100, 32, 97,115, 32, + 114,101, 97,100, 45,111,110,108,121, 34, 41, 10, 9, 9, 9, + 86, 97,114,105, 97, 98,108,101, 40, 34,116,111,108,117, 97, + 95,114,101, 97,100,111,110,108,121, 32,105,110,116, 32, 34, + 46, 46,118, 97,114,110, 97,109,101, 41, 10, 9, 9,101,110, + 100, 10, 9,101,110,100, 10, 9, 32,108,111, 99, 97,108, 32, + 112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, 9, + 32,105,102, 32,112, 97,114,101,110,116, 32,116,104,101,110, + 10, 9, 9,116, 46, 97, 99, 99,101,115,115, 32, 61, 32,112, + 97,114,101,110,116, 46, 99,117,114,114, 95,109,101,109, 98, + 101,114, 95, 97, 99, 99,101,115,115, 10, 9, 9,116, 46,103, + 108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 32, 61, 32, + 116, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95, + 97, 99, 99,101,115,115, 40, 41, 10, 9, 32,101,110,100, 10, + 114,101,116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, + 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10, 45, + 45, 32, 69,120,112,101, 99,116,115, 32, 97, 32,115,116,114, + 105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110, + 103, 32,116,104,101, 32,101,110,117,109,101,114, 97,116,101, + 32, 98,111,100,121, 10,102,117,110, 99,116,105,111,110, 32, + 69,110,117,109,101,114, 97,116,101, 32, 40,110, 44, 98, 44, + 118, 97,114,110, 97,109,101, 41, 10, 9, 98, 32, 61, 32,115, + 116,114,105,110,103, 46,103,115,117, 98, 40, 98, 44, 32, 34, + 44, 91, 37,115, 92,110, 93, 42,125, 34, 44, 32, 34, 92,110, + 125, 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116, + 101, 32,108, 97,115,116, 32, 39, 44, 39, 10, 32,108,111, 99, + 97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116, + 114,115,117, 98, 40, 98, 44, 50, 44, 45, 50, 41, 44, 39, 44, + 39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 98,114, 97, 99,101,115, 10, 32,108,111, 99, 97,108, 32, + 105, 32, 61, 32, 49, 10, 32,108,111, 99, 97,108, 32,101, 32, + 61, 32,123,110, 61, 48,125, 10, 32,119,104,105,108,101, 32, + 116, 91,105, 93, 32,100,111, 10, 32, 32,108,111, 99, 97,108, + 32,116,116, 32, 61, 32,115,112,108,105,116, 40,116, 91,105, + 93, 44, 39, 61, 39, 41, 32, 32, 45, 45, 32,100,105,115, 99, + 97,114,100, 32,105,110,105,116,105, 97,108, 32,118, 97,108, + 117,101, 10, 32, 32,101, 46,110, 32, 61, 32,101, 46,110, 32, + 43, 32, 49, 10, 32, 32,101, 91,101, 46,110, 93, 32, 61, 32, + 116,116, 91, 49, 93, 10, 32, 32,105, 32, 61, 32,105, 43, 49, + 10, 32,101,110,100, 10, 32, 45, 45, 32,115,101,116, 32,108, + 117, 97, 32,110, 97,109,101,115, 10, 32,105, 32, 32, 61, 32, + 49, 10, 32,101, 46,108,110, 97,109,101,115, 32, 61, 32,123, + 125, 10, 32,108,111, 99, 97,108, 32,110,115, 32, 61, 32,103, + 101,116, 99,117,114,114,110, 97,109,101,115,112, 97, 99,101, + 40, 41, 10, 32,119,104,105,108,101, 32,101, 91,105, 93, 32, + 100,111, 10, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, + 115,112,108,105,116, 40,101, 91,105, 93, 44, 39, 64, 39, 41, + 10, 32, 32,101, 91,105, 93, 32, 61, 32,116, 91, 49, 93, 10, + 9, 9,105,102, 32,110,111,116, 32,116, 91, 50, 93, 32,116, + 104,101,110, 10, 9, 9, 32,116, 91, 50, 93, 32, 61, 32, 97, + 112,112,108,121,114,101,110, 97,109,105,110,103, 40,116, 91, + 49, 93, 41, 10, 9, 9,101,110,100, 10, 32, 32,101, 46,108, + 110, 97,109,101,115, 91,105, 93, 32, 61, 32,116, 91, 50, 93, + 32,111,114, 32,116, 91, 49, 93, 10, 32, 32, 95,103,108,111, + 98, 97,108, 95,101,110,117,109,115, 91, 32,110,115, 46, 46, + 101, 91,105, 93, 32, 93, 32, 61, 32, 40,110,115, 46, 46,101, + 91,105, 93, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, + 32,101,110,100, 10, 9,101, 46,110, 97,109,101, 32, 61, 32, + 110, 10, 9,105,102, 32,110, 32,126, 61, 32, 34, 34, 32,116, + 104,101,110, 10, 9, 9, 84,121,112,101,100,101,102, 40, 34, + 105,110,116, 32, 34, 46, 46,110, 41, 10, 9,101,110,100, 10, + 32,114,101,116,117,114,110, 32, 95, 69,110,117,109,101,114, + 97,116,101, 40,101, 44, 32,118, 97,114,110, 97,109,101, 41, + 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/enumerate.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,100,101, 99,108, 97, + 114, 97,116,105,111,110, 32, 99,108, 97,115,115, 10, 45, 45, + 32, 87,114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108, + 100,101,109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, + 84,101, 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, + 10, 45, 45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, + 32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105, + 115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, 32, + 115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99, + 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,101, + 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,105, + 102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115, + 111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,101, + 100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, 32, + 111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, + 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104, + 101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,111, + 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, 32, + 112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,110, + 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, 32, + 117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, + 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,109, + 111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10, + 10, 45, 45, 32, 68,101, 99,108, 97,114, 97,116,105,111,110, + 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101, + 115,101,110,116,115, 32,118, 97,114,105, 97, 98,108,101, 44, + 32,102,117,110, 99,116,105,111,110, 44, 32,111,114, 32, 97, + 114,103,117,109,101,110,116, 32,100,101, 99,108, 97,114, 97, + 116,105,111,110, 46, 10, 45, 45, 32, 83,116,111,114,101,115, + 32,116,104,101, 32,102,111,108,108,111,119,105,110,103, 32, + 102,105,101,108,100,115, 58, 10, 45, 45, 32, 32,109,111,100, + 32, 32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105, + 101,114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32, + 116,121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61, + 32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102, + 32,114,101,112,114,101,115,101,110,116,105,110,103, 32, 97, + 32,112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114, + 101,102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97, + 109,101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,100, + 105,109, 32, 32, 61, 32,100,105,109,101,110,115,105,111,110, + 44, 32,105,102, 32, 97, 32,118,101, 99,116,111,114, 10, 45, + 45, 32, 32,100,101,102, 32, 32, 61, 32,100,101,102, 97,117, + 108,116, 32,118, 97,108,117,101, 44, 32,105,102, 32, 97,110, + 121, 32, 40,111,110,108,121, 32,102,111,114, 32, 97,114,103, + 117,109,101,110,116,115, 41, 10, 45, 45, 32, 32,114,101,116, + 32, 32, 61, 32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, + 32,105,102, 32,118, 97,108,117,101, 32,105,115, 32,116,111, + 32, 98,101, 32,114,101,116,117,114,110,101,100, 32, 40,111, + 110,108,121, 32,102,111,114, 32, 97,114,103,117,109,101,110, + 116,115, 41, 10, 99,108, 97,115,115, 68,101, 99,108, 97,114, + 97,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100, 32, + 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, + 39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10, 32, + 110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32,100,105,109, + 32, 61, 32, 39, 39, 44, 10, 32,114,101,116, 32, 61, 32, 39, + 39, 44, 10, 32,100,101,102, 32, 61, 32, 39, 39, 10,125, 10, + 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111, + 110, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97, + 115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 10,115, + 101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, 97, + 115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 44, 99, + 108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45, + 45, 32, 67,114,101, 97,116,101, 32, 97,110, 32,117,110,105, + 113,117,101, 32,118, 97,114,105, 97, 98,108,101, 32,110, 97, + 109,101, 10,102,117,110, 99,116,105,111,110, 32, 99,114,101, + 97,116,101, 95,118, 97,114,110, 97,109,101, 32, 40, 41, 10, + 32,105,102, 32,110,111,116, 32, 95,118, 97,114,110,117,109, + 98,101,114, 32,116,104,101,110, 32, 95,118, 97,114,110,117, + 109, 98,101,114, 32, 61, 32, 48, 32,101,110,100, 10, 32, 95, + 118, 97,114,110,117,109, 98,101,114, 32, 61, 32, 95,118, 97, + 114,110,117,109, 98,101,114, 32, 43, 32, 49, 10, 32,114,101, + 116,117,114,110, 32, 34,116,111,108,117, 97, 95,118, 97,114, + 95, 34, 46, 46, 95,118, 97,114,110,117,109, 98,101,114, 10, + 101,110,100, 10, 10, 45, 45, 32, 67,104,101, 99,107, 32,100, + 101, 99,108, 97,114, 97,116,105,111,110, 32,110, 97,109,101, + 10, 45, 45, 32, 73,116, 32, 97,108,115,111, 32,105,100,101, + 110,116,105,102,105,101,115, 32,100,101,102, 97,117,108,116, + 32,118, 97,108,117,101,115, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 58, 99,104,101, 99,107,110, 97,109,101, 32, 40, + 41, 10, 10, 32,105,102, 32,115,116,114,115,117, 98, 40,115, + 101,108,102, 46,110, 97,109,101, 44, 49, 44, 49, 41, 32, 61, + 61, 32, 39, 91, 39, 32, 97,110,100, 32,110,111,116, 32,102, + 105,110,100,116,121,112,101, 40,115,101,108,102, 46,116,121, + 112,101, 41, 32,116,104,101,110, 10, 32, 32,115,101,108,102, + 46,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,116,121, + 112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10, 32, + 32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105, + 116, 40,115,101,108,102, 46,109,111,100, 44, 39, 37,115, 37, + 115, 42, 39, 41, 10, 32, 32,115,101,108,102, 46,116,121,112, + 101, 32, 61, 32,109, 91,109, 46,110, 93, 10, 32, 32,115,101, + 108,102, 46,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, + 40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 10, 32,101,110, + 100, 10, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,115, + 112,108,105,116, 40,115,101,108,102, 46,110, 97,109,101, 44, + 39, 61, 39, 41, 10, 32,105,102, 32,116, 46,110, 61, 61, 50, + 32,116,104,101,110, 10, 32, 32,115,101,108,102, 46,110, 97, + 109,101, 32, 61, 32,116, 91, 49, 93, 10, 32, 32,115,101,108, + 102, 46,100,101,102, 32, 61, 32,102,105,110,100, 95,101,110, + 117,109, 95,118, 97,114, 40,116, 91,116, 46,110, 93, 41, 10, + 32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32, 98, 44, + 101, 44,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115, + 101,108,102, 46,110, 97,109,101, 44, 34, 37, 91, 40, 46, 45, + 41, 37, 93, 34, 41, 10, 32,105,102, 32, 98, 32,116,104,101, + 110, 10, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, + 32,115,116,114,115,117, 98, 40,115,101,108,102, 46,110, 97, + 109,101, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32,115,101,108, + 102, 46,100,105,109, 32, 61, 32,102,105,110,100, 95,101,110, + 117,109, 95,118, 97,114, 40,100, 41, 10, 32,101,110,100, 10, + 10, 10, 32,105,102, 32,115,101,108,102, 46,116,121,112,101, + 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, + 46,116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39, + 32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 32, + 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,115,101, + 108,102, 46,110, 97,109,101, 32, 61, 32, 99,114,101, 97,116, + 101, 95,118, 97,114,110, 97,109,101, 40, 41, 10, 32,101,108, + 115,101,105,102, 32,115,101,108,102, 46,107,105,110,100, 61, + 61, 39,118, 97,114, 39, 32,116,104,101,110, 10, 32, 32,105, + 102, 32,115,101,108,102, 46,116,121,112,101, 61, 61, 39, 39, + 32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101,126, + 61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,115,101,108, + 102, 46,116,121,112,101, 32, 61, 32,115,101,108,102, 46,116, + 121,112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10, + 32, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32, + 99,114,101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, + 41, 10, 32, 32,101,108,115,101,105,102, 32,102,105,110,100, + 116,121,112,101, 40,115,101,108,102, 46,110, 97,109,101, 41, + 32,116,104,101,110, 10, 32, 32, 32,105,102, 32,115,101,108, + 102, 46,116,121,112,101, 61, 61, 39, 39, 32,116,104,101,110, + 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101, + 108,102, 46,110, 97,109,101, 10, 32, 32, 32,101,108,115,101, + 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101, + 108,102, 46,116,121,112,101, 46, 46, 39, 32, 39, 46, 46,115, + 101,108,102, 46,110, 97,109,101, 32,101,110,100, 10, 32, 32, + 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32, 99,114, + 101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, 41, 10, + 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, + 32, 97,100,106,117,115,116, 32,116,121,112,101, 32,111,102, + 32,115,116,114,105,110,103, 10, 32,105,102, 32,115,101,108, + 102, 46,116,121,112,101, 32, 61, 61, 32, 39, 99,104, 97,114, + 39, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109, 32, + 126, 61, 32, 39, 39, 32,116,104,101,110, 10, 9, 32,115,101, + 108,102, 46,116,121,112,101, 32, 61, 32, 39, 99,104, 97,114, + 42, 39, 10, 32,101,110,100, 10, 10, 9,105,102, 32,115,101, + 108,102, 46,107,105,110,100, 32, 97,110,100, 32,115,101,108, + 102, 46,107,105,110,100, 32, 61, 61, 32, 39,118, 97,114, 39, + 32,116,104,101,110, 10, 9, 9,115,101,108,102, 46,110, 97, + 109,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40,115,101,108,102, 46,110, 97,109,101, 44, 32, 34, 58, + 46, 42, 36, 34, 44, 32, 34, 34, 41, 32, 45, 45, 32, 63, 63, + 63, 10, 9,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, + 67,104,101, 99,107, 32,100,101, 99,108, 97,114, 97,116,105, + 111,110, 32,116,121,112,101, 10, 45, 45, 32, 83,117, 98,115, + 116,105,116,117,116,101,115, 32,116,121,112,101,100,101,102, + 39,115, 46, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58, + 99,104,101, 99,107,116,121,112,101, 32, 40, 41, 10, 10, 32, + 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,116,104,101, + 114,101, 32,105,115, 32, 97, 32,112,111,105,110,116,101,114, + 32,116,111, 32, 98, 97,115,105, 99, 32,116,121,112,101, 10, + 32,108,111, 99, 97,108, 32, 98, 97,115,105, 99, 32, 61, 32, + 105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121, + 112,101, 41, 10, 32,105,102, 32,115,101,108,102, 46,107,105, + 110,100, 32, 61, 61, 32, 39,102,117,110, 99, 39, 32, 97,110, + 100, 32, 98, 97,115,105, 99, 61, 61, 39,110,117,109, 98,101, + 114, 39, 32, 97,110,100, 32,115,116,114,105,110,103, 46,102, + 105,110,100, 40,115,101,108,102, 46,112,116,114, 44, 32, 34, + 37, 42, 34, 41, 32,116,104,101,110, 10, 32, 9,115,101,108, + 102, 46,116,121,112,101, 32, 61, 32, 39, 95,117,115,101,114, + 100, 97,116, 97, 39, 10, 32, 9,115,101,108,102, 46,112,116, + 114, 32, 61, 32, 34, 34, 10, 32,101,110,100, 10, 32,105,102, + 32, 98, 97,115,105, 99, 32, 97,110,100, 32,115,101,108,102, + 46,112,116,114,126, 61, 39, 39, 32,116,104,101,110, 10, 32, + 32,115,101,108,102, 46,114,101,116, 32, 61, 32,115,101,108, + 102, 46,112,116,114, 10, 32, 32,115,101,108,102, 46,112,116, + 114, 32, 61, 32,110,105,108, 10, 32, 32,105,102, 32,105,115, + 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101, + 41, 32, 61, 61, 32, 39,110,117,109, 98,101,114, 39, 32,116, + 104,101,110, 10, 32, 32, 9,115,101,108,102, 46,114,101,116, + 117,114,110, 95,117,115,101,114,100, 97,116, 97, 32, 61, 32, + 116,114,117,101, 10, 32, 32,101,110,100, 10, 32,101,110,100, + 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32, + 116,104,101,114,101, 32,105,115, 32, 97,114,114, 97,121, 32, + 116,111, 32, 98,101, 32,114,101,116,117,114,110,101,100, 10, + 32,105,102, 32,115,101,108,102, 46,100,105,109,126, 61, 39, + 39, 32, 97,110,100, 32,115,101,108,102, 46,114,101,116,126, + 61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114,114, + 111,114, 40, 39, 35,105,110,118, 97,108,105,100, 32,112, 97, + 114, 97,109,101,116,101,114, 58, 32, 99, 97,110,110,111,116, + 32,114,101,116,117,114,110, 32, 97,110, 32, 97,114,114, 97, + 121, 32,111,102, 32,118, 97,108,117,101,115, 39, 41, 10, 32, + 101,110,100, 10, 32, 45, 45, 32,114,101,115,116,111,114,101, + 32, 39,118,111,105,100, 42, 39, 32, 97,110,100, 32, 39,115, + 116,114,105,110,103, 42, 39, 10, 32,105,102, 32,115,101,108, + 102, 46,116,121,112,101, 32, 61, 61, 32, 39, 95,117,115,101, + 114,100, 97,116, 97, 39, 32,116,104,101,110, 32,115,101,108, + 102, 46,116,121,112,101, 32, 61, 32, 39,118,111,105,100, 42, + 39, 10, 32,101,108,115,101,105,102, 32,115,101,108,102, 46, + 116,121,112,101, 32, 61, 61, 32, 39, 95, 99,115,116,114,105, + 110,103, 39, 32,116,104,101,110, 32,115,101,108,102, 46,116, + 121,112,101, 32, 61, 32, 39, 99,104, 97,114, 42, 39, 10, 32, + 101,108,115,101,105,102, 32,115,101,108,102, 46,116,121,112, + 101, 32, 61, 61, 32, 39, 95,108,115,116, 97,116,101, 39, 32, + 116,104,101,110, 32,115,101,108,102, 46,116,121,112,101, 32, + 61, 32, 39,108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10, + 32,101,110,100, 10, 10, 32, 45, 45, 32,114,101,115,111,108, + 118,101, 32,116,121,112,101,115, 32,105,110,115,105,100,101, + 32,116,104,101, 32,116,101,109,112,108, 97,116,101,115, 10, + 32,105,102, 32,115,101,108,102, 46,116,121,112,101, 32,116, + 104,101,110, 10, 9, 32,115,101,108,102, 46,116,121,112,101, + 32, 61, 32,114,101,115,111,108,118,101, 95,116,101,109,112, + 108, 97,116,101, 95,116,121,112,101,115, 40,115,101,108,102, + 46,116,121,112,101, 41, 10, 32,101,110,100, 10, 10, 45, 45, + 10, 45, 45, 32, 45, 45, 32,105,102, 32,114,101,116,117,114, + 110,105,110,103, 32,118, 97,108,117,101, 44, 32, 97,117,116, + 111,109, 97,116,105, 99, 97,108,108,121, 32,115,101,116, 32, + 100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 10, 45, + 45, 32,105,102, 32,115,101,108,102, 46,114,101,116, 32,126, + 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, 46,100, + 101,102, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 45, + 45, 32, 32,115,101,108,102, 46,100,101,102, 32, 61, 32, 39, + 48, 39, 10, 45, 45, 32,101,110,100, 10, 45, 45, 10, 10,101, + 110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,101, + 115,111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95, + 116,121,112,101,115, 40,116,121,112,101, 41, 10, 10, 9,105, + 102, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, 41, + 32,116,104,101,110, 10, 9, 9,114,101,116,117,114,110, 32, + 116,121,112,101, 10, 9,101,110,100, 10, 9,108,111, 99, 97, + 108, 32, 98, 44, 95, 44,109, 32, 61, 32,115,116,114,105,110, + 103, 46,102,105,110,100, 40,116,121,112,101, 44, 32, 34, 40, + 37, 98, 60, 62, 41, 34, 41, 10, 9,105,102, 32, 98, 32,116, + 104,101,110, 10, 10, 9, 9,109, 32, 61, 32,115,112,108,105, + 116, 95, 99, 95,116,111,107,101,110,115, 40,115,116,114,105, + 110,103, 46,115,117, 98, 40,109, 44, 32, 50, 44, 32, 45, 50, + 41, 44, 32, 34, 44, 34, 41, 10, 9, 9,102,111,114, 32,105, + 61, 49, 44, 32,116, 97, 98,108,101, 46,103,101,116,110, 40, + 109, 41, 32,100,111, 10, 9, 9, 9,109, 91,105, 93, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109, 91, + 105, 93, 44, 34, 37,115, 42, 40, 91, 37, 42, 38, 93, 41, 34, + 44, 32, 34, 37, 49, 34, 41, 10, 9, 9, 9,105,102, 32,110, + 111,116, 32,105,115, 98, 97,115,105, 99, 40,109, 91,105, 93, + 41, 32,116,104,101,110, 10, 9, 9, 9, 9,105,102, 32,110, + 111,116, 32,105,115,101,110,117,109, 40,109, 91,105, 93, 41, + 32,116,104,101,110, 32, 95, 44, 32,109, 91,105, 93, 32, 61, + 32, 97,112,112,108,121,116,121,112,101,100,101,102, 40, 34, + 34, 44, 32,109, 91,105, 93, 41, 32,101,110,100, 10, 9, 9, + 9, 9,109, 91,105, 93, 32, 61, 32,102,105,110,100,116,121, + 112,101, 40,109, 91,105, 93, 41, 32,111,114, 32,109, 91,105, + 93, 10, 9, 9, 9, 9,109, 91,105, 93, 32, 61, 32,114,101, + 115,111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95, + 116,121,112,101,115, 40,109, 91,105, 93, 41, 10, 9, 9, 9, + 101,110,100, 10, 9, 9,101,110,100, 10, 10, 9, 9,108,111, + 99, 97,108, 32, 98, 44,105, 10, 9, 9,116,121,112,101, 44, + 98, 44,105, 32, 61, 32, 98,114,101, 97,107, 95,116,101,109, + 112,108, 97,116,101, 40,116,121,112,101, 41, 10, 45, 45,112, + 114,105,110,116, 40, 34, 99,111,110, 99, 97,116, 32,105,115, + 32, 34, 44, 99,111,110, 99, 97,116, 40,109, 44, 32, 49, 44, + 32,109, 46,110, 41, 41, 10, 9, 9,108,111, 99, 97,108, 32, + 116,101,109,112,108, 97,116,101, 95,112, 97,114,116, 32, 61, + 32, 34, 60, 34, 46, 46, 99,111,110, 99, 97,116, 40,109, 44, + 32, 49, 44, 32,109, 46,110, 44, 32, 34, 44, 34, 41, 46, 46, + 34, 62, 34, 10, 9, 9,116,121,112,101, 32, 61, 32,114,101, + 98,117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40, + 116,121,112,101, 44, 32, 98, 44, 32,116,101,109,112,108, 97, + 116,101, 95,112, 97,114,116, 41, 10, 9, 9,116,121,112,101, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 116,121,112,101, 44, 32, 34, 62, 62, 34, 44, 32, 34, 62, 32, + 62, 34, 41, 10, 9,101,110,100, 10, 9,114,101,116,117,114, + 110, 32,116,121,112,101, 10,101,110,100, 10, 10,102,117,110, + 99,116,105,111,110, 32, 98,114,101, 97,107, 95,116,101,109, + 112,108, 97,116,101, 40,115, 41, 10, 9,108,111, 99, 97,108, + 32, 98, 44,101, 44,116,105,109,112,108, 32, 61, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 40, + 37, 98, 60, 62, 41, 34, 41, 10, 9,105,102, 32,116,105,109, + 112,108, 32,116,104,101,110, 10, 9, 9,115, 32, 61, 32,115, + 116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, + 37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 10, 9, 9,114,101, + 116,117,114,110, 32,115, 44, 32, 98, 44, 32,116,105,109,112, + 108, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114, + 110, 32,115, 44, 32, 48, 44, 32,110,105,108, 10, 9,101,110, + 100, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32,114,101, 98,117,105,108,100, 95,116,101,109,112,108, 97, + 116,101, 40,115, 44, 32, 98, 44, 32,116,105,109,112,108, 41, + 10, 10, 9,105,102, 32, 98, 32, 61, 61, 32, 48, 32,116,104, + 101,110, 10, 9, 9,114,101,116,117,114,110, 32,115, 10, 9, + 101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,115,116, + 114,105,110,103, 46,115,117, 98, 40,115, 44, 32, 49, 44, 32, + 98, 45, 49, 41, 46, 46,116,105,109,112,108, 46, 46,115,116, + 114,105,110,103, 46,115,117, 98, 40,115, 44, 32, 98, 44, 32, + 45, 49, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105, + 110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, + 97,116,105,111,110, 58,112,114,105,110,116, 32, 40,105,100, + 101,110,116, 44, 99,108,111,115,101, 41, 10, 32,112,114,105, + 110,116, 40,105,100,101,110,116, 46, 46, 34, 68,101, 99,108, + 97,114, 97,116,105,111,110,123, 34, 41, 10, 32,112,114,105, + 110,116, 40,105,100,101,110,116, 46, 46, 34, 32,109,111,100, + 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,109,111, + 100, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, + 40,105,100,101,110,116, 46, 46, 34, 32,116,121,112,101, 32, + 61, 32, 39, 34, 46, 46,115,101,108,102, 46,116,121,112,101, + 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 32,112,116,114, 32, 32, 61, + 32, 39, 34, 46, 46,115,101,108,102, 46,112,116,114, 46, 46, + 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100, + 101,110,116, 46, 46, 34, 32,110, 97,109,101, 32, 61, 32, 39, + 34, 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 34, + 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,100,105,109, 32, 32, 61, 32, 39, 34, + 46, 46,115,101,108,102, 46,100,105,109, 46, 46, 34, 39, 44, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34, 32,100,101,102, 32, 32, 61, 32, 39, 34, 46, 46, + 115,101,108,102, 46,100,101,102, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32,114,101,116, 32, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46,114,101,116, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,125, + 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10, 10, + 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32, 97,114,114, + 97,121, 32,111,102, 32,118, 97,108,117,101,115, 32, 97,114, + 101, 32,114,101,116,117,114,110,101,100, 32,116,111, 32, 76, + 117, 97, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,114, + 101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111, + 110, 32, 40,116, 41, 10, 32,105,102, 32,115,101,108,102, 46, + 109,111,100, 32,126, 61, 32, 39, 99,111,110,115,116, 39, 32, + 97,110,100, 10, 9, 32, 32, 32, 32,115,101,108,102, 46,100, + 105,109, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109, + 32,126, 61, 32, 39, 39, 32, 97,110,100, 10, 9, 9, 9, 9, + 32,110,111,116, 32,105,115, 98, 97,115,105, 99, 40,115,101, + 108,102, 46,116,121,112,101, 41, 32, 97,110,100, 10, 9, 9, + 9, 9, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, + 39, 39, 32, 97,110,100, 32,115,101,108,102, 58, 99,104,101, + 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115, + 115, 40, 41, 32,116,104,101,110, 10, 9, 9,108,111, 99, 97, + 108, 32,116,121,112,101, 32, 61, 32,103,115,117, 98, 40,115, + 101,108,102, 46,116,121,112,101, 44, 34, 37,115, 42, 99,111, + 110,115,116, 37,115, 43, 34, 44, 34, 34, 41, 10, 9, 9,116, + 91,116,121,112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, + 95, 99,111,108,108,101, 99,116, 95, 34, 32, 46, 46, 32, 99, + 108,101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,116, + 121,112,101, 41, 10, 9, 9,114,101,116,117,114,110, 32,116, + 114,117,101, 10, 9,101,110,100, 10, 9,114,101,116,117,114, + 110, 32,102, 97,108,115,101, 10,101,110,100, 10, 10, 45, 45, + 32,100,101, 99,108, 97,114,101, 32,116, 97,103, 10,102,117, + 110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99, + 108, 97,114, 97,116,105,111,110, 58,100,101, 99,108,116,121, + 112,101, 32, 40, 41, 10, 10, 9,115,101,108,102, 46,116,121, + 112,101, 32, 61, 32,116,121,112,101,118, 97,114, 40,115,101, + 108,102, 46,116,121,112,101, 41, 10, 9,105,102, 32,115,116, + 114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, + 39, 99,111,110,115,116, 39, 41, 32,116,104,101,110, 10, 9, + 9,115,101,108,102, 46,116,121,112,101, 32, 61, 32, 39, 99, + 111,110,115,116, 32, 39, 46, 46,115,101,108,102, 46,116,121, + 112,101, 10, 9, 9,115,101,108,102, 46,109,111,100, 32, 61, + 32,103,115,117, 98, 40,115,101,108,102, 46,109,111,100, 44, + 39, 99,111,110,115,116, 37,115, 42, 39, 44, 39, 39, 41, 10, + 9,101,110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32,111, + 117,116,112,117,116, 32,116,121,112,101, 32, 99,104,101, 99, + 107,105,110,103, 10,102,117,110, 99,116,105,111,110, 32, 99, + 108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, + 58,111,117,116, 99,104,101, 99,107,116,121,112,101, 32, 40, + 110, 97,114,103, 41, 10, 32,108,111, 99, 97,108, 32,100,101, + 102, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,105,115, + 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101, + 41, 10, 32,105,102, 32,115,101,108,102, 46,100,101,102,126, + 61, 39, 39, 32,116,104,101,110, 10, 32, 32,100,101,102, 32, + 61, 32, 49, 10, 32,101,108,115,101, 10, 32, 32,100,101,102, + 32, 61, 32, 48, 10, 32,101,110,100, 10, 32,105,102, 32,115, + 101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116, + 104,101,110, 10, 9, 45, 45,105,102, 32,116, 61, 61, 39,115, + 116,114,105,110,103, 39, 32,116,104,101,110, 10, 9, 45, 45, + 9,114,101,116,117,114,110, 32, 39,116,111,108,117, 97, 95, + 105,115,115,116,114,105,110,103, 97,114,114, 97,121, 40,116, + 111,108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, + 46, 39, 44, 39, 46, 46,100,101,102, 46, 46, 39, 44, 38,116, + 111,108,117, 97, 95,101,114,114, 41, 39, 10, 9, 45, 45,101, + 108,115,101, 10, 9,114,101,116,117,114,110, 32, 39, 33,116, + 111,108,117, 97, 95,105,115,116, 97, 98,108,101, 40,116,111, + 108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, + 39, 44, 48, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, + 39, 10, 32, 9, 45, 45,101,110,100, 10, 32,101,108,115,101, + 105,102, 32,116, 32,116,104,101,110, 10, 9,114,101,116,117, + 114,110, 32, 39, 33,116,111,108,117, 97, 95,105,115, 39, 46, + 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 39, + 46, 46,110, 97,114,103, 46, 46, 39, 44, 39, 46, 46,100,101, + 102, 46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114,114, + 41, 39, 10, 32,101,108,115,101, 10, 32, 32,108,111, 99, 97, + 108, 32,105,115, 95,102,117,110, 99, 32, 61, 32,103,101,116, + 95,105,115, 95,102,117,110, 99,116,105,111,110, 40,115,101, + 108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102, 32,115, + 101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39, 32, + 111,114, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, + 39, 39, 32,116,104,101,110, 10, 32, 32, 9,114,101,116,117, + 114,110, 32, 39, 40,116,111,108,117, 97, 95,105,115,118, 97, + 108,117,101,110,105,108, 40,116,111,108,117, 97, 95, 83, 44, + 39, 46, 46,110, 97,114,103, 46, 46, 39, 44, 38,116,111,108, + 117, 97, 95,101,114,114, 41, 32,124,124, 32, 33, 39, 46, 46, + 105,115, 95,102,117,110, 99, 46, 46, 39, 40,116,111,108,117, + 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39, 44, + 34, 39, 46, 46,115,101,108,102, 46,116,121,112,101, 46, 46, + 39, 34, 44, 39, 46, 46,100,101,102, 46, 46, 39, 44, 38,116, + 111,108,117, 97, 95,101,114,114, 41, 41, 39, 10, 32, 32,101, + 108,115,101, 10, 9,114,101,116,117,114,110, 32, 39, 33, 39, + 46, 46,105,115, 95,102,117,110, 99, 46, 46, 39, 40,116,111, + 108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, + 39, 44, 34, 39, 46, 46,115,101,108,102, 46,116,121,112,101, + 46, 46, 39, 34, 44, 39, 46, 46,100,101,102, 46, 46, 39, 44, + 38,116,111,108,117, 97, 95,101,114,114, 41, 39, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10,101,110,100, 10, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, + 99,108, 97,114, 97,116,105,111,110, 58, 98,117,105,108,100, + 100,101, 99,108, 97,114, 97,116,105,111,110, 32, 40,110, 97, + 114,103, 44, 32, 99,112,108,117,115,112,108,117,115, 41, 10, + 32,108,111, 99, 97,108, 32, 97,114,114, 97,121, 32, 61, 32, + 115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32, + 97,110,100, 32,116,111,110,117,109, 98,101,114, 40,115,101, + 108,102, 46,100,105,109, 41, 61, 61,110,105,108, 10, 9,108, + 111, 99, 97,108, 32,108,105,110,101, 32, 61, 32, 34, 34, 10, + 32,108,111, 99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, + 10, 32,108,111, 99, 97,108, 32,109,111,100, 10, 32,108,111, + 99, 97,108, 32,116,121,112,101, 32, 61, 32,115,101,108,102, + 46,116,121,112,101, 10, 32,108,111, 99, 97,108, 32,110, 99, + 116,121,112,101, 32, 61, 32,103,115,117, 98, 40,115,101,108, + 102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 37,115, + 43, 39, 44, 39, 39, 41, 10, 32,105,102, 32,115,101,108,102, + 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110, + 10, 9, 32,116,121,112,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46,116,121,112,101, 44, 39, 99,111,110,115, + 116, 37,115, 43, 39, 44, 39, 39, 41, 32, 32, 45, 45, 32,101, + 108,105,109,105,110, 97,116,101,115, 32, 99,111,110,115,116, + 32,109,111,100,105,102,105,101,114, 32,102,111,114, 32, 97, + 114,114, 97,121,115, 10, 32,101,110,100, 10, 32,105,102, 32, + 115,101,108,102, 46,112,116,114,126, 61, 39, 39, 32, 97,110, + 100, 32,110,111,116, 32,105,115, 98, 97,115,105, 99, 40,116, + 121,112,101, 41, 32,116,104,101,110, 32,112,116,114, 32, 61, + 32, 39, 42, 39, 32,101,110,100, 10, 32,108,105,110,101, 32, + 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108, + 105,110,101, 44, 34, 32, 34, 44,115,101,108,102, 46,109,111, + 100, 44,116,121,112,101, 44,112,116,114, 41, 10, 32,105,102, + 32, 97,114,114, 97,121, 32,116,104,101,110, 10, 32, 32,108, + 105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, + 97,109, 40,108,105,110,101, 44, 39, 42, 39, 41, 10, 32,101, + 110,100, 10, 32,108,105,110,101, 32, 61, 32, 99,111,110, 99, + 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44,115,101, + 108,102, 46,110, 97,109,101, 41, 10, 32,105,102, 32,115,101, + 108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104, + 101,110, 10, 32, 32,105,102, 32,116,111,110,117,109, 98,101, + 114, 40,115,101,108,102, 46,100,105,109, 41,126, 61,110,105, + 108, 32,116,104,101,110, 10, 32, 32, 32,108,105,110,101, 32, + 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108, + 105,110,101, 44, 39, 91, 39, 44,115,101,108,102, 46,100,105, + 109, 44, 39, 93, 59, 39, 41, 10, 32, 32,101,108,115,101, 10, + 9,105,102, 32, 99,112,108,117,115,112,108,117,115, 32,116, + 104,101,110, 10, 9, 9,108,105,110,101, 32, 61, 32, 99,111, + 110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, + 39, 32, 61, 32, 77,116,111,108,117, 97, 95,110,101,119, 95, + 100,105,109, 40, 39, 44,116,121,112,101, 44,112,116,114, 44, + 39, 44, 32, 39, 46, 46,115,101,108,102, 46,100,105,109, 46, + 46, 39, 41, 59, 39, 41, 10, 9,101,108,115,101, 10, 9, 9, + 108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97, + 114, 97,109, 40,108,105,110,101, 44, 39, 32, 61, 32, 40, 39, + 44,116,121,112,101, 44,112,116,114, 44, 39, 42, 41, 39, 44, + 10, 9, 9, 39,109, 97,108,108,111, 99, 40, 40, 39, 44,115, + 101,108,102, 46,100,105,109, 44, 39, 41, 42,115,105,122,101, + 111,102, 40, 39, 44,116,121,112,101, 44,112,116,114, 44, 39, + 41, 41, 59, 39, 41, 10, 9,101,110,100, 10, 32, 32,101,110, + 100, 10, 32,101,108,115,101, 10, 32, 32,108,111, 99, 97,108, + 32,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,121, + 112,101, 41, 10, 32, 32,108,105,110,101, 32, 61, 32, 99,111, + 110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, + 39, 32, 61, 32, 39, 41, 10, 32, 32,105,102, 32,116, 32, 61, + 61, 32, 39,115,116, 97,116,101, 39, 32,116,104,101,110, 10, + 32, 32, 9,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97, + 116,112, 97,114, 97,109, 40,108,105,110,101, 44, 32, 39,116, + 111,108,117, 97, 95, 83, 59, 39, 41, 10, 32, 32,101,108,115, + 101, 10, 32, 32, 9, 45, 45,112,114,105,110,116, 40, 34,116, + 32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103, + 40,116, 41, 46, 46, 34, 44, 32,112,116,114, 32,105,115, 32, + 34, 46, 46,116,111,115,116,114,105,110,103, 40,115,101,108, + 102, 46,112,116,114, 41, 41, 10, 32, 32, 9,105,102, 32,116, + 32, 61, 61, 32, 39,110,117,109, 98,101,114, 39, 32, 97,110, + 100, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,115, + 101,108,102, 46,112,116,114, 44, 32, 34, 37, 42, 34, 41, 32, + 116,104,101,110, 10, 32, 32, 9, 9,116, 32, 61, 32, 39,117, + 115,101,114,100, 97,116, 97, 39, 10, 32, 32, 9,101,110,100, + 10, 9,105,102, 32,110,111,116, 32,116, 32, 97,110,100, 32, + 112,116,114, 61, 61, 39, 39, 32,116,104,101,110, 32,108,105, + 110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97, + 109, 40,108,105,110,101, 44, 39, 42, 39, 41, 32,101,110,100, + 10, 9,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116, + 112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 40, 40, 39, + 44,115,101,108,102, 46,109,111,100, 44,116,121,112,101, 41, + 10, 9,105,102, 32,110,111,116, 32,116, 32,116,104,101,110, + 10, 9, 9,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97, + 116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 42, 39, + 41, 10, 9,101,110,100, 10, 9,108,105,110,101, 32, 61, 32, + 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110, + 101, 44, 39, 41, 32, 39, 41, 10, 9,105,102, 32,105,115,101, + 110,117,109, 40,110, 99,116,121,112,101, 41, 32,116,104,101, + 110, 10, 9, 9,108,105,110,101, 32, 61, 32, 99,111,110, 99, + 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 40, + 105,110,116, 41, 32, 39, 41, 10, 9,101,110,100, 10, 9,108, + 111, 99, 97,108, 32,100,101,102, 32, 61, 32, 48, 10, 9,105, + 102, 32,115,101,108,102, 46,100,101,102, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 9, 9,100,101,102, 32, 61, 32, + 115,101,108,102, 46,100,101,102, 10, 9, 9,105,102, 32, 40, + 112,116,114, 32, 61, 61, 32, 39, 39, 32,111,114, 32,115,101, + 108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39, 41, 32, + 97,110,100, 32,110,111,116, 32,116, 32,116,104,101,110, 10, + 9, 9, 9,100,101,102, 32, 61, 32, 34, 40,118,111,105,100, + 42, 41, 38, 40, 99,111,110,115,116, 32, 34, 46, 46,116,121, + 112,101, 46, 46, 34, 41, 34, 46, 46,100,101,102, 10, 9, 9, + 101,110,100, 10, 9,101,110,100, 10, 9,105,102, 32,116, 32, + 116,104,101,110, 10, 9, 9,108,105,110,101, 32, 61, 32, 99, + 111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, + 44, 39,116,111,108,117, 97, 95,116,111, 39, 46, 46,116, 44, + 39, 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114, + 103, 44, 39, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, + 41, 10, 9,101,108,115,101, 10, 9, 9,108,111, 99, 97,108, + 32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95, + 116,111, 95,102,117,110, 99,116,105,111,110, 40,116,121,112, + 101, 41, 10, 9, 9,108,105,110,101, 32, 61, 32, 99,111,110, + 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44,116, + 111, 95,102,117,110, 99, 46, 46, 39, 40,116,111,108,117, 97, + 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44, 39, 44,100, + 101,102, 44, 39, 41, 41, 59, 39, 41, 10, 9,101,110,100, 10, + 32, 32,101,110,100, 10, 32,101,110,100, 10, 9,114,101,116, + 117,114,110, 32,108,105,110,101, 10,101,110,100, 10, 10, 45, + 45, 32, 68,101, 99,108, 97,114,101, 32,118, 97,114,105, 97, + 98,108,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58, + 100,101, 99,108, 97,114,101, 32, 40,110, 97,114,103, 41, 10, + 32,105,102, 32,115,101,108,102, 46,100,105,109, 32,126, 61, + 32, 39, 39, 32, 97,110,100, 32,116,111,110,117,109, 98,101, + 114, 40,115,101,108,102, 46,100,105,109, 41, 61, 61,110,105, + 108, 32,116,104,101,110, 10, 9, 32,111,117,116,112,117,116, + 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,117, + 115,112,108,117,115, 92,110, 39, 41, 10, 9, 9,111,117,116, + 112,117,116, 40,115,101,108,102, 58, 98,117,105,108,100,100, + 101, 99,108, 97,114, 97,116,105,111,110, 40,110, 97,114,103, + 44,116,114,117,101, 41, 41, 10, 9, 9,111,117,116,112,117, + 116, 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10, 9, 9, + 111,117,116,112,117,116, 40,115,101,108,102, 58, 98,117,105, + 108,100,100,101, 99,108, 97,114, 97,116,105,111,110, 40,110, + 97,114,103, 44,102, 97,108,115,101, 41, 41, 10, 9, 32,111, + 117,116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, + 39, 41, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,112, + 117,116, 40,115,101,108,102, 58, 98,117,105,108,100,100,101, + 99,108, 97,114, 97,116,105,111,110, 40,110, 97,114,103, 44, + 102, 97,108,115,101, 41, 41, 10, 9,101,110,100, 10,101,110, + 100, 10, 10, 45, 45, 32, 71,101,116, 32,112, 97,114, 97,109, + 101,116,101,114, 32,118, 97,108,117,101, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97, + 114, 97,116,105,111,110, 58,103,101,116, 97,114,114, 97,121, + 32, 40,110, 97,114,103, 41, 10, 32,105,102, 32,115,101,108, + 102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101, + 110, 10, 9, 32,108,111, 99, 97,108, 32,116,121,112,101, 32, + 61, 32,103,115,117, 98, 40,115,101,108,102, 46,116,121,112, + 101, 44, 39, 99,111,110,115,116, 32, 39, 44, 39, 39, 41, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,123, 39, 41, + 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,105,102,110, + 100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, + 83, 69, 92,110, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32, + 100,101,102, 59, 32,105,102, 32,115,101,108,102, 46,100,101, + 102,126, 61, 39, 39, 32,116,104,101,110, 32,100,101,102, 61, + 49, 32,101,108,115,101, 32,100,101,102, 61, 48, 32,101,110, + 100, 10, 9, 9,108,111, 99, 97,108, 32,116, 32, 61, 32,105, + 115, 98, 97,115,105, 99, 40,116,121,112,101, 41, 10, 9, 9, + 105,102, 32, 40,116, 41, 32,116,104,101,110, 10, 9, 9, 32, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,105,102, + 32, 40, 33,116,111,108,117, 97, 95,105,115, 39, 46, 46,116, + 46, 46, 39, 97,114,114, 97,121, 40,116,111,108,117, 97, 95, + 83, 44, 39, 44,110, 97,114,103, 44, 39, 44, 39, 44,115,101, + 108,102, 46,100,105,109, 44, 39, 44, 39, 44,100,101,102, 44, + 39, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39, + 41, 10, 9, 9,101,108,115,101, 10, 9, 9, 32, 32, 32,111, + 117,116,112,117,116, 40, 39, 32, 32, 32,105,102, 32, 40, 33, + 116,111,108,117, 97, 95,105,115,117,115,101,114,116,121,112, + 101, 97,114,114, 97,121, 40,116,111,108,117, 97, 95, 83, 44, + 39, 44,110, 97,114,103, 44, 39, 44, 34, 39, 44,116,121,112, + 101, 44, 39, 34, 44, 39, 44,115,101,108,102, 46,100,105,109, + 44, 39, 44, 39, 44,100,101,102, 44, 39, 44, 38,116,111,108, + 117, 97, 95,101,114,114, 41, 41, 39, 41, 10, 9, 9,101,110, + 100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 32,103,111,116,111, 32,116,111,108,117, 97, 95,108,101,114, + 114,111,114, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 32, 32,101,108,115,101, 92,110, 39, 41, 10, 9, + 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102, + 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 32, 32,123, 39, 41, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 32, 32, 32,105,110,116, 32,105, 59, 39, 41, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,102, + 111,114, 40,105, 61, 48, 59, 32,105, 60, 39, 46, 46,115,101, + 108,102, 46,100,105,109, 46, 46, 39, 59,105, 43, 43, 41, 39, + 41, 10, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,105, + 115, 98, 97,115,105, 99, 40,116,121,112,101, 41, 10, 32, 32, + 108,111, 99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10, + 32, 32,105,102, 32,115,101,108,102, 46,112,116,114,126, 61, + 39, 39, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39, + 42, 39, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 32, 32, 39, 44,115,101,108,102, 46,110, 97,109, + 101, 46, 46, 39, 91,105, 93, 32, 61, 32, 39, 41, 10, 32, 32, + 105,102, 32,110,111,116, 32,116, 32, 97,110,100, 32,112,116, + 114, 61, 61, 39, 39, 32,116,104,101,110, 32,111,117,116,112, + 117,116, 40, 39, 42, 39, 41, 32,101,110,100, 10, 32, 32,111, + 117,116,112,117,116, 40, 39, 40, 40, 39, 44,116,121,112,101, + 41, 10, 32, 32,105,102, 32,110,111,116, 32,116, 32,116,104, + 101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, 42, + 39, 41, 10, 32, 32,101,110,100, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 41, 32, 39, 41, 10, 32, 32,108,111, 99, 97, + 108, 32,100,101,102, 32, 61, 32, 48, 10, 32, 32,105,102, 32, + 115,101,108,102, 46,100,101,102, 32,126, 61, 32, 39, 39, 32, + 116,104,101,110, 32,100,101,102, 32, 61, 32,115,101,108,102, + 46,100,101,102, 32,101,110,100, 10, 32, 32,105,102, 32,116, + 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, + 40, 39,116,111,108,117, 97, 95,116,111,102,105,101,108,100, + 39, 46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, + 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49, 44, 39, + 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32,101, + 108,115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, + 116,111,108,117, 97, 95,116,111,102,105,101,108,100,117,115, + 101,114,116,121,112,101, 40,116,111,108,117, 97, 95, 83, 44, + 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49, 44, 39, 44, + 100,101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32,101,110, + 100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 125, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32,125, 39, 41, 10, 32,101,110,100, 10,101,110,100, 10, 10, + 45, 45, 32, 71,101,116, 32,112, 97,114, 97,109,101,116,101, + 114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 58,115,101,116, 97,114,114, 97,121, 32, 40,110, + 97,114,103, 41, 10, 32,105,102, 32,110,111,116, 32,115,116, + 114,102,105,110,100, 40,115,101,108,102, 46,116,121,112,101, + 44, 39, 99,111,110,115,116, 37,115, 43, 39, 41, 32, 97,110, + 100, 32,115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 9, 32,108,111, 99, 97,108, 32, + 116,121,112,101, 32, 61, 32,103,115,117, 98, 40,115,101,108, + 102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 32, 39, + 44, 39, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 32,123, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, + 39, 32, 32, 32,105,110,116, 32,105, 59, 39, 41, 10, 32, 32, + 111,117,116,112,117,116, 40, 39, 32, 32, 32,102,111,114, 40, + 105, 61, 48, 59, 32,105, 60, 39, 46, 46,115,101,108,102, 46, + 100,105,109, 46, 46, 39, 59,105, 43, 43, 41, 39, 41, 10, 32, + 32,108,111, 99, 97,108, 32,116, 44, 99,116, 32, 61, 32,105, + 115, 98, 97,115,105, 99, 40,116,121,112,101, 41, 10, 32, 32, + 105,102, 32,116, 32,116,104,101,110, 10, 32, 32, 32,111,117, + 116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, + 95,112,117,115,104,102,105,101,108,100, 39, 46, 46,116, 46, + 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97, + 114,103, 44, 39, 44,105, 43, 49, 44, 40, 39, 44, 99,116, 44, + 39, 41, 39, 44,115,101,108,102, 46,110, 97,109,101, 44, 39, + 91,105, 93, 41, 59, 39, 41, 10, 32, 32,101,108,115,101, 10, + 32, 32, 32,105,102, 32,115,101,108,102, 46,112,116,114, 32, + 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32, 32, 32, + 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,123, 39, 41, + 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 35, + 105,102,100,101,102, 32, 95, 95, 99,112,108,117,115,112,108, + 117,115, 92,110, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116, + 112,117,116, 40, 39, 32, 32, 32, 32,118,111,105,100, 42, 32, + 116,111,108,117, 97, 95,111, 98,106, 32, 61, 32, 77,116,111, + 108,117, 97, 95,110,101,119, 40, 40, 39, 44,116,121,112,101, + 44, 39, 41, 40, 39, 44,115,101,108,102, 46,110, 97,109,101, + 44, 39, 91,105, 93, 41, 41, 59, 39, 41, 10, 32, 32, 32, 32, + 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,111, + 108,117, 97, 95,112,117,115,104,102,105,101,108,100,117,115, + 101,114,116,121,112,101, 95, 97,110,100, 95,116, 97,107,101, + 111,119,110,101,114,115,104,105,112, 40,116,111,108,117, 97, + 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49, + 44,116,111,108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116, + 121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, 32, 32, + 32,111,117,116,112,117,116, 40, 39, 35,101,108,115,101, 92, + 110, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 32, 32, 32,118,111,105,100, 42, 32,116,111,108, + 117, 97, 95,111, 98,106, 32, 61, 32,116,111,108,117, 97, 95, + 99,111,112,121, 40,116,111,108,117, 97, 95, 83, 44, 40,118, + 111,105,100, 42, 41, 38, 39, 44,115,101,108,102, 46,110, 97, + 109,101, 44, 39, 91,105, 93, 44,115,105,122,101,111,102, 40, + 39, 44,116,121,112,101, 44, 39, 41, 41, 59, 39, 41, 10, 32, + 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 32,116,111,108,117, 97, 95,112,117,115,104,102,105,101,108, + 100,117,115,101,114,116,121,112,101, 40,116,111,108,117, 97, + 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49, + 44,116,111,108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116, + 121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, 32, 32, + 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102, + 92,110, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 32, 32, 32,125, 39, 41, 10, 32, 32, 32,101,108, + 115,101, 10, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 32, 32,116,111,108,117, 97, 95,112,117,115,104,102,105, + 101,108,100,117,115,101,114,116,121,112,101, 40,116,111,108, + 117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, + 43, 49, 44, 40,118,111,105,100, 42, 41, 39, 44,115,101,108, + 102, 46,110, 97,109,101, 44, 39, 91,105, 93, 44, 34, 39, 44, + 116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, 32, + 101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,111,117,116, + 112,117,116, 40, 39, 32, 32,125, 39, 41, 10, 32,101,110,100, + 10,101,110,100, 10, 10, 45, 45, 32, 70,114,101,101, 32,100, + 121,110, 97,109,105, 99, 97,108,108,121, 32, 97,108,108,111, + 99, 97,116,101,100, 32, 97,114,114, 97,121, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, + 97,114, 97,116,105,111,110, 58,102,114,101,101, 97,114,114, + 97,121, 32, 40, 41, 10, 32,105,102, 32,115,101,108,102, 46, + 100,105,109, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,116, + 111,110,117,109, 98,101,114, 40,115,101,108,102, 46,100,105, + 109, 41, 61, 61,110,105,108, 32,116,104,101,110, 10, 9, 32, + 111,117,116,112,117,116, 40, 39, 35,105,102,100,101,102, 32, + 95, 95, 99,112,108,117,115,112,108,117,115, 92,110, 39, 41, + 10, 9, 9,111,117,116,112,117,116, 40, 39, 32, 32, 77,116, + 111,108,117, 97, 95,100,101,108,101,116,101, 95,100,105,109, + 40, 39, 44,115,101,108,102, 46,110, 97,109,101, 44, 39, 41, + 59, 39, 41, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35, + 101,108,115,101, 92,110, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 32,102,114,101,101, 40, 39, 44,115,101, + 108,102, 46,110, 97,109,101, 44, 39, 41, 59, 39, 41, 10, 9, + 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102, + 92,110, 39, 41, 10, 32,101,110,100, 10,101,110,100, 10, 10, + 45, 45, 32, 80, 97,115,115, 32,112, 97,114, 97,109,101,116, + 101,114, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,112, + 97,115,115,112, 97,114, 32, 40, 41, 10, 32,105,102, 32,115, + 101,108,102, 46,112,116,114, 61, 61, 39, 38, 39, 32, 97,110, + 100, 32,110,111,116, 32,105,115, 98, 97,115,105, 99, 40,115, + 101,108,102, 46,116,121,112,101, 41, 32,116,104,101,110, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 42, 39, 46, 46,115, + 101,108,102, 46,110, 97,109,101, 41, 10, 32,101,108,115,101, + 105,102, 32,115,101,108,102, 46,114,101,116, 61, 61, 39, 42, + 39, 32,116,104,101,110, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 38, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, + 41, 10, 32,101,108,115,101, 10, 32, 32,111,117,116,112,117, + 116, 40,115,101,108,102, 46,110, 97,109,101, 41, 10, 32,101, + 110,100, 10,101,110,100, 10, 10, 45, 45, 32, 82,101,116,117, + 114,110, 32,112, 97,114, 97,109,101,116,101,114, 32,118, 97, + 108,117,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58, + 114,101,116,118, 97,108,117,101, 32, 40, 41, 10, 32,105,102, + 32,115,101,108,102, 46,114,101,116, 32,126, 61, 32, 39, 39, + 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32,116, + 44, 99,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115, + 101,108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102, 32, + 116, 32, 97,110,100, 32,116,126, 61, 39, 39, 32,116,104,101, + 110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, + 32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46,116, + 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, + 99,116, 44, 39, 41, 39, 46, 46,115,101,108,102, 46,110, 97, + 109,101, 46, 46, 39, 41, 59, 39, 41, 10, 32, 32,101,108,115, + 101, 10, 32, 32, 32,108,111, 99, 97,108, 32,112,117,115,104, + 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,112,117,115, + 104, 95,102,117,110, 99,116,105,111,110, 40,115,101,108,102, + 46,116,121,112,101, 41, 10, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, 95,102,117, + 110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118, + 111,105,100, 42, 41, 39, 46, 46,115,101,108,102, 46,110, 97, + 109,101, 46, 46, 39, 44, 34, 39, 44,115,101,108,102, 46,116, + 121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32,101,110, + 100, 10, 32, 32,114,101,116,117,114,110, 32, 49, 10, 32,101, + 110,100, 10, 32,114,101,116,117,114,110, 32, 48, 10,101,110, + 100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, + 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, + 99,116,105,111,110, 32, 95, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 32, 40,116, 41, 10, 10, 32,115,101,116,109,101, + 116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, + 68,101, 99,108, 97,114, 97,116,105,111,110, 41, 10, 32,116, + 58, 98,117,105,108,100,110, 97,109,101,115, 40, 41, 10, 32, + 116, 58, 99,104,101, 99,107,110, 97,109,101, 40, 41, 10, 32, + 116, 58, 99,104,101, 99,107,116,121,112,101, 40, 41, 10, 32, + 108,111, 99, 97,108, 32,102,116, 32, 61, 32,102,105,110,100, + 116,121,112,101, 40,116, 46,116,121,112,101, 41, 32,111,114, + 32,116, 46,116,121,112,101, 10, 32,105,102, 32,110,111,116, + 32,105,115,101,110,117,109, 40,102,116, 41, 32,116,104,101, + 110, 10, 9,116, 46,109,111,100, 44, 32,116, 46,116,121,112, + 101, 32, 61, 32, 97,112,112,108,121,116,121,112,101,100,101, + 102, 40,116, 46,109,111,100, 44, 32,102,116, 41, 10, 32,101, + 110,100, 10, 10, 32,105,102, 32,116, 46,107,105,110,100, 61, + 61, 34,118, 97,114, 34, 32, 97,110,100, 32, 40,115,116,114, + 105,110,103, 46,102,105,110,100, 40,116, 46,109,111,100, 44, + 32, 34,116,111,108,117, 97, 95,112,114,111,112,101,114,116, + 121, 37,115, 34, 41, 32,111,114, 32,115,116,114,105,110,103, + 46,102,105,110,100, 40,116, 46,109,111,100, 44, 32, 34,116, + 111,108,117, 97, 95,112,114,111,112,101,114,116,121, 36, 34, + 41, 41, 32,116,104,101,110, 10, 32, 9,116, 46,109,111,100, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 116, 46,109,111,100, 44, 32, 34,116,111,108,117, 97, 95,112, + 114,111,112,101,114,116,121, 34, 44, 32, 34,116,111,108,117, + 97, 95,112,114,111,112,101,114,116,121, 95, 95, 34, 46, 46, + 103,101,116, 95,112,114,111,112,101,114,116,121, 95,116,121, + 112,101, 40, 41, 41, 10, 32,101,110,100, 10, 10, 32,114,101, + 116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, + 67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, + 69,120,112,101, 99,116,115, 32,116,104,101, 32,115,116,114, + 105,110,103, 32,100,101, 99,108, 97,114, 97,116,105,111,110, + 46, 10, 45, 45, 32, 84,104,101, 32,107,105,110,100, 32,111, + 102, 32,100,101, 99,108, 97,114, 97,116,105,111,110, 32, 99, + 97,110, 32, 98,101, 32, 34,118, 97,114, 34, 32,111,114, 32, + 34,102,117,110, 99, 34, 46, 10,102,117,110, 99,116,105,111, + 110, 32, 68,101, 99,108, 97,114, 97,116,105,111,110, 32, 40, + 115, 44,107,105,110,100, 44,105,115, 95,112, 97,114, 97,109, + 101,116,101,114, 41, 10, 10, 32, 45, 45, 32,101,108,105,109, + 105,110, 97,116,101, 32,115,112, 97, 99,101,115, 32,105,102, + 32,100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 32, + 105,115, 32,112,114,111,118,105,100,101,100, 10, 32,115, 32, + 61, 32,103,115,117, 98, 40,115, 44, 34, 37,115, 42, 61, 37, + 115, 42, 34, 44, 34, 61, 34, 41, 10, 32,115, 32, 61, 32,103, + 115,117, 98, 40,115, 44, 32, 34, 37,115, 42, 60, 34, 44, 32, + 34, 60, 34, 41, 10, 10, 32,108,111, 99, 97,108, 32,100,101, + 102, 98, 44,116,109,112,100,101,102, 10, 32,100,101,102, 98, + 44, 95, 44,116,109,112,100,101,102, 32, 61, 32,115,116,114, + 105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 40, 61, + 46, 42, 41, 36, 34, 41, 10, 32,105,102, 32,100,101,102, 98, + 32,116,104,101,110, 10, 32, 9,115, 32, 61, 32,115,116,114, + 105,110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 61, 46, + 42, 36, 34, 44, 32, 34, 34, 41, 10, 32,101,108,115,101, 10, + 32, 9,116,109,112,100,101,102, 32, 61, 32, 39, 39, 10, 32, + 101,110,100, 10, 32,105,102, 32,107,105,110,100, 32, 61, 61, + 32, 34,118, 97,114, 34, 32,116,104,101,110, 10, 32, 32, 45, + 45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,111,114, + 109, 58, 32,118,111,105,100, 10, 32, 32,105,102, 32,115, 32, + 61, 61, 32, 39, 39, 32,111,114, 32,115, 32, 61, 61, 32, 39, + 118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32, 32,114, + 101,116,117,114,110, 32, 95, 68,101, 99,108, 97,114, 97,116, + 105,111,110,123,116,121,112,101, 32, 61, 32, 39,118,111,105, + 100, 39, 44, 32,107,105,110,100, 32, 61, 32,107,105,110,100, + 44, 32,105,115, 95,112, 97,114, 97,109,101,116,101,114, 32, + 61, 32,105,115, 95,112, 97,114, 97,109,101,116,101,114,125, + 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, + 45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,111,114, + 109, 58, 32,109,111,100, 32,116,121,112,101, 42, 38, 32,110, + 97,109,101, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, + 115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40, + 115, 44, 39, 37, 42, 37,115, 42, 38, 39, 41, 10, 32,105,102, + 32,116, 46,110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10, + 32, 32,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39,102, + 117,110, 99, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114, + 114,111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,102, + 117,110, 99,116,105,111,110, 32,114,101,116,117,114,110, 32, + 116,121,112,101, 58, 32, 34, 46, 46,115, 41, 10, 32, 32,101, + 110,100, 10, 32, 32, 45, 45,108,111, 99, 97,108, 32,109, 32, + 61, 32,115,112,108,105,116, 40,116, 91, 49, 93, 44, 39, 37, + 115, 37,115, 42, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32, + 109, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107, + 101,110,115, 40,116, 91, 49, 93, 44, 39, 37,115, 43, 39, 41, + 10, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108, + 97,114, 97,116,105,111,110,123, 10, 32, 32, 32,110, 97,109, + 101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,109,112,100,101, + 102, 44, 10, 32, 32, 32,112,116,114, 32, 61, 32, 39, 42, 39, + 44, 10, 32, 32, 32,114,101,116, 32, 61, 32, 39, 38, 39, 44, + 10, 32, 32, 32, 45, 45,116,121,112,101, 32, 61, 32,114,101, + 98,117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40, + 109, 91,109, 46,110, 93, 44, 32,116, 98, 44, 32,116,105,109, + 112,108, 41, 44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32, + 109, 91,109, 46,110, 93, 44, 10, 32, 32, 32,109,111,100, 32, + 61, 32, 99,111,110, 99, 97,116, 40,109, 44, 49, 44,109, 46, + 110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, 95,112, 97,114, + 97,109,101,116,101,114, 32, 61, 32,105,115, 95,112, 97,114, + 97,109,101,116,101,114, 44, 10, 32, 32, 32,107,105,110,100, + 32, 61, 32,107,105,110,100, 10, 32, 32,125, 10, 32,101,110, + 100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104, + 101, 32,102,111,114,109, 58, 32,109,111,100, 32,116,121,112, + 101, 42, 42, 32,110, 97,109,101, 10, 32,116, 32, 61, 32,115, + 112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, + 44, 39, 37, 42, 37,115, 42, 37, 42, 39, 41, 10, 32,105,102, + 32,116, 46,110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10, + 32, 32,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39,102, + 117,110, 99, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114, + 114,111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,102, + 117,110, 99,116,105,111,110, 32,114,101,116,117,114,110, 32, + 116,121,112,101, 58, 32, 34, 46, 46,115, 41, 10, 32, 32,101, + 110,100, 10, 32, 32, 45, 45,108,111, 99, 97,108, 32,109, 32, + 61, 32,115,112,108,105,116, 40,116, 91, 49, 93, 44, 39, 37, + 115, 37,115, 42, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32, + 109, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107, + 101,110,115, 40,116, 91, 49, 93, 44, 39, 37,115, 43, 39, 41, + 10, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108, + 97,114, 97,116,105,111,110,123, 10, 32, 32, 32,110, 97,109, + 101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,109,112,100,101, + 102, 44, 10, 32, 32, 32,112,116,114, 32, 61, 32, 39, 42, 39, + 44, 10, 32, 32, 32,114,101,116, 32, 61, 32, 39, 42, 39, 44, + 10, 32, 32, 32, 45, 45,116,121,112,101, 32, 61, 32,114,101, + 98,117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40, + 109, 91,109, 46,110, 93, 44, 32,116, 98, 44, 32,116,105,109, + 112,108, 41, 44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32, + 109, 91,109, 46,110, 93, 44, 10, 32, 32, 32,109,111,100, 32, + 61, 32, 99,111,110, 99, 97,116, 40,109, 44, 49, 44,109, 46, + 110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, 95,112, 97,114, + 97,109,101,116,101,114, 32, 61, 32,105,115, 95,112, 97,114, + 97,109,101,116,101,114, 44, 10, 32, 32, 32,107,105,110,100, + 32, 61, 32,107,105,110,100, 10, 32, 32,125, 10, 32,101,110, + 100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104, + 101, 32,102,111,114,109, 58, 32,109,111,100, 32,116,121,112, + 101, 38, 32,110, 97,109,101, 10, 32,116, 32, 61, 32,115,112, + 108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44, + 39, 38, 39, 41, 10, 32,105,102, 32,116, 46,110, 32, 61, 61, + 32, 50, 32,116,104,101,110, 10, 32, 32, 45, 45,108,111, 99, + 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 40,116, 91, + 49, 93, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108, + 111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 95, + 99, 95,116,111,107,101,110,115, 40,116, 91, 49, 93, 44, 39, + 37,115, 43, 39, 41, 10, 32, 32,114,101,116,117,114,110, 32, + 95, 68,101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, + 32, 32,110, 97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46, + 116,109,112,100,101,102, 44, 10, 32, 32, 32,112,116,114, 32, + 61, 32, 39, 38, 39, 44, 10, 32, 32, 32, 45, 45,116,121,112, + 101, 32, 61, 32,114,101, 98,117,105,108,100, 95,116,101,109, + 112,108, 97,116,101, 40,109, 91,109, 46,110, 93, 44, 32,116, + 98, 44, 32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,116, + 121,112,101, 32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32, + 32, 32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40, + 109, 44, 49, 44,109, 46,110, 45, 49, 41, 44, 10, 32, 32, 32, + 105,115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32, + 105,115, 95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, + 32, 32,107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, + 32,125, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104, + 101, 99,107, 32,116,104,101, 32,102,111,114,109, 58, 32,109, + 111,100, 32,116,121,112,101, 42, 32,110, 97,109,101, 10, 32, + 108,111, 99, 97,108, 32,115, 49, 32, 61, 32,103,115,117, 98, + 40,115, 44, 34, 40, 37, 98, 92, 91, 92, 93, 41, 34, 44,102, + 117,110, 99,116,105,111,110, 32, 40,110, 41, 32,114,101,116, + 117,114,110, 32,103,115,117, 98, 40,110, 44, 39, 37, 42, 39, + 44, 39, 92, 49, 39, 41, 32,101,110,100, 41, 10, 32,116, 32, + 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110, + 115, 40,115, 49, 44, 39, 37, 42, 39, 41, 10, 32,105,102, 32, + 116, 46,110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10, 32, + 32,116, 91, 50, 93, 32, 61, 32,103,115,117, 98, 40,116, 91, + 50, 93, 44, 39, 92, 49, 39, 44, 39, 37, 42, 39, 41, 32, 45, + 45, 32,114,101,115,116,111,114,101, 32, 42, 32,105,110, 32, + 100,105,109,101,110,115,105,111,110, 32,101,120,112,114,101, + 115,115,105,111,110, 10, 32, 32, 45, 45,108,111, 99, 97,108, + 32,109, 32, 61, 32,115,112,108,105,116, 40,116, 91, 49, 93, + 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108,111, 99, + 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 95, 99, 95, + 116,111,107,101,110,115, 40,116, 91, 49, 93, 44, 39, 37,115, + 43, 39, 41, 10, 32, 32,114,101,116,117,114,110, 32, 95, 68, + 101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, 32, + 110, 97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,109, + 112,100,101,102, 44, 10, 32, 32, 32,112,116,114, 32, 61, 32, + 39, 42, 39, 44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32, + 109, 91,109, 46,110, 93, 44, 10, 32, 32, 32, 45, 45,116,121, + 112,101, 32, 61, 32,114,101, 98,117,105,108,100, 95,116,101, + 109,112,108, 97,116,101, 40,109, 91,109, 46,110, 93, 44, 32, + 116, 98, 44, 32,116,105,109,112,108, 41, 44, 10, 32, 32, 32, + 109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,109, 44, + 49, 44,109, 46,110, 45, 49, 41, 32, 32, 32, 44, 10, 32, 32, + 32,105,115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61, + 32,105,115, 95,112, 97,114, 97,109,101,116,101,114, 44, 10, + 32, 32, 32,107,105,110,100, 32, 61, 32,107,105,110,100, 10, + 32, 32,125, 10, 32,101,110,100, 10, 10, 32,105,102, 32,107, + 105,110,100, 32, 61, 61, 32, 39,118, 97,114, 39, 32,116,104, + 101,110, 10, 32, 32, 45, 45, 32, 99,104,101, 99,107, 32,116, + 104,101, 32,102,111,114,109, 58, 32,109,111,100, 32,116,121, + 112,101, 32,110, 97,109,101, 10, 32, 32, 45, 45,116, 32, 61, + 32,115,112,108,105,116, 40,115, 44, 39, 37,115, 37,115, 42, + 39, 41, 10, 32, 32,116, 32, 61, 32,115,112,108,105,116, 95, + 99, 95,116,111,107,101,110,115, 40,115, 44, 39, 37,115, 43, + 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,118, 10, 32, 32, + 105,102, 32,102,105,110,100,116,121,112,101, 40,116, 91,116, + 46,110, 93, 41, 32,116,104,101,110, 32,118, 32, 61, 32, 99, + 114,101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, 41, + 32,101,108,115,101, 32,118, 32, 61, 32,116, 91,116, 46,110, + 93, 59, 32,116, 46,110, 32, 61, 32,116, 46,110, 45, 49, 32, + 101,110,100, 10, 32, 32,114,101,116,117,114,110, 32, 95, 68, + 101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, 32, + 110, 97,109,101, 32, 61, 32,118, 46, 46,116,109,112,100,101, + 102, 44, 10, 32, 32, 32, 45, 45,116,121,112,101, 32, 61, 32, + 114,101, 98,117,105,108,100, 95,116,101,109,112,108, 97,116, + 101, 40,116, 91,116, 46,110, 93, 44, 32,116, 98, 44, 32,116, + 105,109,112,108, 41, 44, 10, 32, 32, 32,116,121,112,101, 32, + 61, 32,116, 91,116, 46,110, 93, 44, 10, 32, 32, 32,109,111, + 100, 32, 61, 32, 99,111,110, 99, 97,116, 40,116, 44, 49, 44, + 116, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, 95,112, + 97,114, 97,109,101,116,101,114, 32, 61, 32,105,115, 95,112, + 97,114, 97,109,101,116,101,114, 44, 10, 32, 32, 32,107,105, + 110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,125, 10, 10, + 32,101,108,115,101, 32, 45, 45, 32,107,105,110,100, 32, 61, + 61, 32, 34,102,117,110, 99, 34, 10, 10, 32, 32, 45, 45, 32, + 99,104,101, 99,107, 32,116,104,101, 32,102,111,114,109, 58, + 32,109,111,100, 32,116,121,112,101, 32,110, 97,109,101, 10, + 32, 32, 45, 45,116, 32, 61, 32,115,112,108,105,116, 40,115, + 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,116, 32, 61, + 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, + 40,115, 44, 39, 37,115, 43, 39, 41, 10, 32, 32,108,111, 99, + 97,108, 32,118, 32, 61, 32,116, 91,116, 46,110, 93, 32, 32, + 45, 45, 32,108, 97,115,116, 32,119,111,114,100, 32,105,115, + 32,116,104,101, 32,102,117,110, 99,116,105,111,110, 32,110, + 97,109,101, 10, 32, 32,108,111, 99, 97,108, 32,116,112, 44, + 109,100, 10, 32, 32,105,102, 32,116, 46,110, 62, 49, 32,116, + 104,101,110, 10, 32, 32, 32,116,112, 32, 61, 32,116, 91,116, + 46,110, 45, 49, 93, 10, 32, 32, 32,109,100, 32, 61, 32, 99, + 111,110, 99, 97,116, 40,116, 44, 49, 44,116, 46,110, 45, 50, + 41, 10, 32, 32,101,110,100, 10, 32, 32, 45, 45,105,102, 32, + 116,112, 32,116,104,101,110, 32,116,112, 32, 61, 32,114,101, + 98,117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40, + 116,112, 44, 32,116, 98, 44, 32,116,105,109,112,108, 41, 32, + 101,110,100, 10, 32, 32,114,101,116,117,114,110, 32, 95, 68, + 101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, 32, + 110, 97,109,101, 32, 61, 32,118, 44, 10, 32, 32, 32,116,121, + 112,101, 32, 61, 32,116,112, 44, 10, 32, 32, 32,109,111,100, + 32, 61, 32,109,100, 44, 10, 32, 32, 32,105,115, 95,112, 97, + 114, 97,109,101,116,101,114, 32, 61, 32,105,115, 95,112, 97, + 114, 97,109,101,116,101,114, 44, 10, 32, 32, 32,107,105,110, + 100, 32, 61, 32,107,105,110,100, 10, 32, 32,125, 10, 32,101, + 110,100, 10, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/declaration.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,118, 97,114,105, 97, + 98,108,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73, + 100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99, + 111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102, + 116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32, + 114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, + 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32, + 105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116, + 119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104, + 101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, + 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105, + 115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97, + 117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98, + 108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111, + 118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99, + 101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, + 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99, + 101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105, + 102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, + 32, 86, 97,114,105, 97, 98,108,101, 32, 99,108, 97,115,115, + 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, + 97, 32,101,120,116,101,114,110, 32,118, 97,114,105, 97, 98, + 108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99, 32, + 109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108, 97, + 115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32, 97, + 108,108, 32,102,105,101,108,100,115, 32,112,114,101,115,101, + 110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114, 97, + 116,105,111,110, 46, 10, 99,108, 97,115,115, 86, 97,114,105, + 97, 98,108,101, 32, 61, 32,123, 10, 32, 95,103,101,116, 32, + 61, 32,123,125, 44, 32, 32, 32, 45, 45, 32,109, 97,112,112, + 101,100, 32,103,101,116, 32,102,117,110, 99,116,105,111,110, + 115, 10, 32, 95,115,101,116, 32, 61, 32,123,125, 44, 32, 32, + 32, 45, 45, 32,109, 97,112,112,101,100, 32,115,101,116, 32, + 102,117,110, 99,116,105,111,110,115, 10,125, 10, 99,108, 97, + 115,115, 86, 97,114,105, 97, 98,108,101, 46, 95, 95,105,110, + 100,101,120, 32, 61, 32, 99,108, 97,115,115, 86, 97,114,105, + 97, 98,108,101, 10,115,101,116,109,101,116, 97,116, 97, 98, + 108,101, 40, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108, + 101, 44, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32, + 109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110, + 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 58, + 112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108, + 111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 86, 97,114,105, 97, 98,108,101,123, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, + 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97, + 109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,105,102, 32, + 115,101,108,102, 46,100,105,109, 32,116,104,101,110, 32,112, + 114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,100, + 105,109, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100, + 105,109, 46, 46, 34, 39, 44, 34, 41, 32,101,110,100, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 100,101,102, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, + 46,100,101,102, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,114,101, + 116, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,114, + 101,116, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110, + 116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99, + 108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 71, + 101,110,101,114, 97,116,101,115, 32, 67, 32,102,117,110, 99, + 116,105,111,110, 32,110, 97,109,101, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98, + 108,101, 58, 99,102,117,110, 99,110, 97,109,101, 32, 40,112, + 114,101,102,105,120, 41, 10, 32,108,111, 99, 97,108, 32,112, + 97,114,101,110,116, 32, 61, 32, 34, 34, 10, 32,108,111, 99, + 97,108, 32,117,110,115,105,103,110,101,100, 32, 61, 32, 34, + 34, 10, 32,108,111, 99, 97,108, 32,112,116,114, 32, 61, 32, + 34, 34, 10, 10, 32,108,111, 99, 97,108, 32,112, 32, 61, 32, + 115,101,108,102, 58,105,110,109,111,100,117,108,101, 40, 41, + 32,111,114, 32,115,101,108,102, 58,105,110,110, 97,109,101, + 115,112, 97, 99,101, 40, 41, 32,111,114, 32,115,101,108,102, + 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32,105,102, + 32,112, 32,116,104,101,110, 10, 32, 9,105,102, 32,115,101, + 108,102, 46,112, 97,114,101,110,116, 46, 99,108, 97,115,115, + 116,121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, + 32,116,104,101,110, 10, 9, 9,112, 97,114,101,110,116, 32, + 61, 32, 34, 95, 34, 32, 46, 46, 32,115,101,108,102, 46,112, + 97,114,101,110,116, 46,116,121,112,101, 10, 9,101,108,115, + 101, 10, 9, 32, 32,112, 97,114,101,110,116, 32, 61, 32, 34, + 95, 34, 32, 46, 46, 32,112, 10, 9,101,110,100, 10, 32,101, + 110,100, 10, 10, 32,105,102, 32,115,116,114,102,105,110,100, + 40,115,101,108,102, 46,109,111,100, 44, 34, 40,117,110,115, + 105,103,110,101,100, 41, 34, 41, 32,116,104,101,110, 10, 32, + 32,117,110,115,105,103,110,101,100, 32, 61, 32, 34, 95,117, + 110,115,105,103,110,101,100, 34, 10, 32,101,110,100, 10, 10, + 32,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, + 32, 34, 42, 34, 32,116,104,101,110, 32,112,116,114, 32, 61, + 32, 34, 95,112,116,114, 34, 10, 32,101,108,115,101,105,102, + 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 34, 38, + 34, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 34, 95, + 114,101,102, 34, 10, 32,101,110,100, 10, 10, 32,108,111, 99, + 97,108, 32,110, 97,109,101, 32, 61, 32, 32,112,114,101,102, + 105,120, 32, 46, 46, 32,112, 97,114,101,110,116, 32, 46, 46, + 32,117,110,115,105,103,110,101,100, 32, 46, 46, 32, 34, 95, + 34, 32, 46, 46, 32,103,115,117, 98, 40,115,101,108,102, 46, + 108,110, 97,109,101, 32,111,114, 32,115,101,108,102, 46,110, + 97,109,101, 44, 34, 46, 42, 58, 58, 34, 44, 34, 34, 41, 32, + 46, 46, 32,112,116,114, 10, 10, 9,110, 97,109,101, 32, 61, + 32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116,101, + 40,110, 97,109,101, 41, 10, 32,114,101,116,117,114,110, 32, + 110, 97,109,101, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97, + 32,118, 97,114,105, 97, 98,108,101, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98, + 108,101, 58,105,115,118, 97,114,105, 97, 98,108,101, 32, 40, + 41, 10, 32,114,101,116,117,114,110, 32,116,114,117,101, 10, + 101,110,100, 10, 10, 45, 45, 32,103,101,116, 32,118, 97,114, + 105, 97, 98,108,101, 32,118, 97,108,117,101, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, + 97, 98,108,101, 58,103,101,116,118, 97,108,117,101, 32, 40, + 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 44, 32,112, + 114,111,112, 95,103,101,116, 41, 10, 10, 9,108,111, 99, 97, + 108, 32,110, 97,109,101, 10, 9,105,102, 32,112,114,111,112, + 95,103,101,116, 32,116,104,101,110, 10, 10, 9, 9,110, 97, + 109,101, 32, 61, 32,112,114,111,112, 95,103,101,116, 46, 46, + 34, 40, 41, 34, 10, 9,101,108,115,101, 10, 9, 9,110, 97, + 109,101, 32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10, + 9,101,110,100, 10, 10, 9,105,102, 32, 99,108, 97,115,115, + 32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101, + 110, 10, 9, 32,114,101,116,117,114,110, 32,115,101,108,102, + 46,112, 97,114,101,110,116, 46,116,121,112,101, 46, 46, 39, + 58, 58, 39, 46, 46,110, 97,109,101, 10, 9,101,108,115,101, + 105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10, 9, + 32,114,101,116,117,114,110, 32, 39,115,101,108,102, 45, 62, + 39, 46, 46,110, 97,109,101, 10, 9,101,108,115,101, 10, 9, + 32,114,101,116,117,114,110, 32,110, 97,109,101, 10, 9,101, + 110,100, 10,101,110,100, 10, 10, 45, 45, 32,103,101,116, 32, + 118, 97,114,105, 97, 98,108,101, 32,112,111,105,110,116,101, + 114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, + 58,103,101,116,112,111,105,110,116,101,114,118, 97,108,117, + 101, 32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, + 41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, + 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32, + 114,101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39, + 58, 58,112, 39, 10, 32,101,108,115,101,105,102, 32, 99,108, + 97,115,115, 32,116,104,101,110, 10, 32, 32,114,101,116,117, + 114,110, 32, 39,115,101,108,102, 45, 62,112, 39, 10, 32,101, + 108,115,101, 10, 32, 32,114,101,116,117,114,110, 32, 39,112, + 39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, + 87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32,102, + 117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108, + 101, 58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 10, 32, + 108,111, 99, 97,108, 32, 99,108, 97,115,115, 32, 61, 32,115, + 101,108,102, 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, + 9,108,111, 99, 97,108, 32,112,114,111,112, 95,103,101,116, + 44,112,114,111,112, 95,115,101,116, 10, 9,105,102, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40,115,101,108,102, + 46,109,111,100, 44, 32, 39,116,111,108,117, 97, 95,112,114, + 111,112,101,114,116,121, 39, 41, 32,116,104,101,110, 10, 10, + 9, 9,108,111, 99, 97,108, 32, 95, 44, 95, 44,116,121,112, + 101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, + 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108, + 117, 97, 95,112,114,111,112,101,114,116,121, 95, 95, 40, 91, + 94, 37,115, 93, 42, 41, 34, 41, 10, 9, 9,116,121,112,101, + 32, 61, 32,116,121,112,101, 32,111,114, 32, 34,100,101,102, + 97,117,108,116, 34, 10, 9, 9,112,114,111,112, 95,103,101, + 116, 44,112,114,111,112, 95,115,101,116, 32, 61, 32,103,101, + 116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104, + 111,100,115, 40,116,121,112,101, 44, 32,115,101,108,102, 46, + 110, 97,109,101, 41, 10, 9, 9,115,101,108,102, 46,109,111, + 100, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, + 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108, + 117, 97, 95,112,114,111,112,101,114,116,121, 91, 94, 37,115, + 93, 42, 34, 44, 32, 34, 34, 41, 10, 9,101,110,100, 10, 10, + 32, 45, 45, 32,103,101,116, 32,102,117,110, 99,116,105,111, + 110, 32, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 10, 32,105,102, 32, 99,108, 97,115,115, + 32,116,104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, + 34, 47, 42, 32,103,101,116, 32,102,117,110, 99,116,105,111, + 110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34, + 32,111,102, 32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97, + 115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101, + 10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,103, + 101,116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44,115, + 101,108,102, 46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, + 10, 32,101,110,100, 10, 32,115,101,108,102, 46, 99,103,101, + 116,110, 97,109,101, 32, 61, 32,115,101,108,102, 58, 99,102, + 117,110, 99,110, 97,109,101, 40, 34,116,111,108,117, 97, 95, + 103,101,116, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, + 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, + 73, 83, 65, 66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, + 99,103,101,116,110, 97,109,101, 41, 10, 32,111,117,116,112, + 117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,105,110, + 116, 34, 44,115,101,108,102, 46, 99,103,101,116,110, 97,109, + 101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32, + 116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116, + 112,117,116, 40, 34,123, 34, 41, 10, 10, 32, 45, 45, 32,100, + 101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105,102, + 32,116,104,101, 32, 99, 97,115,101, 10, 32,108,111, 99, 97, + 108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115,101,108,102, 46,109,111, + 100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41, + 39, 41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110, + 100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116, + 104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,116, + 121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32, 61, + 32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 40, + 39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,116, + 121,112,101, 44, 39, 42, 41, 32, 39, 41, 10, 32, 32,108,111, + 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,103, + 101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110, 40, + 115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112, + 101, 41, 10, 32, 32,111,117,116,112,117,116, 40,116,111, 95, + 102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, + 49, 44, 48, 41, 59, 39, 41, 10, 32,101,108,115,101,105,102, + 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32, + 95, 44, 95, 44,115,101,108,102, 46,109,111,100, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115,101,108,102, 46,109,111, + 100, 44, 39, 94, 37,115, 42,115,116, 97,116,105, 99, 37,115, + 37,115, 42, 40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10, + 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,115,101,108, + 102, 32,118, 97,108,117,101, 10, 32,105,102, 32, 99,108, 97, + 115,115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61, + 110,105,108, 32,116,104,101,110, 10, 9, 32,111,117,116,112, + 117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, 32, + 40, 33,115,101,108,102, 41, 32,116,111,108,117, 97, 95,101, + 114,114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, + 46, 46,111,117,116,112,117,116, 95,101,114,114,111,114, 95, + 104,111,111,107, 40, 34,105,110,118, 97,108,105,100, 32, 92, + 39,115,101,108,102, 92, 39, 32,105,110, 32, 97, 99, 99,101, + 115,115,105,110,103, 32,118, 97,114,105, 97, 98,108,101, 32, + 92, 39, 37,115, 92, 39, 34, 44, 32,115,101,108,102, 46,110, + 97,109,101, 41, 46, 46, 39, 34, 44, 78, 85, 76, 76, 41, 59, + 39, 41, 59, 10, 9, 9,111,117,116,112,117,116, 40, 39, 35, + 101,110,100,105,102, 92,110, 39, 41, 10, 32,101,110,100, 10, + 10, 32, 45, 45, 32,114,101,116,117,114,110, 32,118, 97,108, + 117,101, 10, 32,105,102, 32,115,116,114,105,110,103, 46,102, + 105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 32, 39, + 116,111,108,117, 97, 95,105,110,104,101,114,105,116,115, 39, + 41, 32,116,104,101,110, 10, 9,108,111, 99, 97,108, 32,112, + 117,115,104, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95, + 112,117,115,104, 95,102,117,110, 99,116,105,111,110, 40,115, + 101,108,102, 46,116,121,112,101, 41, 10, 32, 9,111,117,116, + 112,117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99, + 112,108,117,115,112,108,117,115, 92,110, 39, 41, 10, 9,111, + 117,116,112,117,116, 40, 39, 32, 32, 39, 44,112,117,115,104, + 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, + 44, 40,118,111,105,100, 42, 41,115,116, 97,116,105, 99, 95, + 99, 97,115,116, 60, 39, 46, 46,115,101,108,102, 46,116,121, + 112,101, 46, 46, 39, 42, 62, 40,115,101,108,102, 41, 44, 32, + 34, 39, 44,115,101,108,102, 46,116,121,112,101, 44, 39, 34, + 41, 59, 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 35, + 101,108,115,101, 92,110, 39, 41, 10, 9,111,117,116,112,117, + 116, 40, 39, 32, 32, 39, 44,112,117,115,104, 95,102,117,110, + 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111, + 105,100, 42, 41, 40, 40, 39, 46, 46,115,101,108,102, 46,116, + 121,112,101, 46, 46, 39, 42, 41,115,101,108,102, 41, 44, 32, + 34, 39, 44,115,101,108,102, 46,116,121,112,101, 44, 39, 34, + 41, 59, 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 35, + 101,110,100,105,102, 92,110, 39, 41, 10, 32,101,108,115,101, + 10, 9,108,111, 99, 97,108, 32,116, 44, 99,116, 32, 61, 32, + 105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121, + 112,101, 41, 10, 9,105,102, 32,116, 32,116,104,101,110, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108, + 117, 97, 95,112,117,115,104, 39, 46, 46,116, 46, 46, 39, 40, + 116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,116, 44, 39, + 41, 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108, + 117,101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, + 44,112,114,111,112, 95,103,101,116, 41, 46, 46, 39, 41, 59, + 39, 41, 10, 9,101,108,115,101, 10, 9, 9,108,111, 99, 97, + 108, 32,112,117,115,104, 95,102,117,110, 99, 32, 61, 32,103, + 101,116, 95,112,117,115,104, 95,102,117,110, 99,116,105,111, + 110, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 9, 9, + 116, 32, 61, 32,115,101,108,102, 46,116,121,112,101, 10, 9, + 9,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, + 32, 39, 38, 39, 32,111,114, 32,115,101,108,102, 46,112,116, + 114, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 9, 9, + 9,111,117,116,112,117,116, 40, 39, 32, 32, 39, 44,112,117, + 115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, + 95, 83, 44, 40,118,111,105,100, 42, 41, 38, 39, 46, 46,115, + 101,108,102, 58,103,101,116,118, 97,108,117,101, 40, 99,108, + 97,115,115, 44,115,116, 97,116,105, 99, 44,112,114,111,112, + 95,103,101,116, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, + 34, 41, 59, 39, 41, 10, 9, 9,101,108,115,101, 10, 9, 9, + 9,111,117,116,112,117,116, 40, 39, 32, 32, 39, 44,112,117, + 115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, + 95, 83, 44, 40,118,111,105,100, 42, 41, 39, 46, 46,115,101, + 108,102, 58,103,101,116,118, 97,108,117,101, 40, 99,108, 97, + 115,115, 44,115,116, 97,116,105, 99, 44,112,114,111,112, 95, + 103,101,116, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, 34, + 41, 59, 39, 41, 10, 9, 9,101,110,100, 10, 9,101,110,100, + 10, 32,101,110,100, 10, 32,111,117,116,112,117,116, 40, 39, + 32,114,101,116,117,114,110, 32, 49, 59, 39, 41, 10, 32,111, + 117,116,112,117,116, 40, 39,125, 39, 41, 10, 32,111,117,116, + 112,117,116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35, + 105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, + 83, 65, 66, 76, 69, 92,110, 39, 41, 10, 32,111,117,116,112, + 117,116, 40, 39, 92,110, 39, 41, 10, 10, 32, 45, 45, 32,115, + 101,116, 32,102,117,110, 99,116,105,111,110, 32, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 10, 32,105,102, 32,110,111,116, 32, 40,115,116,114,102,105, + 110,100, 40,115,101,108,102, 46,116,121,112,101, 44, 39, 99, + 111,110,115,116, 37,115, 43, 39, 41, 32,111,114, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,115,101,108,102, 46, + 109,111,100, 44, 32, 39,116,111,108,117, 97, 95,114,101, 97, + 100,111,110,108,121, 39, 41, 32,111,114, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,115,101,108,102, 46,109,111, + 100, 44, 32, 39,116,111,108,117, 97, 95,105,110,104,101,114, + 105,116,115, 39, 41, 41, 32, 32,116,104,101,110, 10, 32, 32, + 105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10, 32, + 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,115,101, + 116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44,115,101, + 108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108, + 97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42, + 47, 34, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111, + 117,116,112,117,116, 40, 34, 47, 42, 32,115,101,116, 32,102, + 117,110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, 46, + 110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32,101, + 110,100, 10, 32, 32,115,101,108,102, 46, 99,115,101,116,110, + 97,109,101, 32, 61, 32,115,101,108,102, 58, 99,102,117,110, + 99,110, 97,109,101, 40, 34,116,111,108,117, 97, 95,115,101, + 116, 34, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, 35, + 105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, + 83, 65, 66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, 99, + 115,101,116,110, 97,109,101, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,105,110, + 116, 34, 44,115,101,108,102, 46, 99,115,101,116,110, 97,109, + 101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32, + 116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 34,123, 34, 41, 10, 10, 32, 32, 45, 45, + 32,100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32, + 105,102, 32,116,104,101, 32, 99, 97,115,101, 10, 32, 32,105, + 102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116, 97, + 116,105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10, 32, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101, + 108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 44, + 39, 42, 39, 44, 39,115,101,108,102, 32, 61, 32, 39, 41, 10, + 32, 32, 32,111,117,116,112,117,116, 40, 39, 40, 39, 44,115, + 101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, + 44, 39, 42, 41, 32, 39, 41, 10, 32, 32, 32,108,111, 99, 97, + 108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, + 95,116,111, 95,102,117,110, 99,116,105,111,110, 40,115,101, + 108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 41, + 10, 32, 32, 32,111,117,116,112,117,116, 40,116,111, 95,102, + 117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, + 44, 48, 41, 59, 39, 41, 10, 32, 32, 32, 45, 45, 32, 99,104, + 101, 99,107, 32,115,101,108,102, 32,118, 97,108,117,101, 10, + 9, 9,101,110,100, 10, 32, 32, 45, 45, 32, 99,104,101, 99, + 107, 32,116,121,112,101,115, 10, 9, 9,111,117,116,112,117, + 116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, + 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9, + 9,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108,117, + 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, 95,101, + 114,114, 59, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115, + 115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,110, + 105,108, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,102, + 41, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116, + 111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,111,117,116,112, + 117,116, 95,101,114,114,111,114, 95,104,111,111,107, 40, 34, + 105,110,118, 97,108,105,100, 32, 92, 39,115,101,108,102, 92, + 39, 32,105,110, 32, 97, 99, 99,101,115,115,105,110,103, 32, + 118, 97,114,105, 97, 98,108,101, 32, 92, 39, 37,115, 92, 39, + 34, 44, 32,115,101,108,102, 46,110, 97,109,101, 41, 46, 46, + 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 59, 10, 32, 32, + 101,108,115,101,105,102, 32,115,116, 97,116,105, 99, 32,116, + 104,101,110, 10, 32, 32, 32, 95, 44, 95, 44,115,101,108,102, + 46,109,111,100, 32, 61, 32,115,116,114,102,105,110,100, 40, + 115,101,108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115, + 116, 97,116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, + 41, 10, 32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32, 99, + 104,101, 99,107, 32,118, 97,114,105, 97, 98,108,101, 32,116, + 121,112,101, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32,105,102, 32, 40, 39, 46, 46,115,101,108,102, 58,111,117, + 116, 99,104,101, 99,107,116,121,112,101, 40, 50, 41, 46, 46, + 39, 41, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40, + 116,111,108,117, 97, 95, 83, 44, 34, 35,118,105,110,118, 97, + 108,105,100, 32,116,121,112,101, 32,105,110, 32,118, 97,114, + 105, 97, 98,108,101, 32, 97,115,115,105,103,110,109,101,110, + 116, 46, 34, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, + 59, 39, 41, 10, 9, 9,111,117,116,112,117,116, 40, 39, 35, + 101,110,100,105,102, 92,110, 39, 41, 10, 10, 32, 32, 45, 45, + 32, 97,115,115,105,103,110, 32,118, 97,108,117,101, 10, 9, + 9,108,111, 99, 97,108, 32,100,101,102, 32, 61, 32, 48, 10, + 9, 9,105,102, 32,115,101,108,102, 46,100,101,102, 32,126, + 61, 32, 39, 39, 32,116,104,101,110, 32,100,101,102, 32, 61, + 32,115,101,108,102, 46,100,101,102, 32,101,110,100, 10, 9, + 9,105,102, 32,115,101,108,102, 46,116,121,112,101, 32, 61, + 61, 32, 39, 99,104, 97,114, 42, 39, 32, 97,110,100, 32,115, + 101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116, + 104,101,110, 32, 45, 45, 32,105,115, 32,115,116,114,105,110, + 103, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32,115, + 116,114,110, 99,112,121, 40, 40, 99,104, 97,114, 42, 41, 39, + 41, 10, 9, 9, 9,105,102, 32, 99,108, 97,115,115, 32, 97, + 110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, + 9, 9, 9, 9,111,117,116,112,117,116, 40,115,101,108,102, + 46,112, 97,114,101,110,116, 46,116,121,112,101, 46, 46, 39, + 58, 58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 41, + 10, 9, 9, 9,101,108,115,101,105,102, 32, 99,108, 97,115, + 115, 32,116,104,101,110, 10, 9, 9, 9, 9,111,117,116,112, + 117,116, 40, 39,115,101,108,102, 45, 62, 39, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 41, 10, 9, 9, 9,101,108,115, + 101, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40,115,101, + 108,102, 46,110, 97,109,101, 41, 10, 9, 9, 9,101,110,100, + 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 44, 40, 99, + 111,110,115,116, 32, 99,104, 97,114, 42, 41,116,111,108,117, + 97, 95,116,111,115,116,114,105,110,103, 40,116,111,108,117, + 97, 95, 83, 44, 50, 44, 39, 44,100,101,102, 44, 39, 41, 44, + 39, 44,115,101,108,102, 46,100,105,109, 44, 39, 45, 49, 41, + 59, 39, 41, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,108, + 111, 99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10, 9, + 9, 9,105,102, 32,115,101,108,102, 46,112,116,114,126, 61, + 39, 39, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39, + 42, 39, 32,101,110,100, 10, 9, 9, 9,111,117,116,112,117, + 116, 40, 39, 32, 39, 41, 10, 9, 9, 9,108,111, 99, 97,108, + 32,110, 97,109,101, 32, 61, 32,112,114,111,112, 95,115,101, + 116, 32,111,114, 32,115,101,108,102, 46,110, 97,109,101, 10, + 9, 9, 9,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, + 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 9, 9, + 9, 9,111,117,116,112,117,116, 40,115,101,108,102, 46,112, + 97,114,101,110,116, 46,116,121,112,101, 46, 46, 39, 58, 58, + 39, 46, 46,110, 97,109,101, 41, 10, 9, 9, 9,101,108,115, + 101,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10, + 9, 9, 9, 9,111,117,116,112,117,116, 40, 39,115,101,108, + 102, 45, 62, 39, 46, 46,110, 97,109,101, 41, 10, 9, 9, 9, + 101,108,115,101, 10, 9, 9, 9, 9,111,117,116,112,117,116, + 40,110, 97,109,101, 41, 10, 9, 9, 9,101,110,100, 10, 9, + 9, 9,108,111, 99, 97,108, 32,116, 32, 61, 32,105,115, 98, + 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, + 10, 9, 9, 9,105,102, 32,112,114,111,112, 95,115,101,116, + 32,116,104,101,110, 10, 9, 9, 9, 9,111,117,116,112,117, + 116, 40, 39, 40, 39, 41, 10, 9, 9, 9,101,108,115,101, 10, + 9, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, 61, 32, + 39, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, 9,105,102, + 32,110,111,116, 32,116, 32, 97,110,100, 32,112,116,114, 61, + 61, 39, 39, 32,116,104,101,110, 32,111,117,116,112,117,116, + 40, 39, 42, 39, 41, 32,101,110,100, 10, 9, 9, 9,111,117, + 116,112,117,116, 40, 39, 40, 40, 39, 44,115,101,108,102, 46, + 109,111,100, 44,115,101,108,102, 46,116,121,112,101, 41, 10, + 9, 9, 9,105,102, 32,110,111,116, 32,116, 32,116,104,101, + 110, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40, 39, 42, + 39, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, 9,111,117, + 116,112,117,116, 40, 39, 41, 32, 39, 41, 10, 9, 9, 9,105, + 102, 32,116, 32,116,104,101,110, 10, 9, 9, 9, 9,105,102, + 32,105,115,101,110,117,109, 40,115,101,108,102, 46,116,121, + 112,101, 41, 32,116,104,101,110, 10, 9, 9, 9, 9, 9,111, + 117,116,112,117,116, 40, 39, 40,105,110,116, 41, 32, 39, 41, + 10, 9, 9, 9, 9,101,110,100, 10, 9, 9, 9, 9,111,117, + 116,112,117,116, 40, 39,116,111,108,117, 97, 95,116,111, 39, + 46, 46,116, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 50, + 44, 39, 44,100,101,102, 44, 39, 41, 41, 39, 41, 10, 9, 9, + 9,101,108,115,101, 10, 9, 9, 9, 9,108,111, 99, 97,108, + 32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95, + 116,111, 95,102,117,110, 99,116,105,111,110, 40,115,101,108, + 102, 46,116,121,112,101, 41, 10, 9, 9, 9, 9,111,117,116, + 112,117,116, 40,116,111, 95,102,117,110, 99, 44, 39, 40,116, + 111,108,117, 97, 95, 83, 44, 50, 44, 39, 44,100,101,102, 44, + 39, 41, 41, 39, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, + 9,105,102, 32,112,114,111,112, 95,115,101,116, 32,116,104, + 101,110, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40, 34, + 41, 34, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, 9,111, + 117,116,112,117,116, 40, 34, 59, 34, 41, 10, 9, 9,101,110, + 100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,114,101, + 116,117,114,110, 32, 48, 59, 39, 41, 10, 32, 32,111,117,116, + 112,117,116, 40, 39,125, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105, + 102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, + 65, 66, 76, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10, 10, + 101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99, + 108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 58,114,101, + 103,105,115,116,101,114, 32, 40,112,114,101, 41, 10, 10, 9, + 105,102, 32,110,111,116, 32,115,101,108,102, 58, 99,104,101, + 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115, + 115, 40, 41, 32,116,104,101,110, 10, 9, 9,114,101,116,117, + 114,110, 10, 9,101,110,100, 10, 32,112,114,101, 32, 61, 32, + 112,114,101, 32,111,114, 32, 39, 39, 10, 32,108,111, 99, 97, + 108, 32,112, 97,114,101,110,116, 32, 61, 32,115,101,108,102, + 58,105,110,109,111,100,117,108,101, 40, 41, 32,111,114, 32, + 115,101,108,102, 58,105,110,110, 97,109,101,115,112, 97, 99, + 101, 40, 41, 32,111,114, 32,115,101,108,102, 58,105,110, 99, + 108, 97,115,115, 40, 41, 10, 32,105,102, 32,110,111,116, 32, + 112, 97,114,101,110,116, 32,116,104,101,110, 10, 32, 32,105, + 102, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, + 46, 95,119, 97,114,110,105,110,103, 61, 61,110,105,108, 32, + 116,104,101,110, 10, 32, 32, 32,119, 97,114,110,105,110,103, + 40, 34, 77, 97,112,112,105,110,103, 32,118, 97,114,105, 97, + 98,108,101, 32,116,111, 32,103,108,111, 98, 97,108, 32,109, + 97,121, 32,100,101,103,114, 97,100,101, 32,112,101,114,102, + 111,114,109, 97,110, 99,101, 34, 41, 10, 32, 32, 32, 99,108, + 97,115,115, 86, 97,114,105, 97, 98,108,101, 46, 95,119, 97, + 114,110,105,110,103, 32, 61, 32, 49, 10, 32, 32,101,110,100, + 10, 32,101,110,100, 10, 32,105,102, 32,115,101,108,102, 46, + 99,115,101,116,110, 97,109,101, 32,116,104,101,110, 10, 32, + 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116, + 111,108,117, 97, 95,118, 97,114,105, 97, 98,108,101, 40,116, + 111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, + 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46, 46,115, + 101,108,102, 46, 99,103,101,116,110, 97,109,101, 46, 46, 39, + 44, 39, 46, 46,115,101,108,102, 46, 99,115,101,116,110, 97, + 109,101, 46, 46, 39, 41, 59, 39, 41, 10, 32,101,108,115,101, + 10, 32, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, + 39,116,111,108,117, 97, 95,118, 97,114,105, 97, 98,108,101, + 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101, + 108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46, + 46,115,101,108,102, 46, 99,103,101,116,110, 97,109,101, 46, + 46, 39, 44, 78, 85, 76, 76, 41, 59, 39, 41, 10, 32,101,110, + 100, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,116,101,114, + 110, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114, + 10,102,117,110, 99,116,105,111,110, 32, 95, 86, 97,114,105, + 97, 98,108,101, 32, 40,116, 41, 10, 32,115,101,116,109,101, + 116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, + 86, 97,114,105, 97, 98,108,101, 41, 10, 32, 97,112,112,101, + 110,100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116, + 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114, + 117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116, + 115, 32, 97, 32,115,116,114,105,110,103, 32,114,101,112,114, + 101,115,101,110,116,105,110,103, 32,116,104,101, 32,118, 97, + 114,105, 97, 98,108,101, 32,100,101, 99,108, 97,114, 97,116, + 105,111,110, 46, 10,102,117,110, 99,116,105,111,110, 32, 86, + 97,114,105, 97, 98,108,101, 32, 40,115, 41, 10, 32,114,101, + 116,117,114,110, 32, 95, 86, 97,114,105, 97, 98,108,101, 32, + 40, 68,101, 99,108, 97,114, 97,116,105,111,110, 40,115, 44, + 39,118, 97,114, 39, 41, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/variable.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 97,114,114, 97,121, + 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116, + 101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, + 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97, + 102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117, + 108, 32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32, + 97,114,114, 97,121, 46,108,117, 97, 44,118, 32, 49, 46, 49, + 32, 50, 48, 48, 48, 47, 49, 49, 47, 48, 54, 32, 50, 50, 58, + 48, 51, 58, 53, 55, 32, 99,101,108,101,115, 32, 69,120,112, + 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100, + 101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, + 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101, + 100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97, + 110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, + 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97, + 114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114, + 101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, + 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, + 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116, + 104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105, + 103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105, + 100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, + 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116, + 101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109, + 101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, + 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 65, + 114,114, 97,121, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82, + 101,112,114,101,115,101,110,116,115, 32, 97, 32,101,120,116, + 101,114,110, 32, 97,114,114, 97,121, 32,118, 97,114,105, 97, + 98,108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99, + 32,109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108, + 97,115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32, + 97,108,108, 32,102,105,101,108,100,115, 32,112,114,101,115, + 101,110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114, + 97,116,105,111,110, 46, 10, 99,108, 97,115,115, 65,114,114, + 97,121, 32, 61, 32,123, 10,125, 10, 99,108, 97,115,115, 65, + 114,114, 97,121, 46, 95, 95,105,110,100,101,120, 32, 61, 32, + 99,108, 97,115,115, 65,114,114, 97,121, 10,115,101,116,109, + 101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 65, + 114,114, 97,121, 44, 99,108, 97,115,115, 68,101, 99,108, 97, + 114, 97,116,105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105, + 110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58, + 112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108, + 111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 65,114,114, 97,121,123, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, + 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,116,121, + 112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,116, + 121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105, + 110,116, 40,105,100,101,110,116, 46, 46, 34, 32,112,116,114, + 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,112,116, + 114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, + 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, 32, + 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,101, + 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 32,100,101,102, 32, 32, 61, + 32, 39, 34, 46, 46,115,101,108,102, 46,100,101,102, 46, 46, + 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100, + 101,110,116, 46, 46, 34, 32,100,105,109, 32, 32, 61, 32, 39, + 34, 46, 46,115,101,108,102, 46,100,105,109, 46, 46, 34, 39, + 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32,114,101,116, 32, 32, 61, 32, 39, 34, 46, + 46,115,101,108,102, 46,114,101,116, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110, + 100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32, + 105,116, 32,105,115, 32, 97, 32,118, 97,114,105, 97, 98,108, + 101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 65,114,114, 97,121, 58,105,115,118, 97,114,105, 97, 98, + 108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110, 32,116, + 114,117,101, 10,101,110,100, 10, 10, 10, 45, 45, 32,103,101, + 116, 32,118, 97,114,105, 97, 98,108,101, 32,118, 97,108,117, + 101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 65,114,114, 97,121, 58,103,101,116,118, 97,108,117,101, + 32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 41, + 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32, + 115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,114, + 101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39, 58, + 58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, + 39, 91,116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, + 10, 32,101,108,115,101,105,102, 32, 99,108, 97,115,115, 32, + 116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 39, + 115,101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110, + 100,101,120, 93, 39, 10, 32,101,108,115,101, 10, 32, 32,114, + 101,116,117,114,110, 32,115,101,108,102, 46,110, 97,109,101, + 46, 46, 39, 91,116,111,108,117, 97, 95,105,110,100,101,120, + 93, 39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, + 32, 87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32, + 102,117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58, + 115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,108,111, 99, + 97,108, 32, 99,108, 97,115,115, 32, 61, 32,115,101,108,102, + 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32, 45, 45, + 32,103,101,116, 32,102,117,110, 99,116,105,111,110, 32, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104, + 101,110, 10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, + 32,103,101,116, 32,102,117,110, 99,116,105,111,110, 58, 34, + 44,115,101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102, + 32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, + 34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101, 10, 32, 32, + 111,117,116,112,117,116, 40, 34, 47, 42, 32,103,101,116, 32, + 102,117,110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, + 46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101, + 110,100, 10, 32,115,101,108,102, 46, 99,103,101,116,110, 97, + 109,101, 32, 61, 32,115,101,108,102, 58, 99,102,117,110, 99, + 110, 97,109,101, 40, 34,116,111,108,117, 97, 95,103,101,116, + 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102, + 110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, + 66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, 99,103,101, + 116,110, 97,109,101, 41, 10, 32,111,117,116,112,117,116, 40, + 34, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 34, 44, + 115,101,108,102, 46, 99,103,101,116,110, 97,109,101, 44, 34, + 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108, + 117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116,112,117,116, + 40, 34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, + 32,105,110,116, 32,116,111,108,117, 97, 95,105,110,100,101, + 120, 59, 34, 41, 10, 10, 32, 45, 45, 32,100,101, 99,108, 97, + 114,101, 32,115,101,108,102, 44, 32,105,102, 32,116,104,101, + 32, 99, 97,115,101, 10, 32,108,111, 99, 97,108, 32, 95, 44, + 95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116,114,102, + 105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, 94, + 37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41, 10, 32, + 105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116, + 97,116,105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101, + 108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 44, + 39, 42, 39, 44, 39,115,101,108,102, 59, 39, 41, 10, 32, 32, + 111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,112,117, + 115,104,115,116,114,105,110,103, 40,116,111,108,117, 97, 95, + 83, 44, 34, 46,115,101,108,102, 34, 41, 59, 39, 41, 10, 32, + 32,111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,114, + 97,119,103,101,116, 40,116,111,108,117, 97, 95, 83, 44, 49, + 41, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32,115,101,108,102, 32, 61, 32, 39, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 39, 40, 39, 44,115,101,108,102, 46,112, + 97,114,101,110,116, 46,116,121,112,101, 44, 39, 42, 41, 32, + 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,108,117, + 97, 95,116,111,117,115,101,114,100, 97,116, 97, 40,116,111, + 108,117, 97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32,101, + 108,115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104, + 101,110, 10, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109, + 111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101, + 108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97, + 116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10, + 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, + 32,105,110,100,101,120, 10, 9,111,117,116,112,117,116, 40, + 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, + 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9,111,117, + 116,112,117,116, 40, 39, 32,123, 39, 41, 10, 9,111,117,116, + 112,117,116, 40, 39, 32, 32,116,111,108,117, 97, 95, 69,114, + 114,111,114, 32,116,111,108,117, 97, 95,101,114,114, 59, 39, + 41, 10, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, + 32, 40, 33,116,111,108,117, 97, 95,105,115,110,117,109, 98, + 101,114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 44, + 38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39, 41, 10, + 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,108, + 117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95, + 83, 44, 34, 35,118,105,110,118, 97,108,105,100, 32,116,121, + 112,101, 32,105,110, 32, 97,114,114, 97,121, 32,105,110,100, + 101,120,105,110,103, 46, 34, 44, 38,116,111,108,117, 97, 95, + 101,114,114, 41, 59, 39, 41, 10, 9,111,117,116,112,117,116, + 40, 39, 32,125, 39, 41, 10, 9,111,117,116,112,117,116, 40, + 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 9,105,102, + 32,102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,104,101, + 110, 32, 45, 45, 32,102,111,114, 32, 99,111,109,112, 97,116, + 105, 98,105,108,105,116,121, 32,119,105,116,104, 32,116,111, + 108,117, 97, 53, 32, 63, 10, 9, 9,111,117,116,112,117,116, + 40, 39, 32,116,111,108,117, 97, 95,105,110,100,101,120, 32, + 61, 32, 40,105,110,116, 41,116,111,108,117, 97, 95,116,111, + 110,117,109, 98,101,114, 40,116,111,108,117, 97, 95, 83, 44, + 50, 44, 48, 41, 45, 49, 59, 39, 41, 10, 9,101,108,115,101, + 10, 9, 9,111,117,116,112,117,116, 40, 39, 32,116,111,108, + 117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110,116, + 41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101,114, + 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 59, 39, + 41, 10, 9,101,110,100, 10, 9,111,117,116,112,117,116, 40, + 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, + 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9,105,102, + 32,115,101,108,102, 46,100,105,109, 32, 97,110,100, 32,115, + 101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116, + 104,101,110, 10, 9, 32, 32,111,117,116,112,117,116, 40, 39, + 32,105,102, 32, 40,116,111,108,117, 97, 95,105,110,100,101, + 120, 60, 48, 32,124,124, 32,116,111,108,117, 97, 95,105,110, + 100,101,120, 62, 61, 39, 46, 46,115,101,108,102, 46,100,105, + 109, 46, 46, 39, 41, 39, 41, 10, 9,101,108,115,101, 10, 9, + 32, 32,111,117,116,112,117,116, 40, 39, 32,105,102, 32, 40, + 116,111,108,117, 97, 95,105,110,100,101,120, 60, 48, 41, 39, + 41, 10, 9,101,110,100, 10, 32,111,117,116,112,117,116, 40, + 39, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40, + 116,111,108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32, + 105,110,100,101,120,105,110,103, 32,111,117,116, 32,111,102, + 32,114, 97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59, + 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 35,101,110, + 100,105,102, 92,110, 39, 41, 10, 10, 32, 45, 45, 32,114,101, + 116,117,114,110, 32,118, 97,108,117,101, 10, 32,108,111, 99, + 97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115, + 105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, + 108,111, 99, 97,108, 32,112,117,115,104, 95,102,117,110, 99, + 32, 61, 32,103,101,116, 95,112,117,115,104, 95,102,117,110, + 99,116,105,111,110, 40,116, 41, 10, 32,105,102, 32,116, 32, + 116,104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46,116, + 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, + 99,116, 44, 39, 41, 39, 46, 46,115,101,108,102, 58,103,101, + 116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116, + 97,116,105, 99, 41, 46, 46, 39, 41, 59, 39, 41, 10, 32,101, + 108,115,101, 10, 9, 9,116, 32, 61, 32,115,101,108,102, 46, + 116,121,112,101, 10, 32, 32,105,102, 32,115,101,108,102, 46, + 112,116,114, 32, 61, 61, 32, 39, 38, 39, 32,111,114, 32,115, + 101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116, + 104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40, + 116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, + 38, 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108, + 117,101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, + 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, + 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116, + 112,117,116, 40, 39, 32, 39, 44,112,117,115,104, 95,102,117, + 110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118, + 111,105,100, 42, 41, 39, 46, 46,115,101,108,102, 58,103,101, + 116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116, + 97,116,105, 99, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, + 34, 41, 59, 39, 41, 10, 32, 32,101,110,100, 10, 32,101,110, + 100, 10, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116, + 117,114,110, 32, 49, 59, 39, 41, 10, 32,111,117,116,112,117, + 116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40, + 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,110,100, + 101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, + 69, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39, + 92,110, 39, 41, 10, 10, 32, 45, 45, 32,115,101,116, 32,102, + 117,110, 99,116,105,111,110, 32, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 32,105,102, + 32,110,111,116, 32,115,116,114,102,105,110,100, 40,115,101, + 108,102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 39, + 41, 32,116,104,101,110, 10, 32, 32,105,102, 32, 99,108, 97, + 115,115, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112, + 117,116, 40, 34, 47, 42, 32,115,101,116, 32,102,117,110, 99, + 116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, 97,109, + 101, 44, 34, 32,111,102, 32, 99,108, 97,115,115, 32, 34, 44, + 99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32, + 101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40, + 34, 47, 42, 32,115,101,116, 32,102,117,110, 99,116,105,111, + 110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34, + 32, 42, 47, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,115, + 101,108,102, 46, 99,115,101,116,110, 97,109,101, 32, 61, 32, + 115,101,108,102, 58, 99,102,117,110, 99,110, 97,109,101, 40, + 34,116,111,108,117, 97, 95,115,101,116, 34, 41, 10, 32, 32, + 111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,102, + 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, + 34, 46, 46,115,101,108,102, 46, 99,115,101,116,110, 97,109, + 101, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, 92,110, + 115,116, 97,116,105, 99, 32,105,110,116, 34, 44,115,101,108, + 102, 46, 99,115,101,116,110, 97,109,101, 44, 34, 40,108,117, + 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95, + 83, 41, 34, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, + 123, 34, 41, 10, 10, 32, 32, 45, 45, 32,100,101, 99,108, 97, + 114,101, 32,105,110,100,101,120, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 32,105,110,116, 32,116,111,108,117, 97, 95, + 105,110,100,101,120, 59, 39, 41, 10, 10, 32, 32, 45, 45, 32, + 100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105, + 102, 32,116,104,101, 32, 99, 97,115,101, 10, 32, 32,108,111, + 99, 97,108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32, + 61, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, + 109,111,100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105, + 99, 41, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115, + 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,110,105, + 108, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 32, 39, 44,115,101,108,102, 46,112, 97,114,101, + 110,116, 46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101, + 108,102, 59, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116, + 40, 39, 32,108,117, 97, 95,112,117,115,104,115,116,114,105, + 110,103, 40,116,111,108,117, 97, 95, 83, 44, 34, 46,115,101, + 108,102, 34, 41, 59, 39, 41, 10, 32, 32, 32,111,117,116,112, + 117,116, 40, 39, 32,108,117, 97, 95,114, 97,119,103,101,116, + 40,116,111,108,117, 97, 95, 83, 44, 49, 41, 59, 39, 41, 10, + 32, 32, 32,111,117,116,112,117,116, 40, 39, 32,115,101,108, + 102, 32, 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 40, 39, 44,115,101,108,102, 46,112, 97,114,101, + 110,116, 46,116,121,112,101, 44, 39, 42, 41, 32, 39, 41, 10, + 32, 32, 32,111,117,116,112,117,116, 40, 39,108,117, 97, 95, + 116,111,117,115,101,114,100, 97,116, 97, 40,116,111,108,117, + 97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32, 32,101,108, + 115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104,101, + 110, 10, 32, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109, + 111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101, + 108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97, + 116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10, + 32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32, 99,104,101, + 99,107, 32,105,110,100,101,120, 10, 9, 32,111,117,116,112, + 117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, + 9, 32,111,117,116,112,117,116, 40, 39, 32,123, 39, 41, 10, + 9, 32,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108, + 117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, 95, + 101,114,114, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 32,105,102, 32, 40, 33,116,111,108,117, 97, 95, + 105,115,110,117,109, 98,101,114, 40,116,111,108,117, 97, 95, + 83, 44, 50, 44, 48, 44, 38,116,111,108,117, 97, 95,101,114, + 114, 41, 41, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, + 39, 32, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, + 40,116,111,108,117, 97, 95, 83, 44, 34, 35,118,105,110,118, + 97,108,105,100, 32,116,121,112,101, 32,105,110, 32, 97,114, + 114, 97,121, 32,105,110,100,101,120,105,110,103, 46, 34, 44, + 38,116,111,108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 32,125, 39, 41, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 35,101,110,100,105, + 102, 92,110, 39, 41, 10, 10, 9,105,102, 32,102,108, 97,103, + 115, 91, 39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45, 32, + 102,111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105, + 116,121, 32,119,105,116,104, 32,116,111,108,117, 97, 53, 32, + 63, 10, 9, 9,111,117,116,112,117,116, 40, 39, 32,116,111, + 108,117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110, + 116, 41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101, + 114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 45, + 49, 59, 39, 41, 10, 9,101,108,115,101, 10, 9, 9,111,117, + 116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,105,110, + 100,101,120, 32, 61, 32, 40,105,110,116, 41,116,111,108,117, + 97, 95,116,111,110,117,109, 98,101,114, 40,116,111,108,117, + 97, 95, 83, 44, 50, 44, 48, 41, 59, 39, 41, 10, 9,101,110, + 100, 10, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,105, + 102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, + 69, 65, 83, 69, 92,110, 39, 41, 10, 9,105,102, 32,115,101, + 108,102, 46,100,105,109, 32, 97,110,100, 32,115,101,108,102, + 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110, + 10, 9, 32, 32,111,117,116,112,117,116, 40, 39, 32,105,102, + 32, 40,116,111,108,117, 97, 95,105,110,100,101,120, 60, 48, + 32,124,124, 32,116,111,108,117, 97, 95,105,110,100,101,120, + 62, 61, 39, 46, 46,115,101,108,102, 46,100,105,109, 46, 46, + 39, 41, 39, 41, 10, 9,101,108,115,101, 10, 9, 32, 32,111, + 117,116,112,117,116, 40, 39, 32,105,102, 32, 40,116,111,108, + 117, 97, 95,105,110,100,101,120, 60, 48, 41, 39, 41, 10, 9, + 101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111, + 108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32,105,110, + 100,101,120,105,110,103, 32,111,117,116, 32,111,102, 32,114, + 97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, + 10, 9, 9,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 10, 10, 32, 32, 45, 45, 32, 97,115, + 115,105,103,110, 32,118, 97,108,117,101, 10, 32, 32,108,111, + 99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10, 32, 32, + 105,102, 32,115,101,108,102, 46,112,116,114,126, 61, 39, 39, + 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39, 42, 39, + 32,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32, + 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,110, + 10, 32, 32, 32,111,117,116,112,117,116, 40, 99,108, 97,115, + 115, 46, 46, 39, 58, 58, 39, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110, + 100,101,120, 93, 39, 41, 10, 32, 32,101,108,115,101,105,102, + 32, 99,108, 97,115,115, 32,116,104,101,110, 10, 32, 32, 32, + 111,117,116,112,117,116, 40, 39,115,101,108,102, 45, 62, 39, + 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91, + 116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10, + 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112,117, + 116, 40,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91, + 116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10, + 32, 32,101,110,100, 10, 32, 32,108,111, 99, 97,108, 32,116, + 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, + 46,116,121,112,101, 41, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 61, 32, 39, 41, 10, 32, 32,105,102, 32,110,111, + 116, 32,116, 32, 97,110,100, 32,112,116,114, 61, 61, 39, 39, + 32,116,104,101,110, 32,111,117,116,112,117,116, 40, 39, 42, + 39, 41, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 40, 40, 39, 44,115,101,108,102, 46,109,111,100, 44, + 115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102, + 32,110,111,116, 32,116, 32,116,104,101,110, 10, 32, 32, 32, + 111,117,116,112,117,116, 40, 39, 42, 39, 41, 10, 32, 32,101, + 110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 41, 32, + 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,100,101,102, 32, + 61, 32, 48, 10, 32, 32,105,102, 32,115,101,108,102, 46,100, + 101,102, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 32,100, + 101,102, 32, 61, 32,115,101,108,102, 46,100,101,102, 32,101, + 110,100, 10, 32, 32,105,102, 32,116, 32,116,104,101,110, 10, + 32, 32, 32,111,117,116,112,117,116, 40, 39,116,111,108,117, + 97, 95,116,111, 39, 46, 46,116, 44, 39, 40,116,111,108,117, + 97, 95, 83, 44, 51, 44, 39, 44,100,101,102, 44, 39, 41, 41, + 59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,108, + 111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32, + 103,101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110, + 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32, 32, + 111,117,116,112,117,116, 40,116,111, 95,102,117,110, 99, 44, + 39, 40,116,111,108,117, 97, 95, 83, 44, 51, 44, 39, 44,100, + 101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32,101,110,100, + 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116, + 117,114,110, 32, 48, 59, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39,125, 39, 41, 10, 32, 32,111,117,116,112,117, + 116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102, + 110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, + 66, 76, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117, + 116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10, 10,101, + 110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 65,114,114, 97,121, 58,114,101,103,105,115,116, + 101,114, 32, 40,112,114,101, 41, 10, 9,105,102, 32,110,111, + 116, 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, + 98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116, + 104,101,110, 10, 9, 9,114,101,116,117,114,110, 10, 9,101, + 110,100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32, + 111,114, 32, 39, 39, 10, 32,105,102, 32,115,101,108,102, 46, + 99,115,101,116,110, 97,109,101, 32,116,104,101,110, 10, 32, + 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116, + 111,108,117, 97, 95, 97,114,114, 97,121, 40,116,111,108,117, + 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, + 97,109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102, + 46, 99,103,101,116,110, 97,109,101, 46, 46, 39, 44, 39, 46, + 46,115,101,108,102, 46, 99,115,101,116,110, 97,109,101, 46, + 46, 39, 41, 59, 39, 41, 10, 32,101,108,115,101, 10, 32, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111, + 108,117, 97, 95, 97,114,114, 97,121, 40,116,111,108,117, 97, + 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97, + 109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102, 46, + 99,103,101,116,110, 97,109,101, 46, 46, 39, 44, 78, 85, 76, + 76, 41, 59, 39, 41, 10, 32,101,110,100, 10,101,110,100, 10, + 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111, + 110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116, + 105,111,110, 32, 95, 65,114,114, 97,121, 32, 40,116, 41, 10, + 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, + 44, 99,108, 97,115,115, 65,114,114, 97,121, 41, 10, 32, 97, + 112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114, + 110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110, + 115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112, + 101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114, + 101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101, + 32,118, 97,114,105, 97, 98,108,101, 32,100,101, 99,108, 97, + 114, 97,116,105,111,110, 46, 10,102,117,110, 99,116,105,111, + 110, 32, 65,114,114, 97,121, 32, 40,115, 41, 10, 32,114,101, + 116,117,114,110, 32, 95, 65,114,114, 97,121, 32, 40, 68,101, + 99,108, 97,114, 97,116,105,111,110, 40,115, 44, 39,118, 97, + 114, 39, 41, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/array.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73, + 100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99, + 111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102, + 116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32, + 114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, + 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32, + 105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116, + 119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104, + 101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, + 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105, + 115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97, + 117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98, + 108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111, + 118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99, + 101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, + 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99, + 101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105, + 102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, + 45, 32, 70,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, + 32, 97, 32,102,117,110, 99,116,105,111,110, 32,111,114, 32, + 97, 32, 99,108, 97,115,115, 32,109,101,116,104,111,100, 46, + 10, 45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105, + 110,103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115, + 116,111,114,101,100, 58, 10, 45, 45, 32, 32,109,111,100, 32, + 32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105,101, + 114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32,116, + 121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61, 32, + 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102, 32, + 114,101,112,114,101,115,101,110,116,105,110,103, 32, 97, 32, + 112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114,101, + 102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97,109, + 101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,108,110, + 97,109,101, 32, 61, 32,108,117, 97, 32,110, 97,109,101, 10, + 45, 45, 32, 32, 97,114,103,115, 32, 32, 61, 32,108,105,115, + 116, 32,111,102, 32, 97,114,103,117,109,101,110,116, 32,100, + 101, 99,108, 97,114, 97,116,105,111,110,115, 10, 45, 45, 32, + 32, 99,111,110,115,116, 32, 61, 32,105,102, 32,105,116, 32, + 105,115, 32, 97, 32,109,101,116,104,111,100, 32,114,101, 99, + 101,105,118,105,110,103, 32, 97, 32, 99,111,110,115,116, 32, + 34,116,104,105,115, 34, 46, 10, 99,108, 97,115,115, 70,117, + 110, 99,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100, + 32, 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, + 39, 39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10, + 32,110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32, 97,114, + 103,115, 32, 61, 32,123,110, 61, 48,125, 44, 10, 32, 99,111, + 110,115,116, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97, + 115,115, 70,117,110, 99,116,105,111,110, 46, 95, 95,105,110, + 100,101,120, 32, 61, 32, 99,108, 97,115,115, 70,117,110, 99, + 116,105,111,110, 10,115,101,116,109,101,116, 97,116, 97, 98, + 108,101, 40, 99,108, 97,115,115, 70,117,110, 99,116,105,111, + 110, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41, + 10, 10, 45, 45, 32,100,101, 99,108, 97,114,101, 32,116, 97, + 103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 70,117,110, 99,116,105,111,110, 58,100,101, 99,108, + 116,121,112,101, 32, 40, 41, 10, 32,115,101,108,102, 46,116, + 121,112,101, 32, 61, 32,116,121,112,101,118, 97,114, 40,115, + 101,108,102, 46,116,121,112,101, 41, 10, 32,105,102, 32,115, + 116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, + 44, 39, 99,111,110,115,116, 39, 41, 32,116,104,101,110, 10, + 9, 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32, 39, + 99,111,110,115,116, 32, 39, 46, 46,115,101,108,102, 46,116, + 121,112,101, 10, 9, 9,115,101,108,102, 46,109,111,100, 32, + 61, 32,103,115,117, 98, 40,115,101,108,102, 46,109,111,100, + 44, 39, 99,111,110,115,116, 39, 44, 39, 39, 41, 10, 9,101, + 110,100, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, + 119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115, + 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97, + 114,103,115, 91,105, 93, 58,100,101, 99,108,116,121,112,101, + 40, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101, + 110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 87,114,105, + 116,101, 32, 98,105,110,100,105,110,103, 32,102,117,110, 99, + 116,105,111,110, 10, 45, 45, 32, 79,117,116,112,117,116,115, + 32, 67, 47, 67, 43, 43, 32, 98,105,110,100,105,110,103, 32, + 102,117,110, 99,116,105,111,110, 46, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105, + 111,110, 58,115,117,112, 99,111,100,101, 32, 40,108,111, 99, + 97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 41, + 10, 10, 32,108,111, 99, 97,108, 32,111,118,101,114,108,111, + 97,100, 32, 61, 32,115,116,114,115,117, 98, 40,115,101,108, + 102, 46, 99,110, 97,109,101, 44, 45, 50, 44, 45, 49, 41, 32, + 45, 32, 49, 32, 32, 45, 45, 32,105,110,100,105, 99, 97,116, + 101, 32,111,118,101,114,108,111, 97,100,101,100, 32,102,117, + 110, 99, 10, 32,108,111, 99, 97,108, 32,110,114,101,116, 32, + 61, 32, 48, 32, 32, 32, 32, 32, 32, 45, 45, 32,110,117,109, + 98,101,114, 32,111,102, 32,114,101,116,117,114,110,101,100, + 32,118, 97,108,117,101,115, 10, 32,108,111, 99, 97,108, 32, + 99,108, 97,115,115, 32, 61, 32,115,101,108,102, 58,105,110, + 99,108, 97,115,115, 40, 41, 10, 32,108,111, 99, 97,108, 32, + 95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, + 39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41, + 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, + 10, 10, 32, 9,105,102, 32,115,101,108,102, 46,110, 97,109, + 101, 32, 61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32, + 115,101,108,102, 46,112, 97,114,101,110,116, 46,102,108, 97, + 103,115, 46,112,117,114,101, 95,118,105,114,116,117, 97,108, + 32,116,104,101,110, 10, 32, 9, 9, 45, 45, 32,110,111, 32, + 99,111,110,115,116,114,117, 99,116,111,114, 32,102,111,114, + 32, 99,108, 97,115,115,101,115, 32,119,105,116,104, 32,112, + 117,114,101, 32,118,105,114,116,117, 97,108, 32,109,101,116, + 104,111,100,115, 10, 32, 9, 9,114,101,116,117,114,110, 10, + 32, 9,101,110,100, 10, 10, 32, 9,105,102, 32,108,111, 99, + 97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32, + 116,104,101,110, 10, 9, 9,111,117,116,112,117,116, 40, 34, + 47, 42, 32,109,101,116,104,111,100, 58, 32,110,101,119, 95, + 108,111, 99, 97,108, 32,111,102, 32, 99,108, 97,115,115, 32, + 34, 44, 99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10, + 9,101,108,115,101, 10, 9, 9,111,117,116,112,117,116, 40, + 34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115,101, + 108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108, + 97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42, + 47, 34, 41, 10, 9,101,110,100, 10, 32,101,108,115,101, 10, + 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,102,117, + 110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, + 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,110,100, + 10, 10, 32,105,102, 32,108,111, 99, 97,108, 95, 99,111,110, + 115,116,114,117, 99,116,111,114, 32,116,104,101,110, 10, 32, + 32,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101, + 102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, + 95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46, + 46, 34, 95,108,111, 99, 97,108, 34, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32, + 105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97,109,101, + 46, 46, 34, 95,108,111, 99, 97,108, 34, 44, 34, 40,108,117, + 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95, + 83, 41, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,111,117, + 116,112,117,116, 40, 34, 35,105,102,110,100,101,102, 32, 84, + 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, 34, 46, + 46,115,101,108,102, 46, 99,110, 97,109,101, 41, 10, 32, 32, + 111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,116,105, + 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97, + 109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, + 32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,101,110, + 100, 10, 32,111,117,116,112,117,116, 40, 34,123, 34, 41, 10, + 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,121,112,101, + 115, 10, 9,105,102, 32,111,118,101,114,108,111, 97,100, 32, + 60, 32, 48, 32,116,104,101,110, 10, 9, 32,111,117,116,112, + 117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, + 9,101,110,100, 10, 9,111,117,116,112,117,116, 40, 39, 32, + 116,111,108,117, 97, 95, 69,114,114,111,114, 32,116,111,108, + 117, 97, 95,101,114,114, 59, 39, 41, 10, 32,111,117,116,112, + 117,116, 40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10, 32, + 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10, 32, + 108,111, 99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32, + 99,108, 97,115,115, 32,116,104,101,110, 32,110, 97,114,103, + 61, 50, 32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32, + 101,110,100, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116, + 104,101,110, 10, 9, 9,108,111, 99, 97,108, 32,102,117,110, + 99, 32, 61, 32,103,101,116, 95,105,115, 95,102,117,110, 99, + 116,105,111,110, 40,115,101,108,102, 46,112, 97,114,101,110, + 116, 46,116,121,112,101, 41, 10, 9, 9,108,111, 99, 97,108, + 32,116,121,112,101, 32, 61, 32,115,101,108,102, 46,112, 97, + 114,101,110,116, 46,116,121,112,101, 10, 9, 9,105,102, 32, + 115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101,119, + 39, 32,111,114, 32,115,116, 97,116,105, 99,126, 61,110,105, + 108, 32,116,104,101,110, 10, 9, 9, 9,102,117,110, 99, 32, + 61, 32, 39,116,111,108,117, 97, 95,105,115,117,115,101,114, + 116, 97, 98,108,101, 39, 10, 9, 9, 9,116,121,112,101, 32, + 61, 32,115,101,108,102, 46,112, 97,114,101,110,116, 46,116, + 121,112,101, 10, 9, 9,101,110,100, 10, 9, 9,105,102, 32, + 115,101,108,102, 46, 99,111,110,115,116, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 9, 9, 9,116,121,112,101, 32, + 61, 32, 34, 99,111,110,115,116, 32, 34, 46, 46,116,121,112, + 101, 10, 9, 9,101,110,100, 10, 9, 9,111,117,116,112,117, + 116, 40, 39, 32, 32, 32, 32, 32, 33, 39, 46, 46,102,117,110, + 99, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, + 34, 39, 46, 46,116,121,112,101, 46, 46, 39, 34, 44, 48, 44, + 38,116,111,108,117, 97, 95,101,114,114, 41, 32,124,124, 92, + 110, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45, 32, 99,104, + 101, 99,107, 32, 97,114,103,115, 10, 32,105,102, 32,115,101, + 108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101, + 32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, + 10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32, + 119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115, + 91,105, 93, 32,100,111, 10, 32, 32, 32,108,111, 99, 97,108, + 32, 98,116,121,112,101, 32, 61, 32,105,115, 98, 97,115,105, + 99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46, + 116,121,112,101, 41, 10, 32, 32, 32,105,102, 32, 98,116,121, + 112,101, 32,126, 61, 32, 39,118, 97,108,117,101, 39, 32, 97, + 110,100, 32, 98,116,121,112,101, 32,126, 61, 32, 39,115,116, + 97,116,101, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,111, + 117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 39, 46, 46, + 115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,111,117, + 116, 99,104,101, 99,107,116,121,112,101, 40,110, 97,114,103, + 41, 46, 46, 39, 32,124,124, 92,110, 39, 41, 10, 32, 32, 32, + 101,110,100, 10, 32, 32, 32,105,102, 32, 98,116,121,112,101, + 32,126, 61, 32, 39,115,116, 97,116,101, 39, 32,116,104,101, + 110, 10, 9, 32, 32, 32,110, 97,114,103, 32, 61, 32,110, 97, + 114,103, 43, 49, 10, 32, 32, 32,101,110,100, 10, 32, 32, 32, + 105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,101, + 110,100, 32,111,102, 32,108,105,115,116, 10, 32,111,117,116, + 112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111,108,117, + 97, 95,105,115,110,111,111, 98,106, 40,116,111,108,117, 97, + 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39, 44, 38, + 116,111,108,117, 97, 95,101,114,114, 41, 92,110, 32, 41, 39, + 41, 10, 9,111,117,116,112,117,116, 40, 39, 32, 32,103,111, + 116,111, 32,116,111,108,117, 97, 95,108,101,114,114,111,114, + 59, 39, 41, 10, 10, 32,111,117,116,112,117,116, 40, 39, 32, + 101,108,115,101, 92,110, 39, 41, 10, 9,105,102, 32,111,118, + 101,114,108,111, 97,100, 32, 60, 32, 48, 32,116,104,101,110, + 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 10, 9,101,110,100, 10, 9,111,117, + 116,112,117,116, 40, 39, 32,123, 39, 41, 10, 10, 32, 45, 45, + 32,100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32, + 105,102, 32,116,104,101, 32, 99, 97,115,101, 10, 32,108,111, + 99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32, 99,108, + 97,115,115, 32,116,104,101,110, 32,110, 97,114,103, 61, 50, + 32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32,101,110, + 100, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, + 32,115,101,108,102, 46,110, 97,109,101,126, 61, 39,110,101, + 119, 39, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61, + 110,105,108, 32,116,104,101,110, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111,110, + 115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46, + 116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32, + 61, 32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,115, + 101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, + 44, 39, 42, 41, 32, 39, 41, 10, 32, 32,108,111, 99, 97,108, + 32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95, + 116,111, 95,102,117,110, 99,116,105,111,110, 40,115,101,108, + 102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 41, 10, + 32, 32,111,117,116,112,117,116, 40,116,111, 95,102,117,110, + 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 48, + 41, 59, 39, 41, 10, 32,101,108,115,101,105,102, 32,115,116, + 97,116,105, 99, 32,116,104,101,110, 10, 32, 32, 95, 44, 95, + 44,115,101,108,102, 46,109,111,100, 32, 61, 32,115,116,114, + 102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, + 94, 37,115, 42,115,116, 97,116,105, 99, 37,115, 37,115, 42, + 40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45, + 32,100,101, 99,108, 97,114,101, 32,112, 97,114, 97,109,101, + 116,101,114,115, 10, 32,105,102, 32,115,101,108,102, 46, 97, + 114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126, 61, 32, + 39,118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32,108, + 111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104,105,108, + 101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32, + 100,111, 10, 32, 32, 32,115,101,108,102, 46, 97,114,103,115, + 91,105, 93, 58,100,101, 99,108, 97,114,101, 40,110, 97,114, + 103, 41, 10, 32, 32, 32,105,102, 32,105,115, 98, 97,115,105, + 99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46, + 116,121,112,101, 41, 32,126, 61, 32, 34,115,116, 97,116,101, + 34, 32,116,104,101,110, 10, 9, 32, 32, 32,110, 97,114,103, + 32, 61, 32,110, 97,114,103, 43, 49, 10, 32, 32, 32,101,110, + 100, 10, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99, + 104,101, 99,107, 32,115,101,108,102, 10, 32,105,102, 32, 99, + 108, 97,115,115, 32, 97,110,100, 32,115,101,108,102, 46,110, + 97,109,101,126, 61, 39,110,101,119, 39, 32, 97,110,100, 32, + 115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,104,101, + 110, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,105,102, + 110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, + 65, 83, 69, 92,110, 39, 41, 10, 9, 32,111,117,116,112,117, + 116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,102, 41, + 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111, + 108,117, 97, 95, 83, 44, 34, 39, 46, 46,111,117,116,112,117, + 116, 95,101,114,114,111,114, 95,104,111,111,107, 40, 34,105, + 110,118, 97,108,105,100, 32, 92, 39,115,101,108,102, 92, 39, + 32,105,110, 32,102,117,110, 99,116,105,111,110, 32, 92, 39, + 37,115, 92, 39, 34, 44, 32,115,101,108,102, 46,110, 97,109, + 101, 41, 46, 46, 39, 34, 44, 32, 78, 85, 76, 76, 41, 59, 39, + 41, 59, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,101, + 110,100,105,102, 92,110, 39, 41, 10, 32,101,110,100, 10, 10, + 32, 45, 45, 32,103,101,116, 32, 97,114,114, 97,121, 32,101, + 108,101,109,101,110,116, 32,118, 97,108,117,101,115, 10, 32, + 105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 32,110, + 97,114,103, 61, 50, 32,101,108,115,101, 32,110, 97,114,103, + 61, 49, 32,101,110,100, 10, 32,105,102, 32,115,101,108,102, + 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126, + 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10, 32, + 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104, + 105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, + 93, 32,100,111, 10, 32, 32, 32,115,101,108,102, 46, 97,114, + 103,115, 91,105, 93, 58,103,101,116, 97,114,114, 97,121, 40, + 110, 97,114,103, 41, 10, 32, 32, 32,110, 97,114,103, 32, 61, + 32,110, 97,114,103, 43, 49, 10, 32, 32, 32,105, 32, 61, 32, + 105, 43, 49, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, + 10, 32,112,114,101, 95, 99, 97,108,108, 95,104,111,111,107, + 40,115,101,108,102, 41, 10, 10, 32,108,111, 99, 97,108, 32, + 111,117,116, 32, 61, 32,115,116,114,105,110,103, 46,102,105, + 110,100, 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116, + 111,108,117, 97, 95,111,117,116,115,105,100,101, 34, 41, 10, + 32, 45, 45, 32, 99, 97,108,108, 32,102,117,110, 99,116,105, + 111,110, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110, + 100, 32,115,101,108,102, 46,110, 97,109,101, 61, 61, 39,100, + 101,108,101,116,101, 39, 32,116,104,101,110, 10, 32, 32,111, + 117,116,112,117,116, 40, 39, 32, 32, 77,116,111,108,117, 97, + 95,100,101,108,101,116,101, 40,115,101,108,102, 41, 59, 39, + 41, 10, 32,101,108,115,101,105,102, 32, 99,108, 97,115,115, + 32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 32, + 61, 61, 32, 39,111,112,101,114, 97,116,111,114, 38, 91, 93, + 39, 32,116,104,101,110, 10, 32, 32,105,102, 32,102,108, 97, + 103,115, 91, 39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45, + 32,102,111,114, 32, 99,111,109,112, 97,116,105, 98,105,108, + 105,116,121, 32,119,105,116,104, 32,116,111,108,117, 97, 53, + 32, 63, 10, 9,111,117,116,112,117,116, 40, 39, 32, 32,115, + 101,108,102, 45, 62,111,112,101,114, 97,116,111,114, 91, 93, + 40, 39, 44,115,101,108,102, 46, 97,114,103,115, 91, 49, 93, + 46,110, 97,109,101, 44, 39, 45, 49, 41, 32, 61, 32, 39, 44, + 115,101,108,102, 46, 97,114,103,115, 91, 50, 93, 46,110, 97, + 109,101, 44, 39, 59, 39, 41, 10, 32, 32,101,108,115,101, 10, + 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,115, + 101,108,102, 45, 62,111,112,101,114, 97,116,111,114, 91, 93, + 40, 39, 44,115,101,108,102, 46, 97,114,103,115, 91, 49, 93, + 46,110, 97,109,101, 44, 39, 41, 32, 61, 32, 39, 44,115,101, + 108,102, 46, 97,114,103,115, 91, 50, 93, 46,110, 97,109,101, + 44, 39, 59, 39, 41, 10, 32, 32,101,110,100, 10, 32,101,108, + 115,101, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, + 123, 39, 41, 10, 32, 32,105,102, 32,115,101,108,102, 46,116, + 121,112,101, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115, + 101,108,102, 46,116,121,112,101, 32,126, 61, 32, 39,118,111, + 105,100, 39, 32,116,104,101,110, 10, 32, 32, 32,111,117,116, + 112,117,116, 40, 39, 32, 32, 39, 44,115,101,108,102, 46,109, + 111,100, 44,115,101,108,102, 46,116,121,112,101, 44,115,101, + 108,102, 46,112,116,114, 44, 39,116,111,108,117, 97, 95,114, + 101,116, 32, 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112, + 117,116, 40, 39, 40, 39, 44,115,101,108,102, 46,109,111,100, + 44,115,101,108,102, 46,116,121,112,101, 44,115,101,108,102, + 46,112,116,114, 44, 39, 41, 32, 39, 41, 10, 32, 32,101,108, + 115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102, 32, + 99,108, 97,115,115, 32, 97,110,100, 32,115,101,108,102, 46, + 110, 97,109,101, 61, 61, 39,110,101,119, 39, 32,116,104,101, + 110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, 77,116, + 111,108,117, 97, 95,110,101,119, 40, 40, 39, 44,115,101,108, + 102, 46,116,121,112,101, 44, 39, 41, 40, 39, 41, 10, 32, 32, + 101,108,115,101,105,102, 32, 99,108, 97,115,115, 32, 97,110, + 100, 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 9, + 105,102, 32,111,117,116, 32,116,104,101,110, 10, 9, 9,111, + 117,116,112,117,116, 40,115,101,108,102, 46,110, 97,109,101, + 44, 39, 40, 39, 41, 10, 9,101,108,115,101, 10, 9, 9,111, + 117,116,112,117,116, 40, 99,108, 97,115,115, 46, 46, 39, 58, + 58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 44, 39, + 40, 39, 41, 10, 9,101,110,100, 10, 32, 32,101,108,115,101, + 105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10, 9, + 105,102, 32,111,117,116, 32,116,104,101,110, 10, 9, 9,111, + 117,116,112,117,116, 40,115,101,108,102, 46,110, 97,109,101, + 44, 39, 40, 39, 41, 10, 9,101,108,115,101, 10, 9, 32, 32, + 105,102, 32,115,101,108,102, 46, 99, 97,115,116, 95,111,112, + 101,114, 97,116,111,114, 32,116,104,101,110, 10, 9, 32, 32, + 9, 45, 45,111,117,116,112,117,116, 40, 39,115,116, 97,116, + 105, 99, 95, 99, 97,115,116, 60, 39, 44,115,101,108,102, 46, + 109,111,100, 44,115,101,108,102, 46,116,121,112,101, 44,115, + 101,108,102, 46,112,116,114, 44, 39, 32, 62, 40, 42,115,101, + 108,102, 39, 41, 10, 9, 9,111,117,116,112,117,116, 40, 39, + 115,101,108,102, 45, 62,111,112,101,114, 97,116,111,114, 32, + 39, 44,115,101,108,102, 46,109,111,100, 44,115,101,108,102, + 46,116,121,112,101, 44, 39, 40, 39, 41, 10, 9, 32, 32,101, + 108,115,101, 10, 9, 9,111,117,116,112,117,116, 40, 39,115, + 101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,110, 97, + 109,101, 44, 39, 40, 39, 41, 10, 9, 32, 32,101,110,100, 10, + 9,101,110,100, 10, 32, 32,101,108,115,101, 10, 32, 32, 32, + 111,117,116,112,117,116, 40,115,101,108,102, 46,110, 97,109, + 101, 44, 39, 40, 39, 41, 10, 32, 32,101,110,100, 10, 10, 32, + 32,105,102, 32,111,117,116, 32, 97,110,100, 32,110,111,116, + 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32, + 9,111,117,116,112,117,116, 40, 39,115,101,108,102, 39, 41, + 10, 9,105,102, 32,115,101,108,102, 46, 97,114,103,115, 91, + 49, 93, 32, 97,110,100, 32,115,101,108,102, 46, 97,114,103, + 115, 91, 49, 93, 46,110, 97,109,101, 32,126, 61, 32, 39, 39, + 32,116,104,101,110, 10, 9, 9,111,117,116,112,117,116, 40, + 39, 44, 39, 41, 10, 9,101,110,100, 10, 32, 32,101,110,100, + 10, 32, 32, 45, 45, 32,119,114,105,116,101, 32,112, 97,114, + 97,109,101,116,101,114,115, 10, 32, 32,108,111, 99, 97,108, + 32,105, 61, 49, 10, 32, 32,119,104,105,108,101, 32,115,101, + 108,102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10, 32, + 32, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58, + 112, 97,115,115,112, 97,114, 40, 41, 10, 32, 32, 32,105, 32, + 61, 32,105, 43, 49, 10, 32, 32, 32,105,102, 32,115,101,108, + 102, 46, 97,114,103,115, 91,105, 93, 32,116,104,101,110, 10, + 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 44, 39, 41, + 10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 10, + 32, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32, + 115,101,108,102, 46,110, 97,109,101, 32, 61, 61, 32, 39,111, + 112,101,114, 97,116,111,114, 91, 93, 39, 32, 97,110,100, 32, + 102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,104,101,110, + 10, 9,111,117,116,112,117,116, 40, 39, 45, 49, 41, 59, 39, + 41, 10, 32, 32,101,108,115,101, 10, 9,105,102, 32, 99,108, + 97,115,115, 32, 97,110,100, 32,115,101,108,102, 46,110, 97, + 109,101, 61, 61, 39,110,101,119, 39, 32,116,104,101,110, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 41, 41, 59, 39, 41, + 32, 45, 45, 32, 99,108,111,115,101, 32, 77,116,111,108,117, + 97, 95,110,101,119, 40, 10, 9,101,108,115,101, 10, 9, 9, + 111,117,116,112,117,116, 40, 39, 41, 59, 39, 41, 10, 9,101, + 110,100, 10, 32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32, + 114,101,116,117,114,110, 32,118, 97,108,117,101,115, 10, 32, + 32,105,102, 32,115,101,108,102, 46,116,121,112,101, 32,126, + 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, 46,116, + 121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39, 32,116, + 104,101,110, 10, 32, 32, 32,110,114,101,116, 32, 61, 32,110, + 114,101,116, 32, 43, 32, 49, 10, 32, 32, 32,108,111, 99, 97, + 108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,105, + 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32, + 32,105,102, 32,116, 32, 97,110,100, 32,115,101,108,102, 46, + 110, 97,109,101, 32,126, 61, 32, 34,110,101,119, 34, 32,116, + 104,101,110, 10, 32, 32, 32, 9,105,102, 32,115,101,108,102, + 46, 99, 97,115,116, 95,111,112,101,114, 97,116,111,114, 32, + 97,110,100, 32, 95, 98, 97,115,105, 99, 95,114, 97,119, 95, + 112,117,115,104, 91,116, 93, 32,116,104,101,110, 10, 9, 9, + 111,117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44, 95, 98, + 97,115,105, 99, 95,114, 97,119, 95,112,117,115,104, 91,116, + 93, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, + 99,116, 44, 39, 41,116,111,108,117, 97, 95,114,101,116, 41, + 59, 39, 41, 10, 32, 32, 32, 9,101,108,115,101, 10, 9, 32, + 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116, + 111,108,117, 97, 95,112,117,115,104, 39, 46, 46,116, 46, 46, + 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,116, + 44, 39, 41,116,111,108,117, 97, 95,114,101,116, 41, 59, 39, + 41, 10, 9,101,110,100, 10, 32, 32, 32,101,108,115,101, 10, + 9,116, 32, 61, 32,115,101,108,102, 46,116,121,112,101, 10, + 9,110,101,119, 95,116, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,116, 44, 32, 34, 99,111,110,115,116, + 37,115, 43, 34, 44, 32, 34, 34, 41, 10, 9,108,111, 99, 97, + 108, 32,111,119,110,101,100, 32, 61, 32,102, 97,108,115,101, + 10, 9,105,102, 32,115,116,114,105,110,103, 46,102,105,110, + 100, 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111, + 108,117, 97, 95,111,119,110,101,100, 34, 41, 32,116,104,101, + 110, 10, 9, 9,111,119,110,101,100, 32, 61, 32,116,114,117, + 101, 10, 9,101,110,100, 10, 32, 32, 32, 32,108,111, 99, 97, + 108, 32,112,117,115,104, 95,102,117,110, 99, 32, 61, 32,103, + 101,116, 95,112,117,115,104, 95,102,117,110, 99,116,105,111, + 110, 40,116, 41, 10, 32, 32, 32, 32,105,102, 32,115,101,108, + 102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101, + 110, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 32, 32,123, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116, + 112,117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99, + 112,108,117,115,112,108,117,115, 92,110, 39, 41, 10, 32, 32, + 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, + 118,111,105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106, + 32, 61, 32, 77,116,111,108,117, 97, 95,110,101,119, 40, 40, + 39, 44,110,101,119, 95,116, 44, 39, 41, 40,116,111,108,117, + 97, 95,114,101,116, 41, 41, 59, 39, 41, 10, 32, 32, 32, 32, + 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, 39, 44, + 112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108, + 117, 97, 95, 83, 44,116,111,108,117, 97, 95,111, 98,106, 44, + 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, 32, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116, + 111,108,117, 97, 95,114,101,103,105,115,116,101,114, 95,103, + 99, 40,116,111,108,117, 97, 95, 83, 44,108,117, 97, 95,103, + 101,116,116,111,112, 40,116,111,108,117, 97, 95, 83, 41, 41, + 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, + 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10, 32, 32, 32, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118, + 111,105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32, + 61, 32,116,111,108,117, 97, 95, 99,111,112,121, 40,116,111, + 108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, 38,116, + 111,108,117, 97, 95,114,101,116, 44,115,105,122,101,111,102, + 40, 39, 44,116, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32, 32, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, 39, + 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111, + 108,117, 97, 95, 83, 44,116,111,108,117, 97, 95,111, 98,106, + 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, + 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, + 116,111,108,117, 97, 95,114,101,103,105,115,116,101,114, 95, + 103, 99, 40,116,111,108,117, 97, 95, 83, 44,108,117, 97, 95, + 103,101,116,116,111,112, 40,116,111,108,117, 97, 95, 83, 41, + 41, 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 32, + 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 125, 39, 41, 10, 32, 32, 32, 32,101,108,115,101,105,102, 32, + 115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39, + 32,116,104,101,110, 10, 32, 32, 32, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, 95,102, + 117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, + 118,111,105,100, 42, 41, 38,116,111,108,117, 97, 95,114,101, + 116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 32, + 32, 32, 32,101,108,115,101, 10, 9, 32,111,117,116,112,117, + 116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, 95,102,117, + 110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118, + 111,105,100, 42, 41,116,111,108,117, 97, 95,114,101,116, 44, + 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 9, 32,105, + 102, 32,111,119,110,101,100, 32,111,114, 32,108,111, 99, 97, + 108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,116, + 104,101,110, 10, 32, 32, 32, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, 95,114,101, + 103,105,115,116,101,114, 95,103, 99, 40,116,111,108,117, 97, + 95, 83, 44,108,117, 97, 95,103,101,116,116,111,112, 40,116, + 111,108,117, 97, 95, 83, 41, 41, 59, 39, 41, 10, 9, 32,101, + 110,100, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32,101, + 110,100, 10, 32, 32,101,110,100, 10, 32, 32,108,111, 99, 97, + 108, 32,105, 61, 49, 10, 32, 32,119,104,105,108,101, 32,115, + 101,108,102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10, + 32, 32, 32,110,114,101,116, 32, 61, 32,110,114,101,116, 32, + 43, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58, + 114,101,116,118, 97,108,117,101, 40, 41, 10, 32, 32, 32,105, + 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32, 32, + 111,117,116,112,117,116, 40, 39, 32, 32,125, 39, 41, 10, 10, + 32, 32, 45, 45, 32,115,101,116, 32, 97,114,114, 97,121, 32, + 101,108,101,109,101,110,116, 32,118, 97,108,117,101,115, 10, + 32, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, + 32,110, 97,114,103, 61, 50, 32,101,108,115,101, 32,110, 97, + 114,103, 61, 49, 32,101,110,100, 10, 32, 32,105,102, 32,115, + 101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112, + 101, 32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101, + 110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, + 32, 32, 32,119,104,105,108,101, 32,115,101,108,102, 46, 97, + 114,103,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,115, + 101,108,102, 46, 97,114,103,115, 91,105, 93, 58,115,101,116, + 97,114,114, 97,121, 40,110, 97,114,103, 41, 10, 32, 32, 32, + 32,110, 97,114,103, 32, 61, 32,110, 97,114,103, 43, 49, 10, + 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32, + 101,110,100, 10, 32, 32,101,110,100, 10, 10, 32, 32, 45, 45, + 32,102,114,101,101, 32,100,121,110, 97,109,105, 99, 97,108, + 108,121, 32, 97,108,108,111, 99, 97,116,101,100, 32, 97,114, + 114, 97,121, 10, 32, 32,105,102, 32,115,101,108,102, 46, 97, + 114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126, 61, 32, + 39,118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32, 32,119,104, + 105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, + 93, 32,100,111, 10, 32, 32, 32, 32,115,101,108,102, 46, 97, + 114,103,115, 91,105, 93, 58,102,114,101,101, 97,114,114, 97, + 121, 40, 41, 10, 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, + 10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 10, 32,112,111,115,116, 95, 99, 97,108,108, + 95,104,111,111,107, 40,115,101,108,102, 41, 10, 10, 32,111, + 117,116,112,117,116, 40, 39, 32,125, 39, 41, 10, 32,111,117, + 116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 39, + 46, 46,110,114,101,116, 46, 46, 39, 59, 39, 41, 10, 10, 32, + 45, 45, 32, 99, 97,108,108, 32,111,118,101,114,108,111, 97, + 100,101,100, 32,102,117,110, 99,116,105,111,110, 32,111,114, + 32,103,101,110,101,114, 97,116,101, 32,101,114,114,111,114, + 10, 9,105,102, 32,111,118,101,114,108,111, 97,100, 32, 60, + 32, 48, 32,116,104,101,110, 10, 10, 9, 9,111,117,116,112, + 117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, + 9, 9,111,117,116,112,117,116, 40, 39,116,111,108,117, 97, + 95,108,101,114,114,111,114, 58, 92,110, 39, 41, 10, 9, 9, + 111,117,116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95, + 101,114,114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34, + 39, 46, 46,111,117,116,112,117,116, 95,101,114,114,111,114, + 95,104,111,111,107, 40, 34, 35,102,101,114,114,111,114, 32, + 105,110, 32,102,117,110, 99,116,105,111,110, 32, 92, 39, 37, + 115, 92, 39, 46, 34, 44, 32,115,101,108,102, 46,108,110, 97, + 109,101, 41, 46, 46, 39, 34, 44, 38,116,111,108,117, 97, 95, + 101,114,114, 41, 59, 39, 41, 10, 9, 9,111,117,116,112,117, + 116, 40, 39, 32,114,101,116,117,114,110, 32, 48, 59, 39, 41, + 10, 9, 9,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 10, 9,101,108,115,101, 10, 9, 9, + 108,111, 99, 97,108, 32, 95,108,111, 99, 97,108, 32, 61, 32, + 34, 34, 10, 9, 9,105,102, 32,108,111, 99, 97,108, 95, 99, + 111,110,115,116,114,117, 99,116,111,114, 32,116,104,101,110, + 10, 9, 9, 9, 95,108,111, 99, 97,108, 32, 61, 32, 34, 95, + 108,111, 99, 97,108, 34, 10, 9, 9,101,110,100, 10, 9, 9, + 111,117,116,112,117,116, 40, 39,116,111,108,117, 97, 95,108, + 101,114,114,111,114, 58, 92,110, 39, 41, 10, 9, 9,111,117, + 116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 39, + 46, 46,115,116,114,115,117, 98, 40,115,101,108,102, 46, 99, + 110, 97,109,101, 44, 49, 44, 45, 51, 41, 46, 46,102,111,114, + 109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,111,118,101,114, + 108,111, 97,100, 41, 46, 46, 95,108,111, 99, 97,108, 46, 46, + 39, 40,116,111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 9, + 101,110,100, 10, 32,111,117,116,112,117,116, 40, 39,125, 39, + 41, 10, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, + 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, + 10, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, + 10, 9, 45, 45, 32,114,101, 99,117,114,115,105,118,101, 32, + 99, 97,108,108, 32,116,111, 32,119,114,105,116,101, 32,108, + 111, 99, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111, + 114, 10, 9,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, + 32,115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101, + 119, 39, 32, 97,110,100, 32,110,111,116, 32,108,111, 99, 97, + 108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,116, + 104,101,110, 10, 10, 9, 9,115,101,108,102, 58,115,117,112, + 99,111,100,101, 40, 49, 41, 10, 9,101,110,100, 10, 10,101, + 110,100, 10, 10, 10, 45, 45, 32,114,101,103,105,115,116,101, + 114, 32,102,117,110, 99,116,105,111,110, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116, + 105,111,110, 58,114,101,103,105,115,116,101,114, 32, 40,112, + 114,101, 41, 10, 10, 9,105,102, 32,110,111,116, 32,115,101, + 108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, + 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10, + 9, 9,114,101,116,117,114,110, 10, 9,101,110,100, 10, 10, + 32, 9,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32, + 61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32,115,101, + 108,102, 46,112, 97,114,101,110,116, 46,102,108, 97,103,115, + 46,112,117,114,101, 95,118,105,114,116,117, 97,108, 32,116, + 104,101,110, 10, 32, 9, 9, 45, 45, 32,110,111, 32, 99,111, + 110,115,116,114,117, 99,116,111,114, 32,102,111,114, 32, 99, + 108, 97,115,115,101,115, 32,119,105,116,104, 32,112,117,114, + 101, 32,118,105,114,116,117, 97,108, 32,109,101,116,104,111, + 100,115, 10, 32, 9, 9,114,101,116,117,114,110, 10, 32, 9, + 101,110,100, 10, 10, 32,111,117,116,112,117,116, 40,112,114, + 101, 46, 46, 39,116,111,108,117, 97, 95,102,117,110, 99,116, + 105,111,110, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, + 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, + 44, 39, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46, + 46, 39, 41, 59, 39, 41, 10, 32, 32,105,102, 32,115,101,108, + 102, 46,110, 97,109,101, 32, 61, 61, 32, 39,110,101,119, 39, + 32,116,104,101,110, 10, 9, 32, 32,111,117,116,112,117,116, + 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,102,117, + 110, 99,116,105,111,110, 40,116,111,108,117, 97, 95, 83, 44, + 34,110,101,119, 95,108,111, 99, 97,108, 34, 44, 39, 46, 46, + 115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 95,108, + 111, 99, 97,108, 41, 59, 39, 41, 10, 9, 32, 32,111,117,116, + 112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, + 95,102,117,110, 99,116,105,111,110, 40,116,111,108,117, 97, + 95, 83, 44, 34, 46, 99, 97,108,108, 34, 44, 39, 46, 46,115, + 101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 95,108,111, + 99, 97,108, 41, 59, 39, 41, 10, 9, 32, 32, 45, 45,111,117, + 116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,115,101, + 116, 95, 99, 97,108,108, 95,101,118,101,110,116, 40,116,111, + 108,117, 97, 95, 83, 44, 39, 46, 46,115,101,108,102, 46, 99, + 110, 97,109,101, 46, 46, 39, 95,108,111, 99, 97,108, 44, 32, + 34, 39, 46, 46,115,101,108,102, 46,112, 97,114,101,110,116, + 46,116,121,112,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32, + 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 80,114, + 105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116, + 105,111,110, 58,112,114,105,110,116, 32, 40,105,100,101,110, + 116, 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, + 40,105,100,101,110,116, 46, 46, 34, 70,117,110, 99,116,105, + 111,110,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100, + 101,110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, + 34, 46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, + 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, + 46,115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46, + 115,101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32, 99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46, + 115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, + 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, + 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41, + 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104, + 105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, + 93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103, + 115, 91,105, 93, 58,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32, + 105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112, + 114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101, + 110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, + 32,105,116, 32,114,101,116,117,114,110,115, 32, 97,110, 32, + 111, 98,106,101, 99,116, 32, 98,121, 32,118, 97,108,117,101, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 70,117,110, 99,116,105,111,110, 58,114,101,113,117,105,114, + 101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116, 41, + 10, 9,108,111, 99, 97,108, 32,114, 32, 61, 32,102, 97,108, + 115,101, 10, 9,105,102, 32,115,101,108,102, 46,116,121,112, + 101, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,110,111,116, + 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116, + 121,112,101, 41, 32, 97,110,100, 32,115,101,108,102, 46,112, + 116,114, 61, 61, 39, 39, 32,116,104,101,110, 10, 9, 9,108, + 111, 99, 97,108, 32,116,121,112,101, 32, 61, 32,103,115,117, + 98, 40,115,101,108,102, 46,116,121,112,101, 44, 34, 37,115, + 42, 99,111,110,115,116, 37,115, 43, 34, 44, 34, 34, 41, 10, + 9, 32,116, 91,116,121,112,101, 93, 32, 61, 32, 34,116,111, + 108,117, 97, 95, 99,111,108,108,101, 99,116, 95, 34, 32, 46, + 46, 32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116, + 101, 40,116,121,112,101, 41, 10, 9, 32,114, 32, 61, 32,116, + 114,117,101, 10, 9,101,110,100, 10, 9,108,111, 99, 97,108, + 32,105, 61, 49, 10, 9,119,104,105,108,101, 32,115,101,108, + 102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10, 9, 9, + 114, 32, 61, 32,115,101,108,102, 46, 97,114,103,115, 91,105, + 93, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99, + 116,105,111,110, 40,116, 41, 32,111,114, 32,114, 10, 9, 9, + 105, 32, 61, 32,105, 43, 49, 10, 9,101,110,100, 10, 9,114, + 101,116,117,114,110, 32,114, 10,101,110,100, 10, 10, 45, 45, + 32,100,101,116,101,114,109,105,110,101, 32,108,117, 97, 32, + 102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 32,111, + 118,101,114,108,111, 97,100, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110, + 58,111,118,101,114,108,111, 97,100, 32, 40, 41, 10, 32,114, + 101,116,117,114,110, 32,115,101,108,102, 46,112, 97,114,101, + 110,116, 58,111,118,101,114,108,111, 97,100, 40,115,101,108, + 102, 46,108,110, 97,109,101, 41, 10,101,110,100, 10, 10, 10, + 102,117,110, 99,116,105,111,110, 32,112, 97,114, 97,109, 95, + 111, 98,106,101, 99,116, 40,112, 97,114, 41, 32, 45, 45, 32, + 114,101,116,117,114,110,115, 32,116,114,117,101, 32,105,102, + 32,116,104,101, 32,112, 97,114, 97,109,101,116,101,114, 32, + 104, 97,115, 32, 97,110, 32,111, 98,106,101, 99,116, 32, 97, + 115, 32,105,116,115, 32,100,101,102, 97,117,108,116, 32,118, + 97,108,117,101, 10, 10, 9,105,102, 32,110,111,116, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114, 44, + 32, 39, 61, 39, 41, 32,116,104,101,110, 32,114,101,116,117, + 114,110, 32,102, 97,108,115,101, 32,101,110,100, 32, 45, 45, + 32,105,116, 32,104, 97,115, 32,110,111, 32,100,101,102, 97, + 117,108,116, 32,118, 97,108,117,101, 10, 10, 9,108,111, 99, + 97,108, 32, 95, 44, 95, 44,100,101,102, 32, 61, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32, + 34, 61, 40, 46, 42, 41, 36, 34, 41, 10, 10, 9,105,102, 32, + 115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114, + 44, 32, 34,124, 34, 41, 32,116,104,101,110, 32, 45, 45, 32, + 97, 32,108,105,115,116, 32,111,102, 32,102,108, 97,103,115, + 10, 10, 9, 9,114,101,116,117,114,110, 32,116,114,117,101, + 10, 9,101,110,100, 10, 10, 9,105,102, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 37, + 42, 34, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39, + 115, 32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116, + 104, 32, 97, 32,100,101,102, 97,117,108,116, 32,118, 97,108, + 117,101, 10, 10, 9, 9,105,102, 32,115,116,114,105,110,103, + 46,102,105,110,100, 40,112, 97,114, 44, 32, 39, 61, 37,115, + 42,110,101,119, 39, 41, 32,111,114, 32,115,116,114,105,110, + 103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 37, 40, + 34, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39,115, + 32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116,104, + 32, 97,110, 32,105,110,115,116, 97,110, 99,101, 32, 97,115, + 32,100,101,102, 97,117,108,116, 32,112, 97,114, 97,109,101, + 116,101,114, 46, 46, 32,105,115, 32,116,104, 97,116, 32,118, + 97,108,105,100, 63, 10, 9, 9, 9,114,101,116,117,114,110, + 32,116,114,117,101, 10, 9, 9,101,110,100, 10, 9, 9,114, + 101,116,117,114,110, 32,102, 97,108,115,101, 32, 45, 45, 32, + 100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 32,105, + 115, 32, 39, 78, 85, 76, 76, 39, 32,111,114, 32,115,111,109, + 101,116,104,105,110,103, 10, 9,101,110,100, 10, 10, 10, 9, + 105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 112, 97,114, 44, 32, 34, 91, 37, 40, 38, 93, 34, 41, 32,116, + 104,101,110, 10, 9, 9,114,101,116,117,114,110, 32,116,114, + 117,101, 10, 9,101,110,100, 32, 45, 45, 32,100,101,102, 97, + 117,108,116, 32,118, 97,108,117,101, 32,105,115, 32, 97, 32, + 99,111,110,115,116,114,117, 99,116,111,114, 32, 99, 97,108, + 108, 32, 40,109,111,115,116, 32,108,105,107,101,108,121, 32, + 102,111,114, 32, 97, 32, 99,111,110,115,116, 32,114,101,102, + 101,114,101,110, 99,101, 41, 10, 10, 9, 45, 45,105,102, 32, + 115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114, + 44, 32, 34, 38, 34, 41, 32,116,104,101,110, 10, 10, 9, 45, + 45, 9,105,102, 32,115,116,114,105,110,103, 46,102,105,110, + 100, 40,100,101,102, 44, 32, 34, 58, 34, 41, 32,111,114, 32, + 115,116,114,105,110,103, 46,102,105,110,100, 40,100,101,102, + 44, 32, 34, 94, 37,115, 42,110,101,119, 37,115, 43, 34, 41, + 32,116,104,101,110, 10, 10, 9, 45, 45, 9, 9, 45, 45, 32, + 105,116, 39,115, 32, 97, 32,114,101,102,101,114,101,110, 99, + 101, 32,119,105,116,104, 32,100,101,102, 97,117,108,116, 32, + 116,111, 32,115,111,109,101,116,104,105,110,103, 32,108,105, + 107,101, 32, 67,108, 97,115,115, 58, 58,109,101,109, 98,101, + 114, 44, 32,111,114, 32, 39,110,101,119, 32, 67,108, 97,115, + 115, 39, 10, 9, 45, 45, 9, 9,114,101,116,117,114,110, 32, + 116,114,117,101, 10, 9, 45, 45, 9,101,110,100, 10, 9, 45, + 45,101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,102, + 97,108,115,101, 32, 45, 45, 32, 63, 10,101,110,100, 10, 10, + 102,117,110, 99,116,105,111,110, 32,115,116,114,105,112, 95, + 108, 97,115,116, 95, 97,114,103, 40, 97,108,108, 95, 97,114, + 103,115, 44, 32,108, 97,115,116, 95, 97,114,103, 41, 32, 45, + 45, 32,115,116,114,105,112,115, 32,116,104,101, 32,100,101, + 102, 97,117,108,116, 32,118, 97,108,117,101, 32,102,114,111, + 109, 32,116,104,101, 32,108, 97,115,116, 32, 97,114,103,117, + 109,101,110,116, 10, 10, 9,108,111, 99, 97,108, 32, 95, 44, + 95, 44,115, 95, 97,114,103, 32, 61, 32,115,116,114,105,110, + 103, 46,102,105,110,100, 40,108, 97,115,116, 95, 97,114,103, + 44, 32, 34, 94, 40, 91, 94, 61, 93, 43, 41, 34, 41, 10, 9, + 108, 97,115,116, 95, 97,114,103, 32, 61, 32,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,108, 97,115,116, 95, 97,114, + 103, 44, 32, 34, 40, 91, 37, 37, 37, 40, 37, 41, 93, 41, 34, + 44, 32, 34, 37, 37, 37, 49, 34, 41, 59, 10, 9, 97,108,108, + 95, 97,114,103,115, 32, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40, 97,108,108, 95, 97,114,103,115, 44, 32, + 34, 37,115, 42, 44, 37,115, 42, 34, 46, 46,108, 97,115,116, + 95, 97,114,103, 46, 46, 34, 37,115, 42, 37, 41, 37,115, 42, + 36, 34, 44, 32, 34, 41, 34, 41, 10, 9,114,101,116,117,114, + 110, 32, 97,108,108, 95, 97,114,103,115, 44, 32,115, 95, 97, + 114,103, 10,101,110,100, 10, 10, 10, 10, 45, 45, 32, 73,110, + 116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117, 99, + 116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95, 70, + 117,110, 99,116,105,111,110, 32, 40,116, 41, 10, 32,115,101, + 116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, + 97,115,115, 70,117,110, 99,116,105,111,110, 41, 10, 10, 32, + 105,102, 32,116, 46, 99,111,110,115,116, 32,126, 61, 32, 39, + 99,111,110,115,116, 39, 32, 97,110,100, 32,116, 46, 99,111, + 110,115,116, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 10, + 32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108, + 105,100, 32, 39, 99,111,110,115,116, 39, 32,115,112,101, 99, + 105,102,105, 99, 97,116,105,111,110, 34, 41, 10, 32,101,110, + 100, 10, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32, + 105,102, 32,116, 58,105,110, 99,108, 97,115,115, 40, 41, 32, + 116,104,101,110, 10, 32, 45, 45,112,114,105,110,116, 32, 40, + 39,116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116, + 46,110, 97,109,101, 46, 46, 39, 44, 32,112, 97,114,101,110, + 116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116, 46, + 112, 97,114,101,110,116, 46,110, 97,109,101, 41, 10, 32, 32, + 105,102, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 116, 46,110, 97,109,101, 44, 32, 34, 37, 98, 60, 62, 34, 44, + 32, 34, 34, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40,116, 46,112, 97,114,101,110,116, 46,111, + 114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,114, + 32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 44, + 32, 34, 37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32,116,104, + 101,110, 10, 32, 32, 32,116, 46,110, 97,109,101, 32, 61, 32, + 39,110,101,119, 39, 10, 32, 32, 32,116, 46,108,110, 97,109, + 101, 32, 61, 32, 39,110,101,119, 39, 10, 32, 32, 32,116, 46, + 112, 97,114,101,110,116, 46, 95,110,101,119, 32, 61, 32,116, + 114,117,101, 10, 32, 32, 32,116, 46,116,121,112,101, 32, 61, + 32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 10, + 32, 32, 32,116, 46,112,116,114, 32, 61, 32, 39, 42, 39, 10, + 32, 32,101,108,115,101,105,102, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,116, 46,110, 97,109,101, 44, 32, 34, + 37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32, 61, 61, 32, 39, + 126, 39, 46, 46,115,116,114,105,110,103, 46,103,115,117, 98, + 40,116, 46,112, 97,114,101,110,116, 46,111,114,105,103,105, + 110, 97,108, 95,110, 97,109,101, 32,111,114, 32,116, 46,112, + 97,114,101,110,116, 46,110, 97,109,101, 44, 32, 34, 37, 98, + 60, 62, 34, 44, 32, 34, 34, 41, 32,116,104,101,110, 10, 32, + 32, 32,116, 46,110, 97,109,101, 32, 61, 32, 39,100,101,108, + 101,116,101, 39, 10, 32, 32, 32,116, 46,108,110, 97,109,101, + 32, 61, 32, 39,100,101,108,101,116,101, 39, 10, 32, 32, 32, + 116, 46,112, 97,114,101,110,116, 46, 95,100,101,108,101,116, + 101, 32, 61, 32,116,114,117,101, 10, 32, 32,101,110,100, 10, + 32,101,110,100, 10, 32,116, 46, 99,110, 97,109,101, 32, 61, + 32,116, 58, 99,102,117,110, 99,110, 97,109,101, 40, 34,116, + 111,108,117, 97, 34, 41, 46, 46,116, 58,111,118,101,114,108, + 111, 97,100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, + 116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116, + 114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99, + 116,115, 32,116,104,114,101,101, 32,115,116,114,105,110,103, + 115, 58, 32,111,110,101, 32,114,101,112,114,101,115,101,110, + 116,105,110,103, 32,116,104,101, 32,102,117,110, 99,116,105, + 111,110, 32,100,101, 99,108, 97,114, 97,116,105,111,110, 44, + 10, 45, 45, 32, 97,110,111,116,104,101,114, 32,114,101,112, + 114,101,115,101,110,116,105,110,103, 32,116,104,101, 32, 97, + 114,103,117,109,101,110,116, 32,108,105,115,116, 44, 32, 97, + 110,100, 32,116,104,101, 32,116,104,105,114,100, 32,114,101, + 112,114,101,115,101,110,116,105,110,103, 10, 45, 45, 32,116, + 104,101, 32, 34, 99,111,110,115,116, 34, 32,111,114, 32,101, + 109,112,116,121, 32,115,116,114,105,110,103, 46, 10,102,117, + 110, 99,116,105,111,110, 32, 70,117,110, 99,116,105,111,110, + 32, 40,100, 44, 97, 44, 99, 41, 10, 32, 45, 45,108,111, 99, + 97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116, + 114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 44, 39, 44, + 39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 98,114, 97, 99,101,115, 10, 32, 45, 45,108,111, 99, 97, + 108, 32,116, 32, 61, 32,115,112,108,105,116, 95,112, 97,114, + 97,109,115, 40,115,116,114,115,117, 98, 40, 97, 44, 50, 44, + 45, 50, 41, 41, 10, 10, 9,105,102, 32,110,111,116, 32,102, + 108, 97,103,115, 91, 39, 87, 39, 93, 32, 97,110,100, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40, 97, 44, 32, 34, + 37, 46, 37, 46, 37, 46, 37,115, 42, 37, 41, 34, 41, 32,116, + 104,101,110, 10, 10, 9, 9,119, 97,114,110,105,110,103, 40, + 34, 70,117,110, 99,116,105,111,110,115, 32,119,105,116,104, + 32,118, 97,114,105, 97, 98,108,101, 32, 97,114,103,117,109, + 101,110,116,115, 32, 40, 96, 46, 46, 46, 39, 41, 32, 97,114, + 101, 32,110,111,116, 32,115,117,112,112,111,114,116,101,100, + 46, 32, 73,103,110,111,114,105,110,103, 32, 34, 46, 46,100, + 46, 46, 97, 46, 46, 99, 41, 10, 9, 9,114,101,116,117,114, + 110, 32,110,105,108, 10, 9,101,110,100, 10, 10, 10, 32,108, + 111, 99, 97,108, 32,105, 61, 49, 10, 32,108,111, 99, 97,108, + 32,108, 32, 61, 32,123,110, 61, 48,125, 10, 10, 32, 9, 97, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 97, 44, 32, 34, 37,115, 42, 40, 91, 37, 40, 37, 41, 93, 41, + 37,115, 42, 34, 44, 32, 34, 37, 49, 34, 41, 10, 9,108,111, + 99, 97,108, 32,116, 44,115,116,114,105,112, 44,108, 97,115, + 116, 32, 61, 32,115,116,114,105,112, 95,112, 97,114,115, 40, + 115,116,114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 41, + 59, 10, 9,105,102, 32,115,116,114,105,112, 32,116,104,101, + 110, 10, 9, 9, 45, 45,108,111, 99, 97,108, 32,110,115, 32, + 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115,116, + 114,115,117, 98, 40, 97, 44, 49, 44, 45, 50, 41, 44, 32, 49, + 44, 32, 45, 40,115,116,114,105,110,103, 46,108,101,110, 40, + 108, 97,115,116, 41, 43, 49, 41, 41, 10, 9, 9,108,111, 99, + 97,108, 32,110,115, 32, 61, 32,106,111,105,110, 40,116, 44, + 32, 34, 44, 34, 44, 32, 49, 44, 32,108, 97,115,116, 45, 49, + 41, 10, 10, 9, 9,110,115, 32, 61, 32, 34, 40, 34, 46, 46, + 115,116,114,105,110,103, 46,103,115,117, 98, 40,110,115, 44, + 32, 34, 37,115, 42, 44, 37,115, 42, 36, 34, 44, 32, 34, 34, + 41, 46, 46, 39, 41, 39, 10, 9, 9, 45, 45,110,115, 32, 61, + 32,115,116,114,105,112, 95,100,101,102, 97,117,108,116,115, + 40,110,115, 41, 10, 10, 9, 9,108,111, 99, 97,108, 32,102, + 32, 61, 32, 70,117,110, 99,116,105,111,110, 40,100, 44, 32, + 110,115, 44, 32, 99, 41, 10, 9, 9,102,111,114, 32,105, 61, + 49, 44,108, 97,115,116, 32,100,111, 10, 9, 9, 9,116, 91, + 105, 93, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40,116, 91,105, 93, 44, 32, 34, 61, 46, 42, 36, 34, 44, + 32, 34, 34, 41, 10, 9, 9,101,110,100, 10, 9,101,110,100, + 10, 10, 32,119,104,105,108,101, 32,116, 91,105, 93, 32,100, + 111, 10, 32, 32,108, 46,110, 32, 61, 32,108, 46,110, 43, 49, + 10, 32, 32,108, 91,108, 46,110, 93, 32, 61, 32, 68,101, 99, + 108, 97,114, 97,116,105,111,110, 40,116, 91,105, 93, 44, 39, + 118, 97,114, 39, 44,116,114,117,101, 41, 10, 32, 32,105, 32, + 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,108,111, 99, + 97,108, 32,102, 32, 61, 32, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 40,100, 44, 39,102,117,110, 99, 39, 41, 10, 32, + 102, 46, 97,114,103,115, 32, 61, 32,108, 10, 32,102, 46, 99, + 111,110,115,116, 32, 61, 32, 99, 10, 32,114,101,116,117,114, + 110, 32, 95, 70,117,110, 99,116,105,111,110, 40,102, 41, 10, + 101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,106, + 111,105,110, 40,116, 44, 32,115,101,112, 44, 32,102,105,114, + 115,116, 44, 32,108, 97,115,116, 41, 10, 10, 9,102,105,114, + 115,116, 32, 61, 32,102,105,114,115,116, 32,111,114, 32, 49, + 10, 9,108, 97,115,116, 32, 61, 32,108, 97,115,116, 32,111, + 114, 32,116, 97, 98,108,101, 46,103,101,116,110, 40,116, 41, + 10, 9,108,111, 99, 97,108, 32,108,115,101,112, 32, 61, 32, + 34, 34, 10, 9,108,111, 99, 97,108, 32,114,101,116, 32, 61, + 32, 34, 34, 10, 9,108,111, 99, 97,108, 32,108,111,111,112, + 32, 61, 32,102, 97,108,115,101, 10, 9,102,111,114, 32,105, + 32, 61, 32,102,105,114,115,116, 44,108, 97,115,116, 32,100, + 111, 10, 10, 9, 9,114,101,116, 32, 61, 32,114,101,116, 46, + 46,108,115,101,112, 46, 46,116, 91,105, 93, 10, 9, 9,108, + 115,101,112, 32, 61, 32,115,101,112, 10, 9, 9,108,111,111, + 112, 32, 61, 32,116,114,117,101, 10, 9,101,110,100, 10, 9, + 105,102, 32,110,111,116, 32,108,111,111,112, 32,116,104,101, + 110, 10, 9, 9,114,101,116,117,114,110, 32, 34, 34, 10, 9, + 101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,114,101, + 116, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32,115,116,114,105,112, 95,112, 97,114,115, 40,115, 41, 10, + 10, 9,108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108, + 105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44, 32, + 39, 44, 39, 41, 10, 9,108,111, 99, 97,108, 32,115,116,114, + 105,112, 32, 61, 32,102, 97,108,115,101, 10, 9,108,111, 99, + 97,108, 32,108, 97,115,116, 10, 10, 9,102,111,114, 32,105, + 61,116, 46,110, 44, 49, 44, 45, 49, 32,100,111, 10, 10, 9, + 9,105,102, 32,110,111,116, 32,115,116,114,105,112, 32, 97, + 110,100, 32,112, 97,114, 97,109, 95,111, 98,106,101, 99,116, + 40,116, 91,105, 93, 41, 32,116,104,101,110, 10, 9, 9, 9, + 108, 97,115,116, 32, 61, 32,105, 10, 9, 9, 9,115,116,114, + 105,112, 32, 61, 32,116,114,117,101, 10, 9, 9,101,110,100, + 10, 9, 9, 45, 45,105,102, 32,115,116,114,105,112, 32,116, + 104,101,110, 10, 9, 9, 45, 45, 9,116, 91,105, 93, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116, 91, + 105, 93, 44, 32, 34, 61, 46, 42, 36, 34, 44, 32, 34, 34, 41, + 10, 9, 9, 45, 45,101,110,100, 10, 9,101,110,100, 10, 10, + 9,114,101,116,117,114,110, 32,116, 44,115,116,114,105,112, + 44,108, 97,115,116, 10, 10,101,110,100, 10, 10,102,117,110, + 99,116,105,111,110, 32,115,116,114,105,112, 95,100,101,102, + 97,117,108,116,115, 40,115, 41, 10, 10, 9,115, 32, 61, 32, + 115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32, + 34, 94, 37, 40, 34, 44, 32, 34, 34, 41, 10, 9,115, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, + 32, 34, 37, 41, 36, 34, 44, 32, 34, 34, 41, 10, 10, 9,108, + 111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116, 95, + 99, 95,116,111,107,101,110,115, 40,115, 44, 32, 34, 44, 34, + 41, 10, 9,108,111, 99, 97,108, 32,115,101,112, 44, 32,114, + 101,116, 32, 61, 32, 34, 34, 44, 34, 34, 10, 9,102,111,114, + 32,105, 61, 49, 44,116, 46,110, 32,100,111, 10, 9, 9,116, + 91,105, 93, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 40,116, 91,105, 93, 44, 32, 34, 61, 46, 42, 36, 34, + 44, 32, 34, 34, 41, 10, 9, 9,114,101,116, 32, 61, 32,114, + 101,116, 46, 46,115,101,112, 46, 46,116, 91,105, 93, 10, 9, + 9,115,101,112, 32, 61, 32, 34, 44, 34, 10, 9,101,110,100, + 10, 10, 9,114,101,116,117,114,110, 32, 34, 40, 34, 46, 46, + 114,101,116, 46, 46, 34, 41, 34, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/function.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,111,112,101,114, 97, + 116,111,114, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73, + 100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99, + 111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102, + 116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32, + 114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, + 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32, + 105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116, + 119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104, + 101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, + 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105, + 115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97, + 117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98, + 108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111, + 118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99, + 101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, + 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99, + 101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105, + 102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, + 32, 79,112,101,114, 97,116,111,114, 32, 99,108, 97,115,115, + 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, + 97,110, 32,111,112,101,114, 97,116,111,114, 32,102,117,110, + 99,116,105,111,110, 32,111,114, 32, 97, 32, 99,108, 97,115, + 115, 32,111,112,101,114, 97,116,111,114, 32,109,101,116,104, + 111,100, 46, 10, 45, 45, 32, 73,116, 32,115,116,111,114,101, + 115, 32,116,104,101, 32,115, 97,109,101, 32,102,105,101,108, + 100,115, 32, 97,115, 32,102,117,110, 99,116,105,111,110,115, + 32,100,111, 32,112,108,117,115, 58, 10, 45, 45, 32, 32,107, + 105,110,100, 32, 61, 32,115,101,116, 32,111,102, 32, 99,104, + 97,114, 97, 99,116,101,114, 32,114,101,112,114,101,115,101, + 110,116,105,110,103, 32,116,104,101, 32,111,112,101,114, 97, + 116,111,114, 32, 40, 97,115, 32,105,116, 32, 97,112,112,101, + 114,115, 32,105,110, 32, 67, 43, 43, 32, 99,111,100,101, 41, + 10, 99,108, 97,115,115, 79,112,101,114, 97,116,111,114, 32, + 61, 32,123, 10, 32,107,105,110,100, 32, 61, 32, 39, 39, 44, + 10,125, 10, 99,108, 97,115,115, 79,112,101,114, 97,116,111, + 114, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97, + 115,115, 79,112,101,114, 97,116,111,114, 10,115,101,116,109, + 101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 79, + 112,101,114, 97,116,111,114, 44, 99,108, 97,115,115, 70,117, + 110, 99,116,105,111,110, 41, 10, 10, 45, 45, 32,116, 97, 98, + 108,101, 32,116,111, 32,116,114, 97,110,115,102,111,114,109, + 32,111,112,101,114, 97,116,111,114, 32,107,105,110,100, 32, + 105,110,116,111, 32,116,104,101, 32, 97,112,112,114,111,112, + 114,105, 97,116,101, 32,116, 97,103, 32,109,101,116,104,111, + 100, 32,110, 97,109,101, 10, 95, 84, 77, 32, 61, 32,123, 91, + 39, 43, 39, 93, 32, 61, 32, 39, 97,100,100, 39, 44, 10, 32, + 32, 32, 32, 32, 32, 32, 91, 39, 45, 39, 93, 32, 61, 32, 39, + 115,117, 98, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, + 42, 39, 93, 32, 61, 32, 39,109,117,108, 39, 44, 10, 32, 32, + 32, 32, 32, 32, 32, 91, 39, 47, 39, 93, 32, 61, 32, 39,100, + 105,118, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 60, + 39, 93, 32, 61, 32, 39,108,116, 39, 44, 10, 32, 32, 32, 32, + 32, 32, 32, 91, 39, 60, 61, 39, 93, 32, 61, 32, 39,108,101, + 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 61, 61, 39, + 93, 32, 61, 32, 39,101,113, 39, 44, 10, 32, 32, 32, 32, 32, + 32, 32, 91, 39, 91, 93, 39, 93, 32, 61, 32, 39,103,101,116, + 105, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 38, 91, + 93, 39, 93, 32, 61, 32, 39,115,101,116,105, 39, 44, 10, 32, + 32, 32, 32, 32, 32, 32, 45, 45, 91, 39, 45, 62, 39, 93, 32, + 61, 32, 39,102,108,101, 99,104,105,116, 97, 39, 44, 10, 32, + 32, 32, 32, 32, 32,125, 10, 10, 10, 45, 45, 32, 80,114,105, + 110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 79,112,101,114, 97,116, + 111,114, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, + 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 79,112,101,114, 97,116,111, + 114,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,107,105,110,100, 32, 32, 61, 32, 39, + 34, 46, 46,115,101,108,102, 46,107,105,110,100, 46, 46, 34, + 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, + 46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46, + 115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108, + 101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32, + 100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103,115, 91, + 105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, + 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105, + 110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, + 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 79,112,101,114, 97,116,111,114, 58,115,117,112, 99,111, + 100,101, 95,116,109,112, 40, 41, 10, 10, 9,105,102, 32,110, + 111,116, 32, 95, 84, 77, 91,115,101,108,102, 46,107,105,110, + 100, 93, 32,116,104,101,110, 10, 9, 9,114,101,116,117,114, + 110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110, + 46,115,117,112, 99,111,100,101, 40,115,101,108,102, 41, 10, + 9,101,110,100, 10, 10, 9, 45, 45, 32,110,111, 32,111,118, + 101,114,108,111, 97,100, 44, 32,110,111, 32,112, 97,114, 97, + 109,101,116,101,114,115, 44, 32, 97,108,119, 97,121,115, 32, + 105,110, 99,108, 97,115,115, 10, 9,111,117,116,112,117,116, + 40, 34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115, + 101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99, + 108, 97,115,115, 32, 34, 44,115,101,108,102, 58,105,110, 99, + 108, 97,115,115, 40, 41, 44, 34, 32, 42, 47, 34, 41, 10, 10, + 9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101, + 102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, + 95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 41, + 10, 9,111,117,116,112,117,116, 40, 34, 92,110,115,116, 97, + 116,105, 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99, + 110, 97,109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116, + 101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 10, + 9,105,102, 32,111,118,101,114,108,111, 97,100, 32, 60, 32, + 48, 32,116,104,101,110, 10, 9, 32,111,117,116,112,117,116, + 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, + 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9,101, + 110,100, 10, 9,111,117,116,112,117,116, 40, 39, 32,116,111, + 108,117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, + 95,101,114,114, 59, 39, 41, 10, 9,111,117,116,112,117,116, + 40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10, 9, 45, 45, + 32, 99,104,101, 99,107, 32,115,101,108,102, 10, 9,108,111, + 99, 97,108, 32,105,115, 95,102,117,110, 99, 32, 61, 32,103, + 101,116, 95,105,115, 95,102,117,110, 99,116,105,111,110, 40, + 115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112, + 101, 41, 10, 9,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 32, 32, 33, 39, 46, 46,105,115, 95,102,117,110, 99, 46, 46, + 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 34, 39, 46, + 46,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121, + 112,101, 46, 46, 39, 34, 44, 48, 44, 38,116,111,108,117, 97, + 95,101,114,114, 41, 32,124,124, 92,110, 39, 41, 10, 9,111, + 117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111, + 108,117, 97, 95,105,115,110,111,111, 98,106, 40,116,111,108, + 117, 97, 95, 83, 44, 50, 44, 38,116,111,108,117, 97, 95,101, + 114,114, 41, 92,110, 32, 41, 39, 41, 10, 9,111,117,116,112, + 117,116, 40, 39, 32, 32,103,111,116,111, 32,116,111,108,117, + 97, 95,108,101,114,114,111,114, 59, 39, 41, 10, 10, 9,111, + 117,116,112,117,116, 40, 39, 32,101,108,115,101, 92,110, 39, + 41, 10, 9,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 32, 45, 45, 32,116,111,108,117, 97, + 95,114,101,108,101, 97,115,101, 10, 9,111,117,116,112,117, + 116, 40, 39, 32,123, 39, 41, 10, 10, 9, 45, 45, 32,100,101, + 99,108, 97,114,101, 32,115,101,108,102, 10, 9,111,117,116, + 112,117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111, + 110,115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116, + 46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, + 32, 61, 32, 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, + 40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,115, + 101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, + 44, 39, 42, 41, 32, 39, 41, 10, 9,108,111, 99, 97,108, 32, + 116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,116, + 111, 95,102,117,110, 99, 40,115,101,108,102, 46,112, 97,114, + 101,110,116, 46,116,121,112,101, 41, 10, 9,111,117,116,112, + 117,116, 40,116,111, 95,102,117,110, 99, 44, 39, 40,116,111, + 108,117, 97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10, 10, + 9, 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10, + 9,111,117,116,112,117,116, 40, 39, 35,105,102,110,100,101, + 102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, + 92,110, 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 32, + 32,105,102, 32, 40, 33,115,101,108,102, 41, 32,116,111,108, + 117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95, + 83, 44, 34, 39, 46, 46,111,117,116,112,117,116, 95,101,114, + 114,111,114, 95,104,111,111,107, 40, 34,105,110,118, 97,108, + 105,100, 32, 92, 39,115,101,108,102, 92, 39, 32,105,110, 32, + 102,117,110, 99,116,105,111,110, 32, 92, 39, 37,115, 92, 39, + 34, 44, 32,115,101,108,102, 46,110, 97,109,101, 41, 46, 46, + 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 59, 10, 9,111, + 117,116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, + 39, 41, 10, 10, 9, 45, 45, 32, 99, 97,115,116, 32,115,101, + 108,102, 10, 9,111,117,116,112,117,116, 40, 39, 32, 32, 39, + 44,115,101,108,102, 46,109,111,100, 44,115,101,108,102, 46, + 116,121,112,101, 44,115,101,108,102, 46,112,116,114, 44, 39, + 116,111,108,117, 97, 95,114,101,116, 32, 61, 32, 39, 41, 10, + 9,111,117,116,112,117,116, 40, 39, 40, 39, 44,115,101,108, + 102, 46,109,111,100, 44,115,101,108,102, 46,116,121,112,101, + 44,115,101,108,102, 46,112,116,114, 44, 39, 41, 40, 42,115, + 101,108,102, 41, 59, 39, 41, 10, 10, 9, 45, 45, 32,114,101, + 116,117,114,110, 32,118, 97,108,117,101, 10, 9,108,111, 99, + 97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115, + 105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 9, + 105,102, 32,116, 32,116,104,101,110, 10, 9, 9,111,117,116, + 112,117,116, 40, 39, 32, 32, 32,116,111,108,117, 97, 95,112, + 117,115,104, 39, 46, 46,116, 46, 46, 39, 40,116,111,108,117, + 97, 95, 83, 44, 40, 39, 44, 99,116, 44, 39, 41,116,111,108, + 117, 97, 95,114,101,116, 41, 59, 39, 41, 10, 9,101,108,115, + 101, 10, 9, 9,116, 32, 61, 32,115,101,108,102, 46,116,121, + 112,101, 10, 9, 9,108,111, 99, 97,108, 32,112,117,115,104, + 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,112,117,115, + 104, 95,102,117,110, 99,116,105,111,110, 40,116, 41, 10, 9, + 9,110,101,119, 95,116, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,116, 44, 32, 34, 99,111,110,115,116, + 37,115, 43, 34, 44, 32, 34, 34, 41, 10, 9, 9,105,102, 32, + 115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32, + 116,104,101,110, 10, 9, 9, 9,111,117,116,112,117,116, 40, + 39, 32, 32, 32,123, 39, 41, 10, 9, 9, 9,111,117,116,112, + 117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,112, + 108,117,115,112,108,117,115, 92,110, 39, 41, 10, 9, 9, 9, + 111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,105, + 100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32, 61, 32, + 77,116,111,108,117, 97, 95,110,101,119, 40, 40, 39, 44,110, + 101,119, 95,116, 44, 39, 41, 40,116,111,108,117, 97, 95,114, + 101,116, 41, 41, 59, 39, 41, 10, 9, 9, 9,111,117,116,112, + 117,116, 40, 39, 32, 32, 32, 32, 39, 44,112,117,115,104, 95, + 102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, + 116,111,108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116, 44, + 39, 34, 41, 59, 39, 41, 10, 9, 9, 9,111,117,116,112,117, + 116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, 95,114,101, + 103,105,115,116,101,114, 95,103, 99, 40,116,111,108,117, 97, + 95, 83, 44,108,117, 97, 95,103,101,116,116,111,112, 40,116, + 111,108,117, 97, 95, 83, 41, 41, 59, 39, 41, 10, 9, 9, 9, + 111,117,116,112,117,116, 40, 39, 35,101,108,115,101, 92,110, + 39, 41, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, + 32, 32, 32,118,111,105,100, 42, 32,116,111,108,117, 97, 95, + 111, 98,106, 32, 61, 32,116,111,108,117, 97, 95, 99,111,112, + 121, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, + 42, 41, 38,116,111,108,117, 97, 95,114,101,116, 44,115,105, + 122,101,111,102, 40, 39, 44,116, 44, 39, 41, 41, 59, 39, 41, + 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40, + 116,111,108,117, 97, 95, 83, 44,116,111,108,117, 97, 95,111, + 98,106, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, + 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, + 116,111,108,117, 97, 95,114,101,103,105,115,116,101,114, 95, + 103, 99, 40,116,111,108,117, 97, 95, 83, 44,108,117, 97, 95, + 103,101,116,116,111,112, 40,116,111,108,117, 97, 95, 83, 41, + 41, 59, 39, 41, 10, 9, 9, 9,111,117,116,112,117,116, 40, + 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 9, 9, 9, + 111,117,116,112,117,116, 40, 39, 32, 32, 32,125, 39, 41, 10, + 9, 9,101,108,115,101,105,102, 32,115,101,108,102, 46,112, + 116,114, 32, 61, 61, 32, 39, 38, 39, 32,116,104,101,110, 10, + 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 39, + 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111, + 108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, 38,116, + 111,108,117, 97, 95,114,101,116, 44, 34, 39, 44,116, 44, 39, + 34, 41, 59, 39, 41, 10, 9, 9,101,108,115,101, 10, 9, 9, + 9,105,102, 32,108,111, 99, 97,108, 95, 99,111,110,115,116, + 114,117, 99,116,111,114, 32,116,104,101,110, 10, 9, 9, 9, + 9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44,112, + 117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, + 97, 95, 83, 44, 40,118,111,105,100, 32, 42, 41,116,111,108, + 117, 97, 95,114,101,116, 44, 34, 39, 44,116, 44, 39, 34, 41, + 59, 39, 41, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40, + 39, 32, 32, 32, 32,116,111,108,117, 97, 95,114,101,103,105, + 115,116,101,114, 95,103, 99, 40,116,111,108,117, 97, 95, 83, + 44,108,117, 97, 95,103,101,116,116,111,112, 40,116,111,108, + 117, 97, 95, 83, 41, 41, 59, 39, 41, 10, 9, 9, 9,101,108, + 115,101, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40, 39, + 32, 32, 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, + 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, + 42, 41,116,111,108,117, 97, 95,114,101,116, 44, 34, 39, 44, + 116, 44, 39, 34, 41, 59, 39, 41, 10, 9, 9, 9,101,110,100, + 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 10, 9,111, + 117,116,112,117,116, 40, 39, 32, 32,125, 39, 41, 10, 9,111, + 117,116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, + 49, 59, 39, 41, 10, 10, 9,111,117,116,112,117,116, 40, 39, + 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, + 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9,111,117,116, + 112,117,116, 40, 39,116,111,108,117, 97, 95,108,101,114,114, + 111,114, 58, 92,110, 39, 41, 10, 9,111,117,116,112,117,116, + 40, 39, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40, + 116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,111,117,116, + 112,117,116, 95,101,114,114,111,114, 95,104,111,111,107, 40, + 34, 35,102,101,114,114,111,114, 32,105,110, 32,102,117,110, + 99,116,105,111,110, 32, 92, 39, 37,115, 92, 39, 46, 34, 44, + 32,115,101,108,102, 46,108,110, 97,109,101, 41, 46, 46, 39, + 34, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, 59, 39, + 41, 10, 9,111,117,116,112,117,116, 40, 39, 32,114,101,116, + 117,114,110, 32, 48, 59, 39, 41, 10, 9,111,117,116,112,117, + 116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 10, + 10, 9,111,117,116,112,117,116, 40, 39,125, 39, 41, 10, 9, + 111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102, 32, + 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, + 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10, 9,111, + 117,116,112,117,116, 40, 39, 92,110, 39, 41, 10,101,110,100, + 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99, + 111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99, + 116,105,111,110, 32, 95, 79,112,101,114, 97,116,111,114, 32, + 40,116, 41, 10, 32,115,101,116,109,101,116, 97,116, 97, 98, + 108,101, 40,116, 44, 99,108, 97,115,115, 79,112,101,114, 97, + 116,111,114, 41, 10, 10, 32,105,102, 32,116, 46, 99,111,110, + 115,116, 32,126, 61, 32, 39, 99,111,110,115,116, 39, 32, 97, + 110,100, 32,116, 46, 99,111,110,115,116, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 32, 32,101,114,114,111,114, 40, + 34, 35,105,110,118, 97,108,105,100, 32, 39, 99,111,110,115, + 116, 39, 32,115,112,101, 99,105,102,105, 99, 97,116,105,111, + 110, 34, 41, 10, 32,101,110,100, 10, 10, 32, 97,112,112,101, + 110,100, 40,116, 41, 10, 32,105,102, 32,110,111,116, 32,116, + 58,105,110, 99,108, 97,115,115, 40, 41, 32,116,104,101,110, + 10, 32, 32,101,114,114,111,114, 40, 34, 35,111,112,101,114, + 97,116,111,114, 32, 99, 97,110, 32,111,110,108,121, 32, 98, + 101, 32,100,101,102,105,110,101,100, 32, 97,115, 32, 99,108, + 97,115,115, 32,109,101,109, 98,101,114, 34, 41, 10, 32,101, + 110,100, 10, 10, 32, 45, 45,116, 46,110, 97,109,101, 32, 61, + 32,116, 46,110, 97,109,101, 32, 46, 46, 32, 34, 95, 34, 32, + 46, 46, 32, 40, 95, 84, 77, 91,116, 46,107,105,110,100, 93, + 32,111,114, 32,116, 46,107,105,110,100, 41, 10, 32,116, 46, + 99,110, 97,109,101, 32, 61, 32,116, 58, 99,102,117,110, 99, + 110, 97,109,101, 40, 34,116,111,108,117, 97, 34, 41, 46, 46, + 116, 58,111,118,101,114,108,111, 97,100, 40,116, 41, 10, 32, + 116, 46,110, 97,109,101, 32, 61, 32, 34,111,112,101,114, 97, + 116,111,114, 34, 32, 46, 46, 32,116, 46,107,105,110,100, 32, + 32, 45, 45, 32,115,101,116, 32, 97,112,112,114,111,112,114, + 105, 97,116,101, 32, 99, 97,108,108,105,110,103, 32,110, 97, + 109,101, 10, 32,114,101,116,117,114,110, 32,116, 10,101,110, + 100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116, + 111,114, 10,102,117,110, 99,116,105,111,110, 32, 79,112,101, + 114, 97,116,111,114, 32, 40,100, 44,107, 44, 97, 44, 99, 41, + 10, 10, 9,108,111, 99, 97,108, 32,111,112, 95,107, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,107, 44, + 32, 34, 94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10, 9,111, + 112, 95,107, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 40,107, 44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, + 34, 41, 10, 9, 45, 45,105,102, 32,115,116,114,105,110,103, + 46,102,105,110,100, 40,107, 44, 32, 34, 94, 91, 37,119, 95, + 58, 37,100, 60, 62, 37, 42, 37, 38, 93, 43, 36, 34, 41, 32, + 116,104,101,110, 10, 9,105,102, 32,100, 32, 61, 61, 32, 34, + 111,112,101,114, 97,116,111,114, 34, 32, 97,110,100, 32,107, + 32,126, 61, 32, 39, 39, 32,116,104,101,110, 10, 10, 9, 9, + 100, 32, 61, 32,107, 46, 46, 34, 32,111,112,101,114, 97,116, + 111,114, 34, 10, 9,101,108,115,101,105,102, 32,110,111,116, + 32, 95, 84, 77, 91,111,112, 95,107, 93, 32,116,104,101,110, + 10, 10, 9, 9,105,102, 32,102,108, 97,103,115, 91, 39, 87, + 39, 93, 32,116,104,101,110, 10, 9, 9, 9,101,114,114,111, + 114, 40, 34,116,111,108,117, 97, 58, 32,110,111, 32,115,117, + 112,112,111,114,116, 32,102,111,114, 32,111,112,101,114, 97, + 116,111,114, 34, 32, 46, 46, 32,102, 46,107,105,110,100, 41, + 10, 9, 9,101,108,115,101, 10, 9, 9, 9,119, 97,114,110, + 105,110,103, 40, 34, 78,111, 32,115,117,112,112,111,114,116, + 32,102,111,114, 32,111,112,101,114, 97,116,111,114, 32, 34, + 46, 46,111,112, 95,107, 46, 46, 34, 44, 32,105,103,110,111, + 114,105,110,103, 34, 41, 10, 9, 9, 9,114,101,116,117,114, + 110, 32,110,105,108, 10, 9, 9,101,110,100, 10, 9,101,110, + 100, 10, 10, 9,108,111, 99, 97,108, 32,114,101,102, 32, 61, + 32, 39, 39, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, + 115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40, + 115,116,114,115,117, 98, 40, 97, 44, 50, 44,115,116,114,108, + 101,110, 40, 97, 41, 45, 49, 41, 44, 39, 44, 39, 41, 32, 45, + 45, 32,101,108,105,109,105,110, 97,116,101, 32, 98,114, 97, + 99,101,115, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, + 32,108,111, 99, 97,108, 32,108, 32, 61, 32,123,110, 61, 48, + 125, 10, 32,119,104,105,108,101, 32,116, 91,105, 93, 32,100, + 111, 10, 32, 32,108, 46,110, 32, 61, 32,108, 46,110, 43, 49, + 10, 32, 32,108, 91,108, 46,110, 93, 32, 61, 32, 68,101, 99, + 108, 97,114, 97,116,105,111,110, 40,116, 91,105, 93, 44, 39, + 118, 97,114, 39, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, + 10, 32,101,110,100, 10, 32,105,102, 32,107, 32, 61, 61, 32, + 39, 91, 93, 39, 32,116,104,101,110, 10, 9, 32,108,111, 99, + 97,108, 32, 95, 10, 9, 32, 95, 44, 32, 95, 44, 32,114,101, + 102, 32, 61, 32,115,116,114,102,105,110,100, 40,100, 44, 39, + 40, 38, 41, 39, 41, 10, 32, 32,100, 32, 61, 32,103,115,117, + 98, 40,100, 44, 39, 38, 39, 44, 39, 39, 41, 10, 32,101,108, + 115,101,105,102, 32,107, 61, 61, 39, 38, 91, 93, 39, 32,116, + 104,101,110, 10, 32, 32,108, 46,110, 32, 61, 32,108, 46,110, + 43, 49, 10, 32, 32,108, 91,108, 46,110, 93, 32, 61, 32, 68, + 101, 99,108, 97,114, 97,116,105,111,110, 40,100, 44, 39,118, + 97,114, 39, 41, 10, 32, 32,108, 91,108, 46,110, 93, 46,110, + 97,109,101, 32, 61, 32, 39,116,111,108,117, 97, 95,118, 97, + 108,117,101, 39, 10, 32,101,110,100, 10, 32,108,111, 99, 97, + 108, 32,102, 32, 61, 32, 68,101, 99,108, 97,114, 97,116,105, + 111,110, 40,100, 44, 39,102,117,110, 99, 39, 41, 10, 32,105, + 102, 32,107, 32, 61, 61, 32, 39, 91, 93, 39, 32, 97,110,100, + 32, 40,108, 91, 49, 93, 61, 61,110,105,108, 32,111,114, 32, + 105,115, 98, 97,115,105, 99, 40,108, 91, 49, 93, 46,116,121, + 112,101, 41,126, 61, 39,110,117,109, 98,101,114, 39, 41, 32, + 116,104,101,110, 10, 32, 32,101,114,114,111,114, 40, 39,111, + 112,101,114, 97,116,111,114, 91, 93, 32, 99, 97,110, 32,111, + 110,108,121, 32, 98,101, 32,100,101,102,105,110,101,100, 32, + 102,111,114, 32,110,117,109,101,114,105, 99, 32,105,110,100, + 101,120, 46, 39, 41, 10, 32,101,110,100, 10, 32,102, 46, 97, + 114,103,115, 32, 61, 32,108, 10, 32,102, 46, 99,111,110,115, + 116, 32, 61, 32, 99, 10, 32,102, 46,107,105,110,100, 32, 61, + 32,111,112, 95,107, 10, 32,102, 46,108,110, 97,109,101, 32, + 61, 32, 34, 46, 34, 46, 46, 40, 95, 84, 77, 91,102, 46,107, + 105,110,100, 93, 32,111,114, 32,102, 46,107,105,110,100, 41, + 10, 32,105,102, 32,110,111,116, 32, 95, 84, 77, 91,102, 46, + 107,105,110,100, 93, 32,116,104,101,110, 10, 32, 9,102, 46, + 99, 97,115,116, 95,111,112,101,114, 97,116,111,114, 32, 61, + 32,116,114,117,101, 10, 32,101,110,100, 10, 32,105,102, 32, + 102, 46,107,105,110,100, 32, 61, 61, 32, 39, 91, 93, 39, 32, + 97,110,100, 32,114,101,102, 61, 61, 39, 38, 39, 32, 97,110, + 100, 32,102, 46, 99,111,110,115,116,126, 61, 39, 99,111,110, + 115,116, 39, 32,116,104,101,110, 10, 32, 32, 79,112,101,114, + 97,116,111,114, 40,100, 44, 39, 38, 39, 46, 46,107, 44, 97, + 44, 99, 41, 32, 9, 45, 45, 32, 99,114,101, 97,116,101, 32, + 99,111,114,114,101,115,112,111,100,105,110,103, 32,115,101, + 116, 32,111,112,101,114, 97,116,111,114, 10, 32,101,110,100, + 10, 32,114,101,116,117,114,110, 32, 95, 79,112,101,114, 97, + 116,111,114, 40,102, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/operator.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 10, 95,103,108,111, 98, 97,108, 95,116,101,109,112,108, 97, + 116,101,115, 32, 61, 32,123,125, 10, 10, 99,108, 97,115,115, + 84,101,109,112,108, 97,116,101, 67,108, 97,115,115, 32, 61, + 32,123, 10, 10, 9,110, 97,109,101, 32, 61, 32, 39, 39, 44, + 10, 9, 98,111,100,121, 32, 61, 32, 39, 39, 44, 10, 9,112, + 97,114,101,110,116,115, 32, 61, 32,123,125, 44, 10, 9, 97, + 114,103,115, 32, 61, 32,123,125, 44, 32, 45, 45, 32,116,104, + 101, 32,116,101,109,112,108, 97,116,101, 32, 97,114,103,117, + 109,101,110,116,115, 10,125, 10, 10, 99,108, 97,115,115, 84, + 101,109,112,108, 97,116,101, 67,108, 97,115,115, 46, 95, 95, + 105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 84,101, + 109,112,108, 97,116,101, 67,108, 97,115,115, 10, 10, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 84,101, + 109,112,108, 97,116,101, 67,108, 97,115,115, 58,116,104,114, + 111,119, 40,116,121,112,101,115, 44, 32,108,111, 99, 97,108, + 95,115, 99,111,112,101, 41, 10, 10, 9, 45, 45,105,102, 32, + 116, 97, 98,108,101, 46,103,101,116,110, 40,116,121,112,101, + 115, 41, 32,126, 61, 32,116, 97, 98,108,101, 46,103,101,116, + 110, 40,115,101,108,102, 46, 97,114,103,115, 41, 32,116,104, + 101,110, 10, 9, 45, 45, 9,101,114,114,111,114, 40, 34, 35, + 105,110,118, 97,108,105,100, 32,112, 97,114, 97,109,101,116, + 101,114, 32, 99,111,117,110,116, 34, 41, 10, 9, 45, 45,101, + 110,100, 10, 10, 9, 45, 45, 32,114,101,112,108, 97, 99,101, + 10, 9,102,111,114, 32,105, 32, 61, 49, 32, 44, 32,116,121, + 112,101,115, 46,110, 32,100,111, 10, 10, 9, 9,108,111, 99, + 97,108, 32, 73,108, 32, 61, 32,115,112,108,105,116, 95, 99, + 95,116,111,107,101,110,115, 40,116,121,112,101,115, 91,105, + 93, 44, 32, 34, 32, 34, 41, 10, 9, 9,105,102, 32,116, 97, + 98,108,101, 46,103,101,116,110, 40, 73,108, 41, 32,126, 61, + 32,116, 97, 98,108,101, 46,103,101,116,110, 40,115,101,108, + 102, 46, 97,114,103,115, 41, 32,116,104,101,110, 10, 9, 9, + 9,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105, + 100, 32,112, 97,114, 97,109,101,116,101,114, 32, 99,111,117, + 110,116, 32,102,111,114, 32, 34, 46, 46,116,121,112,101,115, + 91,105, 93, 41, 10, 9, 9,101,110,100, 10, 9, 9,108,111, + 99, 97,108, 32, 98, 73, 32, 61, 32,115,101,108,102, 46, 98, + 111,100,121, 10, 9, 9,108,111, 99, 97,108, 32,112, 73, 32, + 61, 32,123,125, 10, 9, 9,102,111,114, 32,106, 32, 61, 32, + 49, 44,115,101,108,102, 46, 97,114,103,115, 46,110, 32,100, + 111, 10, 9, 9, 9, 45, 45, 84,108, 91,106, 93, 32, 61, 32, + 102,105,110,100,116,121,112,101, 40, 84,108, 91,106, 93, 41, + 32,111,114, 32, 84,108, 91,106, 93, 10, 9, 9, 9, 98, 73, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 98, 73, 44, 32, 34, 40, 91, 94, 95, 37,119, 93, 41, 34, 46, + 46,115,101,108,102, 46, 97,114,103,115, 91,106, 93, 46, 46, + 34, 40, 91, 94, 95, 37,119, 93, 41, 34, 44, 32, 34, 37, 49, + 34, 46, 46, 73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41, + 10, 9, 9, 9,105,102, 32,115,101,108,102, 46,112, 97,114, + 101,110,116,115, 32,116,104,101,110, 10, 9, 9, 9, 9,102, + 111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,103,101, + 116,110, 40,115,101,108,102, 46,112, 97,114,101,110,116,115, + 41, 32,100,111, 10, 9, 9, 9, 9, 9,112, 73, 91,105, 93, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 115,101,108,102, 46,112, 97,114,101,110,116,115, 91,105, 93, + 44, 32, 34, 40, 91, 94, 95, 37,119, 93, 63, 41, 34, 46, 46, + 115,101,108,102, 46, 97,114,103,115, 91,106, 93, 46, 46, 34, + 40, 91, 94, 95, 37,119, 93, 63, 41, 34, 44, 32, 34, 37, 49, + 34, 46, 46, 73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41, + 10, 9, 9, 9, 9,101,110,100, 10, 9, 9, 9,101,110,100, + 10, 9, 9,101,110,100, 10, 9, 9, 45, 45,108,111, 99, 97, + 108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34, 46, + 46,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,121, + 112,101,115, 91,105, 93, 44, 32, 34, 37,115, 43, 34, 44, 32, + 34, 44, 34, 41, 46, 46, 34, 62, 34, 10, 9, 9,108,111, 99, + 97,108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34, + 46, 46, 99,111,110, 99, 97,116, 40, 73,108, 44, 32, 49, 44, + 32,116, 97, 98,108,101, 46,103,101,116,110, 40, 73,108, 41, + 44, 32, 34, 44, 34, 41, 46, 46, 34, 62, 34, 10, 9, 9, 97, + 112,112,101,110,100, 32, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40, 97,112,112,101,110,100, 44, 32, 34, 37, + 115, 42, 44, 37,115, 42, 34, 44, 32, 34, 44, 34, 41, 10, 9, + 9, 97,112,112,101,110,100, 32, 61, 32,115,116,114,105,110, + 103, 46,103,115,117, 98, 40, 97,112,112,101,110,100, 44, 32, + 34, 62, 62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10, 9, 9, + 102,111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,103, + 101,116,110, 40,112, 73, 41, 32,100,111, 10, 9, 9, 9, 45, + 45,112, 73, 91,105, 93, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,112, 73, 91,105, 93, 44, 32, 34, 62, + 62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10, 9, 9, 9,112, + 73, 91,105, 93, 32, 61, 32,114,101,115,111,108,118,101, 95, + 116,101,109,112,108, 97,116,101, 95,116,121,112,101,115, 40, + 112, 73, 91,105, 93, 41, 10, 9, 9,101,110,100, 10, 9, 9, + 98, 73, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40, 98, 73, 44, 32, 34, 62, 62, 34, 44, 32, 34, 62, 32, + 62, 34, 41, 10, 9, 9,108,111, 99, 97,108, 32,110, 32, 61, + 32,115,101,108,102, 46,110, 97,109,101, 10, 9, 9,105,102, + 32,108,111, 99, 97,108, 95,115, 99,111,112,101, 32,116,104, + 101,110, 10, 9, 9, 9,110, 32, 61, 32,115,101,108,102, 46, + 108,111, 99, 97,108, 95,110, 97,109,101, 10, 9, 9,101,110, + 100, 10, 10, 9, 9, 67,108, 97,115,115, 40,110, 46, 46, 97, + 112,112,101,110,100, 44, 32,112, 73, 44, 32, 98, 73, 41, 10, + 9,101,110,100, 10,101,110,100, 10, 10, 10,102,117,110, 99, + 116,105,111,110, 32, 84,101,109,112,108, 97,116,101, 67,108, + 97,115,115, 40,110, 97,109,101, 44, 32,112, 97,114,101,110, + 116,115, 44, 32, 98,111,100,121, 44, 32,112, 97,114, 97,109, + 101,116,101,114,115, 41, 10, 10, 9,108,111, 99, 97,108, 32, + 111, 32, 61, 32,123, 10, 9, 10, 9, 9,112, 97,114,101,110, + 116,115, 32, 61, 32,112, 97,114,101,110,116,115, 44, 10, 9, + 9, 98,111,100,121, 32, 61, 32, 98,111,100,121, 44, 10, 9, + 9, 97,114,103,115, 32, 61, 32,112, 97,114, 97,109,101,116, + 101,114,115, 44, 10, 9,125, 10, 9, 10, 9,108,111, 99, 97, + 108, 32,111,110, 97,109,101, 32, 61, 32,115,116,114,105,110, + 103, 46,103,115,117, 98, 40,110, 97,109,101, 44, 32, 34, 64, + 46, 42, 36, 34, 44, 32, 34, 34, 41, 10, 9,111,110, 97,109, + 101, 32, 61, 32,103,101,116,110, 97,109,101,115,112, 97, 99, + 101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 46, 99,117,114,114, 41, 46, 46,111,110, 97,109,101, 10, + 9,111, 46,110, 97,109,101, 32, 61, 32,111,110, 97,109,101, + 10, 10, 9,111, 46,108,111, 99, 97,108, 95,110, 97,109,101, + 32, 61, 32,110, 97,109,101, 10, 9, 10, 9,115,101,116,109, + 101,116, 97,116, 97, 98,108,101, 40,111, 44, 32, 99,108, 97, + 115,115, 84,101,109,112,108, 97,116,101, 67,108, 97,115,115, + 41, 10, 10, 9,105,102, 32, 95,103,108,111, 98, 97,108, 95, + 116,101,109,112,108, 97,116,101,115, 91,111,110, 97,109,101, + 93, 32,116,104,101,110, 10, 9, 9,119, 97,114,110,105,110, + 103, 40, 34, 68,117,112,108,105, 99, 97,116,101, 32,100,101, + 99,108, 97,114, 97,116,105,111,110, 32,111,102, 32,116,101, + 109,112,108, 97,116,101, 32, 34, 46, 46,111,110, 97,109,101, + 41, 10, 9,101,108,115,101, 10, 9, 9, 95,103,108,111, 98, + 97,108, 95,116,101,109,112,108, 97,116,101,115, 91,111,110, + 97,109,101, 93, 32, 61, 32,111, 10, 9,101,110,100, 10, 10, + 9,114,101,116,117,114,110, 32,111, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/template_class.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 99,108, 97,115,115, + 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116, + 101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, + 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97, + 102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117, + 108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, + 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, + 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97, + 114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100, + 105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110, + 100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, + 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114, + 101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,101, + 117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, + 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, + 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104, + 111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, + 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,100, + 101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32, + 115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101, + 115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101, + 110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, + 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 67,108, + 97,115,115, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101, + 112,114,101,115,101,110,116,115, 32, 97, 32, 99,108, 97,115, + 115, 32,100,101,102,105,110,105,116,105,111,110, 46, 10, 45, + 45, 32, 83,116,111,114,101,115, 32,116,104,101, 32,102,111, + 108,108,111,119,105,110,103, 32,102,105,101,108,100,115, 58, + 10, 45, 45, 32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99, + 108, 97,115,115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32, + 32, 98, 97,115,101, 32, 61, 32, 99,108, 97,115,115, 32, 98, + 97,115,101, 44, 32,105,102, 32, 97,110,121, 32, 40,111,110, + 108,121, 32,115,105,110,103,108,101, 32,105,110,104,101,114, + 105,116, 97,110, 99,101, 32,105,115, 32,115,117,112,112,111, + 114,116,101,100, 41, 10, 45, 45, 32, 32, 32, 32,123,105,125, + 32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101,109, + 98,101,114,115, 10, 99,108, 97,115,115, 67,108, 97,115,115, + 32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121,112,101, + 32, 61, 32, 39, 99,108, 97,115,115, 39, 44, 10, 32,110, 97, + 109,101, 32, 61, 32, 39, 39, 44, 10, 32, 98, 97,115,101, 32, + 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, + 39, 44, 10, 32, 98,116,121,112,101, 32, 61, 32, 39, 39, 44, + 10, 32, 99,116,121,112,101, 32, 61, 32, 39, 39, 44, 10,125, + 10, 99,108, 97,115,115, 67,108, 97,115,115, 46, 95, 95,105, + 110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,108, 97, + 115,115, 10,115,101,116,109,101,116, 97,116, 97, 98,108,101, + 40, 99,108, 97,115,115, 67,108, 97,115,115, 44, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 41, 10, 10, 10, + 45, 45, 32,114,101,103,105,115,116,101,114, 32, 99,108, 97, + 115,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 67,108, 97,115,115, 58,114,101,103,105,115,116,101, + 114, 32, 40,112,114,101, 41, 10, 10, 9,105,102, 32,110,111, + 116, 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, + 98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116, + 104,101,110, 10, 9, 9,114,101,116,117,114,110, 10, 9,101, + 110,100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32, + 111,114, 32, 39, 39, 10, 32,112,117,115,104, 40,115,101,108, + 102, 41, 10, 9,105,102, 32, 95, 99,111,108,108,101, 99,116, + 91,115,101,108,102, 46,116,121,112,101, 93, 32,116,104,101, + 110, 10, 9, 9,111,117,116,112,117,116, 40,112,114,101, 44, + 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,115, + 112,108,117,115, 92,110, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95, + 99, 99,108, 97,115,115, 40,116,111,108,117, 97, 95, 83, 44, + 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46, + 46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46,116,121, + 112,101, 46, 46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102, + 46, 98,116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46, 95, + 99,111,108,108,101, 99,116, 91,115,101,108,102, 46,116,121, + 112,101, 93, 46, 46, 39, 41, 59, 39, 41, 10, 9, 9,111,117, + 116,112,117,116, 40,112,114,101, 44, 39, 35,101,108,115,101, + 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,112, + 114,101, 46, 46, 39,116,111,108,117, 97, 95, 99, 99,108, 97, + 115,115, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46, + 115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, + 34, 39, 46, 46,115,101,108,102, 46,116,121,112,101, 46, 46, + 39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46, 98,116,121, + 112,101, 46, 46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, + 10, 9, 9,111,117,116,112,117,116, 40,112,114,101, 44, 39, + 35,101,110,100,105,102, 92,110, 39, 41, 10, 9,101,108,115, + 101, 10, 32, 32,111,117,116,112,117,116, 40,112,114,101, 46, + 46, 39,116,111,108,117, 97, 95, 99, 99,108, 97,115,115, 40, + 116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108, + 102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 34, 39, 46, + 46,115,101,108,102, 46,116,121,112,101, 46, 46, 39, 34, 44, + 34, 39, 46, 46,115,101,108,102, 46, 98,116,121,112,101, 46, + 46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 10, 9,101, + 110,100, 10, 9,105,102, 32,115,101,108,102, 46,101,120,116, + 114, 97, 95, 98, 97,115,101,115, 32,116,104,101,110, 10, 9, + 9,102,111,114, 32,107, 44, 98, 97,115,101, 32,105,110, 32, + 105,112, 97,105,114,115, 40,115,101,108,102, 46,101,120,116, + 114, 97, 95, 98, 97,115,101,115, 41, 32,100,111, 10, 9, 9, + 9, 45, 45, 32,110,111,116, 32,110,111,119, 10, 32, 32, 32, + 45, 45,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39, + 32,116,111,108,117, 97, 95, 97,100,100, 98, 97,115,101, 40, + 116,111,108,117, 97, 95, 83, 44, 32, 34, 39, 46, 46,115,101, + 108,102, 46,116,121,112,101, 46, 46, 39, 34, 44, 32, 34, 39, + 46, 46, 98, 97,115,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, + 9, 9,101,110,100, 10, 9,101,110,100, 10, 32,111,117,116, + 112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, + 95, 98,101,103,105,110,109,111,100,117,108,101, 40,116,111, + 108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46, + 108,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108, + 101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32, + 115,101,108,102, 91,105, 93, 58,114,101,103,105,115,116,101, + 114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32, 32,105, + 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,111,117, + 116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, + 97, 95,101,110,100,109,111,100,117,108,101, 40,116,111,108, + 117, 97, 95, 83, 41, 59, 39, 41, 10, 9,112,111,112, 40, 41, + 10,101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110, + 32, 99,111,108,108,101, 99,116,105,111,110, 32,114,101,113, + 117,105,114,101,109,101,110,116, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58,114, + 101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111, + 110, 32, 40,116, 41, 10, 9,105,102, 32,115,101,108,102, 46, + 102,108, 97,103,115, 46,112,114,111,116,101, 99,116,101,100, + 95,100,101,115,116,114,117, 99,116,111,114, 32,111,114, 32, + 40,110,111,116, 32,115,101,108,102, 58, 99,104,101, 99,107, + 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, + 41, 41, 32,116,104,101,110, 10, 9, 9,114,101,116,117,114, + 110, 32,102, 97,108,115,101, 10, 9,101,110,100, 10, 32,112, + 117,115,104, 40,115,101,108,102, 41, 10, 9,108,111, 99, 97, + 108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,108,111, + 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101, 32, + 115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,114, 32, + 61, 32,115,101,108,102, 91,105, 93, 58,114,101,113,117,105, + 114,101, 99,111,108,108,101, 99,116,105,111,110, 40,116, 41, + 32,111,114, 32,114, 10, 32, 32,105, 32, 61, 32,105, 43, 49, + 10, 32,101,110,100, 10, 9,112,111,112, 40, 41, 10, 9, 45, + 45, 32,111,110,108,121, 32, 99,108, 97,115,115, 32,116,104, + 97,116, 32,101,120,112,111,114,116,115, 32,100,101,115,116, + 114,117, 99,116,111,114, 32, 99, 97,110, 32, 98,101, 32, 97, + 112,112,114,111,112,114,105, 97,116,101,108,121, 32, 99,111, + 108,108,101, 99,116,101,100, 10, 9, 45, 45, 32, 99,108, 97, + 115,115,101,115, 32,116,104, 97,116, 32,101,120,112,111,114, + 116, 32, 99,111,110,115,116,114,117, 99,116,111,114,115, 32, + 110,101,101,100, 32,116,111, 32,104, 97,118,101, 32, 97, 32, + 99,111,108,108,101, 99,116,111,114, 32, 40,111,118,101,114, + 114,105,100,101,100, 32, 98,121, 32, 45, 68, 32,102,108, 97, + 103, 32,111,110, 32, 99,111,109,109, 97,110,100, 32,108,105, + 110,101, 41, 10, 9,105,102, 32,115,101,108,102, 46, 95,100, + 101,108,101,116,101, 32,111,114, 32, 40, 40,110,111,116, 32, + 102,108, 97,103,115, 91, 39, 68, 39, 93, 41, 32, 97,110,100, + 32,115,101,108,102, 46, 95,110,101,119, 41, 32,116,104,101, + 110, 10, 9, 9, 45, 45,116, 91,115,101,108,102, 46,116,121, + 112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95, 99,111, + 108,108,101, 99,116, 95, 34, 32, 46, 46, 32,103,115,117, 98, + 40,115,101,108,102, 46,116,121,112,101, 44, 34, 58, 58, 34, + 44, 34, 95, 34, 41, 10, 9, 9,116, 91,115,101,108,102, 46, + 116,121,112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95, + 99,111,108,108,101, 99,116, 95, 34, 32, 46, 46, 32, 99,108, + 101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,115,101, + 108,102, 46,116,121,112,101, 41, 10, 9, 9,114, 32, 61, 32, + 116,114,117,101, 10, 9,101,110,100, 10, 32,114,101,116,117, + 114,110, 32,114, 10,101,110,100, 10, 10, 45, 45, 32,111,117, + 116,112,117,116, 32,116, 97,103,115, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58, + 100,101, 99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117, + 115,104, 40,115,101,108,102, 41, 10, 9,115,101,108,102, 46, + 116,121,112,101, 32, 61, 32,114,101,103,116,121,112,101, 40, + 115,101,108,102, 46,111,114,105,103,105,110, 97,108, 95,110, + 97,109,101, 32,111,114, 32,115,101,108,102, 46,110, 97,109, + 101, 41, 10, 9,115,101,108,102, 46, 98,116,121,112,101, 32, + 61, 32,116,121,112,101,118, 97,114, 40,115,101,108,102, 46, + 98, 97,115,101, 41, 10, 9,115,101,108,102, 46, 99,116,121, + 112,101, 32, 61, 32, 39, 99,111,110,115,116, 32, 39, 46, 46, + 115,101,108,102, 46,116,121,112,101, 10, 9,105,102, 32,115, + 101,108,102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115, + 32,116,104,101,110, 10, 9, 9,102,111,114, 32,105, 61, 49, + 44,116, 97, 98,108,101, 46,103,101,116,110, 40,115,101,108, + 102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115, 41, 32, + 100,111, 10, 9, 9, 9,115,101,108,102, 46,101,120,116,114, + 97, 95, 98, 97,115,101,115, 91,105, 93, 32, 61, 32,116,121, + 112,101,118, 97,114, 40,115,101,108,102, 46,101,120,116,114, + 97, 95, 98, 97,115,101,115, 91,105, 93, 41, 10, 9, 9,101, + 110,100, 10, 9,101,110,100, 10, 32,108,111, 99, 97,108, 32, + 105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, + 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105, + 93, 58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32, + 105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 9,112, + 111,112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80, + 114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115, + 115, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, 44, + 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,105, + 100,101,110,116, 46, 46, 34, 67,108, 97,115,115,123, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32, 98, 97,115,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46, 98, 97,115,101, 46, 46, 34, 39, 59, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 98,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46, 98,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32, 99,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46, 99,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, + 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104, + 105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, + 32, 32,115,101,108,102, 91,105, 93, 58,112,114,105,110,116, + 40,105,100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34, + 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110, + 100, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110, + 100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 67,108, 97,115,115, 58,115,101,116, 95,112,114,111, + 116,101, 99,116,101,100, 95,100,101,115,116,114,117, 99,116, + 111,114, 40,112, 41, 10, 9,115,101,108,102, 46,102,108, 97, + 103,115, 46,112,114,111,116,101, 99,116,101,100, 95,100,101, + 115,116,114,117, 99,116,111,114, 32, 61, 32,115,101,108,102, + 46,102,108, 97,103,115, 46,112,114,111,116,101, 99,116,101, + 100, 95,100,101,115,116,114,117, 99,116,111,114, 32,111,114, + 32,112, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,116,101, + 114,110, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111, + 114, 10,102,117,110, 99,116,105,111,110, 32, 95, 67,108, 97, + 115,115, 32, 40,116, 41, 10, 32,115,101,116,109,101,116, 97, + 116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 67,108, + 97,115,115, 41, 10, 32,116, 58, 98,117,105,108,100,110, 97, + 109,101,115, 40, 41, 10, 32, 97,112,112,101,110,100, 40,116, + 41, 10, 32,114,101,116,117,114,110, 32,116, 10,101,110,100, + 10, 10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111, + 114, 10, 45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104, + 101, 32,110, 97,109,101, 44, 32,116,104,101, 32, 98, 97,115, + 101, 32, 40, 97,114,114, 97,121, 41, 32, 97,110,100, 32,116, + 104,101, 32, 98,111,100,121, 32,111,102, 32,116,104,101, 32, + 99,108, 97,115,115, 46, 10,102,117,110, 99,116,105,111,110, + 32, 67,108, 97,115,115, 32, 40,110, 44,112, 44, 98, 41, 10, + 10, 9,105,102, 32,116, 97, 98,108,101, 46,103,101,116,110, + 40,112, 41, 32, 62, 32, 49, 32,116,104,101,110, 10, 9, 9, + 98, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40, + 98, 44, 32, 49, 44, 32, 45, 50, 41, 10, 9, 9,102,111,114, + 32,105, 61, 50, 44,116, 97, 98,108,101, 46,103,101,116,110, + 40,112, 41, 44, 49, 32,100,111, 10, 9, 9, 9, 98, 32, 61, + 32, 98, 46, 46, 34, 92,110, 32,116,111,108,117, 97, 95,105, + 110,104,101,114,105,116,115, 32, 34, 46, 46,112, 91,105, 93, + 46, 46, 34, 32, 95, 95, 34, 46, 46,112, 91,105, 93, 46, 46, + 34, 95, 95, 59, 92,110, 34, 10, 9, 9,101,110,100, 10, 9, + 9, 98, 32, 61, 32, 98, 46, 46, 34, 92,110,125, 34, 10, 9, + 101,110,100, 10, 10, 9, 45, 45, 32, 99,104,101, 99,107, 32, + 102,111,114, 32,116,101,109,112,108, 97,116,101, 10, 9, 98, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 98, 44, 32, 34, 94,123, 37,115, 42, 84, 69, 77, 80, 76, 65, + 84, 69, 95, 66, 73, 78, 68, 34, 44, 32, 34,123, 92,110, 84, + 79, 76, 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, + 73, 78, 68, 34, 41, 10, 9,108,111, 99, 97,108, 32,116, 44, + 95, 44, 84, 44, 73, 32, 61, 32,115,116,114,105,110,103, 46, + 102,105,110,100, 40, 98, 44, 32, 39, 94,123, 37,115, 42, 84, + 79, 76, 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, + 73, 78, 68, 37,115, 42, 37, 40, 43, 37,115, 42, 92, 34, 63, + 40, 91, 94, 92, 34, 44, 93, 42, 41, 92, 34, 63, 37,115, 42, + 44, 37,115, 42, 40, 91, 94, 37, 41, 93, 42, 41, 37,115, 42, + 37, 41, 43, 39, 41, 10, 9,105,102, 32,116, 32,116,104,101, + 110, 10, 10, 9, 9, 45, 45, 32,114,101,109,111,118,101, 32, + 113,117,111,116,101,115, 10, 9, 9, 73, 32, 61, 32,115,116, + 114,105,110,103, 46,103,115,117, 98, 40, 73, 44, 32, 34, 92, + 34, 34, 44, 32, 34, 34, 41, 10, 9, 9, 84, 32, 61, 32,115, + 116,114,105,110,103, 46,103,115,117, 98, 40, 84, 44, 32, 34, + 92, 34, 34, 44, 32, 34, 34, 41, 10, 9, 9, 45, 45, 32,103, + 101,116, 32,116,121,112,101, 32,108,105,115,116, 10, 9, 9, + 108,111, 99, 97,108, 32,116,121,112,101,115, 32, 61, 32,115, + 112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40, 73, + 44, 32, 34, 44, 34, 41, 10, 9, 9, 45, 45, 32,114,101,109, + 111,118,101, 32, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73, + 78, 68, 32,108,105,110,101, 10, 9, 9,108,111, 99, 97,108, + 32, 98,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 40, 98, 44, 32, 34, 94,123, 37,115, 42, 84, 79, 76, + 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73, 78, + 68, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34,123, 92, + 110, 34, 41, 10, 9, 9, 9, 10, 9, 9,108,111, 99, 97,108, + 32, 84,108, 32, 61, 32,115,112,108,105,116, 40, 84, 44, 32, + 34, 32, 34, 41, 10, 9, 9,108,111, 99, 97,108, 32,116, 99, + 32, 61, 32, 84,101,109,112,108, 97,116,101, 67,108, 97,115, + 115, 40,110, 44, 32,112, 44, 32, 98,115, 44, 32, 84,108, 41, + 10, 10, 9, 9, 10, 9, 9,116, 99, 58,116,104,114,111,119, + 40,116,121,112,101,115, 44, 32,116,114,117,101, 41, 10, 9, + 9, 45, 45,102,111,114, 32,105, 61, 49, 44,116,121,112,101, + 115, 46,110, 32,100,111, 10, 9, 9, 45, 45, 9,116, 99, 58, + 116,104,114,111,119, 40,115,112,108,105,116, 95, 99, 95,116, + 111,107,101,110,115, 40,116,121,112,101,115, 91,105, 93, 44, + 32, 34, 32, 34, 41, 44, 32,116,114,117,101, 41, 10, 9, 9, + 45, 45,101,110,100, 10, 9, 9,114,101,116,117,114,110, 10, + 9,101,110,100, 10, 9, 10, 9,108,111, 99, 97,108, 32,109, + 98, 97,115,101, 10, 10, 9,105,102, 32,112, 32,116,104,101, + 110, 10, 9, 9,109, 98, 97,115,101, 32, 61, 32,116, 97, 98, + 108,101, 46,114,101,109,111,118,101, 40,112, 44, 32, 49, 41, + 10, 9, 9,105,102, 32,110,111,116, 32,112, 91, 49, 93, 32, + 116,104,101,110, 32,112, 32, 61, 32,110,105,108, 32,101,110, + 100, 10, 9,101,110,100, 10, 10, 9,109, 98, 97,115,101, 32, + 61, 32,109, 98, 97,115,101, 32, 97,110,100, 32,114,101,115, + 111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95,116, + 121,112,101,115, 40,109, 98, 97,115,101, 41, 10, 10, 9,108, + 111, 99, 97,108, 32, 99, 10, 9,108,111, 99, 97,108, 32,111, + 110, 97,109,101, 32, 61, 32,115,116,114,105,110,103, 46,103, + 115,117, 98, 40,110, 44, 32, 34, 64, 46, 42, 36, 34, 44, 32, + 34, 34, 41, 10, 9,111,110, 97,109,101, 32, 61, 32,103,101, + 116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, + 41, 46, 46,111,110, 97,109,101, 10, 10, 9,105,102, 32, 95, + 103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91, + 111,110, 97,109,101, 93, 32,116,104,101,110, 10, 9, 9, 99, + 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115, + 115,101,115, 91,111,110, 97,109,101, 93, 10, 9, 9,105,102, + 32,109, 98, 97,115,101, 32, 97,110,100, 32, 40, 40,110,111, + 116, 32, 99, 46, 98, 97,115,101, 41, 32,111,114, 32, 99, 46, + 98, 97,115,101, 32, 61, 61, 32, 34, 34, 41, 32,116,104,101, + 110, 10, 9, 9, 9, 99, 46, 98, 97,115,101, 32, 61, 32,109, + 98, 97,115,101, 10, 9, 9,101,110,100, 10, 9,101,108,115, + 101, 10, 9, 9, 99, 32, 61, 32, 95, 67,108, 97,115,115, 40, + 95, 67,111,110,116, 97,105,110,101,114,123,110, 97,109,101, + 61,110, 44, 32, 98, 97,115,101, 61,109, 98, 97,115,101, 44, + 32,101,120,116,114, 97, 95, 98, 97,115,101,115, 61,112,125, + 41, 10, 10, 9, 9,108,111, 99, 97,108, 32,102,116, 32, 61, + 32,103,101,116,110, 97,109,101,115,112, 97, 99,101, 40, 99, + 46,112, 97,114,101,110,116, 41, 46, 46, 99, 46,111,114,105, + 103,105,110, 97,108, 95,110, 97,109,101, 10, 9, 9, 97,112, + 112,101,110,100, 95,103,108,111, 98, 97,108, 95,116,121,112, + 101, 40,102,116, 44, 32, 99, 41, 10, 9,101,110,100, 10, 10, + 9,112,117,115,104, 40, 99, 41, 10, 9, 99, 58,112, 97,114, + 115,101, 40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115, + 116,114,108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, + 32,101,108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99, + 101,115, 10, 9,112,111,112, 40, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/class.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,109, 97,114,107, 32,117,112, 32, 99,111,109,109, + 101,110,116,115, 32, 97,110,100, 32,115,116,114,105,110,103, + 115, 10, 83, 84, 82, 49, 32, 61, 32, 34, 92, 48, 48, 49, 34, + 10, 83, 84, 82, 50, 32, 61, 32, 34, 92, 48, 48, 50, 34, 10, + 83, 84, 82, 51, 32, 61, 32, 34, 92, 48, 48, 51, 34, 10, 83, + 84, 82, 52, 32, 61, 32, 34, 92, 48, 48, 52, 34, 10, 82, 69, + 77, 32, 32, 61, 32, 34, 92, 48, 48, 53, 34, 10, 65, 78, 89, + 32, 32, 61, 32, 34, 40, 91, 92, 48, 48, 49, 45, 92, 48, 48, + 53, 93, 41, 34, 10, 69, 83, 67, 49, 32, 61, 32, 34, 92, 48, + 48, 54, 34, 10, 69, 83, 67, 50, 32, 61, 32, 34, 92, 48, 48, + 55, 34, 10, 10, 77, 65, 83, 75, 32, 61, 32,123, 32, 45, 45, + 32,116,104,101, 32,115,117, 98,115,116,105,116,117,116,105, + 111,110, 32,111,114,100,101,114, 32,105,115, 32,105,109,112, + 111,114,116, 97,110,116, 10, 32,123, 69, 83, 67, 49, 44, 32, + 34, 92, 92, 39, 34,125, 44, 10, 32,123, 69, 83, 67, 50, 44, + 32, 39, 92, 92, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 49, + 44, 32, 34, 39, 34,125, 44, 10, 32,123, 83, 84, 82, 50, 44, + 32, 39, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 51, 44, 32, + 34, 37, 91, 37, 91, 34,125, 44, 10, 32,123, 83, 84, 82, 52, + 44, 32, 34, 37, 93, 37, 93, 34,125, 44, 10, 32,123, 82, 69, + 77, 32, 44, 32, 34, 37, 45, 37, 45, 34,125, 44, 10,125, 10, + 10,102,117,110, 99,116,105,111,110, 32,109, 97,115,107, 32, + 40,115, 41, 10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44, + 103,101,116,110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10, + 32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65, + 83, 75, 91,105, 93, 91, 50, 93, 44, 77, 65, 83, 75, 91,105, + 93, 91, 49, 93, 41, 10, 32,101,110,100, 10, 32,114,101,116, + 117,114,110, 32,115, 10,101,110,100, 10, 10,102,117,110, 99, + 116,105,111,110, 32,117,110,109, 97,115,107, 32, 40,115, 41, + 10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44,103,101,116, + 110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10, 32, 32,115, + 32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65, 83, 75, 91, + 105, 93, 91, 49, 93, 44, 77, 65, 83, 75, 91,105, 93, 91, 50, + 93, 41, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110, + 32,115, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108,101, 97,110, 32, 40,115, 41, 10, 32, 45, 45, + 32, 99,104,101, 99,107, 32,102,111,114, 32, 99,111,109,112, + 105,108, 97,116,105,111,110, 32,101,114,114,111,114, 10, 32, + 108,111, 99, 97,108, 32, 99,111,100,101, 32, 61, 32, 34,114, + 101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, 32, + 40, 41, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34, + 92,110, 32,101,110,100, 34, 10, 32,105,102, 32,110,111,116, + 32,100,111,115,116,114,105,110,103, 40, 99,111,100,101, 41, + 32,116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, + 110,105,108, 10, 32,101,110,100, 10, 10, 32,105,102, 32,102, + 108, 97,103,115, 91, 39, 67, 39, 93, 32,116,104,101,110, 10, + 32, 9,114,101,116,117,114,110, 32,115, 10, 32,101,110,100, + 10, 10, 32,108,111, 99, 97,108, 32, 83, 32, 61, 32, 34, 34, + 32, 45, 45, 32,115, 97,118,101,100, 32,115,116,114,105,110, + 103, 10, 10, 32,115, 32, 61, 32,109, 97,115,107, 40,115, 41, + 10, 10, 32, 45, 45, 32,114,101,109,111,118,101, 32, 98,108, + 97,110,107,115, 32, 97,110,100, 32, 99,111,109,109,101,110, + 116,115, 10, 32,119,104,105,108,101, 32, 49, 32,100,111, 10, + 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100, 32, 61, + 32,115,116,114,102,105,110,100, 40,115, 44, 65, 78, 89, 41, + 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32, + 32, 83, 32, 61, 32, 83, 46, 46,115,116,114,115,117, 98, 40, + 115, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32, 32,115, 32, 61, + 32,115,116,114,115,117, 98, 40,115, 44, 98, 43, 49, 41, 10, + 32, 32, 32,105,102, 32,100, 61, 61, 83, 84, 82, 49, 32,111, + 114, 32,100, 61, 61, 83, 84, 82, 50, 32,116,104,101,110, 10, + 32, 32, 32, 32,101, 32, 61, 32,115,116,114,102,105,110,100, + 40,115, 44,100, 41, 10, 32, 32, 32, 32, 83, 32, 61, 32, 83, + 32, 46, 46,100, 46, 46,115,116,114,115,117, 98, 40,115, 44, + 49, 44,101, 41, 10, 32, 32, 32, 32,115, 32, 61, 32,115,116, + 114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32, 32, + 101,108,115,101,105,102, 32,100, 61, 61, 83, 84, 82, 51, 32, + 116,104,101,110, 10, 32, 32, 32, 32,101, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115, 44, 83, 84, 82, 52, 41, 10, 32, + 32, 32, 32, 83, 32, 61, 32, 83, 46, 46,100, 46, 46,115,116, + 114,115,117, 98, 40,115, 44, 49, 44,101, 41, 10, 32, 32, 32, + 32,115, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44,101, + 43, 49, 41, 10, 32, 32, 32,101,108,115,101,105,102, 32,100, + 61, 61, 82, 69, 77, 32,116,104,101,110, 10, 32, 32, 32, 32, + 115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 91, 94, 92, + 110, 93, 42, 40, 92,110, 63, 41, 34, 44, 34, 37, 49, 34, 44, + 49, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,108,115, + 101, 10, 32, 32, 32, 83, 32, 61, 32, 83, 46, 46,115, 10, 32, + 32, 32, 98,114,101, 97,107, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 32, 45, 45, 32,101,108,105,109,105,110, 97, + 116,101, 32,117,110,101, 99,101,115,115, 97,114,121, 32,115, + 112, 97, 99,101,115, 10, 32, 83, 32, 61, 32,103,115,117, 98, + 40, 83, 44, 34, 91, 32, 92,116, 93, 43, 34, 44, 34, 32, 34, + 41, 10, 32, 83, 32, 61, 32,103,115,117, 98, 40, 83, 44, 34, + 91, 32, 92,116, 93, 42, 92,110, 91, 32, 92,116, 93, 42, 34, + 44, 34, 92,110, 34, 41, 10, 9, 83, 32, 61, 32,103,115,117, + 98, 40, 83, 44, 34, 92,110, 43, 34, 44, 34, 92,110, 34, 41, + 10, 32, 83, 32, 61, 32,117,110,109, 97,115,107, 40, 83, 41, + 10, 32,114,101,116,117,114,110, 32, 83, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/clean.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32, 71,101,110,101,114, 97,116,101, 32, 98,105,110, + 100,105,110,103, 32, 99,111,100,101, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 76, 97, + 115,116, 32,117,112,100, 97,116,101, 58, 32, 65,112,114, 32, + 50, 48, 48, 51, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, + 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32, + 105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114, + 101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105, + 115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, + 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, + 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, + 32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117, + 110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, + 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97, + 110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111, + 114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97, + 116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, + 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115, + 117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, + 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110, + 116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97, + 116,105,111,110,115, 46, 10, 10,102,117,110, 99,116,105,111, + 110, 32,112, 97,114,115,101, 95,101,120,116,114, 97, 40, 41, + 10, 10, 9,102,111,114, 32,107, 44,118, 32,105,110, 32,105, + 112, 97,105,114,115, 40, 95,101,120,116,114, 97, 95,112, 97, + 114, 97,109,101,116,101,114,115, 32,111,114, 32,123,125, 41, + 32,100,111, 10, 9, 9, 10, 9, 9,108,111, 99, 97,108, 32, + 98, 44,101, 44,110, 97,109,101, 44,118, 97,108,117,101, 32, + 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,118, + 44, 32, 34, 94, 40, 91, 94, 61, 93, 42, 41, 61, 40, 46, 42, + 41, 36, 34, 41, 10, 9, 9,105,102, 32, 98, 32,116,104,101, + 110, 10, 9, 9, 9, 95,101,120,116,114, 97, 95,112, 97,114, + 97,109,101,116,101,114,115, 91,110, 97,109,101, 93, 32, 61, + 32,118, 97,108,117,101, 10, 9, 9,101,108,115,101, 10, 9, + 9, 9, 95,101,120,116,114, 97, 95,112, 97,114, 97,109,101, + 116,101,114,115, 91,118, 93, 32, 61, 32,116,114,117,101, 10, + 9, 9,101,110,100, 10, 9,101,110,100, 10,101,110,100, 10, + 10,102,117,110, 99,116,105,111,110, 32,100,111,105,116, 32, + 40, 41, 10, 9, 45, 45, 32,100,101,102,105,110,101, 32,112, + 97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,105,102, + 32,110,111,116, 32,112,114,111,118,105,100,101,100, 10, 9, + 105,102, 32,110,111,116, 32,102,108, 97,103,115, 46,110, 32, + 116,104,101,110, 10, 9, 9,105,102, 32,102,108, 97,103,115, + 46,102, 32,116,104,101,110, 10, 9, 9, 9,102,108, 97,103, + 115, 46,110, 32, 61, 32,103,115,117, 98, 40,102,108, 97,103, + 115, 46,102, 44, 34, 37, 46, 46, 42, 36, 34, 44, 34, 34, 41, + 10, 9, 9, 9, 95, 44, 95, 44,102,108, 97,103,115, 46,110, + 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 102,108, 97,103,115, 46,110, 44, 32, 34, 40, 91, 94, 47, 92, + 92, 93, 42, 41, 36, 34, 41, 10, 9, 9,101,108,115,101, 10, + 9, 9, 9,101,114,114,111,114, 40, 34, 35,110,111, 32,112, + 97, 99,107, 97,103,101, 32,110, 97,109,101, 32,110,111,114, + 32,105,110,112,117,116, 32,102,105,108,101, 32,112,114,111, + 118,105,100,101,100, 34, 41, 10, 9, 9,101,110,100, 10, 9, + 101,110,100, 10, 10, 9, 45, 45, 32,112, 97,114,115,101, 32, + 116, 97, 98,108,101, 32,119,105,116,104, 32,101,120,116,114, + 97, 32,112, 97,114, 97,109,116,101,114,115, 10, 9,112, 97, + 114,115,101, 95,101,120,116,114, 97, 40, 41, 10, 10, 9, 45, + 45, 32,100,111, 32,116,104,105,115, 32, 97,102,116,101,114, + 32,115,101,116,116,105,110,103, 32,116,104,101, 32,112, 97, + 99,107, 97,103,101, 32,110, 97,109,101, 10, 9,105,102, 32, + 102,108, 97,103,115, 91, 39, 76, 39, 93, 32,116,104,101,110, + 10, 9, 9,100,111,102,105,108,101, 40,102,108, 97,103,115, + 91, 39, 76, 39, 93, 41, 10, 9,101,110,100, 10, 10, 9, 45, + 45, 32, 97,100,100, 32, 99,112,112,115,116,114,105,110,103, + 10, 9,105,102, 32,110,111,116, 32,102,108, 97,103,115, 91, + 39, 83, 39, 93, 32,116,104,101,110, 10, 9, 9, 95, 98, 97, + 115,105, 99, 91, 39,115,116,114,105,110,103, 39, 93, 32, 61, + 32, 39, 99,112,112,115,116,114,105,110,103, 39, 10, 9, 9, + 95, 98, 97,115,105, 99, 91, 39,115,116,100, 58, 58,115,116, + 114,105,110,103, 39, 93, 32, 61, 32, 39, 99,112,112,115,116, + 114,105,110,103, 39, 10, 9, 9, 95, 98, 97,115,105, 99, 95, + 99,116,121,112,101, 46, 99,112,112,115,116,114,105,110,103, + 32, 61, 32, 39, 99,111,110,115,116, 32, 99,104, 97,114, 42, + 39, 10, 9,101,110,100, 10, 10, 9, 45, 45, 32,112,114,111, + 99, 99,101,115,115, 32,112, 97, 99,107, 97,103,101, 10, 9, + 108,111, 99, 97,108, 32,112, 32, 32, 61, 32, 80, 97, 99,107, + 97,103,101, 40,102,108, 97,103,115, 46,110, 44,102,108, 97, + 103,115, 46,102, 41, 10, 10, 9,105,102, 32,102,108, 97,103, + 115, 46,112, 32,116,104,101,110, 10, 9, 9,114,101,116,117, + 114,110, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,111,110, + 108,121, 32,112, 97,114,115,101, 10, 9,101,110,100, 10, 10, + 9,105,102, 32,102,108, 97,103,115, 46,111, 32,116,104,101, + 110, 10, 9, 9,108,111, 99, 97,108, 32,115,116, 44,109,115, + 103, 32, 61, 32,119,114,105,116,101,116,111, 40,102,108, 97, + 103,115, 46,111, 41, 10, 9, 9,105,102, 32,110,111,116, 32, + 115,116, 32,116,104,101,110, 10, 9, 9, 9,101,114,114,111, + 114, 40, 39, 35, 39, 46, 46,109,115,103, 41, 10, 9, 9,101, + 110,100, 10, 9,101,110,100, 10, 10, 9,112, 58,100,101, 99, + 108,116,121,112,101, 40, 41, 10, 9,105,102, 32,102,108, 97, + 103,115, 46, 80, 32,116,104,101,110, 10, 9, 9,112, 58,112, + 114,105,110,116, 40, 41, 10, 9,101,108,115,101, 10, 9, 9, + 112,117,115,104, 40,112, 41, 10, 9, 9,112,114,101, 95,111, + 117,116,112,117,116, 95,104,111,111,107, 40,112, 41, 10, 9, + 9,112,111,112, 40, 41, 10, 9, 9,112, 58,112,114,101, 97, + 109, 98,108,101, 40, 41, 10, 9, 9,112, 58,115,117,112, 99, + 111,100,101, 40, 41, 10, 9, 9,112,117,115,104, 40,112, 41, + 10, 9, 9,112,114,101, 95,114,101,103,105,115,116,101,114, + 95,104,111,111,107, 40,112, 41, 10, 9, 9,112,111,112, 40, + 41, 10, 9, 9,112, 58,114,101,103,105,115,116,101,114, 40, + 41, 10, 9, 9,112,117,115,104, 40,112, 41, 10, 9, 9,112, + 111,115,116, 95,111,117,116,112,117,116, 95,104,111,111,107, + 40,112, 41, 10, 9, 9,112,111,112, 40, 41, 10, 9,101,110, + 100, 10, 10, 9,105,102, 32,102,108, 97,103,115, 46,111, 32, + 116,104,101,110, 10, 9, 9,119,114,105,116,101,116,111, 40, + 41, 10, 9,101,110,100, 10, 10, 9, 45, 45, 32,119,114,105, + 116,101, 32,104,101, 97,100,101,114, 32,102,105,108,101, 10, + 9,105,102, 32,110,111,116, 32,102,108, 97,103,115, 46, 80, + 32,116,104,101,110, 10, 9, 9,105,102, 32,102,108, 97,103, + 115, 46, 72, 32,116,104,101,110, 10, 9, 9, 9,108,111, 99, + 97,108, 32,115,116, 44,109,115,103, 32, 61, 32,119,114,105, + 116,101,116,111, 40,102,108, 97,103,115, 46, 72, 41, 10, 9, + 9, 9,105,102, 32,110,111,116, 32,115,116, 32,116,104,101, + 110, 10, 9, 9, 9, 9,101,114,114,111,114, 40, 39, 35, 39, + 46, 46,109,115,103, 41, 10, 9, 9, 9,101,110,100, 10, 9, + 9, 9,112, 58,104,101, 97,100,101,114, 40, 41, 10, 9, 9, + 9,119,114,105,116,101,116,111, 40, 41, 10, 9, 9,101,110, + 100, 10, 9,101,110,100, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/doit.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 10,108,111, 99, 97,108, 32,101,114,114, 44,109,115,103, 32, + 61, 32,112, 99, 97,108,108, 40,100,111,105,116, 41, 10,105, + 102, 32,110,111,116, 32,101,114,114, 32,116,104,101,110, 10, + 32,108,111, 99, 97,108, 32, 95, 44, 95, 44,108, 97, 98,101, + 108, 44,109,115,103, 32, 61, 32,115,116,114,102,105,110,100, + 40,109,115,103, 44, 34, 40, 46, 45, 58, 46, 45, 58, 37,115, + 42, 41, 40, 46, 42, 41, 34, 41, 10, 32,116,111,108,117, 97, + 95,101,114,114,111,114, 40,109,115,103, 44,108, 97, 98,101, + 108, 41, 10, 32,112,114,105,110,116, 40,100,101, 98,117,103, + 46,116,114, 97, 99,101, 98, 97, 99,107, 40, 41, 41, 10,101, + 110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code 23"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + tolua_endmodule(tolua_S); + return 1; +} + + +#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 + TOLUA_API int luaopen_tolua (lua_State* tolua_S) { + return tolua_tolua_open(tolua_S); +}; +#endif + diff --git a/tolua++-1.0.93/src/bin/toluabind.h b/tolua++-1.0.93/src/bin/toluabind.h new file mode 100644 index 000000000..7f1f018c9 --- /dev/null +++ b/tolua++-1.0.93/src/bin/toluabind.h @@ -0,0 +1,8 @@ +/* +** Lua binding: tolua +** Generated automatically by tolua++-1.0.92 on Sun Feb 15 22:29:48 2009. +*/ + +/* Exported function */ +TOLUA_API int tolua_tolua_open (lua_State* tolua_S); + diff --git a/tolua++-1.0.93/src/bin/toluabind_default.c b/tolua++-1.0.93/src/bin/toluabind_default.c new file mode 100644 index 000000000..b5db813bf --- /dev/null +++ b/tolua++-1.0.93/src/bin/toluabind_default.c @@ -0,0 +1,8009 @@ +/* +** Lua binding: tolua +** Generated automatically by tolua++-1.0.92 on Fri Dec 28 21:37:36 2007. +*/ + +#ifndef __cplusplus +#include "stdlib.h" +#endif +#include "string.h" + +#include "tolua++.h" + +/* Exported function */ +TOLUA_API int tolua_tolua_open (lua_State* tolua_S); + + +/* function to register type */ +static void tolua_reg_types (lua_State* tolua_S) +{ +} + +/* Open function */ +TOLUA_API int tolua_tolua_open (lua_State* tolua_S) +{ + tolua_open(tolua_S); + tolua_reg_types(tolua_S); + tolua_module(tolua_S,NULL,0); + tolua_beginmodule(tolua_S,NULL); + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 95, 86, 69, 82, 83, 73, 79, 78, 44, 32, 34, 53, 37, 46, 48, + 34, 41, 32,116,104,101,110, 13, 10, 9,114,101,116,117,114, + 110, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 32, 34,108, + 111, 97,100,102,105,108,101, 34, 13, 10,108,111, 99, 97,108, + 32,102,117,110, 99,116,105,111,110, 32,112,112, 95,100,111, + 102,105,108,101, 40,112, 97,116,104, 41, 13, 10, 13, 10, 9, + 108,111, 99, 97,108, 32,108,111, 97,100,101,100, 32, 61, 32, + 102, 97,108,115,101, 13, 10, 9,108,111, 99, 97,108, 32,103, + 101,116,102,105,108,101, 32, 61, 32,102,117,110, 99,116,105, + 111,110, 40, 41, 13, 10, 13, 10, 9, 9,105,102, 32,108,111, + 97,100,101,100, 32,116,104,101,110, 13, 10, 9, 9, 9,114, + 101,116,117,114,110, 13, 10, 9, 9,101,108,115,101, 13, 10, + 9, 9, 9,108,111, 99, 97,108, 32,102,105,108,101, 44,101, + 114,114, 32, 61, 32,105,111, 46,111,112,101,110, 40,112, 97, + 116,104, 41, 13, 10, 9, 9, 9,105,102, 32,110,111,116, 32, + 102,105,108,101, 32,116,104,101,110, 13, 10, 9, 9, 9, 9, + 101,114,114,111,114, 40, 34,101,114,114,111,114, 32,108,111, + 97,100,105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112, + 97,116,104, 46, 46, 34, 58, 32, 34, 46, 46,101,114,114, 41, + 13, 10, 9, 9, 9,101,110,100, 13, 10, 9, 9, 9,108,111, + 99, 97,108, 32,114,101,116, 32, 61, 32,102,105,108,101, 58, + 114,101, 97,100, 40, 34, 42, 97, 34, 41, 13, 10, 9, 9, 9, + 102,105,108,101, 58, 99,108,111,115,101, 40, 41, 13, 10, 13, + 10, 9, 9, 9,114,101,116, 32, 61, 32,115,116,114,105,110, + 103, 46,103,115,117, 98, 40,114,101,116, 44, 32, 34, 37, 46, + 37, 46, 37, 46, 37,115, 42, 37, 41, 34, 44, 32, 34, 46, 46, + 46, 41, 32,108,111, 99, 97,108, 32, 97,114,103, 32, 61, 32, + 123,110, 61,115,101,108,101, 99,116, 40, 39, 35, 39, 44, 32, + 46, 46, 46, 41, 44, 32, 46, 46, 46,125, 59, 34, 41, 13, 10, + 13, 10, 9, 9, 9,108,111, 97,100,101,100, 32, 61, 32,116, + 114,117,101, 13, 10, 9, 9, 9,114,101,116,117,114,110, 32, + 114,101,116, 13, 10, 9, 9,101,110,100, 13, 10, 9,101,110, + 100, 13, 10, 13, 10, 9,108,111, 99, 97,108, 32,102, 32, 61, + 32,108,111, 97,100, 40,103,101,116,102,105,108,101, 44, 32, + 112, 97,116,104, 41, 13, 10, 9,105,102, 32,110,111,116, 32, + 102, 32,116,104,101,110, 13, 10, 9, 13, 10, 9, 9,101,114, + 114,111,114, 40, 34,101,114,114,111,114, 32,108,111, 97,100, + 105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112, 97,116, + 104, 41, 13, 10, 9,101,110,100, 13, 10, 9,114,101,116,117, + 114,110, 32,102, 40, 41, 13, 10,101,110,100, 13, 10, 13, 10, + 111,108,100, 95,100,111,102,105,108,101, 32, 61, 32,100,111, + 102,105,108,101, 13, 10,100,111,102,105,108,101, 32, 61, 32, + 112,112, 95,100,111,102,105,108,101, 13, 10, 13, 10, 13, 10, + 45, 45, 32,115,116,114,105,110,103, 46,103,115,117, 98, 13, + 10, 45, 45, 91, 91, 13, 10,108,111, 99, 97,108, 32,111,103, + 115,117, 98, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 13, 10,108,111, 99, 97,108, 32,102,117,110, 99,116, + 105,111,110, 32, 99,111,109,112,103,115,117, 98, 40, 97, 44, + 98, 44, 99, 44,100, 41, 13, 10, 32, 32,105,102, 32,116,121, + 112,101, 40, 99, 41, 32, 61, 61, 32, 34,102,117,110, 99,116, + 105,111,110, 34, 32,116,104,101,110, 13, 10, 32, 32, 32, 32, + 108,111, 99, 97,108, 32,111, 99, 32, 61, 32, 99, 13, 10, 32, + 32, 32, 32, 99, 32, 61, 32,102,117,110, 99,116,105,111,110, + 32, 40, 46, 46, 46, 41, 32,114,101,116,117,114,110, 32,111, + 99, 40, 46, 46, 46, 41, 32,111,114, 32, 39, 39, 32,101,110, + 100, 13, 10, 32, 32,101,110,100, 13, 10, 32, 32,114,101,116, + 117,114,110, 32,111,103,115,117, 98, 40, 97, 44, 98, 44, 99, + 44,100, 41, 13, 10,101,110,100, 13, 10,115,116,114,105,110, + 103, 46,114,101,112,108, 32, 61, 32,111,103,115,117, 98, 13, + 10, 45, 45, 93, 93, 13, 10, 13, 10, 45, 45,115,116,114,105, + 110,103, 46,103,115,117, 98, 32, 61, 32, 99,111,109,112,103, + 115,117, 98, 13,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/compat-5.1.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 82,101, 97,108, + 32,103,108,111, 98, 97,108,115, 10, 45, 45, 32, 95, 65, 76, + 69, 82, 84, 10, 45, 45, 32, 95, 69, 82, 82, 79, 82, 77, 69, + 83, 83, 65, 71, 69, 10, 45, 45, 32, 95, 86, 69, 82, 83, 73, + 79, 78, 10, 45, 45, 32, 95, 71, 10, 45, 45, 32, 97,115,115, + 101,114,116, 10, 45, 45, 32,101,114,114,111,114, 10, 45, 45, + 32,109,101,116, 97,116, 97, 98,108,101, 10, 45, 45, 32,110, + 101,120,116, 10, 45, 45, 32,112,114,105,110,116, 10, 45, 45, + 32,114,101,113,117,105,114,101, 10, 45, 45, 32,116,111,110, + 117,109, 98,101,114, 10, 45, 45, 32,116,111,115,116,114,105, + 110,103, 10, 45, 45, 32,116,121,112,101, 10, 45, 45, 32,117, + 110,112, 97, 99,107, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, + 45, 45, 32, 99,111,108,108,101, 99,116,103, 97,114, 98, 97, + 103,101, 10, 45, 45, 32,103, 99,105,110,102,111, 10, 10, 45, + 45, 32,103,108,111, 98, 97,108,115, 10, 10, 45, 45, 32, 99, + 97,108,108, 32, 32, 32, 45, 62, 32,112,114,111,116,101, 99, + 116, 40,102, 44, 32,101,114,114, 41, 10, 45, 45, 32,108,111, + 97,100,102,105,108,101, 10, 45, 45, 32,108,111, 97,100,115, + 116,114,105,110,103, 10, 10, 45, 45, 32,114, 97,119,103,101, + 116, 10, 45, 45, 32,114, 97,119,115,101,116, 10, 10, 45, 45, + 32,103,101,116, 97,114,103,115, 32, 61, 32, 77, 97,105,110, + 46,103,101,116, 97,114,103,115, 32, 63, 63, 10, 10,114, 97, + 119,116,121,112,101, 32, 61, 32,116,121,112,101, 10, 10,102, + 117,110, 99,116,105,111,110, 32,100,111, 95, 32, 40,102, 44, + 32,101,114,114, 41, 10, 32, 32,105,102, 32,110,111,116, 32, + 102, 32,116,104,101,110, 32,112,114,105,110,116, 40,101,114, + 114, 41, 59, 32,114,101,116,117,114,110, 32,101,110,100, 10, + 32, 32,108,111, 99, 97,108, 32, 97, 44, 98, 32, 61, 32,112, + 99, 97,108,108, 40,102, 41, 10, 32, 32,105,102, 32,110,111, + 116, 32, 97, 32,116,104,101,110, 32,112,114,105,110,116, 40, + 98, 41, 59, 32,114,101,116,117,114,110, 32,110,105,108, 10, + 32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32, 98, + 32,111,114, 32,116,114,117,101, 10, 32, 32,101,110,100, 10, + 101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,100, + 111,115,116,114,105,110,103, 40,115, 41, 32,114,101,116,117, + 114,110, 32,100,111, 95, 40,108,111, 97,100,115,116,114,105, + 110,103, 40,115, 41, 41, 32,101,110,100, 10, 45, 45, 32,102, + 117,110, 99,116,105,111,110, 32,100,111,102,105,108,101, 40, + 115, 41, 32,114,101,116,117,114,110, 32,100,111, 95, 40,108, + 111, 97,100,102,105,108,101, 40,115, 41, 41, 32,101,110,100, + 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 84, 97, + 98,108,101, 32,108,105, 98,114, 97,114,121, 10,108,111, 99, + 97,108, 32,116, 97, 98, 32, 61, 32,116, 97, 98,108,101, 10, + 102,111,114,101, 97, 99,104, 32, 61, 32,116, 97, 98, 46,102, + 111,114,101, 97, 99,104, 10,102,111,114,101, 97, 99,104,105, + 32, 61, 32,116, 97, 98, 46,102,111,114,101, 97, 99,104,105, + 10,103,101,116,110, 32, 61, 32,116, 97, 98, 46,103,101,116, + 110, 10,116,105,110,115,101,114,116, 32, 61, 32,116, 97, 98, + 46,105,110,115,101,114,116, 10,116,114,101,109,111,118,101, + 32, 61, 32,116, 97, 98, 46,114,101,109,111,118,101, 10,115, + 111,114,116, 32, 61, 32,116, 97, 98, 46,115,111,114,116, 10, + 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 98, + 117,103, 32,108,105, 98,114, 97,114,121, 10,108,111, 99, 97, + 108, 32,100, 98,103, 32, 61, 32,100,101, 98,117,103, 10,103, + 101,116,105,110,102,111, 32, 61, 32,100, 98,103, 46,103,101, + 116,105,110,102,111, 10,103,101,116,108,111, 99, 97,108, 32, + 61, 32,100, 98,103, 46,103,101,116,108,111, 99, 97,108, 10, + 115,101,116, 99, 97,108,108,104,111,111,107, 32, 61, 32,102, + 117,110, 99,116,105,111,110, 32, 40, 41, 32,101,114,114,111, + 114, 34, 96,115,101,116, 99, 97,108,108,104,111,111,107, 39, + 32,105,115, 32,100,101,112,114,101, 99, 97,116,101,100, 34, + 32,101,110,100, 10,115,101,116,108,105,110,101,104,111,111, + 107, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40, 41, + 32,101,114,114,111,114, 34, 96,115,101,116,108,105,110,101, + 104,111,111,107, 39, 32,105,115, 32,100,101,112,114,101, 99, + 97,116,101,100, 34, 32,101,110,100, 10,115,101,116,108,111, + 99, 97,108, 32, 61, 32,100, 98,103, 46,115,101,116,108,111, + 99, 97,108, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, + 32,109, 97,116,104, 32,108,105, 98,114, 97,114,121, 10,108, + 111, 99, 97,108, 32,109, 97,116,104, 32, 61, 32,109, 97,116, + 104, 10, 97, 98,115, 32, 61, 32,109, 97,116,104, 46, 97, 98, + 115, 10, 97, 99,111,115, 32, 61, 32,102,117,110, 99,116,105, + 111,110, 32, 40,120, 41, 32,114,101,116,117,114,110, 32,109, + 97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97, 99, + 111,115, 40,120, 41, 41, 32,101,110,100, 10, 97,115,105,110, + 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,120, 41, + 32,114,101,116,117,114,110, 32,109, 97,116,104, 46,100,101, + 103, 40,109, 97,116,104, 46, 97,115,105,110, 40,120, 41, 41, + 32,101,110,100, 10, 97,116, 97,110, 32, 61, 32,102,117,110, + 99,116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114, + 110, 32,109, 97,116,104, 46,100,101,103, 40,109, 97,116,104, + 46, 97,116, 97,110, 40,120, 41, 41, 32,101,110,100, 10, 97, + 116, 97,110, 50, 32, 61, 32,102,117,110, 99,116,105,111,110, + 32, 40,120, 44,121, 41, 32,114,101,116,117,114,110, 32,109, + 97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97,116, + 97,110, 50, 40,120, 44,121, 41, 41, 32,101,110,100, 10, 99, + 101,105,108, 32, 61, 32,109, 97,116,104, 46, 99,101,105,108, + 10, 99,111,115, 32, 61, 32,102,117,110, 99,116,105,111,110, + 32, 40,120, 41, 32,114,101,116,117,114,110, 32,109, 97,116, + 104, 46, 99,111,115, 40,109, 97,116,104, 46,114, 97,100, 40, + 120, 41, 41, 32,101,110,100, 10,100,101,103, 32, 61, 32,109, + 97,116,104, 46,100,101,103, 10,101,120,112, 32, 61, 32,109, + 97,116,104, 46,101,120,112, 10,102,108,111,111,114, 32, 61, + 32,109, 97,116,104, 46,102,108,111,111,114, 10,102,114,101, + 120,112, 32, 61, 32,109, 97,116,104, 46,102,114,101,120,112, + 10,108,100,101,120,112, 32, 61, 32,109, 97,116,104, 46,108, + 100,101,120,112, 10,108,111,103, 32, 61, 32,109, 97,116,104, + 46,108,111,103, 10,108,111,103, 49, 48, 32, 61, 32,109, 97, + 116,104, 46,108,111,103, 49, 48, 10,109, 97,120, 32, 61, 32, + 109, 97,116,104, 46,109, 97,120, 10,109,105,110, 32, 61, 32, + 109, 97,116,104, 46,109,105,110, 10,109,111,100, 32, 61, 32, + 109, 97,116,104, 46,109,111,100, 10, 80, 73, 32, 61, 32,109, + 97,116,104, 46,112,105, 10, 45, 45, 63, 63, 63, 32,112,111, + 119, 32, 61, 32,109, 97,116,104, 46,112,111,119, 32, 32, 10, + 114, 97,100, 32, 61, 32,109, 97,116,104, 46,114, 97,100, 10, + 114, 97,110,100,111,109, 32, 61, 32,109, 97,116,104, 46,114, + 97,110,100,111,109, 10,114, 97,110,100,111,109,115,101,101, + 100, 32, 61, 32,109, 97,116,104, 46,114, 97,110,100,111,109, + 115,101,101,100, 10,115,105,110, 32, 61, 32,102,117,110, 99, + 116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114,110, + 32,109, 97,116,104, 46,115,105,110, 40,109, 97,116,104, 46, + 114, 97,100, 40,120, 41, 41, 32,101,110,100, 10,115,113,114, + 116, 32, 61, 32,109, 97,116,104, 46,115,113,114,116, 10,116, + 97,110, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40, + 120, 41, 32,114,101,116,117,114,110, 32,109, 97,116,104, 46, + 116, 97,110, 40,109, 97,116,104, 46,114, 97,100, 40,120, 41, + 41, 32,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, + 45, 45, 32,115,116,114,105,110,103, 32,108,105, 98,114, 97, + 114,121, 10,108,111, 99, 97,108, 32,115,116,114, 32, 61, 32, + 115,116,114,105,110,103, 10,115,116,114, 98,121,116,101, 32, + 61, 32,115,116,114, 46, 98,121,116,101, 10,115,116,114, 99, + 104, 97,114, 32, 61, 32,115,116,114, 46, 99,104, 97,114, 10, + 115,116,114,102,105,110,100, 32, 61, 32,115,116,114, 46,102, + 105,110,100, 10,102,111,114,109, 97,116, 32, 61, 32,115,116, + 114, 46,102,111,114,109, 97,116, 10,103,115,117, 98, 32, 61, + 32,115,116,114, 46,103,115,117, 98, 10,115,116,114,108,101, + 110, 32, 61, 32,115,116,114, 46,108,101,110, 10,115,116,114, + 108,111,119,101,114, 32, 61, 32,115,116,114, 46,108,111,119, + 101,114, 10,115,116,114,114,101,112, 32, 61, 32,115,116,114, + 46,114,101,112, 10,115,116,114,115,117, 98, 32, 61, 32,115, + 116,114, 46,115,117, 98, 10,115,116,114,117,112,112,101,114, + 32, 61, 32,115,116,114, 46,117,112,112,101,114, 10, 10, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 10, 45, 45, 32,111,115, 32,108,105, + 98,114, 97,114,121, 10, 99,108,111, 99,107, 32, 61, 32,111, + 115, 46, 99,108,111, 99,107, 10,100, 97,116,101, 32, 61, 32, + 111,115, 46,100, 97,116,101, 10,100,105,102,102,116,105,109, + 101, 32, 61, 32,111,115, 46,100,105,102,102,116,105,109,101, + 10,101,120,101, 99,117,116,101, 32, 61, 32,111,115, 46,101, + 120,101, 99,117,116,101, 32, 45, 45, 63, 10,101,120,105,116, + 32, 61, 32,111,115, 46,101,120,105,116, 10,103,101,116,101, + 110,118, 32, 61, 32,111,115, 46,103,101,116,101,110,118, 10, + 114,101,109,111,118,101, 32, 61, 32,111,115, 46,114,101,109, + 111,118,101, 10,114,101,110, 97,109,101, 32, 61, 32,111,115, + 46,114,101,110, 97,109,101, 10,115,101,116,108,111, 99, 97, + 108,101, 32, 61, 32,111,115, 46,115,101,116,108,111, 99, 97, + 108,101, 10,116,105,109,101, 32, 61, 32,111,115, 46,116,105, + 109,101, 10,116,109,112,110, 97,109,101, 32, 61, 32,111,115, + 46,116,109,112,110, 97,109,101, 10, 10, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 10, 45, 45, 32, 99,111,109,112, 97,116,105, 98,105, + 108,105,116,121, 32,111,110,108,121, 10,103,101,116,103,108, + 111, 98, 97,108, 32, 61, 32,102,117,110, 99,116,105,111,110, + 32, 40,110, 41, 32,114,101,116,117,114,110, 32, 95, 71, 91, + 110, 93, 32,101,110,100, 10,115,101,116,103,108,111, 98, 97, + 108, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,110, + 44,118, 41, 32, 95, 71, 91,110, 93, 32, 61, 32,118, 32,101, + 110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10,108,111, + 99, 97,108, 32,105,111, 44, 32,116, 97, 98, 32, 61, 32,105, + 111, 44, 32,116, 97, 98,108,101, 10, 10, 45, 45, 32, 73, 79, + 32,108,105, 98,114, 97,114,121, 32, 40,102,105,108,101,115, + 41, 10, 95, 83, 84, 68, 73, 78, 32, 61, 32,105,111, 46,115, + 116,100,105,110, 10, 95, 83, 84, 68, 69, 82, 82, 32, 61, 32, + 105,111, 46,115,116,100,101,114,114, 10, 95, 83, 84, 68, 79, + 85, 84, 32, 61, 32,105,111, 46,115,116,100,111,117,116, 10, + 95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115,116,100, + 105,110, 10, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105,111, + 46,115,116,100,111,117,116, 10,115,101,101,107, 32, 61, 32, + 105,111, 46,115,116,100,105,110, 46,115,101,101,107, 32, 32, + 32, 45, 45, 32,115,105, 99,107, 32, 59, 45, 41, 10,116,109, + 112,102,105,108,101, 32, 61, 32,105,111, 46,116,109,112,102, + 105,108,101, 10, 99,108,111,115,101,102,105,108,101, 32, 61, + 32,105,111, 46, 99,108,111,115,101, 10,111,112,101,110,102, + 105,108,101, 32, 61, 32,105,111, 46,111,112,101,110, 10, 10, + 102,117,110, 99,116,105,111,110, 32,102,108,117,115,104, 32, + 40,102, 41, 10, 32, 32,105,102, 32,102, 32,116,104,101,110, + 32,102, 58,102,108,117,115,104, 40, 41, 10, 32, 32,101,108, + 115,101, 32, 95, 79, 85, 84, 80, 85, 84, 58,102,108,117,115, + 104, 40, 41, 10, 32, 32,101,110,100, 10,101,110,100, 10, 10, + 102,117,110, 99,116,105,111,110, 32,114,101, 97,100,102,114, + 111,109, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102, 32, + 110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104,101, + 110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44, 32, + 101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46, 99, + 108,111,115,101, 40, 95, 73, 78, 80, 85, 84, 41, 10, 32, 32, + 32, 32, 95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115, + 116,100,105,110, 10, 32, 32, 32, 32,114,101,116,117,114,110, + 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32, + 101,108,115,101, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32, + 102, 44, 32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105, + 111, 46,111,112,101,110, 40,110, 97,109,101, 44, 32, 34,114, + 34, 41, 10, 32, 32, 32, 32, 95, 73, 78, 80, 85, 84, 32, 61, + 32,102, 32,111,114, 32, 95, 73, 78, 80, 85, 84, 10, 32, 32, + 32, 32,114,101,116,117,114,110, 32,102, 44, 32,101,114,114, + 44, 32, 99,111,100, 10, 32, 32,101,110,100, 10,101,110,100, + 10, 10,102,117,110, 99,116,105,111,110, 32,119,114,105,116, + 101,116,111, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102, + 32,110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104, + 101,110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44, + 32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46, + 99,108,111,115,101, 40, 95, 79, 85, 84, 80, 85, 84, 41, 10, + 32, 32, 32, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105, + 111, 46,115,116,100,111,117,116, 10, 32, 32, 32, 32,114,101, + 116,117,114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111, + 100, 10, 32, 32,101,108,115,101, 10, 32, 32, 32, 32,108,111, + 99, 97,108, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, + 32, 61, 32,105,111, 46,111,112,101,110, 40,110, 97,109,101, + 44, 32, 34,119, 34, 41, 10, 32, 32, 32, 32, 95, 79, 85, 84, + 80, 85, 84, 32, 61, 32,102, 32,111,114, 32, 95, 79, 85, 84, + 80, 85, 84, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32, + 102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32,101, + 110,100, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, + 110, 32, 97,112,112,101,110,100,116,111, 32, 40,110, 97,109, + 101, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44, 32,101, + 114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46,111,112, + 101,110, 40,110, 97,109,101, 44, 32, 34, 97, 34, 41, 10, 32, + 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,102, 32,111,114, + 32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,114,101,116,117, + 114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, + 101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114, + 101, 97,100, 32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99, + 97,108, 32,102, 32, 61, 32, 95, 73, 78, 80, 85, 84, 10, 32, + 32,105,102, 32,114, 97,119,116,121,112,101, 40, 97,114,103, + 91, 49, 93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97, + 116, 97, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32, + 61, 32,116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114, + 103, 44, 32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114, + 101,116,117,114,110, 32,102, 58,114,101, 97,100, 40,117,110, + 112, 97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100, 10, + 10,102,117,110, 99,116,105,111,110, 32,119,114,105,116,101, + 32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99, 97,108, 32, + 102, 32, 61, 32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,105, + 102, 32,114, 97,119,116,121,112,101, 40, 97,114,103, 91, 49, + 93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97,116, 97, + 39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32, 61, 32, + 116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114,103, 44, + 32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114,101,116, + 117,114,110, 32,102, 58,119,114,105,116,101, 40,117,110,112, + 97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/compat.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 98, 97,115,105, 99, + 32,117,116,105,108,105,116,121, 32,102,117,110, 99,116,105, + 111,110,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32, + 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108, + 101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80, + 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49, + 57, 57, 56, 10, 45, 45, 32, 76, 97,115,116, 32,117,112,100, + 97,116,101, 58, 32, 65,112,114, 32, 50, 48, 48, 51, 10, 45, + 45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104, + 105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, + 32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, + 99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116, + 101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100, + 105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32, + 115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100, + 101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, + 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, + 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116, + 104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110, + 111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, + 32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101, + 110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, + 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110, + 104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32, + 109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, + 10, 10, 45, 45, 32, 66, 97,115,105, 99, 32, 67, 32,116,121, + 112,101,115, 32, 97,110,100, 32,116,104,101,105,114, 32, 99, + 111,114,114,101,115,112,111,110,100,105,110,103, 32, 76,117, + 97, 32,116,121,112,101,115, 10, 45, 45, 32, 65,108,108, 32, + 111, 99, 99,117,114,114,101,110, 99,101,115, 32,111,102, 32, + 34, 99,104, 97,114, 42, 34, 32,119,105,108,108, 32, 98,101, + 32,114,101,112,108, 97, 99,101,100, 32, 98,121, 32, 34, 95, + 99,115,116,114,105,110,103, 34, 44, 10, 45, 45, 32, 97,110, + 100, 32, 97,108,108, 32,111, 99, 99,117,114,114,101,110, 99, + 101,115, 32,111,102, 32, 34,118,111,105,100, 42, 34, 32,119, + 105,108,108, 32, 98,101, 32,114,101,112,108, 97, 99,101,100, + 32, 98,121, 32, 34, 95,117,115,101,114,100, 97,116, 97, 34, + 10, 95, 98, 97,115,105, 99, 32, 61, 32,123, 10, 32, 91, 39, + 118,111,105,100, 39, 93, 32, 61, 32, 39, 39, 44, 10, 32, 91, + 39, 99,104, 97,114, 39, 93, 32, 61, 32, 39,110,117,109, 98, + 101,114, 39, 44, 10, 32, 91, 39,105,110,116, 39, 93, 32, 61, + 32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,115, + 104,111,114,116, 39, 93, 32, 61, 32, 39,110,117,109, 98,101, + 114, 39, 44, 10, 32, 91, 39,108,111,110,103, 39, 93, 32, 61, + 32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,117, + 110,115,105,103,110,101,100, 39, 93, 32, 61, 32, 39,110,117, + 109, 98,101,114, 39, 44, 10, 32, 91, 39,102,108,111, 97,116, + 39, 93, 32, 61, 32, 39,110,117,109, 98,101,114, 39, 44, 10, + 32, 91, 39,100,111,117, 98,108,101, 39, 93, 32, 61, 32, 39, + 110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39, 95, 99,115, + 116,114,105,110,103, 39, 93, 32, 61, 32, 39,115,116,114,105, + 110,103, 39, 44, 10, 32, 91, 39, 95,117,115,101,114,100, 97, + 116, 97, 39, 93, 32, 61, 32, 39,117,115,101,114,100, 97,116, + 97, 39, 44, 10, 32, 91, 39, 99,104, 97,114, 42, 39, 93, 32, + 61, 32, 39,115,116,114,105,110,103, 39, 44, 10, 32, 91, 39, + 118,111,105,100, 42, 39, 93, 32, 61, 32, 39,117,115,101,114, + 100, 97,116, 97, 39, 44, 10, 32, 91, 39, 98,111,111,108, 39, + 93, 32, 61, 32, 39, 98,111,111,108,101, 97,110, 39, 44, 10, + 32, 91, 39,108,117, 97, 95, 79, 98,106,101, 99,116, 39, 93, + 32, 61, 32, 39,118, 97,108,117,101, 39, 44, 10, 32, 91, 39, + 76, 85, 65, 95, 86, 65, 76, 85, 69, 39, 93, 32, 61, 32, 39, + 118, 97,108,117,101, 39, 44, 32, 32, 32, 32, 45, 45, 32,102, + 111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,116, + 121, 32,119,105,116,104, 32,116,111,108,117, 97, 32, 52, 46, + 48, 10, 32, 91, 39,108,117, 97, 95, 83,116, 97,116,101, 42, + 39, 93, 32, 61, 32, 39,115,116, 97,116,101, 39, 44, 10, 32, + 91, 39, 95,108,115,116, 97,116,101, 39, 93, 32, 61, 32, 39, + 115,116, 97,116,101, 39, 44, 10, 32, 91, 39,108,117, 97, 95, + 70,117,110, 99,116,105,111,110, 39, 93, 32, 61, 32, 39,118, + 97,108,117,101, 39, 44, 10,125, 10, 10, 95, 98, 97,115,105, + 99, 95, 99,116,121,112,101, 32, 61, 32,123, 10, 32,110,117, + 109, 98,101,114, 32, 61, 32, 34,108,117, 97, 95, 78,117,109, + 98,101,114, 34, 44, 10, 32,115,116,114,105,110,103, 32, 61, + 32, 34, 99,111,110,115,116, 32, 99,104, 97,114, 42, 34, 44, + 10, 32,117,115,101,114,100, 97,116, 97, 32, 61, 32, 34,118, + 111,105,100, 42, 34, 44, 10, 32, 98,111,111,108,101, 97,110, + 32, 61, 32, 34, 98,111,111,108, 34, 44, 10, 32,118, 97,108, + 117,101, 32, 61, 32, 34,105,110,116, 34, 44, 10, 32,115,116, + 97,116,101, 32, 61, 32, 34,108,117, 97, 95, 83,116, 97,116, + 101, 42, 34, 44, 10,125, 10, 10, 45, 45, 32,102,117,110, 99, + 116,105,111,110,115, 32,116,104,101, 32, 97,114,101, 32,117, + 115,101,100, 32,116,111, 32,100,111, 32, 97, 32, 39,114, 97, + 119, 32,112,117,115,104, 39, 32,111,102, 32, 98, 97,115,105, + 99, 32,116,121,112,101,115, 10, 95, 98, 97,115,105, 99, 95, + 114, 97,119, 95,112,117,115,104, 32, 61, 32,123,125, 10, 10, + 45, 45, 32, 76,105,115,116, 32,111,102, 32,117,115,101,114, + 32,100,101,102,105,110,101,100, 32,116,121,112,101,115, 10, + 45, 45, 32, 69, 97, 99,104, 32,116,121,112,101, 32, 99,111, + 114,114,101,115,112,111,110,100,115, 32,116,111, 32, 97, 32, + 118, 97,114,105, 97, 98,108,101, 32,110, 97,109,101, 32,116, + 104, 97,116, 32,115,116,111,114,101,115, 32,105,116,115, 32, + 116, 97,103, 32,118, 97,108,117,101, 46, 10, 95,117,115,101, + 114,116,121,112,101, 32, 61, 32,123,125, 10, 10, 45, 45, 32, + 76,105,115,116, 32,111,102, 32,116,121,112,101,115, 32,116, + 104, 97,116, 32,104, 97,118,101, 32,116,111, 32, 98,101, 32, + 99,111,108,108,101, 99,116,101,100, 10, 95, 99,111,108,108, + 101, 99,116, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105, + 115,116, 32,111,102, 32,116,121,112,101,115, 10, 95,103,108, + 111, 98, 97,108, 95,116,121,112,101,115, 32, 61, 32,123,110, + 61, 48,125, 10, 95,103,108,111, 98, 97,108, 95,116,121,112, + 101,115, 95,104, 97,115,104, 32, 61, 32,123,125, 10, 10, 45, + 45, 32,108,105,115,116, 32,111,102, 32, 99,108, 97,115,115, + 101,115, 10, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115, + 115,101,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105, + 115,116, 32,111,102, 32,101,110,117,109, 32, 99,111,110,115, + 116, 97,110,116,115, 10, 95,103,108,111, 98, 97,108, 95,101, + 110,117,109,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76, + 105,115,116, 32,111,102, 32, 97,117,116,111, 32,114,101,110, + 97,109,105,110,103, 10, 95,114,101,110, 97,109,105,110,103, + 32, 61, 32,123,125, 10,102,117,110, 99,116,105,111,110, 32, + 97,112,112,101,110,100,114,101,110, 97,109,105,110,103, 32, + 40,115, 41, 10, 32,108,111, 99, 97,108, 32, 98, 44,101, 44, + 111,108,100, 44,110,101,119, 32, 61, 32,115,116,114,102,105, + 110,100, 40,115, 44, 34, 37,115, 42, 40, 46, 45, 41, 37,115, + 42, 64, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 36, 34, 41, + 10, 9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, + 10, 9, 32,101,114,114,111,114, 40, 34, 35, 73,110,118, 97, + 108,105,100, 32,114,101,110, 97,109,105,110,103, 32,115,121, + 110,116, 97,120, 59, 32,105,116, 32,115,104,111,117,108,100, + 32, 98,101, 32,111,102, 32,116,104,101, 32,102,111,114,109, + 58, 32,112, 97,116,116,101,114,110, 64,112, 97,116,116,101, + 114,110, 34, 41, 10, 9,101,110,100, 10, 9,116,105,110,115, + 101,114,116, 40, 95,114,101,110, 97,109,105,110,103, 44,123, + 111,108,100, 61,111,108,100, 44, 32,110,101,119, 61,110,101, + 119,125, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105, + 111,110, 32, 97,112,112,108,121,114,101,110, 97,109,105,110, + 103, 32, 40,115, 41, 10, 9,102,111,114, 32,105, 61, 49, 44, + 103,101,116,110, 40, 95,114,101,110, 97,109,105,110,103, 41, + 32,100,111, 10, 9, 32,108,111, 99, 97,108, 32,109, 44,110, + 32, 61, 32,103,115,117, 98, 40,115, 44, 95,114,101,110, 97, + 109,105,110,103, 91,105, 93, 46,111,108,100, 44, 95,114,101, + 110, 97,109,105,110,103, 91,105, 93, 46,110,101,119, 41, 10, + 9, 9,105,102, 32,110, 32,126, 61, 32, 48, 32,116,104,101, + 110, 10, 9, 9, 32,114,101,116,117,114,110, 32,109, 10, 9, + 9,101,110,100, 10, 9,101,110,100, 10, 9,114,101,116,117, + 114,110, 32,110,105,108, 10,101,110,100, 10, 10, 45, 45, 32, + 69,114,114,111,114, 32,104, 97,110,100,108,101,114, 10,102, + 117,110, 99,116,105,111,110, 32,116,111,108,117, 97, 95,101, + 114,114,111,114, 32, 40,115, 44,102, 41, 10,105,102, 32, 95, + 99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110, 10, + 9,112,114,105,110,116, 40, 34, 42, 42, 42, 99,117,114,114, + 32, 99,111,100,101, 32,102,111,114, 32,101,114,114,111,114, + 32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103, + 40, 95, 99,117,114,114, 95, 99,111,100,101, 41, 41, 10, 9, + 112,114,105,110,116, 40,100,101, 98,117,103, 46,116,114, 97, + 99,101, 98, 97, 99,107, 40, 41, 41, 10,101,110,100, 10, 32, + 108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79, 85, + 84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, + 32, 95, 83, 84, 68, 69, 82, 82, 10, 32,105,102, 32,115,116, + 114,115,117, 98, 40,115, 44, 49, 44, 49, 41, 32, 61, 61, 32, + 39, 35, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116, + 101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 58, 32, + 34, 46, 46,115,116,114,115,117, 98, 40,115, 44, 50, 41, 46, + 46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 32,105,102, 32, + 95, 99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110, + 10, 32, 32, 32,108,111, 99, 97,108, 32, 95, 44, 95, 44,115, + 32, 61, 32,115,116,114,102,105,110,100, 40, 95, 99,117,114, + 114, 95, 99,111,100,101, 44, 34, 94, 37,115, 42, 40, 46, 45, + 92,110, 41, 34, 41, 32, 45, 45, 32,101,120,116,114, 97, 99, + 116, 32,102,105,114,115,116, 32,108,105,110,101, 10, 32, 32, + 32,105,102, 32,115, 61, 61,110,105,108, 32,116,104,101,110, + 32,115, 32, 61, 32, 95, 99,117,114,114, 95, 99,111,100,101, + 32,101,110,100, 10, 32, 32, 32,115, 32, 61, 32,103,115,117, + 98, 40,115, 44, 34, 95,117,115,101,114,100, 97,116, 97, 34, + 44, 34,118,111,105,100, 42, 34, 41, 32, 45, 45, 32,114,101, + 116,117,114,110, 32,119,105,116,104, 32, 39,118,111,105,100, + 42, 39, 10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40, + 115, 44, 34, 95, 99,115,116,114,105,110,103, 34, 44, 34, 99, + 104, 97,114, 42, 34, 41, 32, 32, 45, 45, 32,114,101,116,117, + 114,110, 32,119,105,116,104, 32, 39, 99,104, 97,114, 42, 39, + 10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, + 34, 95,108,115,116, 97,116,101, 34, 44, 34,108,117, 97, 95, + 83,116, 97,116,101, 42, 34, 41, 32, 32, 45, 45, 32,114,101, + 116,117,114,110, 32,119,105,116,104, 32, 39,108,117, 97, 95, + 83,116, 97,116,101, 42, 39, 10, 32, 32, 32,119,114,105,116, + 101, 40, 34, 67,111,100,101, 32, 98,101,105,110,103, 32,112, + 114,111, 99,101,115,115,101,100, 58, 92,110, 34, 46, 46,115, + 46, 46, 34, 92,110, 34, 41, 10, 32, 32,101,110,100, 10, 32, + 101,108,115,101, 10, 32,105,102, 32,110,111,116, 32,102, 32, + 116,104,101,110, 32,102, 32, 61, 32, 34, 40,102, 32,105,115, + 32,110,105,108, 41, 34, 32,101,110,100, 10, 32, 32,112,114, + 105,110,116, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, + 32,105,110,116,101,114,110, 97,108, 32,101,114,114,111,114, + 58, 32, 34, 46, 46,102, 46, 46,115, 46, 46, 34, 46, 92,110, + 92,110, 34, 41, 10, 32, 32,114,101,116,117,114,110, 10, 32, + 101,110,100, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32, + 111,117,116, 10,101,110,100, 10, 10,102,117,110, 99,116,105, + 111,110, 32,119, 97,114,110,105,110,103, 32, 40,109,115,103, + 41, 10, 32,105,102, 32,102,108, 97,103,115, 46,113, 32,116, + 104,101,110, 32,114,101,116,117,114,110, 32,101,110,100, 10, + 32,108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79, + 85, 84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, + 61, 32, 95, 83, 84, 68, 69, 82, 82, 10, 32,119,114,105,116, + 101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 32,119, + 97,114,110,105,110,103, 58, 32, 34, 46, 46,109,115,103, 46, + 46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 95, 79, 85, 84, + 80, 85, 84, 32, 61, 32,111,117,116, 10,101,110,100, 10, 10, + 45, 45, 32,114,101,103,105,115,116,101,114, 32, 97,110, 32, + 117,115,101,114, 32,100,101,102,105,110,101,100, 32,116,121, + 112,101, 58, 32,114,101,116,117,114,110,115, 32,102,117,108, + 108, 32,116,121,112,101, 10,102,117,110, 99,116,105,111,110, + 32,114,101,103,116,121,112,101, 32, 40,116, 41, 10, 9, 45, + 45,105,102, 32,105,115, 98, 97,115,105, 99, 40,116, 41, 32, + 116,104,101,110, 10, 9, 45, 45, 9,114,101,116,117,114,110, + 32,116, 10, 9, 45, 45,101,110,100, 10, 9,108,111, 99, 97, + 108, 32,102,116, 32, 61, 32,102,105,110,100,116,121,112,101, + 40,116, 41, 10, 10, 9,105,102, 32,110,111,116, 32, 95,117, + 115,101,114,116,121,112,101, 91,102,116, 93, 32,116,104,101, + 110, 10, 9, 9,114,101,116,117,114,110, 32, 97,112,112,101, + 110,100,117,115,101,114,116,121,112,101, 40,116, 41, 10, 9, + 101,110,100, 10, 9,114,101,116,117,114,110, 32,102,116, 10, + 101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110, 32, + 116,121,112,101, 32,110, 97,109,101, 58, 32,114,101,116,117, + 114,110,115, 32,102,117,108,108, 32,116,121,112,101, 10,102, + 117,110, 99,116,105,111,110, 32,116,121,112,101,118, 97,114, + 40,116,121,112,101, 41, 10, 9,105,102, 32,116,121,112,101, + 32, 61, 61, 32, 39, 39, 32,111,114, 32,116,121,112,101, 32, + 61, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10, + 9, 9,114,101,116,117,114,110, 32,116,121,112,101, 10, 9, + 101,108,115,101, 10, 9, 9,108,111, 99, 97,108, 32,102,116, + 32, 61, 32,102,105,110,100,116,121,112,101, 40,116,121,112, + 101, 41, 10, 9, 9,105,102, 32,102,116, 32,116,104,101,110, + 10, 9, 9, 9,114,101,116,117,114,110, 32,102,116, 10, 9, + 9,101,110,100, 10, 9, 9, 95,117,115,101,114,116,121,112, + 101, 91,116,121,112,101, 93, 32, 61, 32,116,121,112,101, 10, + 9, 9,114,101,116,117,114,110, 32,116,121,112,101, 10, 9, + 101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, + 99,107, 32,105,102, 32, 98, 97,115,105, 99, 32,116,121,112, + 101, 10,102,117,110, 99,116,105,111,110, 32,105,115, 98, 97, + 115,105, 99, 32, 40,116,121,112,101, 41, 10, 32,108,111, 99, + 97,108, 32,116, 32, 61, 32,103,115,117, 98, 40,116,121,112, + 101, 44, 39, 99,111,110,115,116, 32, 39, 44, 39, 39, 41, 10, + 32,108,111, 99, 97,108, 32,109, 44,116, 32, 61, 32, 97,112, + 112,108,121,116,121,112,101,100,101,102, 40, 39, 39, 44, 32, + 116, 41, 10, 32,108,111, 99, 97,108, 32, 98, 32, 61, 32, 95, + 98, 97,115,105, 99, 91,116, 93, 10, 32,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 98, + 44, 95, 98, 97,115,105, 99, 95, 99,116,121,112,101, 91, 98, + 93, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110, 32, + 110,105,108, 10,101,110,100, 10, 10, 45, 45, 32,115,112,108, + 105,116, 32,115,116,114,105,110,103, 32,117,115,105,110,103, + 32, 97, 32,116,111,107,101,110, 10,102,117,110, 99,116,105, + 111,110, 32,115,112,108,105,116, 32, 40,115, 44,116, 41, 10, + 32,108,111, 99, 97,108, 32,108, 32, 61, 32,123,110, 61, 48, + 125, 10, 32,108,111, 99, 97,108, 32,102, 32, 61, 32,102,117, + 110, 99,116,105,111,110, 32, 40,115, 41, 10, 32, 32,108, 46, + 110, 32, 61, 32,108, 46,110, 32, 43, 32, 49, 10, 32, 32,108, + 91,108, 46,110, 93, 32, 61, 32,115, 10, 32, 32,114,101,116, + 117,114,110, 32, 34, 34, 10, 32,101,110,100, 10, 32,108,111, + 99, 97,108, 32,112, 32, 61, 32, 34, 37,115, 42, 40, 46, 45, + 41, 37,115, 42, 34, 46, 46,116, 46, 46, 34, 37,115, 42, 34, + 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 94, + 37,115, 43, 34, 44, 34, 34, 41, 10, 32,115, 32, 61, 32,103, + 115,117, 98, 40,115, 44, 34, 37,115, 43, 36, 34, 44, 34, 34, + 41, 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44,112, + 44,102, 41, 10, 32,108, 46,110, 32, 61, 32,108, 46,110, 32, + 43, 32, 49, 10, 32,108, 91,108, 46,110, 93, 32, 61, 32,103, + 115,117, 98, 40,115, 44, 34, 40, 37,115, 37,115, 42, 41, 36, + 34, 44, 34, 34, 41, 10, 32,114,101,116,117,114,110, 32,108, + 10,101,110,100, 10, 10, 45, 45, 32,115,112,108,105,116,115, + 32, 97, 32,115,116,114,105,110,103, 32,117,115,105,110,103, + 32, 97, 32,112, 97,116,116,101,114,110, 44, 32, 99,111,110, + 115,105,100,101,114,105,110,103, 32,116,104,101, 32,115,112, + 97, 99,105, 97,108, 32, 99, 97,115,101,115, 32,111,102, 32, + 67, 32, 99,111,100,101, 32, 40,116,101,109,112,108, 97,116, + 101,115, 44, 32,102,117,110, 99,116,105,111,110, 32,112, 97, + 114, 97,109,101,116,101,114,115, 44, 32,101,116, 99, 41, 10, + 45, 45, 32,112, 97,116,116,101,114,110, 32, 99, 97,110, 39, + 116, 32, 99,111,110,116, 97,105,110, 32,116,104,101, 32, 39, + 94, 39, 32, 40, 97,115, 32,117,115,101,100, 32,116,111, 32, + 105,100,101,110,116,105,102,121, 32,116,104,101, 32, 98,101, + 103,105,110,105,110,103, 32,111,102, 32,116,104,101, 32,108, + 105,110,101, 41, 10, 45, 45, 32, 97,108,115,111, 32,115,116, + 114,105,112,115, 32,119,104,105,116,101,115,112, 97, 99,101, + 10,102,117,110, 99,116,105,111,110, 32,115,112,108,105,116, + 95, 99, 95,116,111,107,101,110,115, 40,115, 44, 32,112, 97, + 116, 41, 10, 10, 9,115, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,115, 44, 32, 34, 94, 37,115, 42, 34, + 44, 32, 34, 34, 41, 10, 9,115, 32, 61, 32,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 37,115, 42, + 36, 34, 44, 32, 34, 34, 41, 10, 10, 9,108,111, 99, 97,108, + 32,116,111,107,101,110, 95, 98,101,103,105,110, 32, 61, 32, + 49, 10, 9,108,111, 99, 97,108, 32,116,111,107,101,110, 95, + 101,110,100, 32, 61, 32, 49, 10, 9,108,111, 99, 97,108, 32, + 111,102,115, 32, 61, 32, 49, 10, 9,108,111, 99, 97,108, 32, + 114,101,116, 32, 61, 32,123,110, 61, 48,125, 10, 10, 9,102, + 117,110, 99,116,105,111,110, 32, 97,100,100, 95,116,111,107, + 101,110, 40,111,102,115, 41, 10, 10, 9, 9,108,111, 99, 97, + 108, 32,116, 32, 61, 32,115,116,114,105,110,103, 46,115,117, + 98, 40,115, 44, 32,116,111,107,101,110, 95, 98,101,103,105, + 110, 44, 32,111,102,115, 41, 10, 9, 9,116, 32, 61, 32,115, + 116,114,105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, + 94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10, 9, 9,116, 32, + 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116, + 44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, 41, 10, 9, + 9,114,101,116, 46,110, 32, 61, 32,114,101,116, 46,110, 32, + 43, 32, 49, 10, 9, 9,114,101,116, 91,114,101,116, 46,110, + 93, 32, 61, 32,116, 10, 9,101,110,100, 10, 10, 9,119,104, + 105,108,101, 32,111,102,115, 32, 60, 61, 32,115,116,114,105, + 110,103, 46,108,101,110, 40,115, 41, 32,100,111, 10, 10, 9, + 9,108,111, 99, 97,108, 32,115,117, 98, 32, 61, 32,115,116, + 114,105,110,103, 46,115,117, 98, 40,115, 44, 32,111,102,115, + 44, 32, 45, 49, 41, 10, 9, 9,108,111, 99, 97,108, 32, 98, + 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110, + 100, 40,115,117, 98, 44, 32, 34, 94, 34, 46, 46,112, 97,116, + 41, 10, 9, 9,105,102, 32, 98, 32,116,104,101,110, 10, 9, + 9, 9, 97,100,100, 95,116,111,107,101,110, 40,111,102,115, + 45, 49, 41, 10, 9, 9, 9,111,102,115, 32, 61, 32,111,102, + 115, 43,101, 10, 9, 9, 9,116,111,107,101,110, 95, 98,101, + 103,105,110, 32, 61, 32,111,102,115, 10, 9, 9,101,108,115, + 101, 10, 9, 9, 9,108,111, 99, 97,108, 32, 99,104, 97,114, + 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115, + 44, 32,111,102,115, 44, 32,111,102,115, 41, 10, 9, 9, 9, + 105,102, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32, + 111,114, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 60, 34, 32, + 116,104,101,110, 10, 10, 9, 9, 9, 9,108,111, 99, 97,108, + 32, 98,108,111, 99,107, 10, 9, 9, 9, 9,105,102, 32, 99, + 104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32,116,104,101,110, + 32, 98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 40, 41, + 34, 32,101,110,100, 10, 9, 9, 9, 9,105,102, 32, 99,104, + 97,114, 32, 61, 61, 32, 34, 60, 34, 32,116,104,101,110, 32, + 98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 60, 62, 34, + 32,101,110,100, 10, 10, 9, 9, 9, 9, 98, 44,101, 32, 61, + 32,115,116,114,105,110,103, 46,102,105,110,100, 40,115,117, + 98, 44, 32, 98,108,111, 99,107, 41, 10, 9, 9, 9, 9,105, + 102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 9, 9, + 9, 9, 9, 45, 45, 32,117,110,116,101,114,109,105,110, 97, + 116,101,100, 32, 98,108,111, 99,107, 63, 10, 9, 9, 9, 9, + 9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10, 9, 9, + 9, 9,101,108,115,101, 10, 9, 9, 9, 9, 9,111,102,115, + 32, 61, 32,111,102,115, 32, 43, 32,101, 10, 9, 9, 9, 9, + 101,110,100, 10, 10, 9, 9, 9,101,108,115,101, 10, 9, 9, + 9, 9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10, 9, + 9, 9,101,110,100, 10, 9, 9,101,110,100, 10, 10, 9,101, + 110,100, 10, 9, 97,100,100, 95,116,111,107,101,110, 40,111, + 102,115, 41, 10, 9, 45, 45,105,102, 32,114,101,116, 46,110, + 32, 61, 61, 32, 48, 32,116,104,101,110, 10, 10, 9, 45, 45, + 9,114,101,116, 46,110, 61, 49, 10, 9, 45, 45, 9,114,101, + 116, 91, 49, 93, 32, 61, 32, 34, 34, 10, 9, 45, 45,101,110, + 100, 10, 10, 9,114,101,116,117,114,110, 32,114,101,116, 10, + 10,101,110,100, 10, 10, 45, 45, 32, 99,111,110, 99, 97,116, + 101,110, 97,116,101, 32,115,116,114,105,110,103,115, 32,111, + 102, 32, 97, 32,116, 97, 98,108,101, 10,102,117,110, 99,116, + 105,111,110, 32, 99,111,110, 99, 97,116, 32, 40,116, 44,102, + 44,108, 44,106,115,116,114, 41, 10, 9,106,115,116,114, 32, + 61, 32,106,115,116,114, 32,111,114, 32, 34, 32, 34, 10, 32, + 108,111, 99, 97,108, 32,115, 32, 61, 32, 39, 39, 10, 32,108, + 111, 99, 97,108, 32,105, 61,102, 10, 32,119,104,105,108,101, + 32,105, 60, 61,108, 32,100,111, 10, 32, 32,115, 32, 61, 32, + 115, 46, 46,116, 91,105, 93, 10, 32, 32,105, 32, 61, 32,105, + 43, 49, 10, 32, 32,105,102, 32,105, 32, 60, 61, 32,108, 32, + 116,104,101,110, 32,115, 32, 61, 32,115, 46, 46,106,115,116, + 114, 32,101,110,100, 10, 32,101,110,100, 10, 32,114,101,116, + 117,114,110, 32,115, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 111,110, 99, 97,116,101,110, 97,116,101, 32, 97,108,108, 32, + 112, 97,114, 97,109,101,116,101,114,115, 44, 32,102,111,108, + 108,111,119,105,110,103, 32,111,117,116,112,117,116, 32,114, + 117,108,101,115, 10,102,117,110, 99,116,105,111,110, 32, 99, + 111,110, 99, 97,116,112, 97,114, 97,109, 32, 40,108,105,110, + 101, 44, 32, 46, 46, 46, 41, 10, 32,108,111, 99, 97,108, 32, + 105, 61, 49, 10, 32,119,104,105,108,101, 32,105, 60, 61, 97, + 114,103, 46,110, 32,100,111, 10, 32, 32,105,102, 32, 95, 99, + 111,110,116, 32, 97,110,100, 32,110,111,116, 32,115,116,114, + 102,105,110,100, 40, 95, 99,111,110,116, 44, 39, 91, 37, 40, + 44, 34, 93, 39, 41, 32, 97,110,100, 10, 32, 32, 32, 32, 32, + 115,116,114,102,105,110,100, 40, 97,114,103, 91,105, 93, 44, + 34, 94, 91, 37, 97, 95,126, 93, 34, 41, 32,116,104,101,110, + 10, 9, 32, 32, 32, 32,108,105,110,101, 32, 61, 32,108,105, + 110,101, 32, 46, 46, 32, 39, 32, 39, 10, 32, 32,101,110,100, + 10, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32, + 46, 46, 32, 97,114,103, 91,105, 93, 10, 32, 32,105,102, 32, + 97,114,103, 91,105, 93, 32,126, 61, 32, 39, 39, 32,116,104, + 101,110, 10, 32, 32, 32, 95, 99,111,110,116, 32, 61, 32,115, + 116,114,115,117, 98, 40, 97,114,103, 91,105, 93, 44, 45, 49, + 44, 45, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,105, 32, + 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,105,102, 32, + 115,116,114,102,105,110,100, 40, 97,114,103, 91, 97,114,103, + 46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37, 59, 37,123, 37, + 125, 93, 36, 34, 41, 32,116,104,101,110, 10, 32, 32, 95, 99, + 111,110,116, 61,110,105,108, 32,108,105,110,101, 32, 61, 32, + 108,105,110,101, 32, 46, 46, 32, 39, 92,110, 39, 10, 32,101, + 110,100, 10, 9,114,101,116,117,114,110, 32,108,105,110,101, + 10,101,110,100, 10, 10, 45, 45, 32,111,117,116,112,117,116, + 32,108,105,110,101, 10,102,117,110, 99,116,105,111,110, 32, + 111,117,116,112,117,116, 32, 40, 46, 46, 46, 41, 10, 32,108, + 111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101, + 32,105, 60, 61, 97,114,103, 46,110, 32,100,111, 10, 32, 32, + 105,102, 32, 95, 99,111,110,116, 32, 97,110,100, 32,110,111, + 116, 32,115,116,114,102,105,110,100, 40, 95, 99,111,110,116, + 44, 39, 91, 37, 40, 44, 34, 93, 39, 41, 32, 97,110,100, 10, + 32, 32, 32, 32, 32,115,116,114,102,105,110,100, 40, 97,114, + 103, 91,105, 93, 44, 34, 94, 91, 37, 97, 95,126, 93, 34, 41, + 32,116,104,101,110, 10, 9, 32, 32, 32, 32,119,114,105,116, + 101, 40, 39, 32, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32, + 119,114,105,116,101, 40, 97,114,103, 91,105, 93, 41, 10, 32, + 32,105,102, 32, 97,114,103, 91,105, 93, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,111,110,116, + 32, 61, 32,115,116,114,115,117, 98, 40, 97,114,103, 91,105, + 93, 44, 45, 49, 44, 45, 49, 41, 10, 32, 32,101,110,100, 10, + 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, + 32,105,102, 32,115,116,114,102,105,110,100, 40, 97,114,103, + 91, 97,114,103, 46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37, + 59, 37,123, 37,125, 93, 36, 34, 41, 32,116,104,101,110, 10, + 32, 32, 95, 99,111,110,116, 61,110,105,108, 32,119,114,105, + 116,101, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101, + 110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,103,101, + 116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104, + 111,100,115, 40,112,116,121,112,101, 44, 32,110, 97,109,101, + 41, 10, 10, 9,105,102, 32,103,101,116, 95,112,114,111,112, + 101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,111, + 111,107, 32, 97,110,100, 32,103,101,116, 95,112,114,111,112, + 101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,111, + 111,107, 40,112,116,121,112,101, 44,110, 97,109,101, 41, 32, + 116,104,101,110, 10, 9, 9,114,101,116,117,114,110, 32,103, + 101,116, 95,112,114,111,112,101,114,116,121, 95,109,101,116, + 104,111,100,115, 95,104,111,111,107, 40,112,116,121,112,101, + 44, 32,110, 97,109,101, 41, 10, 9,101,110,100, 10, 10, 9, + 105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34,100,101, + 102, 97,117,108,116, 34, 32,116,104,101,110, 32, 45, 45, 32, + 103,101,116, 95,110, 97,109,101, 44, 32,115,101,116, 95,110, + 97,109,101, 10, 9, 9,114,101,116,117,114,110, 32, 34,103, + 101,116, 95, 34, 46, 46,110, 97,109,101, 44, 32, 34,115,101, + 116, 95, 34, 46, 46,110, 97,109,101, 10, 9,101,110,100, 10, + 10, 9,105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34, + 113,116, 34, 32,116,104,101,110, 32, 45, 45, 32,110, 97,109, + 101, 44, 32,115,101,116, 78, 97,109,101, 10, 9, 9,114,101, + 116,117,114,110, 32,110, 97,109,101, 44, 32, 34,115,101,116, + 34, 46, 46,115,116,114,105,110,103, 46,117,112,112,101,114, + 40,115,116,114,105,110,103, 46,115,117, 98, 40,110, 97,109, + 101, 44, 32, 49, 44, 32, 49, 41, 41, 46, 46,115,116,114,105, + 110,103, 46,115,117, 98, 40,110, 97,109,101, 44, 32, 50, 44, + 32, 45, 49, 41, 10, 9,101,110,100, 10, 10, 9,105,102, 32, + 112,116,121,112,101, 32, 61, 61, 32, 34,111,118,101,114,108, + 111, 97,100, 34, 32,116,104,101,110, 32, 45, 45, 32,110, 97, + 109,101, 44, 32,110, 97,109,101, 10, 9, 9,114,101,116,117, + 114,110, 32,110, 97,109,101, 44,110, 97,109,101, 10, 9,101, + 110,100, 10, 10, 9,114,101,116,117,114,110, 32,110,105,108, + 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 32,116,104,101, 32,104,111,111,107,115, + 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32,114,105,103, + 104,116, 32, 97,102,116,101,114, 32,112,114,111, 99,101,115, + 115,105,110,103, 32,116,104,101, 32, 36, 91,105, 99,104,108, + 93,102,105,108,101, 32,100,105,114,101, 99,116,105,118,101, + 115, 44, 10, 45, 45, 32,114,105,103,104,116, 32, 98,101,102, + 111,114,101, 32,112,114,111, 99,101,115,115,105,110,103, 32, + 97,110,121,116,104,105,110,103, 32,101,108,115,101, 10, 45, + 45, 32,116, 97,107,101,115, 32,116,104,101, 32,112, 97, 99, + 107, 97,103,101, 32,111, 98,106,101, 99,116, 32, 97,115, 32, + 116,104,101, 32,112, 97,114, 97,109,101,116,101,114, 10,102, + 117,110, 99,116,105,111,110, 32,112,114,101,112,114,111, 99, + 101,115,115, 95,104,111,111,107, 40,112, 41, 10, 9, 45, 45, + 32,112, 46, 99,111,100,101, 32,104, 97,115, 32, 97,108,108, + 32,116,104,101, 32,105,110,112,117,116, 32, 99,111,100,101, + 32,102,114,111,109, 32,116,104,101, 32,112,107,103, 10,101, + 110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32, + 102,111,114, 32,101,118,101,114,121, 32, 36,105,102,105,108, + 101, 32,100,105,114,101, 99,116,105,118,101, 10, 45, 45, 32, + 116, 97,107,101,115, 32, 97, 32,116, 97, 98,108,101, 32,119, + 105,116,104, 32, 97, 32,115,116,114,105,110,103, 32, 99, 97, + 108,108,101,100, 32, 39, 99,111,100,101, 39, 32,105,110,115, + 105,100,101, 44, 32,116,104,101, 32,102,105,108,101,110, 97, + 109,101, 44, 32, 97,110,100, 32, 97,110,121, 32,101,120,116, + 114, 97, 32, 97,114,103,117,109,101,110,116,115, 10, 45, 45, + 32,112, 97,115,115,101,100, 32,116,111, 32, 36,105,102,105, + 108,101, 46, 32,110,111, 32,114,101,116,117,114,110, 32,118, + 97,108,117,101, 10,102,117,110, 99,116,105,111,110, 32,105, + 110, 99,108,117,100,101, 95,102,105,108,101, 95,104,111,111, + 107, 40,116, 44, 32,102,105,108,101,110, 97,109,101, 44, 32, + 46, 46, 46, 41, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 97,108,108,101,100, 32, 97,102,116,101,114, 32,112,114,111, + 99,101,115,115,105,110,103, 32, 97,110,121,116,104,105,110, + 103, 32,116,104, 97,116, 39,115, 32,110,111,116, 32, 99,111, + 100,101, 32, 40,108,105,107,101, 32, 39, 36,114,101,110, 97, + 109,105,110,103, 39, 44, 32, 99,111,109,109,101,110,116,115, + 44, 32,101,116, 99, 41, 10, 45, 45, 32, 97,110,100, 32,114, + 105,103,104,116, 32, 98,101,102,111,114,101, 32,112, 97,114, + 115,105,110,103, 32,116,104,101, 32, 97, 99,116,117, 97,108, + 32, 99,111,100,101, 46, 10, 45, 45, 32,116, 97,107,101,115, + 32,116,104,101, 32, 80, 97, 99,107, 97,103,101, 32,111, 98, + 106,101, 99,116, 32,119,105,116,104, 32, 97,108,108, 32,116, + 104,101, 32, 99,111,100,101, 32,111,110, 32,116,104,101, 32, + 39, 99,111,100,101, 39, 32,107,101,121, 46, 32,110,111, 32, + 114,101,116,117,114,110, 32,118, 97,108,117,101, 10,102,117, + 110, 99,116,105,111,110, 32,112,114,101,112, 97,114,115,101, + 95,104,111,111,107, 40,112, 97, 99,107, 97,103,101, 41, 10, + 10,101,110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,108,101, + 100, 32, 97,102,116,101,114, 32,119,114,105,116,105,110,103, + 32, 97,108,108, 32,116,104,101, 32,111,117,116,112,117,116, + 46, 10, 45, 45, 32,116, 97,107,101,115, 32,116,104,101, 32, + 80, 97, 99,107, 97,103,101, 32,111, 98,106,101, 99,116, 10, + 102,117,110, 99,116,105,111,110, 32,112,111,115,116, 95,111, + 117,116,112,117,116, 95,104,111,111,107, 40,112, 97, 99,107, + 97,103,101, 41, 10, 10,101,110,100, 10, 10, 10, 45, 45, 32, + 99, 97,108,108,101,100, 32,102,114,111,109, 32, 39,103,101, + 116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104, + 111,100,115, 39, 32,116,111, 32,103,101,116, 32,116,104,101, + 32,109,101,116,104,111,100,115, 32,116,111, 32,114,101,116, + 114,105,101,118,101, 32, 97, 32,112,114,111,112,101,114,116, + 121, 10, 45, 45, 32, 97, 99, 99,111,114,100,105,110,103, 32, + 116,111, 32,105,116,115, 32,116,121,112,101, 10,102,117,110, + 99,116,105,111,110, 32,103,101,116, 95,112,114,111,112,101, + 114,116,121, 95,109,101,116,104,111,100,115, 95,104,111,111, + 107, 40,112,114,111,112,101,114,116,121, 95,116,121,112,101, + 44, 32,110, 97,109,101, 41, 10, 10,101,110,100, 10, 10, 45, + 45, 32, 99, 97,108,108,101,100, 32,102,114,111,109, 32, 67, + 108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,100, + 111,112, 97,114,115,101, 32,119,105,116,104, 32,116,104,101, + 32,115,116,114,105,110,103, 32, 98,101,105,110,103, 32,112, + 97,114,115,101,100, 10, 45, 45, 32,114,101,116,117,114,110, + 32,110,105,108, 44, 32,111,114, 32, 97, 32,115,117, 98,115, + 116,114,105,110,103, 10,102,117,110, 99,116,105,111,110, 32, + 112, 97,114,115,101,114, 95,104,111,111,107, 40,115, 41, 10, + 10, 9,114,101,116,117,114,110, 32,110,105,108, 10,101,110, + 100, 10, 10, 45, 45, 32, 99,117,115,116,111,109, 32,112,117, + 115,104,101,114,115, 10, 10, 95,112,117,115,104, 95,102,117, + 110, 99,116,105,111,110,115, 32, 61, 32,123,125, 10, 95,105, + 115, 95,102,117,110, 99,116,105,111,110,115, 32, 61, 32,123, + 125, 10, 95,116,111, 95,102,117,110, 99,116,105,111,110,115, + 32, 61, 32,123,125, 10, 10, 95, 98, 97,115,101, 95,112,117, + 115,104, 95,102,117,110, 99,116,105,111,110,115, 32, 61, 32, + 123,125, 10, 95, 98, 97,115,101, 95,105,115, 95,102,117,110, + 99,116,105,111,110,115, 32, 61, 32,123,125, 10, 95, 98, 97, + 115,101, 95,116,111, 95,102,117,110, 99,116,105,111,110,115, + 32, 61, 32,123,125, 10, 10,108,111, 99, 97,108, 32,102,117, + 110, 99,116,105,111,110, 32,115,101, 97,114, 99,104, 95, 98, + 97,115,101, 40,116, 44, 32,102,117,110, 99,115, 41, 10, 10, + 9,108,111, 99, 97,108, 32, 99,108, 97,115,115, 32, 61, 32, + 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, + 91,116, 93, 10, 10, 9,119,104,105,108,101, 32, 99,108, 97, + 115,115, 32,100,111, 10, 9, 9,105,102, 32,102,117,110, 99, + 115, 91, 99,108, 97,115,115, 46,116,121,112,101, 93, 32,116, + 104,101,110, 10, 9, 9, 9,114,101,116,117,114,110, 32,102, + 117,110, 99,115, 91, 99,108, 97,115,115, 46,116,121,112,101, + 93, 10, 9, 9,101,110,100, 10, 9, 9, 99,108, 97,115,115, + 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115, + 115,101,115, 91, 99,108, 97,115,115, 46, 98,116,121,112,101, + 93, 10, 9,101,110,100, 10, 9,114,101,116,117,114,110, 32, + 110,105,108, 10,101,110,100, 10, 10,102,117,110, 99,116,105, + 111,110, 32,103,101,116, 95,112,117,115,104, 95,102,117,110, + 99,116,105,111,110, 40,116, 41, 10, 9,114,101,116,117,114, + 110, 32, 95,112,117,115,104, 95,102,117,110, 99,116,105,111, + 110,115, 91,116, 93, 32,111,114, 32,115,101, 97,114, 99,104, + 95, 98, 97,115,101, 40,116, 44, 32, 95, 98, 97,115,101, 95, + 112,117,115,104, 95,102,117,110, 99,116,105,111,110,115, 41, + 32,111,114, 32, 34,116,111,108,117, 97, 95,112,117,115,104, + 117,115,101,114,116,121,112,101, 34, 10,101,110,100, 10, 10, + 102,117,110, 99,116,105,111,110, 32,103,101,116, 95,116,111, + 95,102,117,110, 99,116,105,111,110, 40,116, 41, 10, 9,114, + 101,116,117,114,110, 32, 95,116,111, 95,102,117,110, 99,116, + 105,111,110,115, 91,116, 93, 32,111,114, 32,115,101, 97,114, + 99,104, 95, 98, 97,115,101, 40,116, 44, 32, 95, 98, 97,115, + 101, 95,116,111, 95,102,117,110, 99,116,105,111,110,115, 41, + 32,111,114, 32, 34,116,111,108,117, 97, 95,116,111,117,115, + 101,114,116,121,112,101, 34, 10,101,110,100, 10, 10,102,117, + 110, 99,116,105,111,110, 32,103,101,116, 95,105,115, 95,102, + 117,110, 99,116,105,111,110, 40,116, 41, 10, 9,114,101,116, + 117,114,110, 32, 95,105,115, 95,102,117,110, 99,116,105,111, + 110,115, 91,116, 93, 32,111,114, 32,115,101, 97,114, 99,104, + 95, 98, 97,115,101, 40,116, 44, 32, 95, 98, 97,115,101, 95, + 105,115, 95,102,117,110, 99,116,105,111,110,115, 41, 32,111, + 114, 32, 34,116,111,108,117, 97, 95,105,115,117,115,101,114, + 116,121,112,101, 34, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/basic.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 97, 98,115,116,114, + 97, 99,116, 32,102,101, 97,116,117,114,101, 32, 99,108, 97, + 115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32, 98, + 121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108,101, + 115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80, 85, + 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49, 57, + 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45, + 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105,115, 32, + 102,114,101,101, 32,115,111,102,116,119, 97,114,101, 59, 32, + 121,111,117, 32, 99, 97,110, 32,114,101,100,105,115,116,114, + 105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47,111,114, + 32,109,111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32, + 84,104,101, 32,115,111,102,116,119, 97,114,101, 32,112,114, + 111,118,105,100,101,100, 32,104,101,114,101,117,110,100,101, + 114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32, + 105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10, + 45, 45, 32,116,104,101, 32, 97,117,116,104,111,114, 32,104, + 97,115, 32,110,111, 32,111, 98,108,105,103, 97,116,105,111, + 110, 32,116,111, 32,112,114,111,118,105,100,101, 32,109, 97, + 105,110,116,101,110, 97,110, 99,101, 44, 32,115,117,112,112, + 111,114,116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45, + 45, 32,101,110,104, 97,110, 99,101,109,101,110,116,115, 44, + 32,111,114, 32,109,111,100,105,102,105, 99, 97,116,105,111, + 110,115, 46, 10, 10, 10, 45, 45, 32, 70,101, 97,116,117,114, + 101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114, + 101,115,101,110,116,115, 32,116,104,101, 32, 98, 97,115,101, + 32, 99,108, 97,115,115, 32,111,102, 32, 97,108,108, 32,109, + 97,112,112,101,100, 32,102,101, 97,116,117,114,101, 46, 10, + 99,108, 97,115,115, 70,101, 97,116,117,114,101, 32, 61, 32, + 123, 10,125, 10, 99,108, 97,115,115, 70,101, 97,116,117,114, + 101, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97, + 115,115, 70,101, 97,116,117,114,101, 10, 10, 45, 45, 32,119, + 114,105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111, + 100,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 70,101, 97,116,117,114,101, 58,115,117,112, 99,111, + 100,101, 32, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,111, + 117,116,112,117,116, 32,116, 97,103, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114, + 101, 58,100,101, 99,108,116,121,112,101, 32, 40, 41, 10,101, + 110,100, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,114, + 32,102,101, 97,116,117,114,101, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, + 58,114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41, + 10,101,110,100, 10, 10, 45, 45, 32,116,114, 97,110,115,108, + 97,116,101, 32,118,101,114, 98, 97,116,105,109, 10,102,117, + 110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97, + 116,117,114,101, 58,112,114,101, 97,109, 98,108,101, 32, 40, + 41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, + 32,105,102, 32,105,116, 32,105,115, 32, 97, 32,118, 97,114, + 105, 97, 98,108,101, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,115, + 118, 97,114,105, 97, 98,108,101, 32, 40, 41, 10, 32,114,101, + 116,117,114,110, 32,102, 97,108,115,101, 10,101,110,100, 10, + 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,105,116, + 32,114,101,113,117,105,114,101,115, 32, 99,111,108,108,101, + 99,116,105,111,110, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,114,101, + 113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,110, + 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,102, 97, + 108,115,101, 10,101,110,100, 10, 10, 45, 45, 32, 98,117,105, + 108,100, 32,110, 97,109,101,115, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, + 58, 98,117,105,108,100,110, 97,109,101,115, 32, 40, 41, 10, + 32,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32, 97, + 110,100, 32,115,101,108,102, 46,110, 97,109,101,126, 61, 39, + 39, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32, + 110, 32, 61, 32,115,112,108,105,116, 40,115,101,108,102, 46, + 110, 97,109,101, 44, 39, 64, 39, 41, 10, 32, 32,115,101,108, + 102, 46,110, 97,109,101, 32, 61, 32,110, 91, 49, 93, 10, 32, + 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32,115,116, + 114,105,110,103, 46,103,115,117, 98, 40,115,101,108,102, 46, + 110, 97,109,101, 44, 32, 34, 58, 37,100, 42, 36, 34, 44, 32, + 34, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32,110, 91, + 50, 93, 32,116,104,101,110, 10, 32, 32, 32,110, 91, 50, 93, + 32, 61, 32, 97,112,112,108,121,114,101,110, 97,109,105,110, + 103, 40,110, 91, 49, 93, 41, 10, 32, 32,101,110,100, 10, 32, + 32,115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32,110, + 91, 50, 93, 32,111,114, 32,103,115,117, 98, 40,110, 91, 49, + 93, 44, 34, 37, 91, 46, 45, 37, 93, 34, 44, 34, 34, 41, 10, + 32, 32,115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32, + 115,116,114,105,110,103, 46,103,115,117, 98, 40,115,101,108, + 102, 46,108,110, 97,109,101, 44, 32, 34, 58, 37,100, 42, 36, + 34, 44, 32, 34, 34, 41, 10, 32, 32,115,101,108,102, 46,111, + 114,105,103,105,110, 97,108, 95,110, 97,109,101, 32, 61, 32, + 115,101,108,102, 46,110, 97,109,101, 10, 32, 32,115,101,108, + 102, 46,108,110, 97,109,101, 32, 61, 32, 99,108,101, 97,110, + 95,116,101,109,112,108, 97,116,101, 40,115,101,108,102, 46, + 108,110, 97,109,101, 41, 10, 32,101,110,100, 10, 32,105,102, + 32,110,111,116, 32,115,101,108,102, 46,105,115, 95,112, 97, + 114, 97,109,101,116,101,114, 32,116,104,101,110, 10, 9, 32, + 115,101,108,102, 46,110, 97,109,101, 32, 61, 32,103,101,116, + 111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 40, 41, + 32, 46, 46, 32,115,101,108,102, 46,110, 97,109,101, 10, 32, + 101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,112, 97,114, + 101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116, + 97,105,110,101,114, 46, 99,117,114,114, 10, 32,105,102, 32, + 112, 97,114,101,110,116, 32,116,104,101,110, 10, 32, 9,115, + 101,108,102, 46, 97, 99, 99,101,115,115, 32, 61, 32,112, 97, + 114,101,110,116, 46, 99,117,114,114, 95,109,101,109, 98,101, + 114, 95, 97, 99, 99,101,115,115, 10, 9,115,101,108,102, 46, + 103,108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 32, 61, + 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98, + 108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 32,101, + 108,115,101, 10, 32,101,110,100, 10,101,110,100, 10, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, + 97,116,117,114,101, 58, 99,104,101, 99,107, 95,112,117, 98, + 108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 10, 9, + 105,102, 32,116,121,112,101, 40,115,101,108,102, 46,103,108, + 111, 98, 97,108, 95, 97, 99, 99,101,115,115, 41, 32, 61, 61, + 32, 34, 98,111,111,108,101, 97,110, 34, 32,116,104,101,110, + 10, 9, 9,114,101,116,117,114,110, 32,115,101,108,102, 46, + 103,108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 10, 9, + 101,110,100, 10, 10, 9,105,102, 32,115,101,108,102, 46, 97, + 99, 99,101,115,115, 32, 97,110,100, 32,115,101,108,102, 46, + 97, 99, 99,101,115,115, 32,126, 61, 32, 48, 32,116,104,101, + 110, 10, 9, 9,114,101,116,117,114,110, 32,102, 97,108,115, + 101, 10, 9,101,110,100, 10, 10, 9,108,111, 99, 97,108, 32, + 112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, 9, + 119,104,105,108,101, 32,112, 97,114,101,110,116, 32,100,111, + 10, 9, 9,105,102, 32,112, 97,114,101,110,116, 46, 97, 99, + 99,101,115,115, 32, 97,110,100, 32,112, 97,114,101,110,116, + 46, 97, 99, 99,101,115,115, 32,126, 61, 32, 48, 32,116,104, + 101,110, 10, 9, 9, 9,114,101,116,117,114,110, 32,102, 97, + 108,115,101, 10, 9, 9,101,110,100, 10, 9, 9,112, 97,114, + 101,110,116, 32, 61, 32,112, 97,114,101,110,116, 46,112,114, + 111,120, 10, 9,101,110,100, 10, 9,114,101,116,117,114,110, + 32,116,114,117,101, 10,101,110,100, 10, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108,101, 97,110, 95,116,101,109,112, + 108, 97,116,101, 40,116, 41, 10, 10, 9,114,101,116,117,114, + 110, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116, + 44, 32, 34, 91, 60, 62, 58, 44, 32, 37, 42, 93, 34, 44, 32, + 34, 95, 34, 41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104, + 101, 99,107, 32,105,102, 32,102,101, 97,116,117,114,101, 32, + 105,115, 32,105,110,115,105,100,101, 32, 97, 32, 99,111,110, + 116, 97,105,110,101,114, 32,100,101,102,105,110,105,116,105, + 111,110, 10, 45, 45, 32,105,116, 32,114,101,116,117,114,110, + 115, 32,116,104,101, 32, 99,111,110,116, 97,105,110,101,114, + 32, 99,108, 97,115,115, 32,110, 97,109,101, 32,111,114, 32, + 110,105,108, 46, 10,102,117,110, 99,116,105,111,110, 32, 99, + 108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,110, 99, + 111,110,116, 97,105,110,101,114, 32, 40,119,104,105, 99,104, + 41, 10, 32,105,102, 32,115,101,108,102, 46,112, 97,114,101, + 110,116, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, + 32,112, 97,114,101,110,116, 32, 61, 32,115,101,108,102, 46, + 112, 97,114,101,110,116, 10, 32, 32,119,104,105,108,101, 32, + 112, 97,114,101,110,116, 32,100,111, 10, 32, 32, 32,105,102, + 32,112, 97,114,101,110,116, 46, 99,108, 97,115,115,116,121, + 112,101, 32, 61, 61, 32,119,104,105, 99,104, 32,116,104,101, + 110, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,112, 97, + 114,101,110,116, 46,110, 97,109,101, 10, 32, 32, 32,101,110, + 100, 10, 32, 32, 32,112, 97,114,101,110,116, 32, 61, 32,112, + 97,114,101,110,116, 46,112, 97,114,101,110,116, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10, 32,114,101,116,117,114, + 110, 32,110,105,108, 10,101,110,100, 10, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117, + 114,101, 58,105,110, 99,108, 97,115,115, 32, 40, 41, 10, 32, + 114,101,116,117,114,110, 32,115,101,108,102, 58,105,110, 99, + 111,110,116, 97,105,110,101,114, 40, 39, 99,108, 97,115,115, + 39, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58, + 105,110,109,111,100,117,108,101, 32, 40, 41, 10, 32,114,101, + 116,117,114,110, 32,115,101,108,102, 58,105,110, 99,111,110, + 116, 97,105,110,101,114, 40, 39,109,111,100,117,108,101, 39, + 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105, + 110,110, 97,109,101,115,112, 97, 99,101, 32, 40, 41, 10, 32, + 114,101,116,117,114,110, 32,115,101,108,102, 58,105,110, 99, + 111,110,116, 97,105,110,101,114, 40, 39,110, 97,109,101,115, + 112, 97, 99,101, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32, + 114,101,116,117,114,110, 32, 67, 32, 98,105,110,100,105,110, + 103, 32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101, + 32, 98, 97,115,101,100, 32,111,110, 32,110, 97,109,101, 10, + 45, 45, 32,116,104,101, 32, 99,108,105,101,110,116, 32,115, + 112,101, 99,105,102,105,101,115, 32, 97, 32,112,114,101,102, + 105,120, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 70,101, 97,116,117,114,101, 58, 99,102,117,110, 99, + 110, 97,109,101, 32, 40,110, 41, 10, 10, 32,105,102, 32,115, + 101,108,102, 46,112, 97,114,101,110,116, 32,116,104,101,110, + 10, 32, 32,110, 32, 61, 32,115,101,108,102, 46,112, 97,114, + 101,110,116, 58, 99,102,117,110, 99,110, 97,109,101, 40,110, + 41, 10, 32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32, + 102,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,108,110, + 97,109,101, 10, 32,105,102, 32,110,111,116, 32,102,110, 97, + 109,101, 32,111,114, 32,102,110, 97,109,101, 32, 61, 61, 32, + 39, 39, 32,116,104,101,110, 10, 32, 9,102,110, 97,109,101, + 32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10, 32,101, + 110,100, 10, 32, 32,110, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,110, 46, 46, 39, 95, 39, 46, 46, 32, + 40,102,110, 97,109,101, 41, 44, 32, 34, 91, 60, 62, 58, 44, + 32, 92, 46, 37, 42, 38, 93, 34, 44, 32, 34, 95, 34, 41, 10, + 10, 32, 32,114,101,116,117,114,110, 32,110, 10,101,110,100, + 32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/feature.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,118,101,114, 98, 97, + 116,105,109, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73, + 100, 58, 32,118,101,114, 98, 97,116,105,109, 46,108,117, 97, + 44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48, 49, 47, + 50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 54, 32, 99,101,108, + 101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32, 84,104, + 105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, + 32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, + 99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116, + 101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100, + 105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32, + 115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100, + 101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, + 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, + 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116, + 104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110, + 111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, + 32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101, + 110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, + 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110, + 104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32, + 109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, + 10, 10, 10, 45, 45, 32, 86,101,114, 98, 97,116,105,109, 32, + 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115, + 101,110,116,115, 32, 97, 32,108,105,110,101, 32,116,114, 97, + 110,115,108, 97,116,101,100, 32,100,105,114,101, 99,116,101, + 100, 32,116,111, 32,116,104,101, 32, 98,105,110,100,105,110, + 103, 32,102,105,108,101, 46, 10, 45, 45, 32, 84,104,101, 32, + 102,111,108,108,111,119,105,110,103, 32,102,105,108,100,115, + 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45, + 32, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32, + 116,101,120,116, 10, 99,108, 97,115,115, 86,101,114, 98, 97, + 116,105,109, 32, 61, 32,123, 10, 32,108,105,110,101, 32, 61, + 32, 39, 39, 44, 10, 9, 99,111,110,100, 32, 61, 32,110,105, + 108, 44, 32, 32, 32, 32, 45, 45, 32, 99,111,110,100,105,116, + 105,111,110, 58, 32,119,104,101,114,101, 32,116,111, 32,103, + 101,110,101,114, 97,116,101, 32,116,104,101, 32, 99,111,100, + 101, 32, 40,115, 61,115,117,112,111,114,116, 44, 32,114, 61, + 114,101,103,105,115,116,101,114, 41, 10,125, 10, 99,108, 97, + 115,115, 86,101,114, 98, 97,116,105,109, 46, 95, 95,105,110, + 100,101,120, 32, 61, 32, 99,108, 97,115,115, 86,101,114, 98, + 97,116,105,109, 10,115,101,116,109,101,116, 97,116, 97, 98, + 108,101, 40, 99,108, 97,115,115, 86,101,114, 98, 97,116,105, + 109, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41, + 10, 10, 45, 45, 32,112,114,101, 97,109, 98,108,101, 32,118, + 101,114, 98, 97,116,105,109, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109, + 58,112,114,101, 97,109, 98,108,101, 32, 40, 41, 10, 32,105, + 102, 32,115,101,108,102, 46, 99,111,110,100, 32, 61, 61, 32, + 39, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116,101, + 40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101,110, + 100, 10,101,110,100, 10, 10, 45, 45, 32,115,117,112,112,111, + 114,116, 32, 99,111,100,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109, + 58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,105,102, + 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, 99, + 111,110,100, 44, 39,115, 39, 41, 32,116,104,101,110, 10, 32, + 32,119,114,105,116,101, 40,115,101,108,102, 46,108,105,110, + 101, 41, 10, 32, 32,119,114,105,116,101, 40, 39, 92,110, 39, + 41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, + 114,101,103,105,115,116,101,114, 32, 99,111,100,101, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 86,101, + 114, 98, 97,116,105,109, 58,114,101,103,105,115,116,101,114, + 32, 40,112,114,101, 41, 10, 32,105,102, 32,115,116,114,102, + 105,110,100, 40,115,101,108,102, 46, 99,111,110,100, 44, 39, + 114, 39, 41, 32,116,104,101,110, 10, 32, 32,119,114,105,116, + 101, 40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101, + 110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,114,105, + 110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116, + 105,109, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, + 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 86,101,114, 98, 97,116,105, + 109,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,108,105,110,101, 32, 61, 32, 39, 34, + 46, 46,115,101,108,102, 46,108,105,110,101, 46, 46, 34, 39, + 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10, + 101,110,100, 10, 10, 10, 45, 45, 32, 73,110,116,101,114,110, + 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10, + 102,117,110, 99,116,105,111,110, 32, 95, 86,101,114, 98, 97, + 116,105,109, 32, 40,116, 41, 10, 32,115,101,116,109,101,116, + 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 86, + 101,114, 98, 97,116,105,109, 41, 10, 32, 97,112,112,101,110, + 100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116, 10, + 101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117, + 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,115, + 32, 97, 32,115,116,114,105,110,103, 32,114,101,112,114,101, + 115,101,110,116,105,110,103, 32,116,104,101, 32,116,101,120, + 116, 32,108,105,110,101, 10,102,117,110, 99,116,105,111,110, + 32, 86,101,114, 98, 97,116,105,109, 32, 40,108, 44, 99,111, + 110,100, 41, 10, 32,105,102, 32,115,116,114,115,117, 98, 40, + 108, 44, 49, 44, 49, 41, 32, 61, 61, 32, 34, 39, 34, 32,116, + 104,101,110, 10, 32, 32,108, 32, 61, 32,115,116,114,115,117, + 98, 40,108, 44, 50, 41, 10, 32,101,108,115,101,105,102, 32, + 115,116,114,115,117, 98, 40,108, 44, 49, 44, 49, 41, 32, 61, + 61, 32, 39, 36, 39, 32,116,104,101,110, 10, 32, 32, 99,111, + 110,100, 32, 61, 32, 39,115,114, 39, 32, 32, 32, 32, 32, 32, + 32, 45, 45, 32,103,101,110,101,114, 97,116,101,115, 32,105, + 110, 32, 98,111,116,104, 32,115,117,112,111,114,116, 32, 97, + 110,100, 32,114,101,103,105,115,116,101,114, 32,102,114, 97, + 103,109,101,110,116,115, 10, 32, 32,108, 32, 61, 32,115,116, + 114,115,117, 98, 40,108, 44, 50, 41, 10, 32,101,110,100, 10, + 32,114,101,116,117,114,110, 32, 95, 86,101,114, 98, 97,116, + 105,109, 32,123, 10, 32, 32,108,105,110,101, 32, 61, 32,108, + 44, 10, 32, 32, 99,111,110,100, 32, 61, 32, 99,111,110,100, + 32,111,114, 32, 39, 39, 44, 10, 32,125, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/verbatim.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,100,101, 32, + 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101, + 110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67, + 101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, + 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, + 32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, + 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32, + 105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114, + 101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105, + 115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, + 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, + 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, + 32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117, + 110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, + 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97, + 110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111, + 114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97, + 116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, + 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115, + 117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, + 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110, + 116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97, + 116,105,111,110,115, 46, 10, 10, 45, 45, 32,103,108,111, 98, + 97,108, 10, 99,111,100,101, 95,110, 32, 61, 32, 49, 10, 10, + 45, 45, 32, 67,111,100,101, 32, 99,108, 97,115,115, 10, 45, + 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 76,117, + 97, 32, 99,111,100,101, 32,116,111, 32, 98,101, 32, 99,111, + 109,112,105,108,101,100, 32, 97,110,100, 32,105,110, 99,108, + 117,100,101,100, 10, 45, 45, 32,105,110, 32,116,104,101, 32, + 105,110,105,116,105, 97,108,105,122, 97,116,105,111,110, 32, + 102,117,110, 99,116,105,111,110, 46, 10, 45, 45, 32, 84,104, + 101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,101, + 108,100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, + 10, 45, 45, 32, 32, 32,116,101,120,116, 32, 61, 32,116,101, + 120,116, 32, 99,111,100,101, 10, 99,108, 97,115,115, 67,111, + 100,101, 32, 61, 32,123, 10, 32,116,101,120,116, 32, 61, 32, + 39, 39, 44, 10,125, 10, 99,108, 97,115,115, 67,111,100,101, + 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115, + 115, 67,111,100,101, 10,115,101,116,109,101,116, 97,116, 97, + 98,108,101, 40, 99,108, 97,115,115, 67,111,100,101, 44, 99, + 108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45, + 45, 32,114,101,103,105,115,116,101,114, 32, 99,111,100,101, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 67,111,100,101, 58,114,101,103,105,115,116,101,114, 32, 40, + 112,114,101, 41, 10, 32,112,114,101, 32, 61, 32,112,114,101, + 32,111,114, 32, 39, 39, 10, 32, 45, 45, 32, 99,108,101, 97, + 110, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99, + 97,108, 32,115, 32, 61, 32, 99,108,101, 97,110, 40,115,101, + 108,102, 46,116,101,120,116, 41, 10, 32,105,102, 32,110,111, + 116, 32,115, 32,116,104,101,110, 10, 32, 32, 45, 45,112,114, + 105,110,116, 40,115,101,108,102, 46,116,101,120,116, 41, 10, + 32, 32,101,114,114,111,114, 40, 34,112, 97,114,115,101,114, + 32,101,114,114,111,114, 32,105,110, 32,101,109, 98,101,100, + 100,101,100, 32, 99,111,100,101, 34, 41, 10, 32,101,110,100, + 10, 10, 32, 45, 45, 32,103,101,116, 32,102,105,114,115,116, + 32,108,105,110,101, 10, 32,108,111, 99, 97,108, 32, 95, 44, + 32, 95, 44, 32,102,105,114,115,116, 95,108,105,110,101, 61, + 115,116,114,105,110,103, 46,102,105,110,100, 40,115,101,108, + 102, 46,116,101,120,116, 44, 32, 34, 94, 40, 91, 94, 92,110, + 92,114, 93, 42, 41, 34, 41, 10, 32,105,102, 32,115,116,114, + 105,110,103, 46,102,105,110,100, 40,102,105,114,115,116, 95, + 108,105,110,101, 44, 32, 34, 94, 37,115, 42, 37, 45, 37, 45, + 34, 41, 32,116,104,101,110, 10, 9, 32,105,102, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,102,105,114,115,116, + 95,108,105,110,101, 44, 32, 34, 94, 37, 45, 37, 45, 35, 35, + 34, 41, 32,116,104,101,110, 10, 9, 9,102,105,114,115,116, + 95,108,105,110,101, 32, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40,102,105,114,115,116, 95,108,105,110,101, + 44, 32, 34, 94, 37, 45, 37, 45, 35, 35, 34, 44, 32, 34, 34, + 41, 10, 9, 9,105,102, 32,102,108, 97,103,115, 91, 39, 67, + 39, 93, 32,116,104,101,110, 10, 9, 9, 9,115, 32, 61, 32, + 115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32, + 34, 94, 37, 45, 37, 45, 35, 35, 91, 94, 92,110, 92,114, 93, + 42, 92,110, 34, 44, 32, 34, 34, 41, 10, 9, 9,101,110,100, + 10, 9, 32,101,110,100, 10, 32,101,108,115,101, 10, 32, 9, + 102,105,114,115,116, 95,108,105,110,101, 32, 61, 32, 34, 34, + 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,111,110,118, + 101,114,116, 32,116,111, 32, 67, 10, 32,111,117,116,112,117, + 116, 40, 39, 92,110, 39, 46, 46,112,114,101, 46, 46, 39,123, + 32, 47, 42, 32, 98,101,103,105,110, 32,101,109, 98,101,100, + 100,101,100, 32,108,117, 97, 32, 99,111,100,101, 32, 42, 47, + 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40,112,114, + 101, 46, 46, 39, 32,105,110,116, 32,116,111,112, 32, 61, 32, + 108,117, 97, 95,103,101,116,116,111,112, 40,116,111,108,117, + 97, 95, 83, 41, 59, 39, 41, 10, 32,111,117,116,112,117,116, + 40,112,114,101, 46, 46, 39, 32,115,116, 97,116,105, 99, 32, + 117,110,115,105,103,110,101,100, 32, 99,104, 97,114, 32, 66, + 91, 93, 32, 61, 32,123, 92,110, 32, 32, 32, 39, 41, 10, 32, + 108,111, 99, 97,108, 32,116, 61,123,110, 61, 48,125, 10, 32, + 108,111, 99, 97,108, 32, 98, 32, 61, 32,103,115,117, 98, 40, + 115, 44, 39, 40, 46, 41, 39, 44,102,117,110, 99,116,105,111, + 110, 32, 40, 99, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,108,111, 99, 97,108, 32,101, 32, 61, 32, 39, 39, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32,116, 46,110, 61,116, 46, + 110, 43, 49, 32,105,102, 32,116, 46,110, 61, 61, 49, 53, 32, + 116,104,101,110, 32,116, 46,110, 61, 48, 32,101, 61, 39, 92, + 110, 39, 46, 46,112,114,101, 46, 46, 39, 32, 32, 39, 32,101, + 110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101, + 116,117,114,110, 32,102,111,114,109, 97,116, 40, 39, 37, 51, + 117, 44, 37,115, 39, 44,115,116,114, 98,121,116,101, 40, 99, + 41, 44,101, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101, + 110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 41, 10, 32,111,117,116,112,117,116, 40, 98, 46, + 46,115,116,114, 98,121,116,101, 40, 34, 32, 34, 41, 41, 10, + 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 46, 46,112, + 114,101, 46, 46, 39, 32,125, 59, 92,110, 39, 41, 10, 32,105, + 102, 32,102,105,114,115,116, 95,108,105,110,101, 32, 97,110, + 100, 32,102,105,114,115,116, 95,108,105,110,101, 32,126, 61, + 32, 34, 34, 32,116,104,101,110, 10, 32, 9,111,117,116,112, + 117,116, 40,112,114,101, 46, 46, 39, 32,116,111,108,117, 97, + 95,100,111, 98,117,102,102,101,114, 40,116,111,108,117, 97, + 95, 83, 44, 40, 99,104, 97,114, 42, 41, 66, 44,115,105,122, + 101,111,102, 40, 66, 41, 44, 34,116,111,108,117, 97, 32,101, + 109, 98,101,100,100,101,100, 58, 32, 39, 46, 46,102,105,114, + 115,116, 95,108,105,110,101, 46, 46, 39, 34, 41, 59, 39, 41, + 10, 32,101,108,115,101, 10, 32, 9,111,117,116,112,117,116, + 40,112,114,101, 46, 46, 39, 32,116,111,108,117, 97, 95,100, + 111, 98,117,102,102,101,114, 40,116,111,108,117, 97, 95, 83, + 44, 40, 99,104, 97,114, 42, 41, 66, 44,115,105,122,101,111, + 102, 40, 66, 41, 44, 34,116,111,108,117, 97, 58, 32,101,109, + 98,101,100,100,101,100, 32, 76,117, 97, 32, 99,111,100,101, + 32, 39, 46, 46, 99,111,100,101, 95,110, 46, 46, 39, 34, 41, + 59, 39, 41, 10, 32,101,110,100, 10, 32,111,117,116,112,117, + 116, 40,112,114,101, 46, 46, 39, 32,108,117, 97, 95,115,101, + 116,116,111,112, 40,116,111,108,117, 97, 95, 83, 44, 32,116, + 111,112, 41, 59, 39, 41, 10, 32,111,117,116,112,117,116, 40, + 112,114,101, 46, 46, 39,125, 32, 47, 42, 32,101,110,100, 32, + 111,102, 32,101,109, 98,101,100,100,101,100, 32,108,117, 97, + 32, 99,111,100,101, 32, 42, 47, 92,110, 92,110, 39, 41, 10, + 32, 99,111,100,101, 95,110, 32, 61, 32, 99,111,100,101, 95, + 110, 32, 43, 49, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80, + 114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,100,101, + 58,112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99, + 108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100, + 101,110,116, 46, 46, 34, 67,111,100,101,123, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 116,101,120,116, 32, 61, 32, 91, 91, 34, 46, 46,115,101,108, + 102, 46,116,101,120,116, 46, 46, 34, 93, 93, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10, + 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99, + 111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99, + 116,105,111,110, 32, 95, 67,111,100,101, 32, 40,116, 41, 10, + 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, + 44, 99,108, 97,115,115, 67,111,100,101, 41, 10, 32, 97,112, + 112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114,110, + 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115, + 116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, + 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114,101, + 112,114,101,115,101,110,116,105,110,103, 32,116,104,101, 32, + 99,111,100,101, 32,116,101,120,116, 10,102,117,110, 99,116, + 105,111,110, 32, 67,111,100,101, 32, 40,108, 41, 10, 32,114, + 101,116,117,114,110, 32, 95, 67,111,100,101, 32,123, 10, 32, + 32,116,101,120,116, 32, 61, 32,108, 10, 32,125, 10,101,110, + 100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/code.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,116,121,112,101,100, + 101,102, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105, + 116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97, + 114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71, + 114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, + 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, + 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111, + 100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116, + 119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114, + 101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, + 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105, + 116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, + 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101, + 114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97, + 110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, + 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117, + 116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108, + 105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118, + 105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, + 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97, + 116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101, + 109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102, + 105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, + 32, 84,121,112,101,100,101,102, 32, 99,108, 97,115,115, 10, + 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97, + 32,116,121,112,101, 32,115,121,110,111,110,121,109, 46, 10, + 45, 45, 32, 84,104,101, 32, 39,100,101, 32,102, 97, 99,116, + 111, 39, 32,116,121,112,101, 32,114,101,112,108, 97, 99,101, + 115, 32,116,104,101, 32,116,121,112,101,100,101,102, 32, 98, + 101,102,111,114,101, 32,116,104,101, 10, 45, 45, 32,114,101, + 109, 97,105,110,105,110,103, 32, 99,111,100,101, 32,105,115, + 32,112, 97,114,115,101,100, 46, 10, 45, 45, 32, 84,104,101, + 32,102,111,108,108,111,119,105,110,103, 32,102,105,101,108, + 100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, + 45, 45, 32, 32, 32,117,116,121,112,101, 32, 61, 32,116,121, + 112,101,100,101,102, 32,110, 97,109,101, 10, 45, 45, 32, 32, + 32,116,121,112,101, 32, 61, 32, 39,116,104,101, 32,102, 97, + 99,116,111, 39, 32,116,121,112,101, 10, 45, 45, 32, 32, 32, + 109,111,100, 32, 61, 32,109,111,100,105,102,105,101,114,115, + 32,116,111, 32,116,104,101, 32, 39,100,101, 32,102, 97, 99, + 116,111, 39, 32,116,121,112,101, 10, 99,108, 97,115,115, 84, + 121,112,101,100,101,102, 32, 61, 32,123, 10, 32,117,116,121, + 112,101, 32, 61, 32, 39, 39, 44, 10, 32,109,111,100, 32, 61, + 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, 39, + 10,125, 10, 99,108, 97,115,115, 84,121,112,101,100,101,102, + 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115, + 115, 84,121,112,101,100,101,102, 10, 10, 45, 45, 32, 80,114, + 105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 84,121,112,101,100, + 101,102, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, + 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 84,121,112,101,100,101,102, + 123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32,117,116,121,112,101, 32, 61, 32, 39, 34, + 46, 46,115,101,108,102, 46,117,116,121,112,101, 46, 46, 34, + 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,109,111,100, 32, 61, 32, 39, 34, 46, + 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, + 10, 10, 45, 45, 32, 82,101,116,117,114,110, 32,105,116, 39, + 115, 32,110,111,116, 32, 97, 32,118, 97,114,105, 97, 98,108, + 101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 84,121,112,101,100,101,102, 58,105,115,118, 97,114,105, + 97, 98,108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110, + 32,102, 97,108,115,101, 10,101,110,100, 10, 10, 45, 45, 32, + 73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114, + 117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, + 95, 84,121,112,101,100,101,102, 32, 40,116, 41, 10, 32,115, + 101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99, + 108, 97,115,115, 84,121,112,101,100,101,102, 41, 10, 32,116, + 46,116,121,112,101, 32, 61, 32,114,101,115,111,108,118,101, + 95,116,101,109,112,108, 97,116,101, 95,116,121,112,101,115, + 40,116, 46,116,121,112,101, 41, 10, 32, 97,112,112,101,110, + 100,116,121,112,101,100,101,102, 40,116, 41, 10, 32,114,101, + 116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, + 67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, + 69,120,112,101, 99,116,115, 32,111,110,101, 32,115,116,114, + 105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110, + 103, 32,116,104,101, 32,116,121,112,101, 32,100,101,102,105, + 110,105,116,105,111,110, 46, 10,102,117,110, 99,116,105,111, + 110, 32, 84,121,112,101,100,101,102, 32, 40,115, 41, 10, 32, + 105,102, 32,115,116,114,102,105,110,100, 40,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,115, 44, 32, 39, 37, 98, 60, + 62, 39, 44, 32, 39, 39, 41, 44, 39, 91, 37, 42, 38, 93, 39, + 41, 32,116,104,101,110, 10, 32, 32,116,111,108,117, 97, 95, + 101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105,100, + 32,116,121,112,101,100,101,102, 58, 32,112,111,105,110,116, + 101,114,115, 32, 40, 97,110,100, 32,114,101,102,101,114,101, + 110, 99,101,115, 41, 32, 97,114,101, 32,110,111,116, 32,115, + 117,112,112,111,114,116,101,100, 34, 41, 10, 32,101,110,100, + 10, 32,108,111, 99, 97,108, 32,111, 32, 61, 32,123,109,111, + 100, 32, 61, 32, 39, 39,125, 10, 32,105,102, 32,115,116,114, + 105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 91, 60, + 62, 93, 34, 41, 32,116,104,101,110, 10, 32, 9, 95, 44, 95, + 44,111, 46,116,121,112,101, 44,111, 46,117,116,121,112,101, + 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 115, 44, 32, 34, 94, 37,115, 42, 40, 91, 94, 60, 62, 93, 43, + 37, 98, 60, 62, 91, 94, 37,115, 93, 42, 41, 37,115, 43, 40, + 46, 45, 41, 36, 34, 41, 10, 32,101,108,115,101, 10, 32, 9, + 108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116, + 40,103,115,117, 98, 40,115, 44, 34, 37,115, 37,115, 42, 34, + 44, 34, 32, 34, 41, 44, 34, 32, 34, 41, 10, 32, 9,111, 32, + 61, 32,123, 10, 9, 32, 32,117,116,121,112,101, 32, 61, 32, + 116, 91,116, 46,110, 93, 44, 10, 9, 32, 32,116,121,112,101, + 32, 61, 32,116, 91,116, 46,110, 45, 49, 93, 44, 10, 9, 32, + 32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,116, + 44, 49, 44,116, 46,110, 45, 50, 41, 44, 10, 9, 32,125, 10, + 32,101,110,100, 10, 32,114,101,116,117,114,110, 32, 95, 84, + 121,112,101,100,101,102, 40,111, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/typedef.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,110,116, 97, + 105,110,101,114, 32, 97, 98,115,116,114, 97, 99,116, 32, 99, + 108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, + 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101, + 108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, + 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, + 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, + 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105, + 115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,101, + 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,115, + 116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47, + 111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, 45, + 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, 32, + 112,114,111,118,105,100,101,100, 32,104,101,114,101,117,110, + 100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97, + 115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110, + 100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,114, + 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,116, + 105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, 32, + 109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,117, + 112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, 44, + 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,116, + 115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,116, + 105,111,110,115, 46, 10, 10, 45, 45, 32,116, 97, 98,108,101, + 32,116,111, 32,115,116,111,114,101, 32,110, 97,109,101,115, + 112, 97, 99,101,100, 32,116,121,112,101,100,101,102,115, 47, + 101,110,117,109,115, 32,105,110, 32,103,108,111, 98, 97,108, + 32,115, 99,111,112,101, 10,103,108,111, 98, 97,108, 95,116, + 121,112,101,100,101,102,115, 32, 61, 32,123,125, 10,103,108, + 111, 98, 97,108, 95,101,110,117,109,115, 32, 61, 32,123,125, + 10, 10, 45, 45, 32, 67,111,110,116, 97,105,110,101,114, 32, + 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115, + 101,110,116,115, 32, 97, 32, 99,111,110,116, 97,105,110,101, + 114, 32,111,102, 32,102,101, 97,116,117,114,101,115, 32,116, + 111, 32, 98,101, 32, 98,111,117,110,100, 10, 45, 45, 32,116, + 111, 32,108,117, 97, 46, 10, 99,108, 97,115,115, 67,111,110, + 116, 97,105,110,101,114, 32, 61, 10,123, 10, 32, 99,117,114, + 114, 32, 61, 32,110,105,108, 44, 10,125, 10, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 46, 95, 95,105,110, + 100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116, + 97,105,110,101,114, 10,115,101,116,109,101,116, 97,116, 97, + 98,108,101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105, + 110,101,114, 44, 99,108, 97,115,115, 70,101, 97,116,117,114, + 101, 41, 10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116, + 97,103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,100,101, + 99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117,115,104, + 40,115,101,108,102, 41, 10, 32,108,111, 99, 97,108, 32,105, + 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91, + 105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105, 93, + 58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32,105, + 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,111, + 112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32,119,114, + 105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111,100, + 101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 58,115,117,112, 99, + 111,100,101, 32, 40, 41, 10, 10, 9,105,102, 32,110,111,116, + 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98, + 108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104, + 101,110, 10, 9, 9,114,101,116,117,114,110, 10, 9,101,110, + 100, 10, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, + 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105, + 108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, + 32,105,102, 32,115,101,108,102, 91,105, 93, 58, 99,104,101, + 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115, + 115, 40, 41, 32,116,104,101,110, 10, 32, 32, 9,115,101,108, + 102, 91,105, 93, 58,115,117,112, 99,111,100,101, 40, 41, 10, + 32, 32,101,110,100, 10, 32, 32,105, 32, 61, 32,105, 43, 49, + 10, 32,101,110,100, 10, 32,112,111,112, 40, 41, 10,101,110, + 100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 58,104, 97,115, + 118, 97,114, 32, 40, 41, 10, 32,108,111, 99, 97,108, 32,105, + 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91, + 105, 93, 32,100,111, 10, 32, 32,105,102, 32,115,101,108,102, + 91,105, 93, 58,105,115,118, 97,114,105, 97, 98,108,101, 40, + 41, 32,116,104,101,110, 10, 9, 9, 32,114,101,116,117,114, + 110, 32, 49, 10, 9, 9,101,110,100, 10, 32, 32,105, 32, 61, + 32,105, 43, 49, 10, 32,101,110,100, 10, 9,114,101,116,117, + 114,110, 32, 48, 10,101,110,100, 10, 10, 45, 45, 32, 73,110, + 116,101,114,110, 97,108, 32, 99,111,110,116, 97,105,110,101, + 114, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102, + 117,110, 99,116,105,111,110, 32, 95, 67,111,110,116, 97,105, + 110,101,114, 32, 40,115,101,108,102, 41, 10, 32,115,101,116, + 109,101,116, 97,116, 97, 98,108,101, 40,115,101,108,102, 44, + 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 41, + 10, 32,115,101,108,102, 46,110, 32, 61, 32, 48, 10, 32,115, + 101,108,102, 46,116,121,112,101,100,101,102,115, 32, 61, 32, + 123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32,115,101, + 108,102, 46,117,115,101,114,116,121,112,101,115, 32, 61, 32, + 123,125, 10, 32,115,101,108,102, 46,101,110,117,109,115, 32, + 61, 32,123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32, + 115,101,108,102, 46,108,110, 97,109,101,115, 32, 61, 32,123, + 125, 10, 32,114,101,116,117,114,110, 32,115,101,108,102, 10, + 101,110,100, 10, 10, 45, 45, 32,112,117,115,104, 32, 99,111, + 110,116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111, + 110, 32,112,117,115,104, 32, 40,116, 41, 10, 9,116, 46,112, + 114,111,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116, + 97,105,110,101,114, 46, 99,117,114,114, 10, 32, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114, + 114, 32, 61, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,112, + 111,112, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117, + 110, 99,116,105,111,110, 32,112,111,112, 32, 40, 41, 10, 45, + 45,112,114,105,110,116, 40, 34,110, 97,109,101, 34, 44, 99, + 108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99, + 117,114,114, 46,110, 97,109,101, 41, 10, 45, 45,102,111,114, + 101, 97, 99,104, 40, 99,108, 97,115,115, 67,111,110,116, 97, + 105,110,101,114, 46, 99,117,114,114, 46,117,115,101,114,116, + 121,112,101,115, 44,112,114,105,110,116, 41, 10, 45, 45,112, + 114,105,110,116, 40, 34, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 34, 41, 10, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 32, 61, + 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, + 46, 99,117,114,114, 46,112,114,111,120, 10,101,110,100, 10, + 10, 45, 45, 32,103,101,116, 32, 99,117,114,114,101,110,116, + 32,110, 97,109,101,115,112, 97, 99,101, 10,102,117,110, 99, + 116,105,111,110, 32,103,101,116, 99,117,114,114,110, 97,109, + 101,115,112, 97, 99,101, 32, 40, 41, 10, 9,114,101,116,117, + 114,110, 32,103,101,116,110, 97,109,101,115,112, 97, 99,101, + 40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, + 46, 99,117,114,114, 41, 10,101,110,100, 10, 10, 45, 45, 32, + 97,112,112,101,110,100, 32,116,111, 32, 99,117,114,114,101, + 110,116, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117, + 110, 99,116,105,111,110, 32, 97,112,112,101,110,100, 32, 40, + 116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, + 58, 97,112,112,101,110,100, 40,116, 41, 10,101,110,100, 10, + 10, 45, 45, 32, 97,112,112,101,110,100, 32,116,121,112,101, + 100,101,102, 32,116,111, 32, 99,117,114,114,101,110,116, 32, + 99,111,110,116, 97,105,110,101,114, 10,102,117,110, 99,116, + 105,111,110, 32, 97,112,112,101,110,100,116,121,112,101,100, + 101,102, 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, + 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, + 99,117,114,114, 58, 97,112,112,101,110,100,116,121,112,101, + 100,101,102, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32, + 97,112,112,101,110,100, 32,117,115,101,114,116,121,112,101, + 32,116,111, 32, 99,117,114,114,101,110,116, 32, 99,111,110, + 116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111,110, + 32, 97,112,112,101,110,100,117,115,101,114,116,121,112,101, + 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108, + 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117, + 114,114, 58, 97,112,112,101,110,100,117,115,101,114,116,121, + 112,101, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32, 97, + 112,112,101,110,100, 32,101,110,117,109, 32,116,111, 32, 99, + 117,114,114,101,110,116, 32, 99,111,110,116, 97,105,110,101, + 114, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112,101, + 110,100,101,110,117,109, 32, 40,116, 41, 10, 32,114,101,116, + 117,114,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105, + 110,101,114, 46, 99,117,114,114, 58, 97,112,112,101,110,100, + 101,110,117,109, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, + 32,115,117, 98,115,116,105,116,117,116,101, 32,116,121,112, + 101,100,101,102, 10,102,117,110, 99,116,105,111,110, 32, 97, + 112,112,108,121,116,121,112,101,100,101,102, 32, 40,109,111, + 100, 44,116,121,112,101, 41, 10, 32,114,101,116,117,114,110, + 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, + 46, 99,117,114,114, 58, 97,112,112,108,121,116,121,112,101, + 100,101,102, 40,109,111,100, 44,116,121,112,101, 41, 10,101, + 110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, + 32,105,115, 32,116,121,112,101, 10,102,117,110, 99,116,105, + 111,110, 32,102,105,110,100,116,121,112,101, 32, 40,116,121, + 112,101, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, + 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, + 99,117,114,114, 58,102,105,110,100,116,121,112,101, 40,116, + 121,112,101, 41, 10, 9,114,101,116,117,114,110, 32,116, 10, + 101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105, + 102, 32,105,115, 32,116,121,112,101,100,101,102, 10,102,117, + 110, 99,116,105,111,110, 32,105,115,116,121,112,101,100,101, + 102, 32, 40,116,121,112,101, 41, 10, 32,114,101,116,117,114, + 110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 46, 99,117,114,114, 58,105,115,116,121,112,101,100,101, + 102, 40,116,121,112,101, 41, 10,101,110,100, 10, 10, 45, 45, + 32,103,101,116, 32,102,117,108,108,116,121,112,101, 32, 40, + 119,105,116,104, 32,110, 97,109,101,115,112, 97, 99,101, 41, + 10,102,117,110, 99,116,105,111,110, 32,102,117,108,108,116, + 121,112,101, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32, + 99,117,114,114, 32, 61, 32, 32, 99,108, 97,115,115, 67,111, + 110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, 9,119, + 104,105,108,101, 32, 99,117,114,114, 32,100,111, 10, 9, 32, + 105,102, 32, 99,117,114,114, 32,116,104,101,110, 10, 9, 9, + 32,105,102, 32, 99,117,114,114, 46,116,121,112,101,100,101, + 102,115, 32, 97,110,100, 32, 99,117,114,114, 46,116,121,112, + 101,100,101,102,115, 91,116, 93, 32,116,104,101,110, 10, 9, + 9, 32, 32,114,101,116,117,114,110, 32, 99,117,114,114, 46, + 116,121,112,101,100,101,102,115, 91,116, 93, 10, 9, 9, 32, + 101,108,115,101,105,102, 32, 99,117,114,114, 46,117,115,101, + 114,116,121,112,101,115, 32, 97,110,100, 32, 99,117,114,114, + 46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116, + 104,101,110, 10, 9, 9, 32, 32,114,101,116,117,114,110, 32, + 99,117,114,114, 46,117,115,101,114,116,121,112,101,115, 91, + 116, 93, 10, 9, 9, 9,101,110,100, 10, 9, 9,101,110,100, + 10, 9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46, + 112,114,111,120, 10, 9,101,110,100, 10, 9,114,101,116,117, + 114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 99,104, + 101, 99,107,115, 32,105,102, 32,105,116, 32,114,101,113,117, + 105,114,101,115, 32, 99,111,108,108,101, 99,116,105,111,110, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 58,114,101,113,117,105, + 114,101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116, + 41, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 9,108,111, 99, 97, + 108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,119,104, + 105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, + 32, 32,114, 32, 61, 32,115,101,108,102, 91,105, 93, 58,114, + 101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111, + 110, 40,116, 41, 32,111,114, 32,114, 10, 32, 32,105, 32, 61, + 32,105, 43, 49, 10, 32,101,110,100, 10, 9,112,111,112, 40, + 41, 10, 9,114,101,116,117,114,110, 32,114, 10,101,110,100, + 10, 10, 10, 45, 45, 32,103,101,116, 32,110, 97,109,101,115, + 97,112, 99,101, 10,102,117,110, 99,116,105,111,110, 32,103, + 101,116,110, 97,109,101,115,112, 97, 99,101, 32, 40, 99,117, + 114,114, 41, 10, 9,108,111, 99, 97,108, 32,110, 97,109,101, + 115,112, 97, 99,101, 32, 61, 32, 39, 39, 10, 9,119,104,105, + 108,101, 32, 99,117,114,114, 32,100,111, 10, 9, 32,105,102, + 32, 99,117,114,114, 32, 97,110,100, 10, 9, 9, 32, 32, 32, + 40, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112, + 101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111,114, + 32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112,101, + 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101, 39, + 41, 10, 9, 9,116,104,101,110, 10, 9, 9, 32,110, 97,109, + 101,115,112, 97, 99,101, 32, 61, 32, 40, 99,117,114,114, 46, + 111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111, + 114, 32, 99,117,114,114, 46,110, 97,109,101, 41, 32, 46, 46, + 32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109,101,115,112, + 97, 99,101, 10, 9, 9, 32, 45, 45,110, 97,109,101,115,112, + 97, 99,101, 32, 61, 32, 99,117,114,114, 46,110, 97,109,101, + 32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109, + 101,115,112, 97, 99,101, 10, 9, 9,101,110,100, 10, 9, 32, + 99,117,114,114, 32, 61, 32, 99,117,114,114, 46,112,114,111, + 120, 10, 9,101,110,100, 10, 9,114,101,116,117,114,110, 32, + 110, 97,109,101,115,112, 97, 99,101, 10,101,110,100, 10, 10, + 45, 45, 32,103,101,116, 32,110, 97,109,101,115,112, 97, 99, + 101, 32, 40,111,110,108,121, 32,110, 97,109,101,115,112, 97, + 99,101, 41, 10,102,117,110, 99,116,105,111,110, 32,103,101, + 116,111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 32, + 40, 41, 10, 32,108,111, 99, 97,108, 32, 99,117,114,114, 32, + 61, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 46, 99,117,114,114, 10, 9,108,111, 99, 97,108, 32,110, + 97,109,101,115,112, 97, 99,101, 32, 61, 32, 39, 39, 10, 9, + 119,104,105,108,101, 32, 99,117,114,114, 32,100,111, 10, 9, + 9,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116, + 121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32, + 116,104,101,110, 10, 9, 9, 32,114,101,116,117,114,110, 32, + 110, 97,109,101,115,112, 97, 99,101, 10, 9, 9,101,108,115, + 101,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116, + 121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, + 99,101, 39, 32,116,104,101,110, 10, 9, 9, 32,110, 97,109, + 101,115,112, 97, 99,101, 32, 61, 32, 99,117,114,114, 46,110, + 97,109,101, 32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32, + 110, 97,109,101,115,112, 97, 99,101, 10, 9, 9,101,110,100, + 10, 9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46, + 112,114,111,120, 10, 9,101,110,100, 10, 9,114,101,116,117, + 114,110, 32,110, 97,109,101,115,112, 97, 99,101, 10,101,110, + 100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32, + 105,115, 32,101,110,117,109, 10,102,117,110, 99,116,105,111, + 110, 32,105,115,101,110,117,109, 32, 40,116,121,112,101, 41, + 10, 32,114,101,116,117,114,110, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 58,105, + 115,101,110,117,109, 40,116,121,112,101, 41, 10,101,110,100, + 10, 10, 45, 45, 32, 97,112,112,101,110,100, 32,102,101, 97, + 116,117,114,101, 32,116,111, 32, 99,111,110,116, 97,105,110, + 101,114, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 58, 97,112,112, + 101,110,100, 32, 40,116, 41, 10, 32,115,101,108,102, 46,110, + 32, 61, 32,115,101,108,102, 46,110, 32, 43, 32, 49, 10, 32, + 115,101,108,102, 91,115,101,108,102, 46,110, 93, 32, 61, 32, + 116, 10, 32,116, 46,112, 97,114,101,110,116, 32, 61, 32,115, + 101,108,102, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112, + 101,110,100, 32,116,121,112,101,100,101,102, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,110,116, + 97,105,110,101,114, 58, 97,112,112,101,110,100,116,121,112, + 101,100,101,102, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, + 32,110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101, + 116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, + 41, 10, 32,115,101,108,102, 46,116,121,112,101,100,101,102, + 115, 46,116,111,108,117, 97, 95,110, 32, 61, 32,115,101,108, + 102, 46,116,121,112,101,100,101,102,115, 46,116,111,108,117, + 97, 95,110, 32, 43, 32, 49, 10, 32,115,101,108,102, 46,116, + 121,112,101,100,101,102,115, 91,115,101,108,102, 46,116,121, + 112,101,100,101,102,115, 46,116,111,108,117, 97, 95,110, 93, + 32, 61, 32,116, 10, 9,115,101,108,102, 46,116,121,112,101, + 100,101,102,115, 91,116, 46,117,116,121,112,101, 93, 32, 61, + 32,110, 97,109,101,115,112, 97, 99,101, 32, 46, 46, 32,116, + 46,117,116,121,112,101, 10, 9,103,108,111, 98, 97,108, 95, + 116,121,112,101,100,101,102,115, 91,110, 97,109,101,115,112, + 97, 99,101, 46, 46,116, 46,117,116,121,112,101, 93, 32, 61, + 32,116, 10, 9,116, 46,102,116,121,112,101, 32, 61, 32,102, + 105,110,100,116,121,112,101, 40,116, 46,116,121,112,101, 41, + 32,111,114, 32,116, 46,116,121,112,101, 10, 9, 45, 45,112, + 114,105,110,116, 40, 34, 97,112,112,101,110,100,105,110,103, + 32,116,121,112,101,100,101,102, 32, 34, 46, 46,116, 46,117, + 116,121,112,101, 46, 46, 34, 32, 97,115, 32, 34, 46, 46,110, + 97,109,101,115,112, 97, 99,101, 46, 46,116, 46,117,116,121, + 112,101, 46, 46, 34, 32,119,105,116,104, 32,102,116,121,112, + 101, 32, 34, 46, 46,116, 46,102,116,121,112,101, 41, 10, 9, + 97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95,116, + 121,112,101, 40,110, 97,109,101,115,112, 97, 99,101, 46, 46, + 116, 46,117,116,121,112,101, 41, 10, 9,105,102, 32,116, 46, + 102,116,121,112,101, 32, 97,110,100, 32,105,115,101,110,117, + 109, 40,116, 46,102,116,121,112,101, 41, 32,116,104,101,110, + 10, 10, 9, 9,103,108,111, 98, 97,108, 95,101,110,117,109, + 115, 91,110, 97,109,101,115,112, 97, 99,101, 46, 46,116, 46, + 117,116,121,112,101, 93, 32, 61, 32,116,114,117,101, 10, 9, + 101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112, + 101,110,100, 32,117,115,101,114,116,121,112,101, 58, 32,114, + 101,116,117,114,110, 32,102,117,108,108, 32,116,121,112,101, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 58, 97,112,112,101,110, + 100,117,115,101,114,116,121,112,101, 32, 40,116, 41, 10, 9, + 108,111, 99, 97,108, 32, 99,111,110,116, 97,105,110,101,114, + 10, 9,105,102, 32,116, 32, 61, 61, 32, 40,115,101,108,102, + 46,111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32, + 111,114, 32,115,101,108,102, 46,110, 97,109,101, 41, 32,116, + 104,101,110, 10, 9, 9, 99,111,110,116, 97,105,110,101,114, + 32, 61, 32,115,101,108,102, 46,112,114,111,120, 10, 9,101, + 108,115,101, 10, 9, 9, 99,111,110,116, 97,105,110,101,114, + 32, 61, 32,115,101,108,102, 10, 9,101,110,100, 10, 9,108, + 111, 99, 97,108, 32,102,116, 32, 61, 32,103,101,116,110, 97, + 109,101,115,112, 97, 99,101, 40, 99,111,110,116, 97,105,110, + 101,114, 41, 32, 46, 46, 32,116, 10, 9, 99,111,110,116, 97, + 105,110,101,114, 46,117,115,101,114,116,121,112,101,115, 91, + 116, 93, 32, 61, 32,102,116, 10, 9, 95,117,115,101,114,116, + 121,112,101, 91,102,116, 93, 32, 61, 32,102,116, 10, 9,114, + 101,116,117,114,110, 32,102,116, 10,101,110,100, 10, 10, 45, + 45, 32, 97,112,112,101,110,100, 32,101,110,117,109, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111, + 110,116, 97,105,110,101,114, 58, 97,112,112,101,110,100,101, + 110,117,109, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32, + 110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101,116, + 110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 41, + 10, 32,115,101,108,102, 46,101,110,117,109,115, 46,116,111, + 108,117, 97, 95,110, 32, 61, 32,115,101,108,102, 46,101,110, + 117,109,115, 46,116,111,108,117, 97, 95,110, 32, 43, 32, 49, + 10, 32,115,101,108,102, 46,101,110,117,109,115, 91,115,101, + 108,102, 46,101,110,117,109,115, 46,116,111,108,117, 97, 95, + 110, 93, 32, 61, 32,116, 10, 9,103,108,111, 98, 97,108, 95, + 101,110,117,109,115, 91,110, 97,109,101,115,112, 97, 99,101, + 46, 46,116, 46,110, 97,109,101, 93, 32, 61, 32,116, 10,101, + 110,100, 10, 10, 45, 45, 32,100,101,116,101,114,109,105,110, + 101, 32,108,117, 97, 32,102,117,110, 99,116,105,111,110, 32, + 110, 97,109,101, 32,111,118,101,114,108,111, 97,100, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111, + 110,116, 97,105,110,101,114, 58,111,118,101,114,108,111, 97, + 100, 32, 40,108,110, 97,109,101, 41, 10, 32,105,102, 32,110, + 111,116, 32,115,101,108,102, 46,108,110, 97,109,101,115, 91, + 108,110, 97,109,101, 93, 32,116,104,101,110, 10, 32, 32,115, + 101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97,109, + 101, 93, 32, 61, 32, 48, 10, 32,101,108,115,101, 10, 32, 32, + 115,101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97, + 109,101, 93, 32, 61, 32,115,101,108,102, 46,108,110, 97,109, + 101,115, 91,108,110, 97,109,101, 93, 32, 43, 32, 49, 10, 32, + 101,110,100, 10, 32,114,101,116,117,114,110, 32,102,111,114, + 109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,115,101,108,102, + 46,108,110, 97,109,101,115, 91,108,110, 97,109,101, 93, 41, + 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,108,105,101, + 115, 32,116,121,112,101,100,101,102, 58, 32,114,101,116,117, + 114,110,115, 32,116,104,101, 32, 39,116,104,101, 32,102, 97, + 99,116,111, 39, 32,109,111,100,105,102,105,101,114, 32, 97, + 110,100, 32,116,121,112,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 58, 97,112,112,108,121,116,121,112,101,100,101,102, 32, + 40,109,111,100, 44,116,121,112,101, 41, 10, 9,105,102, 32, + 103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115, + 91,116,121,112,101, 93, 32,116,104,101,110, 10, 9, 9, 45, + 45,112,114,105,110,116, 40, 34,102,111,117,110,100, 32,116, + 121,112,101,100,101,102, 32, 34, 46, 46,103,108,111, 98, 97, + 108, 95,116,121,112,101,100,101,102,115, 91,116,121,112,101, + 93, 46,116,121,112,101, 41, 10, 9, 9,108,111, 99, 97,108, + 32,109,111,100, 49, 44, 32,116,121,112,101, 49, 32, 61, 32, + 103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115, + 91,116,121,112,101, 93, 46,109,111,100, 44, 32,103,108,111, + 98, 97,108, 95,116,121,112,101,100,101,102,115, 91,116,121, + 112,101, 93, 46,102,116,121,112,101, 10, 9, 9,108,111, 99, + 97,108, 32,109,111,100, 50, 44, 32,116,121,112,101, 50, 32, + 61, 32, 97,112,112,108,121,116,121,112,101,100,101,102, 40, + 109,111,100, 46, 46, 34, 32, 34, 46, 46,109,111,100, 49, 44, + 32,116,121,112,101, 49, 41, 10, 9, 9, 45, 45,114,101,116, + 117,114,110, 32,109,111,100, 50, 32, 46, 46, 32, 39, 32, 39, + 32, 46, 46, 32,109,111,100, 49, 44, 32,116,121,112,101, 50, + 10, 9, 9,114,101,116,117,114,110, 32,109,111,100, 50, 44, + 32,116,121,112,101, 50, 10, 9,101,110,100, 10, 9,100,111, + 32,114,101,116,117,114,110, 32,109,111,100, 44,116,121,112, + 101, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97, + 32,116,121,112,101,100,101,102, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110, + 101,114, 58,105,115,116,121,112,101,100,101,102, 32, 40,116, + 121,112,101, 41, 10, 32,108,111, 99, 97,108, 32,101,110,118, + 32, 61, 32,115,101,108,102, 10, 32,119,104,105,108,101, 32, + 101,110,118, 32,100,111, 10, 32, 32,105,102, 32,101,110,118, + 46,116,121,112,101,100,101,102,115, 32,116,104,101,110, 10, + 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32, + 32,119,104,105,108,101, 32,101,110,118, 46,116,121,112,101, + 100,101,102,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32, + 105,102, 32,101,110,118, 46,116,121,112,101,100,101,102,115, + 91,105, 93, 46,117,116,121,112,101, 32, 61, 61, 32,116,121, + 112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, + 32, 32,114,101,116,117,114,110, 32,116,121,112,101, 10, 32, + 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, + 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32, + 101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118, + 32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32, + 101,110,100, 10, 32,114,101,116,117,114,110, 32,110,105,108, + 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, + 102,105,110,100, 95,101,110,117,109, 95,118, 97,114, 40,118, + 97,114, 41, 10, 10, 9,105,102, 32,116,111,110,117,109, 98, + 101,114, 40,118, 97,114, 41, 32,116,104,101,110, 32,114,101, + 116,117,114,110, 32,118, 97,114, 32,101,110,100, 10, 10, 9, + 108,111, 99, 97,108, 32, 99, 32, 61, 32, 99,108, 97,115,115, + 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, + 9,119,104,105,108,101, 32, 99, 32,100,111, 10, 9, 9,108, + 111, 99, 97,108, 32,110,115, 32, 61, 32,103,101,116,110, 97, + 109,101,115,112, 97, 99,101, 40, 99, 41, 10, 9, 9,102,111, + 114, 32,107, 44,118, 32,105,110, 32,112, 97,105,114,115, 40, + 95,103,108,111, 98, 97,108, 95,101,110,117,109,115, 41, 32, + 100,111, 10, 9, 9, 9,105,102, 32,109, 97,116, 99,104, 95, + 116,121,112,101, 40,118, 97,114, 44, 32,118, 44, 32,110,115, + 41, 32,116,104,101,110, 10, 9, 9, 9, 9,114,101,116,117, + 114,110, 32,118, 10, 9, 9, 9,101,110,100, 10, 9, 9,101, + 110,100, 10, 9, 9,105,102, 32, 99, 46, 98, 97,115,101, 32, + 97,110,100, 32, 99, 46, 98, 97,115,101, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 9, 9, 9, 99, 32, 61, 32, 95, + 103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91, + 99, 58,102,105,110,100,116,121,112,101, 40, 99, 46, 98, 97, + 115,101, 41, 93, 10, 9, 9,101,108,115,101, 10, 9, 9, 9, + 99, 32, 61, 32,110,105,108, 10, 9, 9,101,110,100, 10, 9, + 101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,118, 97, + 114, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, + 32,105,102, 32,105,115, 32, 97, 32,114,101,103,105,115,116, + 101,114,101,100, 32,116,121,112,101, 58, 32,114,101,116,117, + 114,110, 32,102,117,108,108, 32,116,121,112,101, 32,111,114, + 32,110,105,108, 10,102,117,110, 99,116,105,111,110, 32, 99, + 108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,102, + 105,110,100,116,121,112,101, 32, 40,116, 41, 10, 10, 9,116, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 116, 44, 32, 34, 61, 46, 42, 34, 44, 32, 34, 34, 41, 10, 9, + 105,102, 32, 95, 98, 97,115,105, 99, 91,116, 93, 32,116,104, + 101,110, 10, 9, 32,114,101,116,117,114,110, 32,116, 10, 9, + 101,110,100, 10, 10, 9,108,111, 99, 97,108, 32, 95, 44, 95, + 44,101,109, 32, 61, 32,115,116,114,105,110,103, 46,102,105, + 110,100, 40,116, 44, 32, 34, 40, 91, 38, 37, 42, 93, 41, 37, + 115, 42, 36, 34, 41, 10, 9,116, 32, 61, 32,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, 37,115, 42, + 40, 91, 38, 37, 42, 93, 41, 37,115, 42, 36, 34, 44, 32, 34, + 34, 41, 10, 9,112, 32, 61, 32,115,101,108,102, 10, 9,119, + 104,105,108,101, 32,112, 32, 97,110,100, 32,116,121,112,101, + 40,112, 41, 61, 61, 39,116, 97, 98,108,101, 39, 32,100,111, + 10, 9, 9,108,111, 99, 97,108, 32,115,116, 32, 61, 32,103, + 101,116,110, 97,109,101,115,112, 97, 99,101, 40,112, 41, 10, + 10, 9, 9,102,111,114, 32,105, 61, 95,103,108,111, 98, 97, + 108, 95,116,121,112,101,115, 46,110, 44, 49, 44, 45, 49, 32, + 100,111, 32, 45, 45, 32,105,110, 32,114,101,118,101,114,115, + 101, 32,111,114,100,101,114, 10, 10, 9, 9, 9,105,102, 32, + 109, 97,116, 99,104, 95,116,121,112,101, 40,116, 44, 32, 95, + 103,108,111, 98, 97,108, 95,116,121,112,101,115, 91,105, 93, + 44, 32,115,116, 41, 32,116,104,101,110, 10, 9, 9, 9, 9, + 114,101,116,117,114,110, 32, 95,103,108,111, 98, 97,108, 95, + 116,121,112,101,115, 91,105, 93, 46, 46, 40,101,109, 32,111, + 114, 32, 34, 34, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, + 101,110,100, 10, 9, 9,105,102, 32,112, 46, 98, 97,115,101, + 32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126, 61, 32, + 39, 39, 32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126, + 61, 32,116, 32,116,104,101,110, 10, 9, 9, 9, 45, 45,112, + 114,105,110,116, 40, 34,116,121,112,101, 32,105,115, 32, 34, + 46, 46,116, 46, 46, 34, 44, 32,112, 32,105,115, 32, 34, 46, + 46,112, 46, 98, 97,115,101, 46, 46, 34, 32,115,101,108,102, + 46,116,121,112,101, 32,105,115, 32, 34, 46, 46,115,101,108, + 102, 46,116,121,112,101, 46, 46, 34, 32,115,101,108,102, 46, + 110, 97,109,101, 32,105,115, 32, 34, 46, 46,115,101,108,102, + 46,110, 97,109,101, 41, 10, 9, 9, 9,112, 32, 61, 32, 95, + 103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91, + 112, 58,102,105,110,100,116,121,112,101, 40,112, 46, 98, 97, + 115,101, 41, 93, 10, 9, 9,101,108,115,101, 10, 9, 9, 9, + 112, 32, 61, 32,110,105,108, 10, 9, 9,101,110,100, 10, 9, + 101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,110,105, + 108, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32, 97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95, + 116,121,112,101, 40,116, 44, 32, 99,108, 97,115,115, 41, 10, + 9, 95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 46, + 110, 32, 61, 32, 95,103,108,111, 98, 97,108, 95,116,121,112, + 101,115, 46,110, 32, 43, 49, 10, 9, 95,103,108,111, 98, 97, + 108, 95,116,121,112,101,115, 91, 95,103,108,111, 98, 97,108, + 95,116,121,112,101,115, 46,110, 93, 32, 61, 32,116, 10, 9, + 95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 95,104, + 97,115,104, 91,116, 93, 32, 61, 32, 49, 10, 9,105,102, 32, + 99,108, 97,115,115, 32,116,104,101,110, 32, 97,112,112,101, + 110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40,116, + 44, 32, 99,108, 97,115,115, 41, 32,101,110,100, 10,101,110, + 100, 10, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112, + 101,110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40, + 116, 44, 99,108, 97,115,115, 41, 10, 9,105,102, 32, 95,103, + 108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116, + 93, 32,116,104,101,110, 10, 9, 9, 99,108, 97,115,115, 46, + 102,108, 97,103,115, 32, 61, 32, 95,103,108,111, 98, 97,108, + 95, 99,108, 97,115,115,101,115, 91,116, 93, 46,102,108, 97, + 103,115, 10, 9, 9, 99,108, 97,115,115, 46,108,110, 97,109, + 101,115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, + 97,115,115,101,115, 91,116, 93, 46,108,110, 97,109,101,115, + 10, 9, 9,105,102, 32, 95,103,108,111, 98, 97,108, 95, 99, + 108, 97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32, + 97,110,100, 32, 40, 95,103,108,111, 98, 97,108, 95, 99,108, + 97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32,126, + 61, 32, 39, 39, 41, 32,116,104,101,110, 10, 9, 9, 9, 99, + 108, 97,115,115, 46, 98, 97,115,101, 32, 61, 32, 95,103,108, + 111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116, 93, + 46, 98, 97,115,101, 32,111,114, 32, 99,108, 97,115,115, 46, + 98, 97,115,101, 10, 9, 9,101,110,100, 10, 9,101,110,100, + 10, 9, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115, + 101,115, 91,116, 93, 32, 61, 32, 99,108, 97,115,115, 10, 9, + 99,108, 97,115,115, 46,102,108, 97,103,115, 32, 61, 32, 99, + 108, 97,115,115, 46,102,108, 97,103,115, 32,111,114, 32,123, + 125, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32,109, 97,116, 99,104, 95,116,121,112,101, 40, 99,104,105, + 108,100,116,121,112,101, 44, 32,114,101,103,116,121,112,101, + 44, 32,115,116, 41, 10, 45, 45,112,114,105,110,116, 40, 34, + 102,105,110,100,116,121,112,101, 32, 34, 46, 46, 99,104,105, + 108,100,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,114, + 101,103,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,115, + 116, 41, 10, 9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61, + 32,115,116,114,105,110,103, 46,102,105,110,100, 40,114,101, + 103,116,121,112,101, 44, 32, 99,104,105,108,100,116,121,112, + 101, 44, 32, 45,115,116,114,105,110,103, 46,108,101,110, 40, + 99,104,105,108,100,116,121,112,101, 41, 44, 32,116,114,117, + 101, 41, 10, 9,105,102, 32, 98, 32,116,104,101,110, 10, 10, + 9, 9,105,102, 32,101, 32, 61, 61, 32,115,116,114,105,110, + 103, 46,108,101,110, 40,114,101,103,116,121,112,101, 41, 32, + 97,110,100, 10, 9, 9, 9, 9, 40, 98, 32, 61, 61, 32, 49, + 32,111,114, 32, 40,115,116,114,105,110,103, 46,115,117, 98, + 40,114,101,103,116,121,112,101, 44, 32, 98, 45, 49, 44, 32, + 98, 45, 49, 41, 32, 61, 61, 32, 39, 58, 39, 32, 97,110,100, + 10, 9, 9, 9, 9,115,116,114,105,110,103, 46,115,117, 98, + 40,114,101,103,116,121,112,101, 44, 32, 49, 44, 32, 98, 45, + 49, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46,115,117, + 98, 40,115,116, 44, 32, 49, 44, 32, 98, 45, 49, 41, 41, 41, + 32,116,104,101,110, 10, 9, 9, 9,114,101,116,117,114,110, + 32,116,114,117,101, 10, 9, 9,101,110,100, 10, 9,101,110, + 100, 10, 10, 9,114,101,116,117,114,110, 32,102, 97,108,115, + 101, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, + 32,102,105,110,100,116,121,112,101, 95,111,110, 95, 99,104, + 105,108,100,115, 40,115,101,108,102, 44, 32,116, 41, 10, 10, + 9,108,111, 99, 97,108, 32,116, 99,104,105,108,100, 10, 9, + 105,102, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121, + 112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111, + 114, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121,112, + 101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101, + 39, 32,116,104,101,110, 10, 9, 9,102,111,114, 32,107, 44, + 118, 32,105,110, 32,105,112, 97,105,114,115, 40,115,101,108, + 102, 41, 32,100,111, 10, 9, 9, 9,105,102, 32,118, 46, 99, + 108, 97,115,115,116,121,112,101, 32, 61, 61, 32, 39, 99,108, + 97,115,115, 39, 32,111,114, 32,118, 46, 99,108, 97,115,115, + 116,121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, + 97, 99,101, 39, 32,116,104,101,110, 10, 9, 9, 9, 9,105, + 102, 32,118, 46,116,121,112,101,100,101,102,115, 32, 97,110, + 100, 32,118, 46,116,121,112,101,100,101,102,115, 91,116, 93, + 32,116,104,101,110, 10, 9, 9, 9, 9, 32,114,101,116,117, + 114,110, 32,118, 46,116,121,112,101,100,101,102,115, 91,116, + 93, 10, 9, 9, 9, 9,101,108,115,101,105,102, 32,118, 46, + 117,115,101,114,116,121,112,101,115, 32, 97,110,100, 32,118, + 46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116, + 104,101,110, 10, 9, 9, 9, 9, 32,114,101,116,117,114,110, + 32,118, 46,117,115,101,114,116,121,112,101,115, 91,116, 93, + 10, 9, 9, 9, 9,101,110,100, 10, 9, 9, 9, 9,116, 99, + 104,105,108,100, 32, 61, 32,102,105,110,100,116,121,112,101, + 95,111,110, 95, 99,104,105,108,100,115, 40,118, 44, 32,116, + 41, 10, 9, 9, 9, 9,105,102, 32,116, 99,104,105,108,100, + 32,116,104,101,110, 32,114,101,116,117,114,110, 32,116, 99, + 104,105,108,100, 32,101,110,100, 10, 9, 9, 9,101,110,100, + 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 9,114,101, + 116,117,114,110, 32,110,105,108, 10, 10,101,110,100, 10, 10, + 102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 58,105,115,101,110,117,109, + 32, 40,116,121,112,101, 41, 10, 32,105,102, 32,103,108,111, + 98, 97,108, 95,101,110,117,109,115, 91,116,121,112,101, 93, + 32,116,104,101,110, 10, 9,114,101,116,117,114,110, 32,116, + 121,112,101, 10, 32,101,108,115,101, 10, 32, 9,114,101,116, + 117,114,110, 32,102, 97,108,115,101, 10, 32,101,110,100, 10, + 10, 32,108,111, 99, 97,108, 32, 98, 97,115,101,116,121,112, + 101, 32, 61, 32,103,115,117, 98, 40,116,121,112,101, 44, 34, + 94, 46, 42, 58, 58, 34, 44, 34, 34, 41, 10, 32,108,111, 99, + 97,108, 32,101,110,118, 32, 61, 32,115,101,108,102, 10, 32, + 119,104,105,108,101, 32,101,110,118, 32,100,111, 10, 32, 32, + 105,102, 32,101,110,118, 46,101,110,117,109,115, 32,116,104, + 101,110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, + 10, 32, 32, 32,119,104,105,108,101, 32,101,110,118, 46,101, + 110,117,109,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32, + 105,102, 32,101,110,118, 46,101,110,117,109,115, 91,105, 93, + 46,110, 97,109,101, 32, 61, 61, 32, 98, 97,115,101,116,121, + 112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, + 32, 32,114,101,116,117,114,110, 32,116,114,117,101, 10, 32, + 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, + 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32, + 101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118, + 32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32, + 101,110,100, 10, 32,114,101,116,117,114,110, 32,102, 97,108, + 115,101, 10,101,110,100, 10, 10,109,101,116,104,111,100,105, + 115,118,105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115, + 101, 32, 45, 45, 32, 97, 32,103,108,111, 98, 97,108, 10, 10, + 45, 45, 32,112, 97,114,115,101, 32, 99,104,117,110,107, 10, + 102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 58,100,111,112, 97,114,115, + 101, 32, 40,115, 41, 10, 45, 45,112,114,105,110,116, 32, 40, + 34,112, 97,114,115,101, 32, 34, 46, 46,115, 41, 10, 10, 32, + 45, 45, 32,116,114,121, 32,116,104,101, 32,112, 97,114,115, + 101,114, 32,104,111,111,107, 10, 32,100,111, 10, 32, 9,108, + 111, 99, 97,108, 32,115,117, 98, 32, 61, 32,112, 97,114,115, + 101,114, 95,104,111,111,107, 40,115, 41, 10, 32, 9,105,102, + 32,115,117, 98, 32,116,104,101,110, 10, 32, 9, 9,114,101, + 116,117,114,110, 32,115,117, 98, 10, 32, 9,101,110,100, 10, + 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,116, + 104,101, 32,110,117,108,108, 32,115,116, 97,116,101,109,101, + 110,116, 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, + 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, + 42, 59, 34, 41, 10, 32, 9,105,102, 32, 98, 32,116,104,101, + 110, 10, 32, 9, 9,114,101,116,117,114,110, 32,115,116,114, + 115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 9,101,110, + 100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, + 32,101,109,112,116,121, 32,118,101,114, 98, 97,116,105,109, + 32,108,105,110,101, 10, 32,100,111, 10, 32, 9,108,111, 99, + 97,108, 32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, + 94, 37,115, 42, 36, 92,110, 34, 41, 10, 32, 9,105,102, 32, + 98, 32,116,104,101,110, 10, 32, 9, 9,114,101,116,117,114, + 110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, + 10, 32, 9,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, + 45, 32,116,114,121, 32, 76,117, 97, 32, 99,111,100,101, 10, + 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, + 44, 99,111,100,101, 32, 61, 32,115,116,114,102,105,110,100, + 40,115, 44, 34, 94, 37,115, 42, 40, 37, 98, 92, 49, 92, 50, + 41, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, + 10, 32, 32, 32, 67,111,100,101, 40,115,116,114,115,117, 98, + 40, 99,111,100,101, 44, 50, 44, 45, 50, 41, 41, 10, 32, 32, + 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40, + 115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101, + 110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 67, 32, 99, + 111,100,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, + 32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114, + 102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 37, 98, + 92, 51, 92, 52, 41, 34, 41, 10, 32, 32,105,102, 32, 98, 32, + 116,104,101,110, 10, 9, 99,111,100,101, 32, 61, 32, 39,123, + 39, 46, 46,115,116,114,115,117, 98, 40, 99,111,100,101, 44, + 50, 44, 45, 50, 41, 46, 46, 39, 92,110,125, 92,110, 39, 10, + 9, 86,101,114, 98, 97,116,105,109, 40, 99,111,100,101, 44, + 39,114, 39, 41, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32, + 118,101,114, 98, 97,116,105,109, 32, 99,111,100,101, 32,102, + 111,114, 32, 39,114, 39,101,103,105,115,116,101,114, 32,102, + 114, 97,103,109,101,110,116, 10, 9,114,101,116,117,114,110, + 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, + 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, + 32,116,114,121, 32, 67, 32, 99,111,100,101, 32,102,111,114, + 32,112,114,101, 97,109, 98,108,101, 32,115,101, 99,116,105, + 111,110, 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, + 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, + 42, 40, 37, 98, 92, 53, 92, 54, 41, 34, 41, 10, 32, 9,105, + 102, 32, 98, 32,116,104,101,110, 10, 32, 9, 9, 99,111,100, + 101, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40, + 99,111,100,101, 44, 32, 50, 44, 32, 45, 50, 41, 46, 46, 34, + 92,110, 34, 10, 9, 9, 86,101,114, 98, 97,116,105,109, 40, + 99,111,100,101, 44, 32, 39, 39, 41, 10, 9, 9,114,101,116, + 117,114,110, 32,115,116,114,105,110,103, 46,115,117, 98, 40, + 115, 44, 32,101, 43, 49, 41, 10, 32, 9,101,110,100, 10, 32, + 101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,100,101, + 102, 97,117,108,116, 95,112,114,111,112,101,114,116,121, 32, + 100,105,114,101, 99,116,105,118,101, 10, 32,100,111, 10, 32, + 9,108,111, 99, 97,108, 32, 98, 44,101, 44,112,116,121,112, + 101, 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32, + 34, 94, 37,115, 42, 84, 79, 76, 85, 65, 95, 80, 82, 79, 80, + 69, 82, 84, 89, 95, 84, 89, 80, 69, 37,115, 42, 37, 40, 43, + 37,115, 42, 40, 91, 94, 37, 41, 37,115, 93, 42, 41, 37,115, + 42, 37, 41, 43, 37,115, 42, 59, 63, 34, 41, 10, 32, 9,105, + 102, 32, 98, 32,116,104,101,110, 10, 32, 9, 9,105,102, 32, + 110,111,116, 32,112,116,121,112,101, 32,111,114, 32,112,116, + 121,112,101, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 10, + 32, 9, 9, 9,112,116,121,112,101, 32, 61, 32, 34,100,101, + 102, 97,117,108,116, 34, 10, 32, 9, 9,101,110,100, 10, 32, + 9, 9,115,101,108,102, 58,115,101,116, 95,112,114,111,112, + 101,114,116,121, 95,116,121,112,101, 40,112,116,121,112,101, + 41, 10, 9, 32, 9,114,101,116,117,114,110, 32,115,116,114, + 115,117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32, 9,101, + 110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114, + 121, 32,112,114,111,116,101, 99,116,101,100, 95,100,101,115, + 116,114,117, 99,116,111,114, 32,100,105,114,101, 99,116,105, + 118,101, 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, + 98, 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105, + 110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 84, 79, 76, 85, + 65, 95, 80, 82, 79, 84, 69, 67, 84, 69, 68, 95, 68, 69, 83, + 84, 82, 85, 67, 84, 79, 82, 37,115, 42, 59, 63, 34, 41, 10, + 9,105,102, 32, 98, 32,116,104,101,110, 10, 9, 9,105,102, + 32,115,101,108,102, 46,115,101,116, 95,112,114,111,116,101, + 99,116,101,100, 95,100,101,115,116,114,117, 99,116,111,114, + 32,116,104,101,110, 10, 9, 32, 9, 9,115,101,108,102, 58, + 115,101,116, 95,112,114,111,116,101, 99,116,101,100, 95,100, + 101,115,116,114,117, 99,116,111,114, 40,116,114,117,101, 41, + 10, 9, 32, 9,101,110,100, 10, 32, 9, 9,114,101,116,117, + 114,110, 32,115,116,114,115,117, 98, 40,115, 44, 32,101, 43, + 49, 41, 10, 32, 9,101,110,100, 10, 32,101,110,100, 10, 10, + 32, 45, 45, 32,116,114,121, 32, 39,101,120,116,101,114,110, + 39, 32,107,101,121,119,111,114,100, 10, 32,100,111, 10, 32, + 9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, + 37,115, 42,101,120,116,101,114,110, 37,115, 43, 34, 41, 10, + 32, 9,105,102, 32, 98, 32,116,104,101,110, 10, 9, 9, 45, + 45, 32,100,111, 32,110,111,116,104,105,110,103, 10, 32, 9, + 9,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40, + 115, 44, 32,101, 43, 49, 41, 10, 32, 9,101,110,100, 10, 32, + 101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 39,118, + 105,114,116,117, 97,108, 39, 32,107,101,121,119,111,114,107, + 100, 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, 98, + 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110, + 100, 40,115, 44, 32, 34, 94, 37,115, 42,118,105,114,116,117, + 97,108, 37,115, 43, 34, 41, 10, 32, 9,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 9, 9,109,101,116,104,111,100,105, + 115,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,101, + 10, 32, 9, 9,114,101,116,117,114,110, 32,115,116,114,115, + 117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32, 9,101,110, + 100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, + 32,108, 97, 98,101,108,115, 32, 40,112,117, 98,108,105, 99, + 44, 32,112,114,105,118, 97,116,101, 44, 32,101,116, 99, 41, + 10, 32,100,111, 10, 32, 9,108,111, 99, 97,108, 32, 98, 44, + 101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, + 40,115, 44, 32, 34, 94, 37,115, 42, 37,119, 42, 37,115, 42, + 58, 91, 94, 58, 93, 34, 41, 10, 32, 9,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 9, 9,114,101,116,117,114,110, 32, + 115,116,114,115,117, 98, 40,115, 44, 32,101, 41, 32, 45, 45, + 32,112,114,101,115,101,114,118,101, 32,116,104,101, 32, 91, + 94, 58, 93, 10, 32, 9,101,110,100, 10, 32,101,110,100, 10, + 10, 32, 45, 45, 32,116,114,121, 32,109,111,100,117,108,101, + 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44, + 101, 44,110, 97,109,101, 44, 98,111,100,121, 32, 61, 32,115, + 116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,109, + 111,100,117,108,101, 37,115, 37,115, 42, 40, 91, 95, 37,119, + 93, 91, 95, 37,119, 93, 42, 41, 37,115, 42, 40, 37, 98,123, + 125, 41, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99, + 111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, + 98, 44,101, 41, 10, 32, 32, 32, 77,111,100,117,108,101, 40, + 110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114, + 101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115, 44, + 101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, + 10, 10, 32, 45, 45, 32,116,114,121, 32,110, 97,109,101,115, + 97,112, 99,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97, + 108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,121, + 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, + 37,115, 42,110, 97,109,101,115,112, 97, 99,101, 37,115, 37, + 115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 93, 42, 41, + 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 59, 63, 34, + 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, + 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32, + 115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, + 32, 32, 78, 97,109,101,115,112, 97, 99,101, 40,110, 97,109, + 101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114,101,116,117, + 114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, + 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, + 45, 45, 32,116,114,121, 32,100,101,102,105,110,101, 10, 32, + 100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44, + 110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100, 40, + 115, 44, 34, 94, 37,115, 42, 35,100,101,102,105,110,101, 37, + 115, 37,115, 42, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92, + 110, 93, 42, 92,110, 37,115, 42, 34, 41, 10, 32, 32,105,102, + 32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114, + 114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, + 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 68,101,102,105, + 110,101, 40,110, 97,109,101, 41, 10, 32, 32, 32,114,101,116, + 117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, + 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, + 32, 45, 45, 32,116,114,121, 32,101,110,117,109,101,114, 97, + 116,101,115, 10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97, + 108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,121, + 44,118, 97,114,110, 97,109,101, 32, 61, 32,115,116,114,102, + 105,110,100, 40,115, 44, 34, 94, 37,115, 42,101,110,117,109, + 37,115, 43, 40, 37, 83, 42, 41, 37,115, 42, 40, 37, 98,123, + 125, 41, 37,115, 42, 40, 91, 94, 37,115, 59, 93, 42, 41, 37, + 115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, + 98, 32,116,104,101,110, 10, 32, 32, 32, 45, 45,101,114,114, + 111,114, 40, 34, 35, 83,111,114,114,121, 44, 32,100,101, 99, + 108, 97,114, 97,116,105,111,110, 32,111,102, 32,101,110,117, + 109,115, 32, 97,110,100, 32,118, 97,114,105, 97, 98,108,101, + 115, 32,111,110, 32,116,104,101, 32,115, 97,109,101, 32,115, + 116, 97,116,101,109,101,110,116, 32,105,115, 32,110,111,116, + 32,115,117,112,112,111,114,116,101,100, 46, 92,110, 68,101, + 99,108, 97,114,101, 32,121,111,117,114, 32,118, 97,114,105, + 97, 98,108,101, 32,115,101,112, 97,114, 97,116,101,108,121, + 32, 40,101,120, 97,109,112,108,101, 58, 32, 39, 34, 46, 46, + 110, 97,109,101, 46, 46, 34, 32, 34, 46, 46,118, 97,114,110, + 97,109,101, 46, 46, 34, 59, 39, 41, 34, 41, 10, 32, 32, 32, + 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116, + 114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, + 69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101, 44, + 98,111,100,121, 44,118, 97,114,110, 97,109,101, 41, 10, 32, + 32, 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, + 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 10, 45, 45, 32,100,111, 10, 45, 45, 32, 32, + 108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101, 44, + 98,111,100,121, 32, 61, 32,115,116,114,102,105,110,100, 40, + 115, 44, 34, 94, 37,115, 42,101,110,117,109, 37,115, 43, 40, + 37, 83, 42, 41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115, + 42, 59, 63, 37,115, 42, 34, 41, 10, 45, 45, 32, 32,105,102, + 32, 98, 32,116,104,101,110, 10, 45, 45, 32, 32, 32, 95, 99, + 117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115, + 117, 98, 40,115, 44, 98, 44,101, 41, 10, 45, 45, 32, 32, 32, + 69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101, 44, + 98,111,100,121, 41, 10, 45, 45, 32, 32,114,101,116,117,114, + 110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, + 10, 45, 45, 32, 32,101,110,100, 10, 45, 45, 32,101,110,100, + 10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, + 44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, + 116,121,112,101,100,101,102, 37,115, 43,101,110,117,109, 91, + 94,123, 93, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40, 91, + 37,119, 95, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42, 59, + 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104, + 101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100, + 101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44, + 101, 41, 10, 32, 32, 32, 69,110,117,109,101,114, 97,116,101, + 40,110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32, + 114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115, + 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110, + 100, 10, 10, 32, 45, 45, 32,116,114,121, 32,111,112,101,114, + 97,116,111,114, 10, 32,100,111, 10, 32, 32,108,111, 99, 97, + 108, 32, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,100, + 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, + 95, 37,119, 93, 91, 95, 37,119, 37,115, 37, 42, 38, 58, 60, + 62, 44, 93, 45, 37,115, 43,111,112,101,114, 97,116,111,114, + 41, 37,115, 42, 40, 91, 94, 37,115, 93, 91, 94, 37,115, 93, + 42, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, + 99, 63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59, + 37,115, 42, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32, + 98, 32,116,104,101,110, 10, 9, 9, 32, 45, 45, 32,116,114, + 121, 32,105,110,108,105,110,101, 10, 32, 32, 32, 98, 44,101, + 44,100,101, 99,108, 44,107,105,110,100, 44, 97,114,103, 44, + 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110,100, + 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91, + 95, 37,119, 37,115, 37, 42, 38, 58, 60, 62, 44, 93, 45, 37, + 115, 43,111,112,101,114, 97,116,111,114, 41, 37,115, 42, 40, + 91, 94, 37,115, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42, + 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110, + 63,115, 63,116, 63, 41, 91, 37,115, 92,110, 93, 42, 37, 98, + 123,125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32, + 101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32, + 116,104,101,110, 10, 32, 32, 9, 45, 45, 32,116,114,121, 32, + 99, 97,115,116, 32,111,112,101,114, 97,116,111,114, 10, 32, + 32, 9, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,100, + 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 40, + 111,112,101,114, 97,116,111,114, 41, 37,115, 43, 40, 91, 37, + 119, 95, 58, 37,100, 60, 62, 37, 42, 37, 38, 37,115, 93, 43, + 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, + 63,111, 63,110, 63,115, 63,116, 63, 41, 34, 41, 59, 10, 32, + 32, 9,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32, 9, + 9,108,111, 99, 97,108, 32, 95, 44,105,101, 32, 61, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, + 94, 37,115, 42, 37, 98,123,125, 34, 44, 32,101, 43, 49, 41, + 10, 32, 32, 9, 9,105,102, 32,105,101, 32,116,104,101,110, + 10, 32, 32, 9, 9, 9,101, 32, 61, 32,105,101, 10, 32, 32, + 9, 9,101,110,100, 10, 32, 32, 9,101,110,100, 10, 32, 32, + 101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, + 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, + 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, + 10, 32, 32, 32, 79,112,101,114, 97,116,111,114, 40,100,101, + 99,108, 44,107,105,110,100, 44, 97,114,103, 44, 99,111,110, + 115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115, + 116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116, + 114,121, 32,102,117,110, 99,116,105,111,110, 10, 32,100,111, + 10, 32, 32, 45, 45,108,111, 99, 97,108, 32, 98, 44,101, 44, + 100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32, + 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37, + 115, 42, 40, 91,126, 95, 37,119, 93, 91, 95, 64, 37,119, 37, + 115, 37, 42, 38, 58, 60, 62, 93, 42, 91, 95, 37,119, 93, 41, + 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63, + 111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37, + 115, 42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, + 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, + 44, 97,114,103, 44, 99,111,110,115,116, 44,118,105,114,116, + 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, + 37,115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,115, + 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63, + 110, 63,115, 63,116, 63, 41, 37,115, 42, 40, 61, 63, 37,115, + 42, 48, 63, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, + 32,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10, + 32, 32, 9, 45, 45, 32,116,114,121, 32,102,117,110, 99,116, + 105,111,110, 32,119,105,116,104, 32,116,101,109,112,108, 97, + 116,101, 10, 32, 32, 9, 98, 44,101, 44,100,101, 99,108, 44, + 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,114, + 102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,126, + 95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38, 58, + 60, 62, 93, 42, 91, 95, 37,119, 93, 37, 98, 60, 62, 41, 37, + 115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, + 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37,115, + 42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32, + 101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32, + 116,104,101,110, 10, 32, 32, 32, 45, 45, 32,116,114,121, 32, + 97, 32,115,105,110,103,108,101, 32,108,101,116,116,101,114, + 32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 10, + 32, 32, 32, 98, 44,101, 44,100,101, 99,108, 44, 97,114,103, + 44, 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110, + 100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, + 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, + 63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59, 37, + 115, 42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102, + 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, + 45, 45, 32,116,114,121, 32,102,117,110, 99,116,105,111,110, + 32,112,111,105,110,116,101,114, 10, 32, 32, 32, 98, 44,101, + 44,100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, + 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, + 37,115, 42, 40, 91, 94, 37, 40, 59, 92,110, 93, 43, 37, 98, + 40, 41, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, + 59, 37,115, 42, 34, 41, 10, 32, 32, 32,105,102, 32, 98, 32, + 116,104,101,110, 10, 32, 32, 32, 32,100,101, 99,108, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,100,101, + 99,108, 44, 32, 34, 37, 40, 37,115, 42, 37, 42, 40, 91, 94, + 37, 41, 93, 42, 41, 37,115, 42, 37, 41, 34, 44, 32, 34, 32, + 37, 49, 32, 34, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32, + 101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, + 10, 32, 32, 9,105,102, 32,118,105,114,116, 32, 97,110,100, + 32,115,116,114,105,110,103, 46,102,105,110,100, 40,118,105, + 114,116, 44, 32, 34, 91, 61, 48, 93, 34, 41, 32,116,104,101, + 110, 10, 32, 32, 9, 9,105,102, 32,115,101,108,102, 46,102, + 108, 97,103,115, 32,116,104,101,110, 10, 32, 32, 9, 9, 9, + 115,101,108,102, 46,102,108, 97,103,115, 46,112,117,114,101, + 95,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,101, + 10, 32, 32, 9, 9,101,110,100, 10, 32, 32, 9,101,110,100, + 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, + 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, + 10, 32, 32, 32, 70,117,110, 99,116,105,111,110, 40,100,101, + 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 41, 10, 32, + 32, 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, + 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,105,110, + 108,105,110,101, 32,102,117,110, 99,116,105,111,110, 10, 32, + 100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44, + 100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32, + 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37, + 115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,115, 42, + 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110, + 63,115, 63,116, 63, 41, 91, 94, 59,123, 93, 42, 37, 98,123, + 125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32, 45, + 45,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, + 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, + 126, 95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38, + 58, 60, 62, 93, 42, 91, 95, 37,119, 62, 93, 41, 37,115, 42, + 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110, + 63,115, 63,116, 63, 41, 91, 94, 59, 93, 42, 37, 98,123,125, + 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102, + 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, + 45, 45, 32,116,114,121, 32, 97, 32,115,105,110,103,108,101, + 32,108,101,116,116,101,114, 32,102,117,110, 99,116,105,111, + 110, 32,110, 97,109,101, 10, 32, 32, 32, 98, 44,101, 44,100, + 101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, + 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, + 42, 40, 91, 95, 37,119, 93, 41, 37,115, 42, 40, 37, 98, 40, + 41, 41, 37,115, 42, 40, 99, 63,111, 63,110, 63,115, 63,116, + 63, 41, 46, 45, 37, 98,123,125, 37,115, 42, 59, 63, 37,115, + 42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102, 32, + 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, + 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40, + 115, 44, 98, 44,101, 41, 10, 32, 32, 32, 70,117,110, 99,116, + 105,111,110, 40,100,101, 99,108, 44, 97,114,103, 44, 99,111, + 110,115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32, + 115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, + 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, + 116,114,121, 32, 99,108, 97,115,115, 10, 32,100,111, 10, 9, + 32,108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101, + 44, 98, 97,115,101, 44, 98,111,100,121, 10, 9, 9, 98, 97, + 115,101, 32, 61, 32, 39, 39, 32, 98,111,100,121, 32, 61, 32, + 39, 39, 10, 9, 9, 98, 44,101, 44,110, 97,109,101, 32, 61, + 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, + 42, 99,108, 97,115,115, 37,115, 42, 40, 91, 95, 37,119, 93, + 91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 59, 34, 41, 32, + 32, 45, 45, 32,100,117,109,109,121, 32, 99,108, 97,115,115, + 10, 9, 9,108,111, 99, 97,108, 32,100,117,109,109,121, 32, + 61, 32,102, 97,108,115,101, 10, 9, 9,105,102, 32,110,111, + 116, 32, 98, 32,116,104,101,110, 10, 9, 9, 9, 98, 44,101, + 44,110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100, + 40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99,116, 37, + 115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42, + 41, 37,115, 42, 59, 34, 41, 32, 32, 32, 32, 45, 45, 32,100, + 117,109,109,121, 32,115,116,114,117, 99,116, 10, 9, 9, 9, + 105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 9, + 9, 9, 9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97,115, + 101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105,110, + 100, 40,115, 44, 34, 94, 37,115, 42, 99,108, 97,115,115, 37, + 115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42, + 41, 37,115, 42, 40, 91, 94,123, 93, 45, 41, 37,115, 42, 40, + 37, 98,123,125, 41, 37,115, 42, 34, 41, 10, 9, 9, 9, 9, + 105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10, 9, + 9, 9, 9, 9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97, + 115,101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105, + 110,100, 40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99, + 116, 37,115, 43, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, + 93, 42, 41, 37,115, 42, 40, 91, 94,123, 93, 45, 41, 37,115, + 42, 40, 37, 98,123,125, 41, 37,115, 42, 34, 41, 10, 9, 9, + 9, 9, 9,105,102, 32,110,111,116, 32, 98, 32,116,104,101, + 110, 10, 9, 9, 9, 9, 9, 9, 98, 44,101, 44,110, 97,109, + 101, 44, 98, 97,115,101, 44, 98,111,100,121, 32, 61, 32,115, + 116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,117, + 110,105,111,110, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, + 37,119, 64, 93, 42, 41, 37,115, 42, 40, 91, 94,123, 93, 45, + 41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 34, 41, + 10, 9, 9, 9, 9, 9, 9,105,102, 32,110,111,116, 32, 98, + 32,116,104,101,110, 10, 9, 9, 9, 9, 9, 9, 9, 98, 97, + 115,101, 32, 61, 32, 39, 39, 10, 9, 9, 9, 9, 9, 9, 9, + 98, 44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61, + 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, + 42,116,121,112,101,100,101,102, 37,115, 37,115, 42,115,116, + 114,117, 99,116, 37,115, 37,115, 42, 91, 95, 37,119, 93, 42, + 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40, 91, 95, + 37,119, 93, 91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 59, + 34, 41, 10, 9, 9, 9, 9, 9, 9,101,110,100, 10, 9, 9, + 9, 9, 9,101,110,100, 10, 9, 9, 9, 9,101,110,100, 10, + 9, 9, 9,101,108,115,101, 32,100,117,109,109,121, 32, 61, + 32, 49, 32,101,110,100, 10, 9, 9,101,108,115,101, 32,100, + 117,109,109,121, 32, 61, 32, 49, 32,101,110,100, 10, 9, 9, + 105,102, 32, 98, 32,116,104,101,110, 10, 9, 9, 9,105,102, + 32, 98, 97,115,101, 32,126, 61, 32, 39, 39, 32,116,104,101, + 110, 10, 9, 9, 9, 9, 98, 97,115,101, 32, 61, 32,115,116, + 114,105,110,103, 46,103,115,117, 98, 40, 98, 97,115,101, 44, + 32, 34, 94, 37,115, 42, 58, 37,115, 42, 34, 44, 32, 34, 34, + 41, 10, 9, 9, 9, 9, 98, 97,115,101, 32, 61, 32,115,116, + 114,105,110,103, 46,103,115,117, 98, 40, 98, 97,115,101, 44, + 32, 34, 37,115, 42,112,117, 98,108,105, 99, 37,115, 42, 34, + 44, 32, 34, 34, 41, 10, 9, 9, 9, 9, 98, 97,115,101, 32, + 61, 32,115,112,108,105,116, 40, 98, 97,115,101, 44, 32, 34, + 44, 34, 41, 10, 9, 9, 9, 9, 45, 45,108,111, 99, 97,108, + 32, 98, 44,101, 10, 9, 9, 9, 9, 45, 45, 98, 44,101, 44, + 98, 97,115,101, 32, 61, 32,115,116,114,102,105,110,100, 40, + 98, 97,115,101, 44, 34, 46, 45, 40, 91, 95, 37,119, 93, 91, + 95, 37,119, 60, 62, 44, 58, 93, 42, 41, 36, 34, 41, 10, 9, + 9, 9,101,108,115,101, 10, 9, 9, 9, 9, 98, 97,115,101, + 32, 61, 32,123,125, 10, 9, 9, 9,101,110,100, 10, 9, 9, + 9, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115, + 116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 9, 9, + 9, 67,108, 97,115,115, 40,110, 97,109,101, 44, 98, 97,115, + 101, 44, 98,111,100,121, 41, 10, 9, 9, 9,105,102, 32,110, + 111,116, 32,100,117,109,109,121, 32,116,104,101,110, 10, 9, + 9, 9, 9,118, 97,114, 98, 44,118, 97,114,101, 44,118, 97, + 114,110, 97,109,101, 32, 61, 32,115,116,114,105,110,103, 46, + 102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 40, 91, + 95, 37,119, 93, 43, 41, 37,115, 42, 59, 34, 44, 32,101, 43, + 49, 41, 10, 9, 9, 9, 9,105,102, 32,118, 97,114, 98, 32, + 116,104,101,110, 10, 9, 9, 9, 9, 9, 86, 97,114,105, 97, + 98,108,101, 40,110, 97,109,101, 46, 46, 34, 32, 34, 46, 46, + 118, 97,114,110, 97,109,101, 41, 10, 9, 9, 9, 9, 9,101, + 32, 61, 32,118, 97,114,101, 10, 9, 9, 9, 9,101,110,100, + 10, 9, 9, 9,101,110,100, 10, 9, 9, 9,114,101,116,117, + 114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, + 41, 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 10, 32, + 45, 45, 32,116,114,121, 32,116,121,112,101,100,101,102, 10, + 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, + 44,116,121,112,101,115, 32, 61, 32,115,116,114,102,105,110, + 100, 40,115, 44, 34, 94, 37,115, 42,116,121,112,101,100,101, + 102, 37,115, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 59, 37, + 115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101, + 110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, + 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, + 41, 10, 32, 32, 32, 84,121,112,101,100,101,102, 40,116,121, + 112,101,115, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32, + 115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, + 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, + 116,114,121, 32,118, 97,114,105, 97, 98,108,101, 10, 32,100, + 111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100, + 101, 99,108, 32, 61, 32,115,116,114,102,105,110,100, 40,115, + 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, 64, + 37,115, 37,119, 37,100, 37, 42, 38, 58, 60, 62, 44, 93, 42, + 91, 95, 37,119, 37,100, 93, 41, 37,115, 42, 59, 37,115, 42, + 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, + 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, + 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, + 10, 9,108,111, 99, 97,108, 32,108,105,115,116, 32, 61, 32, + 115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40, + 100,101, 99,108, 44, 32, 34, 44, 34, 41, 10, 9, 86, 97,114, + 105, 97, 98,108,101, 40,108,105,115,116, 91, 49, 93, 41, 10, + 9,105,102, 32,108,105,115,116, 46,110, 32, 62, 32, 49, 32, + 116,104,101,110, 10, 9, 9,108,111, 99, 97,108, 32, 95, 44, + 95, 44,116,121,112,101, 32, 61, 32,115,116,114,102,105,110, + 100, 40,108,105,115,116, 91, 49, 93, 44, 32, 34, 40, 46, 45, + 41, 37,115, 43, 40, 91, 94, 37,115, 93, 42, 41, 36, 34, 41, + 59, 10, 10, 9, 9,108,111, 99, 97,108, 32,105, 32, 61, 50, + 59, 10, 9, 9,119,104,105,108,101, 32,108,105,115,116, 91, + 105, 93, 32,100,111, 10, 9, 9, 9, 86, 97,114,105, 97, 98, + 108,101, 40,116,121,112,101, 46, 46, 34, 32, 34, 46, 46,108, + 105,115,116, 91,105, 93, 41, 10, 9, 9, 9,105, 61,105, 43, + 49, 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 32, 32, + 32, 45, 45, 86, 97,114,105, 97, 98,108,101, 40,100,101, 99, + 108, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,116, + 114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101, + 110,100, 10, 32,101,110,100, 10, 10, 9, 45, 45, 32,116,114, + 121, 32,115,116,114,105,110,103, 10, 32,100,111, 10, 32, 32, + 108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 32, + 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37, + 115, 42, 40, 91, 95, 37,119, 93, 63, 91, 95, 37,115, 37,119, + 37,100, 93, 45, 99,104, 97,114, 37,115, 43, 91, 95, 64, 37, + 119, 37,100, 93, 42, 37,115, 42, 37, 91, 37,115, 42, 37, 83, + 43, 37,115, 42, 37, 93, 41, 37,115, 42, 59, 37,115, 42, 34, + 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, + 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32, + 115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, + 32, 32, 86, 97,114,105, 97, 98,108,101, 40,100,101, 99,108, + 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,116,114, + 115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110, + 100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, + 32, 97,114,114, 97,121, 10, 32,100,111, 10, 32, 32,108,111, + 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, + 40, 91, 95, 37,119, 93, 91, 93, 91, 95, 64, 37,115, 37,119, + 37,100, 37, 42, 38, 58, 93, 42, 91, 93, 95, 37,119, 37,100, + 93, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32,105, + 102, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117, + 114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, + 98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 65,114,114, + 97,121, 40,100,101, 99,108, 41, 10, 32, 32, 32,114,101,116, + 117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, + 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, + 32, 45, 45, 32,110,111, 32,109, 97,116, 99,104,105,110,103, + 10, 32,105,102, 32,103,115,117, 98, 40,115, 44, 34, 37,115, + 37,115, 42, 34, 44, 34, 34, 41, 32,126, 61, 32, 34, 34, 32, + 116,104,101,110, 10, 32, 32, 95, 99,117,114,114, 95, 99,111, + 100,101, 32, 61, 32,115, 10, 32, 32,101,114,114,111,114, 40, + 34, 35,112, 97,114,115,101, 32,101,114,114,111,114, 34, 41, + 10, 32,101,108,115,101, 10, 32, 32,114,101,116,117,114,110, + 32, 34, 34, 10, 32,101,110,100, 10, 10,101,110,100, 10, 10, + 102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 58,112, 97,114,115,101, 32, + 40,115, 41, 10, 10, 9, 45, 45,115,101,108,102, 46, 99,117, + 114,114, 95,109,101,109, 98,101,114, 95, 97, 99, 99,101,115, + 115, 32, 61, 32,110,105,108, 10, 10, 32,119,104,105,108,101, + 32,115, 32,126, 61, 32, 39, 39, 32,100,111, 10, 32, 32,115, + 32, 61, 32,115,101,108,102, 58,100,111,112, 97,114,115,101, + 40,115, 41, 10, 32, 32,109,101,116,104,111,100,105,115,118, + 105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115,101, 10, + 32,101,110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32,112, + 114,111,112,101,114,116,121, 32,116,121,112,101,115, 10, 10, + 102,117,110, 99,116,105,111,110, 32,103,101,116, 95,112,114, + 111,112,101,114,116,121, 95,116,121,112,101, 40, 41, 10, 10, + 9,114,101,116,117,114,110, 32, 99,108, 97,115,115, 67,111, + 110,116, 97,105,110,101,114, 46, 99,117,114,114, 58,103,101, + 116, 95,112,114,111,112,101,114,116,121, 95,116,121,112,101, + 40, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 58,115,101,116, 95,112,114,111,112,101,114,116,121, 95, + 116,121,112,101, 40,112,116,121,112,101, 41, 10, 9,112,116, + 121,112,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 40,112,116,121,112,101, 44, 32, 34, 94, 37,115, 42, + 34, 44, 32, 34, 34, 41, 10, 9,112,116,121,112,101, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,112,116, + 121,112,101, 44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, + 41, 10, 10, 9,115,101,108,102, 46,112,114,111,112,101,114, + 116,121, 95,116,121,112,101, 32, 61, 32,112,116,121,112,101, + 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58, + 103,101,116, 95,112,114,111,112,101,114,116,121, 95,116,121, + 112,101, 40, 41, 10, 9,114,101,116,117,114,110, 32,115,101, + 108,102, 46,112,114,111,112,101,114,116,121, 95,116,121,112, + 101, 32,111,114, 32, 40,115,101,108,102, 46,112, 97,114,101, + 110,116, 32, 97,110,100, 32,115,101,108,102, 46,112, 97,114, + 101,110,116, 58,103,101,116, 95,112,114,111,112,101,114,116, + 121, 95,116,121,112,101, 40, 41, 41, 32,111,114, 32, 34,100, + 101,102, 97,117,108,116, 34, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/container.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,112, 97, 99,107, 97, + 103,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105, + 116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97, + 114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71, + 114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, + 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, + 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111, + 100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116, + 119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114, + 101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, + 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105, + 116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, + 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101, + 114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97, + 110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, + 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117, + 116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108, + 105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118, + 105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, + 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97, + 116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101, + 109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102, + 105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, + 32, 80, 97, 99,107, 97,103,101, 32, 99,108, 97,115,115, 10, + 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,116, + 104,101, 32,119,104,111,108,101, 32,112, 97, 99,107, 97,103, + 101, 32, 98,101,105,110,103, 32, 98,111,117,110,100, 46, 10, + 45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,110, + 103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115,116, + 111,114,101,100, 58, 10, 45, 45, 32, 32, 32, 32,123,105,125, + 32, 61, 32,108,105,115,116, 32,111,102, 32,111, 98,106,101, + 99,116,115, 32,105,110, 32,116,104,101, 32,112, 97, 99,107, + 97,103,101, 46, 10, 99,108, 97,115,115, 80, 97, 99,107, 97, + 103,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121, + 112,101, 32, 61, 32, 39,112, 97, 99,107, 97,103,101, 39, 10, + 125, 10, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 46, + 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115, + 80, 97, 99,107, 97,103,101, 10,115,101,116,109,101,116, 97, + 116, 97, 98,108,101, 40, 99,108, 97,115,115, 80, 97, 99,107, + 97,103,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105, + 110,101,114, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32, + 109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110, + 32, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112, + 114,105,110,116, 32, 40, 41, 10, 32,112,114,105,110,116, 40, + 34, 80, 97, 99,107, 97,103,101, 58, 32, 34, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 41, 10, 32,108,111, 99, 97,108, + 32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108, + 102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91, + 105, 93, 58,112,114,105,110,116, 40, 34, 34, 44, 34, 34, 41, + 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, + 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114, + 101,112,114,111, 99,101,115,115, 32, 40, 41, 10, 10, 32, 45, + 45, 32, 97,118,111,105,100, 32,112,114,101,112,114,111, 99, + 101,115,115,105,110,103, 32,101,109, 98,101,100,100,101,100, + 32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99, 97, + 108, 32, 76, 32, 61, 32,123,125, 10, 32,115,101,108,102, 46, + 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108, + 102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 37, 36, + 37, 91, 34, 44, 34, 92, 49, 34, 41, 32, 45, 45, 32,100,101, + 97,108, 32,119,105,116,104, 32,101,109, 98,101,100,100,101, + 100, 32,108,117, 97, 32, 99,111,100,101, 10, 32,115,101,108, + 102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115, + 101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, + 37, 36, 37, 93, 34, 44, 34, 92, 50, 34, 41, 10, 32,115,101, + 108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98, 92, + 49, 92, 50, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102,117, + 110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,105, + 110,115,101,114,116, 40, 76, 44, 99, 41, 10, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101, + 116,117,114,110, 32, 34, 92,110, 35, 91, 34, 46, 46,103,101, + 116,110, 40, 76, 41, 46, 46, 34, 93, 35, 34, 10, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110, + 100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114, + 101,112,114,111, 99,101,115,115,105,110,103, 32,101,109, 98, + 101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,108, + 111, 99, 97,108, 32, 67, 32, 61, 32,123,125, 10, 32,115,101, + 108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, + 42, 37, 36, 37, 60, 34, 44, 34, 92, 51, 34, 41, 32, 45, 45, + 32,100,101, 97,108, 32,119,105,116,104, 32,101,109, 98,101, + 100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,115,101, + 108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, + 42, 37, 36, 37, 62, 34, 44, 34, 92, 52, 34, 41, 10, 32,115, + 101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, + 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98, + 92, 51, 92, 52, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102, + 117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116, + 105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114, + 101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46, 46,103, + 101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101, + 110,100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112, + 114,101,112,114,111, 99,101,115,115,105,110,103, 32,101,109, + 98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32, + 115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, + 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, + 37,115, 42, 37, 36, 37,123, 34, 44, 34, 92, 53, 34, 41, 32, + 45, 45, 32,100,101, 97,108, 32,119,105,116,104, 32,101,109, + 98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32, + 115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, + 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, + 37,115, 42, 37, 36, 37,125, 34, 44, 34, 92, 54, 34, 41, 10, + 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115, + 117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, + 37, 98, 92, 53, 92, 54, 41, 34, 44, 32, 32, 32, 32, 32, 32, + 32,102,117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,116,105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,114,101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46, + 46,103,101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,101,110,100, 41, 10, 10, 32, 45, 45,115,101,108,102, 46, + 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108, + 102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 35, 91, + 94,100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34, + 92,110, 92,110, 34, 41, 32, 45, 45, 32,101,108,105,109,105, + 110, 97,116,101, 32,112,114,101,112,114,111, 99,101,115,115, + 111,114, 32,100,105,114,101, 99,116,105,118,101,115, 32,116, + 104, 97,116, 32,100,111,110, 39,116, 32,115,116, 97,114,116, + 32,119,105,116,104, 32, 39,100, 39, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 92,110, 91, 32, 92,116, + 93, 42, 35, 91, 32, 92,116, 93, 42, 91, 94,100, 37, 60, 37, + 91, 93, 34, 44, 32, 34, 92,110, 47, 47, 34, 41, 32, 45, 45, + 32,101,108,105,109,105,110, 97,116,101, 32,112,114,101,112, + 114,111, 99,101,115,115,111,114, 32,100,105,114,101, 99,116, + 105,118,101,115, 32,116,104, 97,116, 32,100,111,110, 39,116, + 32,115,116, 97,114,116, 32,119,105,116,104, 32, 39,100, 39, + 10, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114,101, + 112,114,111, 99,101,115,115,105,110,103, 32,118,101,114, 98, + 97,116,105,109, 32,108,105,110,101,115, 10, 32,108,111, 99, + 97,108, 32, 86, 32, 61, 32,123,125, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 92,110, 40, 37,115, 42, + 37, 36, 91, 94, 37, 91, 37, 93, 93, 91, 94, 92,110, 93, 42, + 41, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,118, 41, + 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32,116,105,110,115,101,114,116, 40, 86, 44,118, 41, + 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32,114,101,116,117,114,110, 32, 34, 92,110, 35, 34, + 46, 46,103,101,116,110, 40, 86, 41, 46, 46, 34, 35, 34, 10, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,101,110,100, 41, 10, 10, 32, 45, 45, 32,112,101,114,102, + 111,114,109, 32,103,108,111, 98, 97,108, 32,115,117, 98,115, + 116,105,116,117,116,105,111,110, 10, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 40, 47, 47, 91, 94, 92, + 110, 93, 42, 41, 34, 44, 34, 34, 41, 32, 32, 32, 32, 32, 45, + 45, 32,101,108,105,109,105,110, 97,116,101, 32, 67, 43, 43, + 32, 99,111,109,109,101,110,116,115, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 47, 37, 42, 34, 44, 34, + 92, 49, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100,101, + 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111, + 100,101, 44, 34, 37, 42, 47, 34, 44, 34, 92, 50, 34, 41, 10, + 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115, + 117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37, + 98, 92, 49, 92, 50, 34, 44, 34, 34, 41, 10, 32,115,101,108, + 102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115, + 101,108,102, 46, 99,111,100,101, 44, 34, 92, 49, 34, 44, 34, + 47, 37, 42, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100, + 101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99, + 111,100,101, 44, 34, 92, 50, 34, 44, 34, 37, 42, 47, 34, 41, + 10, 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103, + 115,117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, + 37,115, 42, 64, 37,115, 42, 34, 44, 34, 64, 34, 41, 32, 45, + 45, 32,101,108,105,109,105,110, 97,116,101, 32,115,112, 97, + 99,101,115, 32, 98,101,115,105,100,101, 32, 64, 10, 32,115, + 101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, + 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63, + 105,110,108,105,110,101, 40, 37,115, 41, 34, 44, 34, 37, 49, + 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 39,105,110,108,105,110,101, 39, 32,107,101,121,119,111, + 114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100,101, + 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111, + 100,101, 44, 34, 37,115, 63,101,120,116,101,114,110, 40, 37, + 115, 41, 34, 44, 34, 37, 49, 34, 41, 32, 45, 45, 32,101,108, + 105,109,105,110, 97,116,101, 32, 39,101,120,116,101,114,110, + 39, 32,107,101,121,119,111,114,100, 10, 32, 45, 45,115,101, + 108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40, + 115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63,118, + 105,114,116,117, 97,108, 40, 37,115, 41, 34, 44, 34, 37, 49, + 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 39,118,105,114,116,117, 97,108, 39, 32,107,101,121,119, + 111,114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100, + 101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99, + 111,100,101, 44, 34,112,117, 98,108,105, 99, 58, 34, 44, 34, + 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 39,112,117, 98,108,105, 99, 58, 39, 32,107,101,121,119, + 111,114,100, 10, 32,115,101,108,102, 46, 99,111,100,101, 32, + 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,100, + 101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,118,111,105,100, + 37,115, 42, 37, 42, 34, 44, 34, 37, 49, 95,117,115,101,114, + 100, 97,116, 97, 32, 34, 41, 32, 45, 45, 32,115,117, 98,115, + 116,105,116,117,116,101, 32, 39,118,111,105,100, 42, 39, 10, + 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115, + 117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, + 91, 94, 37,119, 95, 93, 41,118,111,105,100, 37,115, 42, 37, + 42, 34, 44, 34, 37, 49, 95,117,115,101,114,100, 97,116, 97, + 32, 34, 41, 32, 45, 45, 32,115,117, 98,115,116,105,116,117, + 116,101, 32, 39,118,111,105,100, 42, 39, 10, 32,115,101,108, + 102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115, + 101,108,102, 46, 99,111,100,101, 44, 34, 40, 91, 94, 37,119, + 95, 93, 41, 99,104, 97,114, 37,115, 42, 37, 42, 34, 44, 34, + 37, 49, 95, 99,115,116,114,105,110,103, 32, 34, 41, 32, 32, + 45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39, + 99,104, 97,114, 42, 39, 10, 32,115,101,108,102, 46, 99,111, + 100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, + 99,111,100,101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,108, + 117, 97, 95, 83,116, 97,116,101, 37,115, 42, 37, 42, 34, 44, + 34, 37, 49, 95,108,115,116, 97,116,101, 32, 34, 41, 32, 32, + 45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39, + 108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10, 10, 32, 45, + 45, 32,114,101,115,116,111,114,101, 32,101,109, 98,101,100, + 100,101,100, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,115, + 101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, + 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37, 35, 37, + 91, 40, 37,100, 43, 41, 37, 93, 37, 35, 34, 44,102,117,110, + 99,116,105,111,110, 32, 40,110, 41, 10, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117, + 114,110, 32, 76, 91,116,111,110,117,109, 98,101,114, 40,110, + 41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32,101,110,100, 41, 10, 32, 45, 45, 32,114,101,115,116, + 111,114,101, 32,101,109, 98,101,100,100,101,100, 32, 67, 32, + 99,111,100,101, 10, 32,115,101,108,102, 46, 99,111,100,101, + 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111, + 100,101, 44, 34, 37, 35, 37, 60, 40, 37,100, 43, 41, 37, 62, + 37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,110, + 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32,114,101,116,117,114,110, 32, 67, 91,116,111,110,117, + 109, 98,101,114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 41, 10, 32, 45, + 45, 32,114,101,115,116,111,114,101, 32,118,101,114, 98, 97, + 116,105,109, 32,108,105,110,101,115, 10, 32,115,101,108,102, + 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101, + 108,102, 46, 99,111,100,101, 44, 34, 37, 35, 40, 37,100, 43, + 41, 37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40, + 110, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114, + 101,116,117,114,110, 32, 86, 91,116,111,110,117,109, 98,101, + 114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,101,110,100, 41, 10, 10, 32,115,101,108,102, 46, 99,111, + 100,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 32, 34, 92, + 110, 37,115, 42, 37, 36, 40, 91, 94, 92,110, 93, 43, 41, 34, + 44, 32,102,117,110, 99,116,105,111,110, 32, 40,108, 41, 10, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 86,101,114, 98, + 97,116,105,109, 40,108, 46, 46, 34, 92,110, 34, 41, 10, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,114,101,116,117,114, + 110, 32, 34, 92,110, 34, 10, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 32, 32,101,110,100, 41, 10,101,110,100, 10, 10, 45, + 45, 32,116,114, 97,110,115,108, 97,116,101, 32,118,101,114, + 98, 97,116,105,109, 10,102,117,110, 99,116,105,111,110, 32, + 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114, + 101, 97,109, 98,108,101, 32, 40, 41, 10, 32,111,117,116,112, + 117,116, 40, 39, 47, 42, 92,110, 39, 41, 10, 32,111,117,116, + 112,117,116, 40, 39, 42, 42, 32, 76,117, 97, 32, 98,105,110, + 100,105,110,103, 58, 32, 39, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 39, 92,110, 39, 41, 10, 32,111,117,116, + 112,117,116, 40, 39, 42, 42, 32, 71,101,110,101,114, 97,116, + 101,100, 32, 97,117,116,111,109, 97,116,105, 99, 97,108,108, + 121, 32, 98,121, 32, 39, 46, 46, 84, 79, 76, 85, 65, 95, 86, + 69, 82, 83, 73, 79, 78, 46, 46, 39, 32,111,110, 32, 39, 46, + 46,100, 97,116,101, 40, 41, 46, 46, 39, 46, 92,110, 39, 41, + 10, 32,111,117,116,112,117,116, 40, 39, 42, 47, 92,110, 92, + 110, 39, 41, 10, 10, 9,111,117,116,112,117,116, 40, 39, 35, + 105,102,110,100,101,102, 32, 95, 95, 99,112,108,117,115,112, + 108,117,115, 92,110, 39, 41, 10, 9,111,117,116,112,117,116, + 40, 39, 35,105,110, 99,108,117,100,101, 32, 34,115,116,100, + 108,105, 98, 46,104, 34, 92,110, 39, 41, 10, 9,111,117,116, + 112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, + 10, 9,111,117,116,112,117,116, 40, 39, 35,105,110, 99,108, + 117,100,101, 32, 34,115,116,114,105,110,103, 46,104, 34, 92, + 110, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39, + 35,105,110, 99,108,117,100,101, 32, 34,116,111,108,117, 97, + 43, 43, 46,104, 34, 92,110, 92,110, 39, 41, 10, 10, 32,105, + 102, 32,110,111,116, 32,102,108, 97,103,115, 46,104, 32,116, + 104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47, + 42, 32, 69,120,112,111,114,116,101,100, 32,102,117,110, 99, + 116,105,111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116, + 112,117,116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32, + 105,110,116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115, + 101,108,102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101, + 110, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116, + 111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, + 10, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119, + 104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, + 10, 32, 32,115,101,108,102, 91,105, 93, 58,112,114,101, 97, + 109, 98,108,101, 40, 41, 10, 32, 32,105, 32, 61, 32,105, 43, + 49, 10, 32,101,110,100, 10, 10, 9,105,102, 32,115,101,108, + 102, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99, + 116,105,111,110, 40, 95, 99,111,108,108,101, 99,116, 41, 32, + 116,104,101,110, 10, 9, 9,111,117,116,112,117,116, 40, 39, + 92,110, 39, 41, 10, 9, 9,111,117,116,112,117,116, 40, 39, + 47, 42, 32,102,117,110, 99,116,105,111,110, 32,116,111, 32, + 114,101,108,101, 97,115,101, 32, 99,111,108,108,101, 99,116, + 101,100, 32,111, 98,106,101, 99,116, 32,118,105, 97, 32,100, + 101,115,116,114,117, 99,116,111,114, 32, 42, 47, 39, 41, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101, + 102, 32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110, + 39, 41, 10, 9, 9,102,111,114, 32,105, 44,118, 32,105,110, + 32,112, 97,105,114,115, 40, 95, 99,111,108,108,101, 99,116, + 41, 32,100,111, 10, 9, 9, 32,111,117,116,112,117,116, 40, + 39, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 32, 39, + 46, 46,118, 46, 46, 39, 32, 40,108,117, 97, 95, 83,116, 97, + 116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10, + 9, 9, 9,111,117,116,112,117,116, 40, 39,123, 39, 41, 10, + 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, 39, 46, 46, + 105, 46, 46, 39, 42, 32,115,101,108,102, 32, 61, 32, 40, 39, + 46, 46,105, 46, 46, 39, 42, 41, 32,116,111,108,117, 97, 95, + 116,111,117,115,101,114,116,121,112,101, 40,116,111,108,117, + 97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10, 9, 9, 9, + 111,117,116,112,117,116, 40, 39, 9, 77,116,111,108,117, 97, + 95,100,101,108,101,116,101, 40,115,101,108,102, 41, 59, 39, + 41, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 9,114, + 101,116,117,114,110, 32, 48, 59, 39, 41, 10, 9, 9, 9,111, + 117,116,112,117,116, 40, 39,125, 39, 41, 10, 9, 9,101,110, + 100, 10, 9, 9,111,117,116,112,117,116, 40, 39, 35,101,110, + 100,105,102, 92,110, 92,110, 39, 41, 10, 9,101,110,100, 10, + 10, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, + 32,111,117,116,112,117,116, 40, 39, 47, 42, 32,102,117,110, + 99,116,105,111,110, 32,116,111, 32,114,101,103,105,115,116, + 101,114, 32,116,121,112,101, 32, 42, 47, 39, 41, 10, 32,111, + 117,116,112,117,116, 40, 39,115,116, 97,116,105, 99, 32,118, + 111,105,100, 32,116,111,108,117, 97, 95,114,101,103, 95,116, + 121,112,101,115, 32, 40,108,117, 97, 95, 83,116, 97,116,101, + 42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10, 32,111, + 117,116,112,117,116, 40, 39,123, 39, 41, 10, 10, 9,105,102, + 32,102,108, 97,103,115, 46,116, 32,116,104,101,110, 10, 9, + 9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101, + 102, 32, 77,116,111,108,117, 97, 95,116,121,112,101,105,100, + 92,110, 35,100,101,102,105,110,101, 32, 77,116,111,108,117, + 97, 95,116,121,112,101,105,100, 40, 76, 44, 84, 73, 44, 84, + 41, 92,110, 35,101,110,100,105,102, 92,110, 34, 41, 10, 9, + 101,110,100, 10, 9,102,111,114,101, 97, 99,104, 40, 95,117, + 115,101,114,116,121,112,101, 44,102,117,110, 99,116,105,111, + 110, 40,110, 44,118, 41, 10, 9, 9,105,102, 32, 40,110,111, + 116, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115, + 101,115, 91,118, 93, 41, 32,111,114, 32, 95,103,108,111, 98, + 97,108, 95, 99,108, 97,115,115,101,115, 91,118, 93, 58, 99, + 104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99, + 101,115,115, 40, 41, 32,116,104,101,110, 10, 9, 9, 9,111, + 117,116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,117, + 115,101,114,116,121,112,101, 40,116,111,108,117, 97, 95, 83, + 44, 34, 39, 44,118, 44, 39, 34, 41, 59, 39, 41, 10, 9, 9, + 9,105,102, 32,102,108, 97,103,115, 46,116, 32,116,104,101, + 110, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, + 77,116,111,108,117, 97, 95,116,121,112,101,105,100, 40,116, + 111,108,117, 97, 95, 83, 44,116,121,112,101,105,100, 40, 39, + 44,118, 44, 39, 41, 44, 32, 34, 39, 44,118, 44, 39, 34, 41, + 59, 39, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9,101,110, + 100, 10, 9, 32,101,110,100, 41, 10, 32,111,117,116,112,117, + 116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40, + 39, 92,110, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32,114, + 101,103,105,115,116,101,114, 32,112, 97, 99,107, 97,103,101, + 10, 45, 45, 32,119,114,105,116,101, 32,112, 97, 99,107, 97, + 103,101, 32,111,112,101,110, 32,102,117,110, 99,116,105,111, + 110, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 80, 97, 99,107, 97,103,101, 58,114,101,103,105,115,116, + 101,114, 32, 40,112,114,101, 41, 10, 32,112,114,101, 32, 61, + 32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,112,117,115, + 104, 40,115,101,108,102, 41, 10, 32,111,117,116,112,117,116, + 40,112,114,101, 46, 46, 34, 47, 42, 32, 79,112,101,110, 32, + 102,117,110, 99,116,105,111,110, 32, 42, 47, 34, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79, + 76, 85, 65, 95, 65, 80, 73, 32,105,110,116, 32,116,111,108, + 117, 97, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101, + 46, 46, 34, 95,111,112,101,110, 32, 40,108,117, 97, 95, 83, + 116, 97,116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, + 41, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, + 34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40,112,114, + 101, 46, 46, 34, 32,116,111,108,117, 97, 95,111,112,101,110, + 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111, + 117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111, + 108,117, 97, 95,114,101,103, 95,116,121,112,101,115, 40,116, + 111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111,117,116, + 112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111,108,117, + 97, 95,109,111,100,117,108,101, 40,116,111,108,117, 97, 95, + 83, 44, 78, 85, 76, 76, 44, 34, 44,115,101,108,102, 58,104, + 97,115,118, 97,114, 40, 41, 44, 34, 41, 59, 34, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116, + 111,108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108, + 101, 40,116,111,108,117, 97, 95, 83, 44, 78, 85, 76, 76, 41, + 59, 34, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, + 32,119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32, + 100,111, 10, 32, 32,115,101,108,102, 91,105, 93, 58,114,101, + 103,105,115,116,101,114, 40,112,114,101, 46, 46, 34, 32, 32, + 34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101, + 110,100, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, + 46, 34, 32,116,111,108,117, 97, 95,101,110,100,109,111,100, + 117,108,101, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, + 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, + 32,114,101,116,117,114,110, 32, 49, 59, 34, 41, 10, 32,111, + 117,116,112,117,116, 40,112,114,101, 46, 46, 34,125, 34, 41, + 10, 10, 32,111,117,116,112,117,116, 40, 34, 92,110, 92,110, + 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102, + 32,100,101,102,105,110,101,100, 40, 76, 85, 65, 95, 86, 69, + 82, 83, 73, 79, 78, 95, 78, 85, 77, 41, 32, 38, 38, 32, 76, + 85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 95, 78, 85, 77, 32, + 62, 61, 32, 53, 48, 49, 92,110, 34, 41, 59, 10, 32,111,117, + 116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79, 76, 85, + 65, 95, 65, 80, 73, 32,105,110,116, 32,108,117, 97,111,112, + 101,110, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101, + 46, 46, 34, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42, + 32,116,111,108,117, 97, 95, 83, 41, 32,123, 34, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,114, + 101,116,117,114,110, 32,116,111,108,117, 97, 95, 34, 46, 46, + 115,101,108,102, 46,110, 97,109,101, 46, 46, 34, 95,111,112, + 101,110, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, + 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34,125, + 59, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,101, + 110,100,105,102, 92,110, 92,110, 34, 41, 10, 10, 9,112,111, + 112, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,119,114,105, + 116,101, 32,104,101, 97,100,101,114, 32,102,105,108,101, 10, + 102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 80, + 97, 99,107, 97,103,101, 58,104,101, 97,100,101,114, 32, 40, + 41, 10, 32,111,117,116,112,117,116, 40, 39, 47, 42, 92,110, + 39, 41, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 76, + 117, 97, 32, 98,105,110,100,105,110,103, 58, 32, 39, 46, 46, + 115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 92,110, 39, + 41, 10, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 71, + 101,110,101,114, 97,116,101,100, 32, 97,117,116,111,109, 97, + 116,105, 99, 97,108,108,121, 32, 98,121, 32, 39, 46, 46, 84, + 79, 76, 85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 46, 46, 39, + 32,111,110, 32, 39, 46, 46,100, 97,116,101, 40, 41, 46, 46, + 39, 46, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, + 39, 42, 47, 92,110, 92,110, 39, 41, 10, 10, 32,105,102, 32, + 110,111,116, 32,102,108, 97,103,115, 46,104, 32,116,104,101, + 110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47, 42, 32, + 69,120,112,111,114,116,101,100, 32,102,117,110, 99,116,105, + 111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116,112,117, + 116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32,105,110, + 116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101,110, 32, + 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108, + 117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101, + 110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, + 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117, + 110, 99,116,105,111,110, 32, 95, 80, 97, 99,107, 97,103,101, + 32, 40,115,101,108,102, 41, 10, 32,115,101,116,109,101,116, + 97,116, 97, 98,108,101, 40,115,101,108,102, 44, 99,108, 97, + 115,115, 80, 97, 99,107, 97,103,101, 41, 10, 32,114,101,116, + 117,114,110, 32,115,101,108,102, 10,101,110,100, 10, 10, 45, + 45, 32, 80, 97,114,115,101, 32, 67, 32,104,101, 97,100,101, + 114, 32,102,105,108,101, 32,119,105,116,104, 32,116,111,108, + 117, 97, 32,100,105,114,101, 99,116,105,118,101,115, 10, 45, + 45, 32, 42, 42, 42, 32, 84,104, 97,110,107,115, 32,116,111, + 32, 65,114,105,101,108, 32, 77, 97,110,122,117,114, 32,102, + 111,114, 32,102,105,120,105,110,103, 32, 98,117,103,115, 32, + 105,110, 32,110,101,115,116,101,100, 32,100,105,114,101, 99, + 116,105,118,101,115, 32, 42, 42, 42, 10,102,117,110, 99,116, + 105,111,110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100, + 101, 40,102,110, 44,115, 41, 10, 9,108,111, 99, 97,108, 32, + 99,111,100,101, 32, 61, 32, 39, 92,110, 36, 35,105,110, 99, + 108,117,100,101, 32, 34, 39, 46, 46,102,110, 46, 46, 39, 34, + 92,110, 39, 10, 9,115, 61, 32, 34, 92,110, 34, 32, 46, 46, + 32,115, 32, 46, 46, 32, 34, 92,110, 34, 32, 45, 45, 32, 97, + 100,100, 32, 98,108, 97,110,107, 32,108,105,110,101,115, 32, + 97,115, 32,115,101,110,116,105,110,101,108,115, 10, 9,108, + 111, 99, 97,108, 32, 95, 44,101, 44, 99, 44,116, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115, 44, 32, 34, 92,110, 40, + 91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91, 79,111, 93, + 91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93, 95, 40, 91, + 94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42, 92,110, 34, + 41, 10, 9,119,104,105,108,101, 32,101, 32,100,111, 10, 9, + 9,116, 32, 61, 32,115,116,114,108,111,119,101,114, 40,116, + 41, 10, 9, 9,105,102, 32,116, 32, 61, 61, 32, 34, 98,101, + 103,105,110, 34, 32,116,104,101,110, 10, 9, 9, 9, 95, 44, + 101, 44, 99, 32, 61, 32,115,116,114,102,105,110,100, 40,115, + 44, 34, 40, 46, 45, 41, 92,110, 91, 94, 92,110, 93, 42, 91, + 84,116, 93, 91, 79,111, 93, 91, 76,108, 93, 91, 85,117, 93, + 91, 65, 97, 93, 95, 91, 69,101, 93, 91, 78,110, 93, 91, 68, + 100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44,101, 41, 10, + 9, 9, 9,105,102, 32,110,111,116, 32,101, 32,116,104,101, + 110, 10, 9, 9, 9, 32,116,111,108,117, 97, 95,101,114,114, + 111,114, 40, 34, 85,110, 98, 97,108, 97,110, 99,101,100, 32, + 39,116,111,108,117, 97, 95, 98,101,103,105,110, 39, 32,100, + 105,114,101, 99,116,105,118,101, 32,105,110, 32,104,101, 97, + 100,101,114, 32,102,105,108,101, 34, 41, 10, 9, 9, 9,101, + 110,100, 10, 9, 9,101,110,100, 10, 9, 9, 99,111,100,101, + 32, 61, 32, 99,111,100,101, 32, 46, 46, 32, 99, 32, 46, 46, + 32, 34, 92,110, 34, 10, 9, 32, 95, 44,101, 44, 99, 44,116, + 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32, 34, + 92,110, 40, 91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91, + 79,111, 93, 91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93, + 95, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42, + 92,110, 34, 44,101, 41, 10, 9,101,110,100, 10, 9,114,101, + 116,117,114,110, 32, 99,111,100,101, 10,101,110,100, 10, 10, + 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10, + 45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,101, 32, + 112, 97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,116, + 104,101, 32,102,105,108,101, 32,101,120,116,101,110,115,105, + 111,110, 44, 32, 97,110,100, 32,116,104,101, 32,102,105,108, + 101, 32,116,101,120,116, 46, 10,102,117,110, 99,116,105,111, + 110, 32, 80, 97, 99,107, 97,103,101, 32, 40,110, 97,109,101, + 44,102,110, 41, 10, 32,108,111, 99, 97,108, 32,101,120,116, + 32, 61, 32, 34,112,107,103, 34, 10, 10, 32, 45, 45, 32,111, + 112,101,110, 32,105,110,112,117,116, 32,102,105,108,101, 44, + 32,105,102, 32, 97,110,121, 10, 32,108,111, 99, 97,108, 32, + 115,116, 44,109,115,103, 10, 32,105,102, 32,102,110, 32,116, + 104,101,110, 10, 32, 32,115,116, 44, 32,109,115,103, 32, 61, + 32,114,101, 97,100,102,114,111,109, 40,102,108, 97,103,115, + 46,102, 41, 10, 32, 32,105,102, 32,110,111,116, 32,115,116, + 32,116,104,101,110, 10, 32, 32, 32,101,114,114,111,114, 40, + 39, 35, 39, 46, 46,109,115,103, 41, 10, 32, 32,101,110,100, + 10, 32, 32,108,111, 99, 97,108, 32, 95, 59, 32, 95, 44, 32, + 95, 44, 32,101,120,116, 32, 61, 32,115,116,114,102,105,110, + 100, 40,102,110, 44, 34, 46, 42, 37, 46, 40, 46, 42, 41, 36, + 34, 41, 10, 32,101,110,100, 10, 32,108,111, 99, 97,108, 32, + 99,111,100,101, 10, 32,105,102, 32,101,120,116, 32, 61, 61, + 32, 39,112,107,103, 39, 32,116,104,101,110, 10, 32, 32, 99, + 111,100,101, 32, 61, 32,112,114,101,112, 40,115,116, 41, 10, + 32,101,108,115,101, 10, 32, 32, 99,111,100,101, 32, 61, 32, + 34, 92,110, 34, 32, 46, 46, 32,114,101, 97,100, 40, 39, 42, + 97, 39, 41, 10, 32, 32,105,102, 32,101,120,116, 32, 61, 61, + 32, 39,104, 39, 32,111,114, 32,101,120,116, 32, 61, 61, 32, + 39,104,112,112, 39, 32,116,104,101,110, 10, 32, 32, 32, 99, + 111,100,101, 32, 61, 32,101,120,116,114, 97, 99,116, 95, 99, + 111,100,101, 40,102,110, 44, 99,111,100,101, 41, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99, + 108,111,115,101, 32,102,105,108,101, 10, 32,105,102, 32,102, + 110, 32,116,104,101,110, 10, 32, 32,114,101, 97,100,102,114, + 111,109, 40, 41, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, + 100,101, 97,108, 32,119,105,116,104, 32,105,110, 99,108,117, + 100,101, 32,100,105,114,101, 99,116,105,118,101, 10, 32,108, + 111, 99, 97,108, 32,110,115,117, 98,115,116, 10, 32,114,101, + 112,101, 97,116, 10, 32, 32, 99,111,100,101, 44,110,115,117, + 98,115,116, 32, 61, 32,103,115,117, 98, 40, 99,111,100,101, + 44, 39, 92,110, 37,115, 42, 37, 36, 40, 46, 41,102,105,108, + 101, 37,115, 42, 34, 40, 46, 45, 41, 34, 40, 91, 94, 92,110, + 93, 42, 41, 92,110, 39, 44, 10, 9, 9,102,117,110, 99,116, + 105,111,110, 32, 40,107,105,110,100, 44,102,110, 44,101,120, + 116,114, 97, 41, 10, 9, 9, 9,108,111, 99, 97,108, 32, 95, + 44, 32, 95, 44, 32,101,120,116, 32, 61, 32,115,116,114,102, + 105,110,100, 40,102,110, 44, 34, 46, 42, 37, 46, 40, 46, 42, + 41, 36, 34, 41, 10, 9, 9, 9,108,111, 99, 97,108, 32,102, + 112, 44,109,115,103, 32, 61, 32,111,112,101,110,102,105,108, + 101, 40,102,110, 44, 39,114, 39, 41, 10, 9, 9, 9,105,102, + 32,110,111,116, 32,102,112, 32,116,104,101,110, 10, 9, 9, + 9, 9,101,114,114,111,114, 40, 39, 35, 39, 46, 46,109,115, + 103, 46, 46, 39, 58, 32, 39, 46, 46,102,110, 41, 10, 9, 9, + 9,101,110,100, 10, 9, 9, 9,105,102, 32,107,105,110,100, + 32, 61, 61, 32, 39,112, 39, 32,116,104,101,110, 10, 9, 9, + 9, 9,108,111, 99, 97,108, 32,115, 32, 61, 32,112,114,101, + 112, 40,102,112, 41, 10, 9, 9, 9, 9, 99,108,111,115,101, + 102,105,108,101, 40,102,112, 41, 10, 9, 9, 9, 9,114,101, + 116,117,114,110, 32,115, 10, 9, 9, 9,101,110,100, 10, 9, + 9, 9,108,111, 99, 97,108, 32,115, 32, 61, 32,114,101, 97, + 100, 40,102,112, 44, 39, 42, 97, 39, 41, 10, 9, 9, 9, 99, + 108,111,115,101,102,105,108,101, 40,102,112, 41, 10, 9, 9, + 9,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39, 99, 39, + 32,111,114, 32,107,105,110,100, 32, 61, 61, 32, 39,104, 39, + 32,116,104,101,110, 10, 9, 9, 9, 9,114,101,116,117,114, + 110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100,101, 40, + 102,110, 44,115, 41, 10, 9, 9, 9,101,108,115,101,105,102, + 32,107,105,110,100, 32, 61, 61, 32, 39,108, 39, 32,116,104, + 101,110, 10, 9, 9, 9, 9,114,101,116,117,114,110, 32, 34, + 92,110, 36, 91, 45, 45, 35, 35, 34, 46, 46,102,110, 46, 46, + 34, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34, 92, + 110, 36, 93, 92,110, 34, 10, 9, 9, 9,101,108,115,101,105, + 102, 32,107,105,110,100, 32, 61, 61, 32, 39,105, 39, 32,116, + 104,101,110, 10, 9, 9, 9, 9,108,111, 99, 97,108, 32,116, + 32, 61, 32,123, 99,111,100,101, 61,115,125, 10, 9, 9, 9, + 9,101,120,116,114, 97, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,101,120,116,114, 97, 44, 32, 34, 94, + 37,115, 42, 44, 37,115, 42, 34, 44, 32, 34, 34, 41, 10, 9, + 9, 9, 9,108,111, 99, 97,108, 32,112, 97,114,115, 32, 61, + 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, + 40,101,120,116,114, 97, 44, 32, 34, 44, 34, 41, 10, 9, 9, + 9, 9,105,110, 99,108,117,100,101, 95,102,105,108,101, 95, + 104,111,111,107, 40,116, 44, 32,102,110, 44, 32,117,110,112, + 97, 99,107, 40,112, 97,114,115, 41, 41, 10, 9, 9, 9, 9, + 114,101,116,117,114,110, 32, 34, 92,110, 92,110, 34, 32, 46, + 46, 32,116, 46, 99,111,100,101, 10, 9, 9, 9,101,108,115, + 101, 10, 9, 9, 9, 9,101,114,114,111,114, 40, 39, 35, 73, + 110,118, 97,108,105,100, 32,105,110, 99,108,117,100,101, 32, + 100,105,114,101, 99,116,105,118,101, 32, 40,117,115,101, 32, + 36, 99,102,105,108,101, 44, 32, 36,112,102,105,108,101, 44, + 32, 36,108,102,105,108,101, 32,111,114, 32, 36,105,102,105, + 108,101, 41, 39, 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, + 101,110,100, 41, 10, 32,117,110,116,105,108, 32,110,115,117, + 98,115,116, 61, 61, 48, 10, 10, 32, 45, 45, 32,100,101, 97, + 108, 32,119,105,116,104, 32,114,101,110, 97,109,105,110,103, + 32,100,105,114,101, 99,116,105,118,101, 10, 32,114,101,112, + 101, 97,116, 32, 45, 45, 32, 73, 32,100,111,110, 39,116, 32, + 107,110,111,119, 32,119,104,121, 32,116,104,105,115, 32,105, + 115, 32,110,101, 99,101,115, 97,114,121, 10, 9, 99,111,100, + 101, 44,110,115,117, 98,115,116, 32, 61, 32,103,115,117, 98, + 40, 99,111,100,101, 44, 39, 92,110, 37,115, 42, 37, 36,114, + 101,110, 97,109,105,110,103, 37,115, 42, 40, 46, 45, 41, 37, + 115, 42, 92,110, 39, 44, 32,102,117,110, 99,116,105,111,110, + 32, 40,114, 41, 32, 97,112,112,101,110,100,114,101,110, 97, + 109,105,110,103, 40,114, 41, 32,114,101,116,117,114,110, 32, + 34, 92,110, 34, 32,101,110,100, 41, 10, 32,117,110,116,105, + 108, 32,110,115,117, 98,115,116, 32, 61, 61, 32, 48, 10, 10, + 32,108,111, 99, 97,108, 32,116, 32, 61, 32, 95, 80, 97, 99, + 107, 97,103,101, 40, 95, 67,111,110,116, 97,105,110,101,114, + 123,110, 97,109,101, 61,110, 97,109,101, 44, 32, 99,111,100, + 101, 61, 99,111,100,101,125, 41, 10, 32,112,117,115,104, 40, + 116, 41, 10, 32,112,114,101,112,114,111, 99,101,115,115, 95, + 104,111,111,107, 40,116, 41, 10, 32,116, 58,112,114,101,112, + 114,111, 99,101,115,115, 40, 41, 10, 32,112,114,101,112, 97, + 114,115,101, 95,104,111,111,107, 40,116, 41, 10, 32,116, 58, + 112, 97,114,115,101, 40,116, 46, 99,111,100,101, 41, 10, 32, + 112,111,112, 40, 41, 10, 32,114,101,116,117,114,110, 32,116, + 10,101,110,100, 10, 10, 10,115,101,116,109,101,116, 97,116, + 97, 98,108,101, 40, 95,101,120,116,114, 97, 95,112, 97,114, + 97,109,101,116,101,114,115, 44, 32,123, 32, 95, 95,105,110, + 100,101,120, 32, 61, 32, 95, 71, 32,125, 41, 10, 10,102,117, + 110, 99,116,105,111,110, 32,112,114,101,112, 40,102,105,108, + 101, 41, 10, 10, 32, 32,108,111, 99, 97,108, 32, 99,104,117, + 110,107, 32, 61, 32,123, 39,108,111, 99, 97,108, 32, 95, 95, + 114,101,116, 32, 61, 32,123, 34, 92, 92,110, 34,125, 92,110, + 39,125, 10, 32, 32,102,111,114, 32,108,105,110,101, 32,105, + 110, 32,102,105,108,101, 58,108,105,110,101,115, 40, 41, 32, + 100,111, 10, 32, 32, 32, 32, 32,105,102, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,108,105,110,101, 44, 32, 34, + 94, 35, 35, 34, 41, 32,116,104,101,110, 10, 32, 32, 32, 32, + 32, 32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, + 99,104,117,110,107, 44, 32,115,116,114,105,110,103, 46,115, + 117, 98, 40,108,105,110,101, 44, 32, 51, 41, 32, 46, 46, 32, + 34, 92,110, 34, 41, 10, 32, 32, 32, 32, 32,101,108,115,101, + 10, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,108, 97, + 115,116, 32, 61, 32, 49, 10, 32, 32, 32, 32, 32, 32,102,111, + 114, 32,116,101,120,116, 44, 32,101,120,112,114, 44, 32,105, + 110,100,101,120, 32,105,110, 32,115,116,114,105,110,103, 46, + 103,102,105,110,100, 40,108,105,110,101, 44, 32, 34, 40, 46, + 45, 41, 36, 40, 37, 98, 40, 41, 41, 40, 41, 34, 41, 32,100, + 111, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32,108, 97,115,116, + 32, 61, 32,105,110,100,101,120, 10, 32, 32, 32, 32, 32, 32, + 32, 32,105,102, 32,116,101,120,116, 32,126, 61, 32, 34, 34, + 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 99, + 104,117,110,107, 44, 32,115,116,114,105,110,103, 46,102,111, + 114,109, 97,116, 40, 39,116, 97, 98,108,101, 46,105,110,115, + 101,114,116, 40, 95, 95,114,101,116, 44, 32, 37,113, 32, 41, + 39, 44, 32,116,101,120,116, 41, 41, 10, 32, 32, 32, 32, 32, + 32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, + 116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 99,104, + 117,110,107, 44, 32,115,116,114,105,110,103, 46,102,111,114, + 109, 97,116, 40, 39,116, 97, 98,108,101, 46,105,110,115,101, + 114,116, 40, 95, 95,114,101,116, 44, 32, 37,115, 32, 41, 39, + 44, 32,101,120,112,114, 41, 41, 10, 32, 32, 32, 32, 32, 32, + 101,110,100, 10, 32, 32, 32, 32, 32, 32,116, 97, 98,108,101, + 46,105,110,115,101,114,116, 40, 99,104,117,110,107, 44, 32, + 115,116,114,105,110,103, 46,102,111,114,109, 97,116, 40, 39, + 116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 95, 95, + 114,101,116, 44, 32, 37,113, 41, 92,110, 39, 44, 10, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32,115,116,114,105,110,103, + 46,115,117, 98, 40,108,105,110,101, 44, 32,108, 97,115,116, + 41, 46, 46, 34, 92,110, 34, 41, 41, 10, 32, 32, 32, 32,101, + 110,100, 10, 32, 32,101,110,100, 10, 32, 32,116, 97, 98,108, + 101, 46,105,110,115,101,114,116, 40, 99,104,117,110,107, 44, + 32, 39, 92,110,114,101,116,117,114,110, 32,116, 97, 98,108, + 101, 46, 99,111,110, 99, 97,116, 40, 95, 95,114,101,116, 41, + 92,110, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44, + 101, 32, 61, 32,108,111, 97,100,115,116,114,105,110,103, 40, + 116, 97, 98,108,101, 46, 99,111,110, 99, 97,116, 40, 99,104, + 117,110,107, 41, 41, 10, 32, 32,105,102, 32,101, 32,116,104, + 101,110, 10, 32, 32, 9,101,114,114,111,114, 40, 34, 35, 34, + 46, 46,101, 41, 10, 32, 32,101,110,100, 10, 32, 32,115,101, + 116,102,101,110,118, 40,102, 44, 32, 95,101,120,116,114, 97, + 95,112, 97,114, 97,109,101,116,101,114,115, 41, 10, 32, 32, + 114,101,116,117,114,110, 32,102, 40, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/package.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,109,111,100,117,108, + 101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116, + 116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, + 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, + 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74, + 117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, + 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100, + 101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, + 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101, + 100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97, + 110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, + 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97, + 114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114, + 101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, + 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, + 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116, + 104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105, + 103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105, + 100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, + 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116, + 101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109, + 101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, + 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, 32, + 77,111,100,117,108,101, 32, 99,108, 97,115,115, 10, 45, 45, + 32, 82,101,112,114,101,115,101,110,116,115, 32,109,111,100, + 117,108,101, 46, 10, 45, 45, 32, 84,104,101, 32,102,111,108, + 108,111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97, + 114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32, + 32, 32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102, + 32,111, 98,106,101, 99,116,115, 32,105,110, 32,116,104,101, + 32,109,111,100,117,108,101, 46, 10, 99,108, 97,115,115, 77, + 111,100,117,108,101, 32, 61, 32,123, 10, 32, 99,108, 97,115, + 115,116,121,112,101, 32, 61, 32, 39,109,111,100,117,108,101, + 39, 10,125, 10, 99,108, 97,115,115, 77,111,100,117,108,101, + 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115, + 115, 77,111,100,117,108,101, 10,115,101,116,109,101,116, 97, + 116, 97, 98,108,101, 40, 99,108, 97,115,115, 77,111,100,117, + 108,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105,110, + 101,114, 41, 10, 10, 45, 45, 32,114,101,103,105,115,116,101, + 114, 32,109,111,100,117,108,101, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58, + 114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41, 10, + 32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39, + 39, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111, + 108,117, 97, 95,109,111,100,117,108,101, 40,116,111,108,117, + 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,110, 97, + 109,101, 46, 46, 39, 34, 44, 39, 44,115,101,108,102, 58,104, + 97,115,118, 97,114, 40, 41, 44, 39, 41, 59, 39, 41, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111, + 108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108,101, + 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41, + 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104, + 105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, + 32, 32,115,101,108,102, 91,105, 93, 58,114,101,103,105,115, + 116,101,114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32, + 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111, + 108,117, 97, 95,101,110,100,109,111,100,117,108,101, 40,116, + 111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 9,112,111,112, + 40, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110, + 116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58, + 112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108, + 111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 77,111,100,117,108,101,123, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 34, 39, 59, 34, 41, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108, + 101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32, + 115,101,108,102, 91,105, 93, 58,112,114,105,110,116, 40,105, + 100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34, 41, 10, + 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10, + 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111, + 110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116, + 105,111,110, 32, 95, 77,111,100,117,108,101, 32, 40,116, 41, + 10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, + 116, 44, 99,108, 97,115,115, 77,111,100,117,108,101, 41, 10, + 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116, + 117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67, + 111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69, + 120,112,101, 99,116,115, 32,116,119,111, 32,115,116,114,105, + 110,103, 32,114,101,112,114,101,115,101,110,116,105,110,103, + 32,116,104,101, 32,109,111,100,117,108,101, 32,110, 97,109, + 101, 32, 97,110,100, 32, 98,111,100,121, 46, 10,102,117,110, + 99,116,105,111,110, 32, 77,111,100,117,108,101, 32, 40,110, + 44, 98, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, + 95, 77,111,100,117,108,101, 40, 95, 67,111,110,116, 97,105, + 110,101,114,123,110, 97,109,101, 61,110,125, 41, 10, 32,112, + 117,115,104, 40,116, 41, 10, 32,116, 58,112, 97,114,115,101, + 40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115,116,114, + 108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101, + 108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99,101,115, + 10, 32,112,111,112, 40, 41, 10, 32,114,101,116,117,114,110, + 32,116, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/module.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,110, 97,109,101,115, + 112, 97, 99,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87, + 114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101, + 109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, + 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, + 45, 32, 74,117,108, 32, 50, 48, 48, 51, 10, 45, 45, 32, 36, + 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, + 99,111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111, + 102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, + 32,114,101,100,105,115,116,114,105, 98,117,116,101, 32,105, + 116, 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, + 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102, + 116,119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32, + 104,101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, + 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115, + 105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, + 97,117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, + 98,108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114, + 111,118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, + 99,101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112, + 100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, + 99,101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100, + 105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, + 45, 32, 78, 97,109,101,115,112, 97, 99,101, 32, 99,108, 97, + 115,115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116, + 115, 32, 97, 32,110, 97,109,101,115, 97,112, 99,101, 32,100, + 101,102,105,110,105,116,105,111,110, 46, 10, 45, 45, 32, 83, + 116,111,114,101,115, 32,116,104,101, 32,102,111,108,108,111, + 119,105,110,103, 32,102,105,101,108,100,115, 58, 10, 45, 45, + 32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,108, 97,115, + 115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32, 32,123,105, + 125, 32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101, + 109, 98,101,114,115, 10, 99,108, 97,115,115, 78, 97,109,101, + 115,112, 97, 99,101, 32, 61, 32,123, 10, 32, 99,108, 97,115, + 115,116,121,112,101, 32, 61, 32, 39,110, 97,109,101,115,112, + 97, 99,101, 39, 44, 10, 32,110, 97,109,101, 32, 61, 32, 39, + 39, 44, 10,125, 10, 99,108, 97,115,115, 78, 97,109,101,115, + 112, 97, 99,101, 46, 95, 95,105,110,100,101,120, 32, 61, 32, + 99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 10, + 115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, + 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 44, 99,108, + 97,115,115, 77,111,100,117,108,101, 41, 10, 10, 45, 45, 32, + 80,114,105,110,116, 32,109,101,116,104,111,100, 10,102,117, + 110, 99,116,105,111,110, 32, 99,108, 97,115,115, 78, 97,109, + 101,115,112, 97, 99,101, 58,112,114,105,110,116, 32, 40,105, + 100,101,110,116, 44, 99,108,111,115,101, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 78, 97,109, + 101,115,112, 97, 99,101,123, 34, 41, 10, 32,112,114,105,110, + 116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, + 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109, + 101, 46, 46, 34, 39, 44, 34, 41, 10, 32,108,111, 99, 97,108, + 32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108, + 102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91, + 105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, 61, + 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,110, + 116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99, + 108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 73, + 110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117, + 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95, + 78, 97,109,101,115,112, 97, 99,101, 32, 40,116, 41, 10, 32, + 115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, + 99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 41, + 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101, + 116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, + 67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, + 69,120,112,101, 99,116,115, 32,116,104,101, 32,110, 97,109, + 101, 32, 97,110,100, 32,116,104,101, 32, 98,111,100,121, 32, + 111,102, 32,116,104,101, 32,110, 97,109,101,115,112, 97, 99, + 101, 46, 10,102,117,110, 99,116,105,111,110, 32, 78, 97,109, + 101,115,112, 97, 99,101, 32, 40,110, 44, 98, 41, 10, 32,108, + 111, 99, 97,108, 32, 99, 32, 61, 32, 95, 78, 97,109,101,115, + 112, 97, 99,101, 40, 95, 67,111,110,116, 97,105,110,101,114, + 123,110, 97,109,101, 61,110,125, 41, 10, 32,112,117,115,104, + 40, 99, 41, 10, 32, 99, 58,112, 97,114,115,101, 40,115,116, + 114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,108,101,110, + 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,108,105,109, + 105,110, 97,116,101, 32, 98,114, 97, 99,101,115, 10, 32,112, + 111,112, 40, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/namespace.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,100,101,102,105,110, + 101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116, + 116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, + 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, + 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74, + 117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, + 32,100,101,102,105,110,101, 46,108,117, 97, 44,118, 32, 49, + 46, 50, 32, 49, 57, 57, 57, 47, 48, 55, 47, 50, 56, 32, 50, + 50, 58, 50, 49, 58, 48, 56, 32, 99,101,108,101,115, 32, 69, + 120,112, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99, + 111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102, + 116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32, + 114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, + 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32, + 105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116, + 119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104, + 101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, + 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105, + 115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97, + 117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98, + 108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111, + 118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99, + 101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, + 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99, + 101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105, + 102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, + 32, 68,101,102,105,110,101, 32, 99,108, 97,115,115, 10, 45, + 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97, 32, + 110,117,109,101,114,105, 99, 32, 99,111,110,115,116, 32,100, + 101,102,105,110,105,116,105,111,110, 10, 45, 45, 32, 84,104, + 101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,108, + 100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, + 45, 45, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,111,110, + 115,116, 97,110,116, 32,110, 97,109,101, 10, 99,108, 97,115, + 115, 68,101,102,105,110,101, 32, 61, 32,123, 10, 32,110, 97, + 109,101, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97,115, + 115, 68,101,102,105,110,101, 46, 95, 95,105,110,100,101,120, + 32, 61, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 10, + 115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, + 97,115,115, 68,101,102,105,110,101, 44, 99,108, 97,115,115, + 70,101, 97,116,117,114,101, 41, 10, 10, 45, 45, 32,114,101, + 103,105,115,116,101,114, 32,100,101,102,105,110,101, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, + 102,105,110,101, 58,114,101,103,105,115,116,101,114, 32, 40, + 112,114,101, 41, 10, 9,105,102, 32,110,111,116, 32,115,101, + 108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, + 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10, + 9, 9,114,101,116,117,114,110, 10, 9,101,110,100, 10, 10, + 32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39, + 39, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, + 39,116,111,108,117, 97, 95, 99,111,110,115,116, 97,110,116, + 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101, + 108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46, + 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 41, 59, + 39, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110, + 116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 58, + 112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108, + 111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 68,101,102,105,110,101,123, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10, + 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99, + 111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99, + 116,105,111,110, 32, 95, 68,101,102,105,110,101, 32, 40,116, + 41, 10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, + 40,116, 44, 99,108, 97,115,115, 68,101,102,105,110,101, 41, + 10, 32,116, 58, 98,117,105,108,100,110, 97,109,101,115, 40, + 41, 10, 10, 32,105,102, 32,116, 46,110, 97,109,101, 32, 61, + 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,101,114,114, + 111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,100,101, + 102,105,110,101, 34, 41, 10, 32,101,110,100, 10, 10, 32, 97, + 112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114, + 110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110, + 115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112, + 101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114, + 101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101, + 32, 99,111,110,115,116, 97,110,116, 32,110, 97,109,101, 10, + 102,117,110, 99,116,105,111,110, 32, 68,101,102,105,110,101, + 32, 40,110, 41, 10, 32,114,101,116,117,114,110, 32, 95, 68, + 101,102,105,110,101,123, 10, 32, 32,110, 97,109,101, 32, 61, + 32,110, 10, 32,125, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/define.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,101,110,117,109,101, + 114, 97,116,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87, + 114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101, + 109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, + 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, + 45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, + 73,100, 58, 32,101,110,117,109,101,114, 97,116,101, 46,108, + 117, 97, 44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48, + 49, 47, 50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 53, 32, 99, + 101,108,101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32, + 84,104,105,115, 32, 99,111,100,101, 32,105,115, 32,102,114, + 101,101, 32,115,111,102,116,119, 97,114,101, 59, 32,121,111, + 117, 32, 99, 97,110, 32,114,101,100,105,115,116,114,105, 98, + 117,116,101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109, + 111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104, + 101, 32,115,111,102,116,119, 97,114,101, 32,112,114,111,118, + 105,100,101,100, 32,104,101,114,101,117,110,100,101,114, 32, + 105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, + 34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, + 32,116,104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, + 32,110,111, 32,111, 98,108,105,103, 97,116,105,111,110, 32, + 116,111, 32,112,114,111,118,105,100,101, 32,109, 97,105,110, + 116,101,110, 97,110, 99,101, 44, 32,115,117,112,112,111,114, + 116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32, + 101,110,104, 97,110, 99,101,109,101,110,116,115, 44, 32,111, + 114, 32,109,111,100,105,102,105, 99, 97,116,105,111,110,115, + 46, 10, 10, 10, 45, 45, 32, 69,110,117,109,101,114, 97,116, + 101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114, + 101,115,101,110,116,115, 32,101,110,117,109,101,114, 97,116, + 105,111,110, 10, 45, 45, 32, 84,104,101, 32,102,111,108,108, + 111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97,114, + 101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32, 32, + 32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102, 32, + 99,111,110,115,116, 97,110,116, 32,110, 97,109,101,115, 10, + 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 32, + 61, 32,123, 10,125, 10, 99,108, 97,115,115, 69,110,117,109, + 101,114, 97,116,101, 46, 95, 95,105,110,100,101,120, 32, 61, + 32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, + 10,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99, + 108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 44, 99, + 108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45, + 45, 32,114,101,103,105,115,116,101,114, 32,101,110,117,109, + 101,114, 97,116,105,111,110, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116, + 101, 58,114,101,103,105,115,116,101,114, 32, 40,112,114,101, + 41, 10, 9,105,102, 32,110,111,116, 32,115,101,108,102, 58, + 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, + 99,101,115,115, 40, 41, 32,116,104,101,110, 10, 9, 9,114, + 101,116,117,114,110, 10, 9,101,110,100, 10, 32,112,114,101, + 32, 61, 32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,108, + 111, 99, 97,108, 32,110,115,112, 97, 99,101, 32, 61, 32,103, + 101,116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114, + 114, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, + 119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100, + 111, 10, 32, 9,105,102, 32,115,101,108,102, 46,108,110, 97, + 109,101,115, 91,105, 93, 32, 97,110,100, 32,115,101,108,102, + 46,108,110, 97,109,101,115, 91,105, 93, 32,126, 61, 32, 34, + 34, 32,116,104,101,110, 10, 9, 10, 9, 9,111,117,116,112, + 117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95, + 99,111,110,115,116, 97,110,116, 40,116,111,108,117, 97, 95, + 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109, + 101,115, 91,105, 93, 46, 46, 39, 34, 44, 39, 46, 46,110,115, + 112, 97, 99,101, 46, 46,115,101,108,102, 91,105, 93, 46, 46, + 39, 41, 59, 39, 41, 10, 9,101,110,100, 10, 32, 32,105, 32, + 61, 32,105, 43, 49, 10, 32,101,110,100, 10,101,110,100, 10, + 10, 45, 45, 32, 80,114,105,110,116, 32,109,101,116,104,111, + 100, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 69,110,117,109,101,114, 97,116,101, 58,112,114,105,110, + 116, 32, 40,105,100,101,110,116, 44, 99,108,111,115,101, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 69,110,117,109,101,114, 97,116,101,123, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 110, 97,109,101, 32, 61, 32, 34, 46, 46,115,101,108,102, 46, + 110, 97,109,101, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, + 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,105, + 93, 32,100,111, 10, 32, 32,112,114,105,110,116, 40,105,100, + 101,110,116, 46, 46, 34, 32, 39, 34, 46, 46,115,101,108,102, + 91,105, 93, 46, 46, 34, 39, 40, 34, 46, 46,115,101,108,102, + 46,108,110, 97,109,101,115, 91,105, 93, 46, 46, 34, 41, 44, + 34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101, + 110,100, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101, + 110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, + 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117, + 110, 99,116,105,111,110, 32, 95, 69,110,117,109,101,114, 97, + 116,101, 32, 40,116, 44,118, 97,114,110, 97,109,101, 41, 10, + 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, + 44, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, + 41, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32, 97, + 112,112,101,110,100,101,110,117,109, 40,116, 41, 10, 9, 32, + 105,102, 32,118, 97,114,110, 97,109,101, 32, 97,110,100, 32, + 118, 97,114,110, 97,109,101, 32,126, 61, 32, 34, 34, 32,116, + 104,101,110, 10, 9, 9,105,102, 32,116, 46,110, 97,109,101, + 32,126, 61, 32, 34, 34, 32,116,104,101,110, 10, 9, 9, 9, + 86, 97,114,105, 97, 98,108,101, 40,116, 46,110, 97,109,101, + 46, 46, 34, 32, 34, 46, 46,118, 97,114,110, 97,109,101, 41, + 10, 9, 9,101,108,115,101, 10, 9, 9, 9,108,111, 99, 97, + 108, 32,110,115, 32, 61, 32,103,101,116, 99,117,114,114,110, + 97,109,101,115,112, 97, 99,101, 40, 41, 10, 9, 9, 9,119, + 97,114,110,105,110,103, 40, 34, 86, 97,114,105, 97, 98,108, + 101, 32, 34, 46, 46,110,115, 46, 46,118, 97,114,110, 97,109, + 101, 46, 46, 34, 32,111,102, 32,116,121,112,101, 32, 60, 97, + 110,111,110,121,109,111,117,115, 32,101,110,117,109, 62, 32, + 105,115, 32,100,101, 99,108, 97,114,101,100, 32, 97,115, 32, + 114,101, 97,100, 45,111,110,108,121, 34, 41, 10, 9, 9, 9, + 86, 97,114,105, 97, 98,108,101, 40, 34,116,111,108,117, 97, + 95,114,101, 97,100,111,110,108,121, 32,105,110,116, 32, 34, + 46, 46,118, 97,114,110, 97,109,101, 41, 10, 9, 9,101,110, + 100, 10, 9,101,110,100, 10, 9, 32,108,111, 99, 97,108, 32, + 112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67, + 111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, 9, + 32,105,102, 32,112, 97,114,101,110,116, 32,116,104,101,110, + 10, 9, 9,116, 46, 97, 99, 99,101,115,115, 32, 61, 32,112, + 97,114,101,110,116, 46, 99,117,114,114, 95,109,101,109, 98, + 101,114, 95, 97, 99, 99,101,115,115, 10, 9, 9,116, 46,103, + 108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 32, 61, 32, + 116, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95, + 97, 99, 99,101,115,115, 40, 41, 10, 9, 32,101,110,100, 10, + 114,101,116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, + 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10, 45, + 45, 32, 69,120,112,101, 99,116,115, 32, 97, 32,115,116,114, + 105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110, + 103, 32,116,104,101, 32,101,110,117,109,101,114, 97,116,101, + 32, 98,111,100,121, 10,102,117,110, 99,116,105,111,110, 32, + 69,110,117,109,101,114, 97,116,101, 32, 40,110, 44, 98, 44, + 118, 97,114,110, 97,109,101, 41, 10, 9, 98, 32, 61, 32,115, + 116,114,105,110,103, 46,103,115,117, 98, 40, 98, 44, 32, 34, + 44, 91, 37,115, 92,110, 93, 42,125, 34, 44, 32, 34, 92,110, + 125, 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116, + 101, 32,108, 97,115,116, 32, 39, 44, 39, 10, 32,108,111, 99, + 97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116, + 114,115,117, 98, 40, 98, 44, 50, 44, 45, 50, 41, 44, 39, 44, + 39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 98,114, 97, 99,101,115, 10, 32,108,111, 99, 97,108, 32, + 105, 32, 61, 32, 49, 10, 32,108,111, 99, 97,108, 32,101, 32, + 61, 32,123,110, 61, 48,125, 10, 32,119,104,105,108,101, 32, + 116, 91,105, 93, 32,100,111, 10, 32, 32,108,111, 99, 97,108, + 32,116,116, 32, 61, 32,115,112,108,105,116, 40,116, 91,105, + 93, 44, 39, 61, 39, 41, 32, 32, 45, 45, 32,100,105,115, 99, + 97,114,100, 32,105,110,105,116,105, 97,108, 32,118, 97,108, + 117,101, 10, 32, 32,101, 46,110, 32, 61, 32,101, 46,110, 32, + 43, 32, 49, 10, 32, 32,101, 91,101, 46,110, 93, 32, 61, 32, + 116,116, 91, 49, 93, 10, 32, 32,105, 32, 61, 32,105, 43, 49, + 10, 32,101,110,100, 10, 32, 45, 45, 32,115,101,116, 32,108, + 117, 97, 32,110, 97,109,101,115, 10, 32,105, 32, 32, 61, 32, + 49, 10, 32,101, 46,108,110, 97,109,101,115, 32, 61, 32,123, + 125, 10, 32,108,111, 99, 97,108, 32,110,115, 32, 61, 32,103, + 101,116, 99,117,114,114,110, 97,109,101,115,112, 97, 99,101, + 40, 41, 10, 32,119,104,105,108,101, 32,101, 91,105, 93, 32, + 100,111, 10, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, + 115,112,108,105,116, 40,101, 91,105, 93, 44, 39, 64, 39, 41, + 10, 32, 32,101, 91,105, 93, 32, 61, 32,116, 91, 49, 93, 10, + 9, 9,105,102, 32,110,111,116, 32,116, 91, 50, 93, 32,116, + 104,101,110, 10, 9, 9, 32,116, 91, 50, 93, 32, 61, 32, 97, + 112,112,108,121,114,101,110, 97,109,105,110,103, 40,116, 91, + 49, 93, 41, 10, 9, 9,101,110,100, 10, 32, 32,101, 46,108, + 110, 97,109,101,115, 91,105, 93, 32, 61, 32,116, 91, 50, 93, + 32,111,114, 32,116, 91, 49, 93, 10, 32, 32, 95,103,108,111, + 98, 97,108, 95,101,110,117,109,115, 91, 32,110,115, 46, 46, + 101, 91,105, 93, 32, 93, 32, 61, 32, 40,110,115, 46, 46,101, + 91,105, 93, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, + 32,101,110,100, 10, 9,101, 46,110, 97,109,101, 32, 61, 32, + 110, 10, 9,105,102, 32,110, 32,126, 61, 32, 34, 34, 32,116, + 104,101,110, 10, 9, 9, 84,121,112,101,100,101,102, 40, 34, + 105,110,116, 32, 34, 46, 46,110, 41, 10, 9,101,110,100, 10, + 32,114,101,116,117,114,110, 32, 95, 69,110,117,109,101,114, + 97,116,101, 40,101, 44, 32,118, 97,114,110, 97,109,101, 41, + 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/enumerate.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,100,101, 99,108, 97, + 114, 97,116,105,111,110, 32, 99,108, 97,115,115, 10, 45, 45, + 32, 87,114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108, + 100,101,109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, + 84,101, 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, + 10, 45, 45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, + 32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105, + 115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, 32, + 115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99, + 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,101, + 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,105, + 102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115, + 111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,101, + 100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, 32, + 111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, + 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104, + 101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,111, + 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, 32, + 112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,110, + 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, 32, + 117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, + 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,109, + 111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10, + 10, 45, 45, 32, 68,101, 99,108, 97,114, 97,116,105,111,110, + 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101, + 115,101,110,116,115, 32,118, 97,114,105, 97, 98,108,101, 44, + 32,102,117,110, 99,116,105,111,110, 44, 32,111,114, 32, 97, + 114,103,117,109,101,110,116, 32,100,101, 99,108, 97,114, 97, + 116,105,111,110, 46, 10, 45, 45, 32, 83,116,111,114,101,115, + 32,116,104,101, 32,102,111,108,108,111,119,105,110,103, 32, + 102,105,101,108,100,115, 58, 10, 45, 45, 32, 32,109,111,100, + 32, 32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105, + 101,114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32, + 116,121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61, + 32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102, + 32,114,101,112,114,101,115,101,110,116,105,110,103, 32, 97, + 32,112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114, + 101,102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97, + 109,101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,100, + 105,109, 32, 32, 61, 32,100,105,109,101,110,115,105,111,110, + 44, 32,105,102, 32, 97, 32,118,101, 99,116,111,114, 10, 45, + 45, 32, 32,100,101,102, 32, 32, 61, 32,100,101,102, 97,117, + 108,116, 32,118, 97,108,117,101, 44, 32,105,102, 32, 97,110, + 121, 32, 40,111,110,108,121, 32,102,111,114, 32, 97,114,103, + 117,109,101,110,116,115, 41, 10, 45, 45, 32, 32,114,101,116, + 32, 32, 61, 32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, + 32,105,102, 32,118, 97,108,117,101, 32,105,115, 32,116,111, + 32, 98,101, 32,114,101,116,117,114,110,101,100, 32, 40,111, + 110,108,121, 32,102,111,114, 32, 97,114,103,117,109,101,110, + 116,115, 41, 10, 99,108, 97,115,115, 68,101, 99,108, 97,114, + 97,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100, 32, + 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, + 39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10, 32, + 110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32,100,105,109, + 32, 61, 32, 39, 39, 44, 10, 32,114,101,116, 32, 61, 32, 39, + 39, 44, 10, 32,100,101,102, 32, 61, 32, 39, 39, 10,125, 10, + 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111, + 110, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97, + 115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 10,115, + 101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, 97, + 115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 44, 99, + 108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45, + 45, 32, 67,114,101, 97,116,101, 32, 97,110, 32,117,110,105, + 113,117,101, 32,118, 97,114,105, 97, 98,108,101, 32,110, 97, + 109,101, 10,102,117,110, 99,116,105,111,110, 32, 99,114,101, + 97,116,101, 95,118, 97,114,110, 97,109,101, 32, 40, 41, 10, + 32,105,102, 32,110,111,116, 32, 95,118, 97,114,110,117,109, + 98,101,114, 32,116,104,101,110, 32, 95,118, 97,114,110,117, + 109, 98,101,114, 32, 61, 32, 48, 32,101,110,100, 10, 32, 95, + 118, 97,114,110,117,109, 98,101,114, 32, 61, 32, 95,118, 97, + 114,110,117,109, 98,101,114, 32, 43, 32, 49, 10, 32,114,101, + 116,117,114,110, 32, 34,116,111,108,117, 97, 95,118, 97,114, + 95, 34, 46, 46, 95,118, 97,114,110,117,109, 98,101,114, 10, + 101,110,100, 10, 10, 45, 45, 32, 67,104,101, 99,107, 32,100, + 101, 99,108, 97,114, 97,116,105,111,110, 32,110, 97,109,101, + 10, 45, 45, 32, 73,116, 32, 97,108,115,111, 32,105,100,101, + 110,116,105,102,105,101,115, 32,100,101,102, 97,117,108,116, + 32,118, 97,108,117,101,115, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 58, 99,104,101, 99,107,110, 97,109,101, 32, 40, + 41, 10, 10, 32,105,102, 32,115,116,114,115,117, 98, 40,115, + 101,108,102, 46,110, 97,109,101, 44, 49, 44, 49, 41, 32, 61, + 61, 32, 39, 91, 39, 32, 97,110,100, 32,110,111,116, 32,102, + 105,110,100,116,121,112,101, 40,115,101,108,102, 46,116,121, + 112,101, 41, 32,116,104,101,110, 10, 32, 32,115,101,108,102, + 46,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,116,121, + 112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10, 32, + 32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105, + 116, 40,115,101,108,102, 46,109,111,100, 44, 39, 37,115, 37, + 115, 42, 39, 41, 10, 32, 32,115,101,108,102, 46,116,121,112, + 101, 32, 61, 32,109, 91,109, 46,110, 93, 10, 32, 32,115,101, + 108,102, 46,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, + 40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 10, 32,101,110, + 100, 10, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,115, + 112,108,105,116, 40,115,101,108,102, 46,110, 97,109,101, 44, + 39, 61, 39, 41, 10, 32,105,102, 32,116, 46,110, 61, 61, 50, + 32,116,104,101,110, 10, 32, 32,115,101,108,102, 46,110, 97, + 109,101, 32, 61, 32,116, 91, 49, 93, 10, 32, 32,115,101,108, + 102, 46,100,101,102, 32, 61, 32,102,105,110,100, 95,101,110, + 117,109, 95,118, 97,114, 40,116, 91,116, 46,110, 93, 41, 10, + 32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32, 98, 44, + 101, 44,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115, + 101,108,102, 46,110, 97,109,101, 44, 34, 37, 91, 40, 46, 45, + 41, 37, 93, 34, 41, 10, 32,105,102, 32, 98, 32,116,104,101, + 110, 10, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, + 32,115,116,114,115,117, 98, 40,115,101,108,102, 46,110, 97, + 109,101, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32,115,101,108, + 102, 46,100,105,109, 32, 61, 32,102,105,110,100, 95,101,110, + 117,109, 95,118, 97,114, 40,100, 41, 10, 32,101,110,100, 10, + 10, 10, 32,105,102, 32,115,101,108,102, 46,116,121,112,101, + 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, + 46,116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39, + 32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 32, + 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,115,101, + 108,102, 46,110, 97,109,101, 32, 61, 32, 99,114,101, 97,116, + 101, 95,118, 97,114,110, 97,109,101, 40, 41, 10, 32,101,108, + 115,101,105,102, 32,115,101,108,102, 46,107,105,110,100, 61, + 61, 39,118, 97,114, 39, 32,116,104,101,110, 10, 32, 32,105, + 102, 32,115,101,108,102, 46,116,121,112,101, 61, 61, 39, 39, + 32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101,126, + 61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,115,101,108, + 102, 46,116,121,112,101, 32, 61, 32,115,101,108,102, 46,116, + 121,112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10, + 32, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32, + 99,114,101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, + 41, 10, 32, 32,101,108,115,101,105,102, 32,102,105,110,100, + 116,121,112,101, 40,115,101,108,102, 46,110, 97,109,101, 41, + 32,116,104,101,110, 10, 32, 32, 32,105,102, 32,115,101,108, + 102, 46,116,121,112,101, 61, 61, 39, 39, 32,116,104,101,110, + 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101, + 108,102, 46,110, 97,109,101, 10, 32, 32, 32,101,108,115,101, + 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101, + 108,102, 46,116,121,112,101, 46, 46, 39, 32, 39, 46, 46,115, + 101,108,102, 46,110, 97,109,101, 32,101,110,100, 10, 32, 32, + 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32, 99,114, + 101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, 41, 10, + 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, + 32, 97,100,106,117,115,116, 32,116,121,112,101, 32,111,102, + 32,115,116,114,105,110,103, 10, 32,105,102, 32,115,101,108, + 102, 46,116,121,112,101, 32, 61, 61, 32, 39, 99,104, 97,114, + 39, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109, 32, + 126, 61, 32, 39, 39, 32,116,104,101,110, 10, 9, 32,115,101, + 108,102, 46,116,121,112,101, 32, 61, 32, 39, 99,104, 97,114, + 42, 39, 10, 32,101,110,100, 10, 10, 9,105,102, 32,115,101, + 108,102, 46,107,105,110,100, 32, 97,110,100, 32,115,101,108, + 102, 46,107,105,110,100, 32, 61, 61, 32, 39,118, 97,114, 39, + 32,116,104,101,110, 10, 9, 9,115,101,108,102, 46,110, 97, + 109,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40,115,101,108,102, 46,110, 97,109,101, 44, 32, 34, 58, + 46, 42, 36, 34, 44, 32, 34, 34, 41, 32, 45, 45, 32, 63, 63, + 63, 10, 9,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, + 67,104,101, 99,107, 32,100,101, 99,108, 97,114, 97,116,105, + 111,110, 32,116,121,112,101, 10, 45, 45, 32, 83,117, 98,115, + 116,105,116,117,116,101,115, 32,116,121,112,101,100,101,102, + 39,115, 46, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58, + 99,104,101, 99,107,116,121,112,101, 32, 40, 41, 10, 10, 32, + 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,116,104,101, + 114,101, 32,105,115, 32, 97, 32,112,111,105,110,116,101,114, + 32,116,111, 32, 98, 97,115,105, 99, 32,116,121,112,101, 10, + 32,108,111, 99, 97,108, 32, 98, 97,115,105, 99, 32, 61, 32, + 105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121, + 112,101, 41, 10, 32,105,102, 32,115,101,108,102, 46,107,105, + 110,100, 32, 61, 61, 32, 39,102,117,110, 99, 39, 32, 97,110, + 100, 32, 98, 97,115,105, 99, 61, 61, 39,110,117,109, 98,101, + 114, 39, 32, 97,110,100, 32,115,116,114,105,110,103, 46,102, + 105,110,100, 40,115,101,108,102, 46,112,116,114, 44, 32, 34, + 37, 42, 34, 41, 32,116,104,101,110, 10, 32, 9,115,101,108, + 102, 46,116,121,112,101, 32, 61, 32, 39, 95,117,115,101,114, + 100, 97,116, 97, 39, 10, 32, 9,115,101,108,102, 46,112,116, + 114, 32, 61, 32, 34, 34, 10, 32,101,110,100, 10, 32,105,102, + 32, 98, 97,115,105, 99, 32, 97,110,100, 32,115,101,108,102, + 46,112,116,114,126, 61, 39, 39, 32,116,104,101,110, 10, 32, + 32,115,101,108,102, 46,114,101,116, 32, 61, 32,115,101,108, + 102, 46,112,116,114, 10, 32, 32,115,101,108,102, 46,112,116, + 114, 32, 61, 32,110,105,108, 10, 32, 32,105,102, 32,105,115, + 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101, + 41, 32, 61, 61, 32, 39,110,117,109, 98,101,114, 39, 32,116, + 104,101,110, 10, 32, 32, 9,115,101,108,102, 46,114,101,116, + 117,114,110, 95,117,115,101,114,100, 97,116, 97, 32, 61, 32, + 116,114,117,101, 10, 32, 32,101,110,100, 10, 32,101,110,100, + 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32, + 116,104,101,114,101, 32,105,115, 32, 97,114,114, 97,121, 32, + 116,111, 32, 98,101, 32,114,101,116,117,114,110,101,100, 10, + 32,105,102, 32,115,101,108,102, 46,100,105,109,126, 61, 39, + 39, 32, 97,110,100, 32,115,101,108,102, 46,114,101,116,126, + 61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114,114, + 111,114, 40, 39, 35,105,110,118, 97,108,105,100, 32,112, 97, + 114, 97,109,101,116,101,114, 58, 32, 99, 97,110,110,111,116, + 32,114,101,116,117,114,110, 32, 97,110, 32, 97,114,114, 97, + 121, 32,111,102, 32,118, 97,108,117,101,115, 39, 41, 10, 32, + 101,110,100, 10, 32, 45, 45, 32,114,101,115,116,111,114,101, + 32, 39,118,111,105,100, 42, 39, 32, 97,110,100, 32, 39,115, + 116,114,105,110,103, 42, 39, 10, 32,105,102, 32,115,101,108, + 102, 46,116,121,112,101, 32, 61, 61, 32, 39, 95,117,115,101, + 114,100, 97,116, 97, 39, 32,116,104,101,110, 32,115,101,108, + 102, 46,116,121,112,101, 32, 61, 32, 39,118,111,105,100, 42, + 39, 10, 32,101,108,115,101,105,102, 32,115,101,108,102, 46, + 116,121,112,101, 32, 61, 61, 32, 39, 95, 99,115,116,114,105, + 110,103, 39, 32,116,104,101,110, 32,115,101,108,102, 46,116, + 121,112,101, 32, 61, 32, 39, 99,104, 97,114, 42, 39, 10, 32, + 101,108,115,101,105,102, 32,115,101,108,102, 46,116,121,112, + 101, 32, 61, 61, 32, 39, 95,108,115,116, 97,116,101, 39, 32, + 116,104,101,110, 32,115,101,108,102, 46,116,121,112,101, 32, + 61, 32, 39,108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10, + 32,101,110,100, 10, 10, 32, 45, 45, 32,114,101,115,111,108, + 118,101, 32,116,121,112,101,115, 32,105,110,115,105,100,101, + 32,116,104,101, 32,116,101,109,112,108, 97,116,101,115, 10, + 32,105,102, 32,115,101,108,102, 46,116,121,112,101, 32,116, + 104,101,110, 10, 9, 32,115,101,108,102, 46,116,121,112,101, + 32, 61, 32,114,101,115,111,108,118,101, 95,116,101,109,112, + 108, 97,116,101, 95,116,121,112,101,115, 40,115,101,108,102, + 46,116,121,112,101, 41, 10, 32,101,110,100, 10, 10, 45, 45, + 10, 45, 45, 32, 45, 45, 32,105,102, 32,114,101,116,117,114, + 110,105,110,103, 32,118, 97,108,117,101, 44, 32, 97,117,116, + 111,109, 97,116,105, 99, 97,108,108,121, 32,115,101,116, 32, + 100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 10, 45, + 45, 32,105,102, 32,115,101,108,102, 46,114,101,116, 32,126, + 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, 46,100, + 101,102, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 45, + 45, 32, 32,115,101,108,102, 46,100,101,102, 32, 61, 32, 39, + 48, 39, 10, 45, 45, 32,101,110,100, 10, 45, 45, 10, 10,101, + 110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,101, + 115,111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95, + 116,121,112,101,115, 40,116,121,112,101, 41, 10, 10, 9,105, + 102, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, 41, + 32,116,104,101,110, 10, 9, 9,114,101,116,117,114,110, 32, + 116,121,112,101, 10, 9,101,110,100, 10, 9,108,111, 99, 97, + 108, 32, 98, 44, 95, 44,109, 32, 61, 32,115,116,114,105,110, + 103, 46,102,105,110,100, 40,116,121,112,101, 44, 32, 34, 40, + 37, 98, 60, 62, 41, 34, 41, 10, 9,105,102, 32, 98, 32,116, + 104,101,110, 10, 10, 9, 9,109, 32, 61, 32,115,112,108,105, + 116, 95, 99, 95,116,111,107,101,110,115, 40,115,116,114,105, + 110,103, 46,115,117, 98, 40,109, 44, 32, 50, 44, 32, 45, 50, + 41, 44, 32, 34, 44, 34, 41, 10, 9, 9,102,111,114, 32,105, + 61, 49, 44, 32,116, 97, 98,108,101, 46,103,101,116,110, 40, + 109, 41, 32,100,111, 10, 9, 9, 9,109, 91,105, 93, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109, 91, + 105, 93, 44, 34, 37,115, 42, 40, 91, 37, 42, 38, 93, 41, 34, + 44, 32, 34, 37, 49, 34, 41, 10, 9, 9, 9,105,102, 32,110, + 111,116, 32,105,115,101,110,117,109, 40,109, 91,105, 93, 41, + 32,116,104,101,110, 32, 95, 44, 32,109, 91,105, 93, 32, 61, + 32, 97,112,112,108,121,116,121,112,101,100,101,102, 40, 34, + 34, 44, 32,109, 91,105, 93, 41, 32,101,110,100, 10, 9, 9, + 9,109, 91,105, 93, 32, 61, 32,102,105,110,100,116,121,112, + 101, 40,109, 91,105, 93, 41, 32,111,114, 32,109, 91,105, 93, + 10, 9, 9, 9,109, 91,105, 93, 32, 61, 32,114,101,115,111, + 108,118,101, 95,116,101,109,112,108, 97,116,101, 95,116,121, + 112,101,115, 40,109, 91,105, 93, 41, 10, 9, 9,101,110,100, + 10, 10, 9, 9,108,111, 99, 97,108, 32, 98, 44,105, 10, 9, + 9,116,121,112,101, 44, 98, 44,105, 32, 61, 32, 98,114,101, + 97,107, 95,116,101,109,112,108, 97,116,101, 40,116,121,112, + 101, 41, 10, 45, 45,112,114,105,110,116, 40, 34, 99,111,110, + 99, 97,116, 32,105,115, 32, 34, 44, 99,111,110, 99, 97,116, + 40,109, 44, 32, 49, 44, 32,109, 46,110, 41, 41, 10, 9, 9, + 108,111, 99, 97,108, 32,116,101,109,112,108, 97,116,101, 95, + 112, 97,114,116, 32, 61, 32, 34, 60, 34, 46, 46, 99,111,110, + 99, 97,116, 40,109, 44, 32, 49, 44, 32,109, 46,110, 44, 32, + 34, 44, 34, 41, 46, 46, 34, 62, 34, 10, 9, 9,116,121,112, + 101, 32, 61, 32,114,101, 98,117,105,108,100, 95,116,101,109, + 112,108, 97,116,101, 40,116,121,112,101, 44, 32, 98, 44, 32, + 116,101,109,112,108, 97,116,101, 95,112, 97,114,116, 41, 10, + 9, 9,116,121,112,101, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,116,121,112,101, 44, 32, 34, 62, 62, + 34, 44, 32, 34, 62, 32, 62, 34, 41, 10, 9,101,110,100, 10, + 9,114,101,116,117,114,110, 32,116,121,112,101, 10,101,110, + 100, 10, 10,102,117,110, 99,116,105,111,110, 32, 98,114,101, + 97,107, 95,116,101,109,112,108, 97,116,101, 40,115, 41, 10, + 9,108,111, 99, 97,108, 32, 98, 44,101, 44,116,105,109,112, + 108, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, + 40,115, 44, 32, 34, 40, 37, 98, 60, 62, 41, 34, 41, 10, 9, + 105,102, 32,116,105,109,112,108, 32,116,104,101,110, 10, 9, + 9,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40,115, 44, 32, 34, 37, 98, 60, 62, 34, 44, 32, 34, 34, + 41, 10, 9, 9,114,101,116,117,114,110, 32,115, 44, 32, 98, + 44, 32,116,105,109,112,108, 10, 9,101,108,115,101, 10, 9, + 9,114,101,116,117,114,110, 32,115, 44, 32, 48, 44, 32,110, + 105,108, 10, 9,101,110,100, 10,101,110,100, 10, 10,102,117, + 110, 99,116,105,111,110, 32,114,101, 98,117,105,108,100, 95, + 116,101,109,112,108, 97,116,101, 40,115, 44, 32, 98, 44, 32, + 116,105,109,112,108, 41, 10, 10, 9,105,102, 32, 98, 32, 61, + 61, 32, 48, 32,116,104,101,110, 10, 9, 9,114,101,116,117, + 114,110, 32,115, 10, 9,101,110,100, 10, 10, 9,114,101,116, + 117,114,110, 32,115,116,114,105,110,103, 46,115,117, 98, 40, + 115, 44, 32, 49, 44, 32, 98, 45, 49, 41, 46, 46,116,105,109, + 112,108, 46, 46,115,116,114,105,110,103, 46,115,117, 98, 40, + 115, 44, 32, 98, 44, 32, 45, 49, 41, 10,101,110,100, 10, 10, + 45, 45, 32, 80,114,105,110,116, 32,109,101,116,104,111,100, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 68,101, 99,108, 97,114, 97,116,105,111,110, 58,112,114,105, + 110,116, 32, 40,105,100,101,110,116, 44, 99,108,111,115,101, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 68,101, 99,108, 97,114, 97,116,105,111,110,123, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, + 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97, + 109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105, + 110,116, 40,105,100,101,110,116, 46, 46, 34, 32,100,105,109, + 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100,105, + 109, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, + 40,105,100,101,110,116, 46, 46, 34, 32,100,101,102, 32, 32, + 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100,101,102, 46, + 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105, + 100,101,110,116, 46, 46, 34, 32,114,101,116, 32, 32, 61, 32, + 39, 34, 46, 46,115,101,108,102, 46,114,101,116, 46, 46, 34, + 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, + 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32, + 105,102, 32, 97,114,114, 97,121, 32,111,102, 32,118, 97,108, + 117,101,115, 32, 97,114,101, 32,114,101,116,117,114,110,101, + 100, 32,116,111, 32, 76,117, 97, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97, + 116,105,111,110, 58,114,101,113,117,105,114,101, 99,111,108, + 108,101, 99,116,105,111,110, 32, 40,116, 41, 10, 32,105,102, + 32,115,101,108,102, 46,109,111,100, 32,126, 61, 32, 39, 99, + 111,110,115,116, 39, 32, 97,110,100, 10, 9, 32, 32, 32, 32, + 115,101,108,102, 46,100,105,109, 32, 97,110,100, 32,115,101, + 108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32, 97,110, + 100, 10, 9, 9, 9, 9, 32,110,111,116, 32,105,115, 98, 97, + 115,105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 32, + 97,110,100, 10, 9, 9, 9, 9, 32,115,101,108,102, 46,112, + 116,114, 32, 61, 61, 32, 39, 39, 32, 97,110,100, 32,115,101, + 108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, + 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10, + 9, 9,108,111, 99, 97,108, 32,116,121,112,101, 32, 61, 32, + 103,115,117, 98, 40,115,101,108,102, 46,116,121,112,101, 44, + 34, 37,115, 42, 99,111,110,115,116, 37,115, 43, 34, 44, 34, + 34, 41, 10, 9, 9,116, 91,116,121,112,101, 93, 32, 61, 32, + 34,116,111,108,117, 97, 95, 99,111,108,108,101, 99,116, 95, + 34, 32, 46, 46, 32, 99,108,101, 97,110, 95,116,101,109,112, + 108, 97,116,101, 40,116,121,112,101, 41, 10, 9, 9,114,101, + 116,117,114,110, 32,116,114,117,101, 10, 9,101,110,100, 10, + 9,114,101,116,117,114,110, 32,102, 97,108,115,101, 10,101, + 110,100, 10, 10, 45, 45, 32,100,101, 99,108, 97,114,101, 32, + 116, 97,103, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58, + 100,101, 99,108,116,121,112,101, 32, 40, 41, 10, 10, 9,115, + 101,108,102, 46,116,121,112,101, 32, 61, 32,116,121,112,101, + 118, 97,114, 40,115,101,108,102, 46,116,121,112,101, 41, 10, + 9,105,102, 32,115,116,114,102,105,110,100, 40,115,101,108, + 102, 46,109,111,100, 44, 39, 99,111,110,115,116, 39, 41, 32, + 116,104,101,110, 10, 9, 9,115,101,108,102, 46,116,121,112, + 101, 32, 61, 32, 39, 99,111,110,115,116, 32, 39, 46, 46,115, + 101,108,102, 46,116,121,112,101, 10, 9, 9,115,101,108,102, + 46,109,111,100, 32, 61, 32,103,115,117, 98, 40,115,101,108, + 102, 46,109,111,100, 44, 39, 99,111,110,115,116, 37,115, 42, + 39, 44, 39, 39, 41, 10, 9,101,110,100, 10,101,110,100, 10, + 10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116,121,112, + 101, 32, 99,104,101, 99,107,105,110,103, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97, + 114, 97,116,105,111,110, 58,111,117,116, 99,104,101, 99,107, + 116,121,112,101, 32, 40,110, 97,114,103, 41, 10, 32,108,111, + 99, 97,108, 32,100,101,102, 10, 32,108,111, 99, 97,108, 32, + 116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108, + 102, 46,116,121,112,101, 41, 10, 32,105,102, 32,115,101,108, + 102, 46,100,101,102,126, 61, 39, 39, 32,116,104,101,110, 10, + 32, 32,100,101,102, 32, 61, 32, 49, 10, 32,101,108,115,101, + 10, 32, 32,100,101,102, 32, 61, 32, 48, 10, 32,101,110,100, + 10, 32,105,102, 32,115,101,108,102, 46,100,105,109, 32,126, + 61, 32, 39, 39, 32,116,104,101,110, 10, 9, 45, 45,105,102, + 32,116, 61, 61, 39,115,116,114,105,110,103, 39, 32,116,104, + 101,110, 10, 9, 45, 45, 9,114,101,116,117,114,110, 32, 39, + 116,111,108,117, 97, 95,105,115,115,116,114,105,110,103, 97, + 114,114, 97,121, 40,116,111,108,117, 97, 95, 83, 44, 39, 46, + 46,110, 97,114,103, 46, 46, 39, 44, 39, 46, 46,100,101,102, + 46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, + 39, 10, 9, 45, 45,101,108,115,101, 10, 9,114,101,116,117, + 114,110, 32, 39, 33,116,111,108,117, 97, 95,105,115,116, 97, + 98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 39, 46, 46, + 110, 97,114,103, 46, 46, 39, 44, 48, 44, 38,116,111,108,117, + 97, 95,101,114,114, 41, 39, 10, 32, 9, 45, 45,101,110,100, + 10, 32,101,108,115,101,105,102, 32,116, 32,116,104,101,110, + 10, 9,114,101,116,117,114,110, 32, 39, 33,116,111,108,117, + 97, 95,105,115, 39, 46, 46,116, 46, 46, 39, 40,116,111,108, + 117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39, + 44, 39, 46, 46,100,101,102, 46, 46, 39, 44, 38,116,111,108, + 117, 97, 95,101,114,114, 41, 39, 10, 32,101,108,115,101, 10, + 32, 32,108,111, 99, 97,108, 32,105,115, 95,102,117,110, 99, + 32, 61, 32,103,101,116, 95,105,115, 95,102,117,110, 99,116, + 105,111,110, 40,115,101,108,102, 46,116,121,112,101, 41, 10, + 32, 32,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, + 61, 32, 39, 38, 39, 32,111,114, 32,115,101,108,102, 46,112, + 116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, + 32, 9,114,101,116,117,114,110, 32, 39, 40,116,111,108,117, + 97, 95,105,115,118, 97,108,117,101,110,105,108, 40,116,111, + 108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, + 39, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, 32,124, + 124, 32, 33, 39, 46, 46,105,115, 95,102,117,110, 99, 46, 46, + 39, 40,116,111,108,117, 97, 95, 83, 44, 39, 46, 46,110, 97, + 114,103, 46, 46, 39, 44, 34, 39, 46, 46,115,101,108,102, 46, + 116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46,100,101,102, + 46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, + 41, 39, 10, 32, 32,101,108,115,101, 10, 9,114,101,116,117, + 114,110, 32, 39, 33, 39, 46, 46,105,115, 95,102,117,110, 99, + 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 39, 46, 46, + 110, 97,114,103, 46, 46, 39, 44, 34, 39, 46, 46,115,101,108, + 102, 46,116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46,100, + 101,102, 46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114, + 114, 41, 39, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, + 101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99, + 108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, + 58, 98,117,105,108,100,100,101, 99,108, 97,114, 97,116,105, + 111,110, 32, 40,110, 97,114,103, 44, 32, 99,112,108,117,115, + 112,108,117,115, 41, 10, 32,108,111, 99, 97,108, 32, 97,114, + 114, 97,121, 32, 61, 32,115,101,108,102, 46,100,105,109, 32, + 126, 61, 32, 39, 39, 32, 97,110,100, 32,116,111,110,117,109, + 98,101,114, 40,115,101,108,102, 46,100,105,109, 41, 61, 61, + 110,105,108, 10, 9,108,111, 99, 97,108, 32,108,105,110,101, + 32, 61, 32, 34, 34, 10, 32,108,111, 99, 97,108, 32,112,116, + 114, 32, 61, 32, 39, 39, 10, 32,108,111, 99, 97,108, 32,109, + 111,100, 10, 32,108,111, 99, 97,108, 32,116,121,112,101, 32, + 61, 32,115,101,108,102, 46,116,121,112,101, 10, 32,108,111, + 99, 97,108, 32,110, 99,116,121,112,101, 32, 61, 32,103,115, + 117, 98, 40,115,101,108,102, 46,116,121,112,101, 44, 39, 99, + 111,110,115,116, 37,115, 43, 39, 44, 39, 39, 41, 10, 32,105, + 102, 32,115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 9, 32,116,121,112,101, 32, 61, + 32,103,115,117, 98, 40,115,101,108,102, 46,116,121,112,101, + 44, 39, 99,111,110,115,116, 37,115, 43, 39, 44, 39, 39, 41, + 32, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,115, + 32, 99,111,110,115,116, 32,109,111,100,105,102,105,101,114, + 32,102,111,114, 32, 97,114,114, 97,121,115, 10, 32,101,110, + 100, 10, 32,105,102, 32,115,101,108,102, 46,112,116,114,126, + 61, 39, 39, 32, 97,110,100, 32,110,111,116, 32,105,115, 98, + 97,115,105, 99, 40,116,121,112,101, 41, 32,116,104,101,110, + 32,112,116,114, 32, 61, 32, 39, 42, 39, 32,101,110,100, 10, + 32,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, + 97,114, 97,109, 40,108,105,110,101, 44, 34, 32, 34, 44,115, + 101,108,102, 46,109,111,100, 44,116,121,112,101, 44,112,116, + 114, 41, 10, 32,105,102, 32, 97,114,114, 97,121, 32,116,104, + 101,110, 10, 32, 32,108,105,110,101, 32, 61, 32, 99,111,110, + 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39, + 42, 39, 41, 10, 32,101,110,100, 10, 32,108,105,110,101, 32, + 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108, + 105,110,101, 44,115,101,108,102, 46,110, 97,109,101, 41, 10, + 32,105,102, 32,115,101,108,102, 46,100,105,109, 32,126, 61, + 32, 39, 39, 32,116,104,101,110, 10, 32, 32,105,102, 32,116, + 111,110,117,109, 98,101,114, 40,115,101,108,102, 46,100,105, + 109, 41,126, 61,110,105,108, 32,116,104,101,110, 10, 32, 32, + 32,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, + 97,114, 97,109, 40,108,105,110,101, 44, 39, 91, 39, 44,115, + 101,108,102, 46,100,105,109, 44, 39, 93, 59, 39, 41, 10, 32, + 32,101,108,115,101, 10, 9,105,102, 32, 99,112,108,117,115, + 112,108,117,115, 32,116,104,101,110, 10, 9, 9,108,105,110, + 101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, + 40,108,105,110,101, 44, 39, 32, 61, 32, 77,116,111,108,117, + 97, 95,110,101,119, 40, 40, 39, 44,116,121,112,101, 44,112, + 116,114, 44, 39, 41, 91, 39, 46, 46,115,101,108,102, 46,100, + 105,109, 46, 46, 39, 93, 41, 59, 39, 41, 10, 9,101,108,115, + 101, 10, 9, 9,108,105,110,101, 32, 61, 32, 99,111,110, 99, + 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 32, + 61, 32, 40, 39, 44,116,121,112,101, 44,112,116,114, 44, 39, + 42, 41, 39, 44, 10, 9, 9, 39,109, 97,108,108,111, 99, 40, + 40, 39, 44,115,101,108,102, 46,100,105,109, 44, 39, 41, 42, + 115,105,122,101,111,102, 40, 39, 44,116,121,112,101, 44,112, + 116,114, 44, 39, 41, 41, 59, 39, 41, 10, 9,101,110,100, 10, + 32, 32,101,110,100, 10, 32,101,108,115,101, 10, 32, 32,108, + 111, 99, 97,108, 32,116, 32, 61, 32,105,115, 98, 97,115,105, + 99, 40,116,121,112,101, 41, 10, 32, 32,108,105,110,101, 32, + 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108, + 105,110,101, 44, 39, 32, 61, 32, 39, 41, 10, 32, 32,105,102, + 32,116, 32, 61, 61, 32, 39,115,116, 97,116,101, 39, 32,116, + 104,101,110, 10, 32, 32, 9,108,105,110,101, 32, 61, 32, 99, + 111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, + 44, 32, 39,116,111,108,117, 97, 95, 83, 59, 39, 41, 10, 32, + 32,101,108,115,101, 10, 32, 32, 9, 45, 45,112,114,105,110, + 116, 40, 34,116, 32,105,115, 32, 34, 46, 46,116,111,115,116, + 114,105,110,103, 40,116, 41, 46, 46, 34, 44, 32,112,116,114, + 32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103, + 40,115,101,108,102, 46,112,116,114, 41, 41, 10, 32, 32, 9, + 105,102, 32,116, 32, 61, 61, 32, 39,110,117,109, 98,101,114, + 39, 32, 97,110,100, 32,115,116,114,105,110,103, 46,102,105, + 110,100, 40,115,101,108,102, 46,112,116,114, 44, 32, 34, 37, + 42, 34, 41, 32,116,104,101,110, 10, 32, 32, 9, 9,116, 32, + 61, 32, 39,117,115,101,114,100, 97,116, 97, 39, 10, 32, 32, + 9,101,110,100, 10, 9,105,102, 32,110,111,116, 32,116, 32, + 97,110,100, 32,112,116,114, 61, 61, 39, 39, 32,116,104,101, + 110, 32,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116, + 112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 42, 39, 41, + 32,101,110,100, 10, 9,108,105,110,101, 32, 61, 32, 99,111, + 110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, + 39, 40, 40, 39, 44,115,101,108,102, 46,109,111,100, 44,116, + 121,112,101, 41, 10, 9,105,102, 32,110,111,116, 32,116, 32, + 116,104,101,110, 10, 9, 9,108,105,110,101, 32, 61, 32, 99, + 111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, + 44, 39, 42, 39, 41, 10, 9,101,110,100, 10, 9,108,105,110, + 101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, + 40,108,105,110,101, 44, 39, 41, 32, 39, 41, 10, 9,105,102, + 32,105,115,101,110,117,109, 40,110, 99,116,121,112,101, 41, + 32,116,104,101,110, 10, 9, 9,108,105,110,101, 32, 61, 32, + 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110, + 101, 44, 39, 40,105,110,116, 41, 32, 39, 41, 10, 9,101,110, + 100, 10, 9,108,111, 99, 97,108, 32,100,101,102, 32, 61, 32, + 48, 10, 9,105,102, 32,115,101,108,102, 46,100,101,102, 32, + 126, 61, 32, 39, 39, 32,116,104,101,110, 10, 9, 9,100,101, + 102, 32, 61, 32,115,101,108,102, 46,100,101,102, 10, 9, 9, + 105,102, 32, 40,112,116,114, 32, 61, 61, 32, 39, 39, 32,111, + 114, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, + 38, 39, 41, 32, 97,110,100, 32,110,111,116, 32,116, 32,116, + 104,101,110, 10, 9, 9, 9,100,101,102, 32, 61, 32, 34, 40, + 118,111,105,100, 42, 41, 38, 40, 99,111,110,115,116, 32, 34, + 46, 46,116,121,112,101, 46, 46, 34, 41, 34, 46, 46,100,101, + 102, 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 9,105, + 102, 32,116, 32,116,104,101,110, 10, 9, 9,108,105,110,101, + 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40, + 108,105,110,101, 44, 39,116,111,108,117, 97, 95,116,111, 39, + 46, 46,116, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 39, + 44,110, 97,114,103, 44, 39, 44, 39, 44,100,101,102, 44, 39, + 41, 41, 59, 39, 41, 10, 9,101,108,115,101, 10, 9, 9,108, + 111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32, + 103,101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110, + 40,116,121,112,101, 41, 10, 9, 9,108,105,110,101, 32, 61, + 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105, + 110,101, 44,116,111, 95,102,117,110, 99, 46, 46, 39, 40,116, + 111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, + 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10, 9, + 101,110,100, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, + 9,114,101,116,117,114,110, 32,108,105,110,101, 10,101,110, + 100, 10, 10, 45, 45, 32, 68,101, 99,108, 97,114,101, 32,118, + 97,114,105, 97, 98,108,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 58,100,101, 99,108, 97,114,101, 32, 40,110, 97, + 114,103, 41, 10, 32,105,102, 32,115,101,108,102, 46,100,105, + 109, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,116,111,110, + 117,109, 98,101,114, 40,115,101,108,102, 46,100,105,109, 41, + 61, 61,110,105,108, 32,116,104,101,110, 10, 9, 32,111,117, + 116,112,117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, + 99,112,108,117,115,112,108,117,115, 92,110, 39, 41, 10, 9, + 9,111,117,116,112,117,116, 40,115,101,108,102, 58, 98,117, + 105,108,100,100,101, 99,108, 97,114, 97,116,105,111,110, 40, + 110, 97,114,103, 44,116,114,117,101, 41, 41, 10, 9, 9,111, + 117,116,112,117,116, 40, 39, 35,101,108,115,101, 92,110, 39, + 41, 10, 9, 9,111,117,116,112,117,116, 40,115,101,108,102, + 58, 98,117,105,108,100,100,101, 99,108, 97,114, 97,116,105, + 111,110, 40,110, 97,114,103, 44,102, 97,108,115,101, 41, 41, + 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 10, 9,101,108,115,101, 10, 9, 9, + 111,117,116,112,117,116, 40,115,101,108,102, 58, 98,117,105, + 108,100,100,101, 99,108, 97,114, 97,116,105,111,110, 40,110, + 97,114,103, 44,102, 97,108,115,101, 41, 41, 10, 9,101,110, + 100, 10,101,110,100, 10, 10, 45, 45, 32, 71,101,116, 32,112, + 97,114, 97,109,101,116,101,114, 32,118, 97,108,117,101, 10, + 102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68, + 101, 99,108, 97,114, 97,116,105,111,110, 58,103,101,116, 97, + 114,114, 97,121, 32, 40,110, 97,114,103, 41, 10, 32,105,102, + 32,115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, + 32,116,104,101,110, 10, 9, 32,108,111, 99, 97,108, 32,116, + 121,112,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, + 46,116,121,112,101, 44, 39, 99,111,110,115,116, 32, 39, 44, + 39, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32,123, 39, 41, 10, 9, 32,111,117,116,112,117,116, 40, 39, + 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, + 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 32, 32,108,111, + 99, 97,108, 32,100,101,102, 59, 32,105,102, 32,115,101,108, + 102, 46,100,101,102,126, 61, 39, 39, 32,116,104,101,110, 32, + 100,101,102, 61, 49, 32,101,108,115,101, 32,100,101,102, 61, + 48, 32,101,110,100, 10, 9, 9,108,111, 99, 97,108, 32,116, + 32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, + 41, 10, 9, 9,105,102, 32, 40,116, 41, 32,116,104,101,110, + 10, 9, 9, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32, 32,105,102, 32, 40, 33,116,111,108,117, 97, 95,105,115, + 39, 46, 46,116, 46, 46, 39, 97,114,114, 97,121, 40,116,111, + 108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44, + 39, 44,115,101,108,102, 46,100,105,109, 44, 39, 44, 39, 44, + 100,101,102, 44, 39, 44, 38,116,111,108,117, 97, 95,101,114, + 114, 41, 41, 39, 41, 10, 9, 9,101,108,115,101, 10, 9, 9, + 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,105, + 102, 32, 40, 33,116,111,108,117, 97, 95,105,115,117,115,101, + 114,116,121,112,101, 97,114,114, 97,121, 40,116,111,108,117, + 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44, 34, 39, + 44,116,121,112,101, 44, 39, 34, 44, 39, 44,115,101,108,102, + 46,100,105,109, 44, 39, 44, 39, 44,100,101,102, 44, 39, 44, + 38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39, 41, 10, + 9, 9,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, + 39, 32, 32, 32, 32,103,111,116,111, 32,116,111,108,117, 97, + 95,108,101,114,114,111,114, 59, 39, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 39, 32, 32, 32,101,108,115,101, 92,110, + 39, 41, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,101, + 110,100,105,102, 92,110, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 32, 32,123, 39, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 39, 32, 32, 32, 32,105,110,116, 32,105, + 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32, 32, 32,102,111,114, 40,105, 61, 48, 59, 32,105, 60, 39, + 46, 46,115,101,108,102, 46,100,105,109, 46, 46, 39, 59,105, + 43, 43, 41, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,116, + 32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, + 41, 10, 32, 32,108,111, 99, 97,108, 32,112,116,114, 32, 61, + 32, 39, 39, 10, 32, 32,105,102, 32,115,101,108,102, 46,112, + 116,114,126, 61, 39, 39, 32,116,104,101,110, 32,112,116,114, + 32, 61, 32, 39, 42, 39, 32,101,110,100, 10, 32, 32,111,117, + 116,112,117,116, 40, 39, 32, 32, 32, 39, 44,115,101,108,102, + 46,110, 97,109,101, 46, 46, 39, 91,105, 93, 32, 61, 32, 39, + 41, 10, 32, 32,105,102, 32,110,111,116, 32,116, 32, 97,110, + 100, 32,112,116,114, 61, 61, 39, 39, 32,116,104,101,110, 32, + 111,117,116,112,117,116, 40, 39, 42, 39, 41, 32,101,110,100, + 10, 32, 32,111,117,116,112,117,116, 40, 39, 40, 40, 39, 44, + 116,121,112,101, 41, 10, 32, 32,105,102, 32,110,111,116, 32, + 116, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 42, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32, + 111,117,116,112,117,116, 40, 39, 41, 32, 39, 41, 10, 32, 32, + 108,111, 99, 97,108, 32,100,101,102, 32, 61, 32, 48, 10, 32, + 32,105,102, 32,115,101,108,102, 46,100,101,102, 32,126, 61, + 32, 39, 39, 32,116,104,101,110, 32,100,101,102, 32, 61, 32, + 115,101,108,102, 46,100,101,102, 32,101,110,100, 10, 32, 32, + 105,102, 32,116, 32,116,104,101,110, 10, 32, 32, 32,111,117, + 116,112,117,116, 40, 39,116,111,108,117, 97, 95,116,111,102, + 105,101,108,100, 39, 46, 46,116, 46, 46, 39, 40,116,111,108, + 117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, + 43, 49, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, + 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112, + 117,116, 40, 39,116,111,108,117, 97, 95,116,111,102,105,101, + 108,100,117,115,101,114,116,121,112,101, 40,116,111,108,117, + 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43, + 49, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10, + 32, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, + 39, 32, 32, 32,125, 39, 41, 10, 32, 32,111,117,116,112,117, + 116, 40, 39, 32, 32,125, 39, 41, 10, 32,101,110,100, 10,101, + 110,100, 10, 10, 45, 45, 32, 71,101,116, 32,112, 97,114, 97, + 109,101,116,101,114, 32,118, 97,108,117,101, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, + 97,114, 97,116,105,111,110, 58,115,101,116, 97,114,114, 97, + 121, 32, 40,110, 97,114,103, 41, 10, 32,105,102, 32,110,111, + 116, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, + 116,121,112,101, 44, 39, 99,111,110,115,116, 37,115, 43, 39, + 41, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109, 32, + 126, 61, 32, 39, 39, 32,116,104,101,110, 10, 9, 32,108,111, + 99, 97,108, 32,116,121,112,101, 32, 61, 32,103,115,117, 98, + 40,115,101,108,102, 46,116,121,112,101, 44, 39, 99,111,110, + 115,116, 32, 39, 44, 39, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 32,123, 39, 41, 10, 32, 32,111,117,116, + 112,117,116, 40, 39, 32, 32, 32,105,110,116, 32,105, 59, 39, + 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 102,111,114, 40,105, 61, 48, 59, 32,105, 60, 39, 46, 46,115, + 101,108,102, 46,100,105,109, 46, 46, 39, 59,105, 43, 43, 41, + 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,116, 44, 99,116, + 32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, + 41, 10, 32, 32,105,102, 32,116, 32,116,104,101,110, 10, 32, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116, + 111,108,117, 97, 95,112,117,115,104,102,105,101,108,100, 39, + 46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, + 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49, 44, 40, 39, + 44, 99,116, 44, 39, 41, 39, 44,115,101,108,102, 46,110, 97, + 109,101, 44, 39, 91,105, 93, 41, 59, 39, 41, 10, 32, 32,101, + 108,115,101, 10, 32, 32, 32,105,102, 32,115,101,108,102, 46, + 112,116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, + 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, + 32,123, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108, + 117,115,112,108,117,115, 92,110, 39, 41, 10, 32, 32, 32, 32, + 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,111, + 105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32, 61, + 32, 77,116,111,108,117, 97, 95,110,101,119, 40, 40, 39, 44, + 116,121,112,101, 44, 39, 41, 40, 39, 44,115,101,108,102, 46, + 110, 97,109,101, 44, 39, 91,105, 93, 41, 41, 59, 39, 41, 10, + 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, + 32, 32,116,111,108,117, 97, 95,112,117,115,104,102,105,101, + 108,100,117,115,101,114,116,121,112,101, 95, 97,110,100, 95, + 116, 97,107,101,111,119,110,101,114,115,104,105,112, 40,116, + 111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, + 44,105, 43, 49, 44,116,111,108,117, 97, 95,111, 98,106, 44, + 34, 39, 44,116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, + 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 35,101, + 108,115,101, 92,110, 39, 41, 10, 32, 32, 32, 32, 32,111,117, + 116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,105,100, 42, + 32,116,111,108,117, 97, 95,111, 98,106, 32, 61, 32,116,111, + 108,117, 97, 95, 99,111,112,121, 40,116,111,108,117, 97, 95, + 83, 44, 40,118,111,105,100, 42, 41, 38, 39, 44,115,101,108, + 102, 46,110, 97,109,101, 44, 39, 91,105, 93, 44,115,105,122, + 101,111,102, 40, 39, 44,116,121,112,101, 44, 39, 41, 41, 59, + 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, + 39, 32, 32, 32, 32,116,111,108,117, 97, 95,112,117,115,104, + 102,105,101,108,100,117,115,101,114,116,121,112,101, 40,116, + 111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, + 44,105, 43, 49, 44,116,111,108,117, 97, 95,111, 98,106, 44, + 34, 39, 44,116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, + 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 35,101, + 110,100,105,102, 92,110, 39, 41, 10, 32, 32, 32, 32, 32,111, + 117,116,112,117,116, 40, 39, 32, 32, 32,125, 39, 41, 10, 32, + 32, 32,101,108,115,101, 10, 32, 32, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 32, 32,116,111,108,117, 97, 95,112,117, + 115,104,102,105,101,108,100,117,115,101,114,116,121,112,101, + 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, + 44, 39, 44,105, 43, 49, 44, 40,118,111,105,100, 42, 41, 39, + 44,115,101,108,102, 46,110, 97,109,101, 44, 39, 91,105, 93, + 44, 34, 39, 44,116,121,112,101, 44, 39, 34, 41, 59, 39, 41, + 10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 32, + 32,111,117,116,112,117,116, 40, 39, 32, 32,125, 39, 41, 10, + 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 70,114, + 101,101, 32,100,121,110, 97,109,105, 99, 97,108,108,121, 32, + 97,108,108,111, 99, 97,116,101,100, 32, 97,114,114, 97,121, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 68,101, 99,108, 97,114, 97,116,105,111,110, 58,102,114,101, + 101, 97,114,114, 97,121, 32, 40, 41, 10, 32,105,102, 32,115, + 101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32, 97, + 110,100, 32,116,111,110,117,109, 98,101,114, 40,115,101,108, + 102, 46,100,105,109, 41, 61, 61,110,105,108, 32,116,104,101, + 110, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,105,102, + 100,101,102, 32, 95, 95, 99,112,108,117,115,112,108,117,115, + 92,110, 39, 41, 10, 9, 9,111,117,116,112,117,116, 40, 39, + 32, 32, 77,116,111,108,117, 97, 95,100,101,108,101,116,101, + 95,100,105,109, 40, 39, 44,115,101,108,102, 46,110, 97,109, + 101, 44, 39, 41, 59, 39, 41, 10, 9, 32,111,117,116,112,117, + 116, 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10, 32, 32, + 111,117,116,112,117,116, 40, 39, 32, 32,102,114,101,101, 40, + 39, 44,115,101,108,102, 46,110, 97,109,101, 44, 39, 41, 59, + 39, 41, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,101, + 110,100,105,102, 92,110, 39, 41, 10, 32,101,110,100, 10,101, + 110,100, 10, 10, 45, 45, 32, 80, 97,115,115, 32,112, 97,114, + 97,109,101,116,101,114, 10,102,117,110, 99,116,105,111,110, + 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105, + 111,110, 58,112, 97,115,115,112, 97,114, 32, 40, 41, 10, 32, + 105,102, 32,115,101,108,102, 46,112,116,114, 61, 61, 39, 38, + 39, 32, 97,110,100, 32,110,111,116, 32,105,115, 98, 97,115, + 105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 32,116, + 104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 42, + 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 41, 10, 32, + 101,108,115,101,105,102, 32,115,101,108,102, 46,114,101,116, + 61, 61, 39, 42, 39, 32,116,104,101,110, 10, 32, 32,111,117, + 116,112,117,116, 40, 39, 38, 39, 46, 46,115,101,108,102, 46, + 110, 97,109,101, 41, 10, 32,101,108,115,101, 10, 32, 32,111, + 117,116,112,117,116, 40,115,101,108,102, 46,110, 97,109,101, + 41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, + 82,101,116,117,114,110, 32,112, 97,114, 97,109,101,116,101, + 114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 58,114,101,116,118, 97,108,117,101, 32, 40, 41, + 10, 32,105,102, 32,115,101,108,102, 46,114,101,116, 32,126, + 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,108,111, 99, + 97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115, + 105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, + 32,105,102, 32,116, 32, 97,110,100, 32,116,126, 61, 39, 39, + 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 32, 32,116,111,108,117, 97, 95,112,117,115,104, + 39, 46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, + 44, 40, 39, 44, 99,116, 44, 39, 41, 39, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 39, 41, 59, 39, 41, 10, 32, + 32,101,108,115,101, 10, 32, 32, 32,108,111, 99, 97,108, 32, + 112,117,115,104, 95,102,117,110, 99, 32, 61, 32,103,101,116, + 95,112,117,115,104, 95,102,117,110, 99,116,105,111,110, 40, + 115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32, 32,111, + 117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115, + 104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, + 83, 44, 40,118,111,105,100, 42, 41, 39, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 39, 44, 34, 39, 44,115,101, + 108,102, 46,116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, + 32, 32,101,110,100, 10, 32, 32,114,101,116,117,114,110, 32, + 49, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110, 32, + 48, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,116,101,114, + 110, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114, + 10,102,117,110, 99,116,105,111,110, 32, 95, 68,101, 99,108, + 97,114, 97,116,105,111,110, 32, 40,116, 41, 10, 10, 32,115, + 101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99, + 108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, + 41, 10, 32,116, 58, 98,117,105,108,100,110, 97,109,101,115, + 40, 41, 10, 32,116, 58, 99,104,101, 99,107,110, 97,109,101, + 40, 41, 10, 32,116, 58, 99,104,101, 99,107,116,121,112,101, + 40, 41, 10, 32,108,111, 99, 97,108, 32,102,116, 32, 61, 32, + 102,105,110,100,116,121,112,101, 40,116, 46,116,121,112,101, + 41, 32,111,114, 32,116, 46,116,121,112,101, 10, 32,105,102, + 32,110,111,116, 32,105,115,101,110,117,109, 40,102,116, 41, + 32,116,104,101,110, 10, 9,116, 46,109,111,100, 44, 32,116, + 46,116,121,112,101, 32, 61, 32, 97,112,112,108,121,116,121, + 112,101,100,101,102, 40,116, 46,109,111,100, 44, 32,102,116, + 41, 10, 32,101,110,100, 10, 10, 32,105,102, 32,116, 46,107, + 105,110,100, 61, 61, 34,118, 97,114, 34, 32, 97,110,100, 32, + 40,115,116,114,105,110,103, 46,102,105,110,100, 40,116, 46, + 109,111,100, 44, 32, 34,116,111,108,117, 97, 95,112,114,111, + 112,101,114,116,121, 37,115, 34, 41, 32,111,114, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,116, 46,109,111,100, + 44, 32, 34,116,111,108,117, 97, 95,112,114,111,112,101,114, + 116,121, 36, 34, 41, 41, 32,116,104,101,110, 10, 32, 9,116, + 46,109,111,100, 32, 61, 32,115,116,114,105,110,103, 46,103, + 115,117, 98, 40,116, 46,109,111,100, 44, 32, 34,116,111,108, + 117, 97, 95,112,114,111,112,101,114,116,121, 34, 44, 32, 34, + 116,111,108,117, 97, 95,112,114,111,112,101,114,116,121, 95, + 95, 34, 46, 46,103,101,116, 95,112,114,111,112,101,114,116, + 121, 95,116,121,112,101, 40, 41, 41, 10, 32,101,110,100, 10, + 10, 32,114,101,116,117,114,110, 32,116, 10,101,110,100, 10, + 10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, + 10, 45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,101, + 32,115,116,114,105,110,103, 32,100,101, 99,108, 97,114, 97, + 116,105,111,110, 46, 10, 45, 45, 32, 84,104,101, 32,107,105, + 110,100, 32,111,102, 32,100,101, 99,108, 97,114, 97,116,105, + 111,110, 32, 99, 97,110, 32, 98,101, 32, 34,118, 97,114, 34, + 32,111,114, 32, 34,102,117,110, 99, 34, 46, 10,102,117,110, + 99,116,105,111,110, 32, 68,101, 99,108, 97,114, 97,116,105, + 111,110, 32, 40,115, 44,107,105,110,100, 44,105,115, 95,112, + 97,114, 97,109,101,116,101,114, 41, 10, 10, 32, 45, 45, 32, + 101,108,105,109,105,110, 97,116,101, 32,115,112, 97, 99,101, + 115, 32,105,102, 32,100,101,102, 97,117,108,116, 32,118, 97, + 108,117,101, 32,105,115, 32,112,114,111,118,105,100,101,100, + 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 37, + 115, 42, 61, 37,115, 42, 34, 44, 34, 61, 34, 41, 10, 32,115, + 32, 61, 32,103,115,117, 98, 40,115, 44, 32, 34, 37,115, 42, + 60, 34, 44, 32, 34, 60, 34, 41, 10, 10, 32,108,111, 99, 97, + 108, 32,100,101,102, 98, 44,116,109,112,100,101,102, 10, 32, + 100,101,102, 98, 44, 95, 44,116,109,112,100,101,102, 32, 61, + 32,115,116,114,105,110,103, 46,102,105,110,100, 40,115, 44, + 32, 34, 40, 61, 46, 42, 41, 36, 34, 41, 10, 32,105,102, 32, + 100,101,102, 98, 32,116,104,101,110, 10, 32, 9,115, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, + 32, 34, 61, 46, 42, 36, 34, 44, 32, 34, 34, 41, 10, 32,101, + 108,115,101, 10, 32, 9,116,109,112,100,101,102, 32, 61, 32, + 39, 39, 10, 32,101,110,100, 10, 32,105,102, 32,107,105,110, + 100, 32, 61, 61, 32, 34,118, 97,114, 34, 32,116,104,101,110, + 10, 32, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101, + 32,102,111,114,109, 58, 32,118,111,105,100, 10, 32, 32,105, + 102, 32,115, 32, 61, 61, 32, 39, 39, 32,111,114, 32,115, 32, + 61, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10, + 32, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108, + 97,114, 97,116,105,111,110,123,116,121,112,101, 32, 61, 32, + 39,118,111,105,100, 39, 44, 32,107,105,110,100, 32, 61, 32, + 107,105,110,100, 44, 32,105,115, 95,112, 97,114, 97,109,101, + 116,101,114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,101, + 116,101,114,125, 10, 32, 32,101,110,100, 10, 32,101,110,100, + 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101, + 32,102,111,114,109, 58, 32,109,111,100, 32,116,121,112,101, + 42, 38, 32,110, 97,109,101, 10, 32,108,111, 99, 97,108, 32, + 116, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107, + 101,110,115, 40,115, 44, 39, 37, 42, 37,115, 42, 38, 39, 41, + 10, 32,105,102, 32,116, 46,110, 32, 61, 61, 32, 50, 32,116, + 104,101,110, 10, 32, 32,105,102, 32,107,105,110,100, 32, 61, + 61, 32, 39,102,117,110, 99, 39, 32,116,104,101,110, 10, 32, + 32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108, + 105,100, 32,102,117,110, 99,116,105,111,110, 32,114,101,116, + 117,114,110, 32,116,121,112,101, 58, 32, 34, 46, 46,115, 41, + 10, 32, 32,101,110,100, 10, 32, 32, 45, 45,108,111, 99, 97, + 108, 32,109, 32, 61, 32,115,112,108,105,116, 40,116, 91, 49, + 93, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108,111, + 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 95, 99, + 95,116,111,107,101,110,115, 40,116, 91, 49, 93, 44, 39, 37, + 115, 43, 39, 41, 10, 32, 32,114,101,116,117,114,110, 32, 95, + 68,101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, + 32,110, 97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46,116, + 109,112,100,101,102, 44, 10, 32, 32, 32,112,116,114, 32, 61, + 32, 39, 42, 39, 44, 10, 32, 32, 32,114,101,116, 32, 61, 32, + 39, 38, 39, 44, 10, 32, 32, 32, 45, 45,116,121,112,101, 32, + 61, 32,114,101, 98,117,105,108,100, 95,116,101,109,112,108, + 97,116,101, 40,109, 91,109, 46,110, 93, 44, 32,116, 98, 44, + 32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,116,121,112, + 101, 32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32, 32, 32, + 109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,109, 44, + 49, 44,109, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, + 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105,115, + 95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, 32, 32, + 107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,125, + 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99, + 107, 32,116,104,101, 32,102,111,114,109, 58, 32,109,111,100, + 32,116,121,112,101, 42, 42, 32,110, 97,109,101, 10, 32,116, + 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101, + 110,115, 40,115, 44, 39, 37, 42, 37,115, 42, 37, 42, 39, 41, + 10, 32,105,102, 32,116, 46,110, 32, 61, 61, 32, 50, 32,116, + 104,101,110, 10, 32, 32,105,102, 32,107,105,110,100, 32, 61, + 61, 32, 39,102,117,110, 99, 39, 32,116,104,101,110, 10, 32, + 32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108, + 105,100, 32,102,117,110, 99,116,105,111,110, 32,114,101,116, + 117,114,110, 32,116,121,112,101, 58, 32, 34, 46, 46,115, 41, + 10, 32, 32,101,110,100, 10, 32, 32, 45, 45,108,111, 99, 97, + 108, 32,109, 32, 61, 32,115,112,108,105,116, 40,116, 91, 49, + 93, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108,111, + 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 95, 99, + 95,116,111,107,101,110,115, 40,116, 91, 49, 93, 44, 39, 37, + 115, 43, 39, 41, 10, 32, 32,114,101,116,117,114,110, 32, 95, + 68,101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, + 32,110, 97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46,116, + 109,112,100,101,102, 44, 10, 32, 32, 32,112,116,114, 32, 61, + 32, 39, 42, 39, 44, 10, 32, 32, 32,114,101,116, 32, 61, 32, + 39, 42, 39, 44, 10, 32, 32, 32, 45, 45,116,121,112,101, 32, + 61, 32,114,101, 98,117,105,108,100, 95,116,101,109,112,108, + 97,116,101, 40,109, 91,109, 46,110, 93, 44, 32,116, 98, 44, + 32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,116,121,112, + 101, 32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32, 32, 32, + 109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,109, 44, + 49, 44,109, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, + 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105,115, + 95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, 32, 32, + 107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,125, + 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99, + 107, 32,116,104,101, 32,102,111,114,109, 58, 32,109,111,100, + 32,116,121,112,101, 38, 32,110, 97,109,101, 10, 32,116, 32, + 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110, + 115, 40,115, 44, 39, 38, 39, 41, 10, 32,105,102, 32,116, 46, + 110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10, 32, 32, 45, + 45,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105, + 116, 40,116, 91, 49, 93, 44, 39, 37,115, 37,115, 42, 39, 41, + 10, 32, 32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112, + 108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,116, 91, + 49, 93, 44, 39, 37,115, 43, 39, 41, 10, 32, 32,114,101,116, + 117,114,110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111, + 110,123, 10, 32, 32, 32,110, 97,109,101, 32, 61, 32,116, 91, + 50, 93, 46, 46,116,109,112,100,101,102, 44, 10, 32, 32, 32, + 112,116,114, 32, 61, 32, 39, 38, 39, 44, 10, 32, 32, 32, 45, + 45,116,121,112,101, 32, 61, 32,114,101, 98,117,105,108,100, + 95,116,101,109,112,108, 97,116,101, 40,109, 91,109, 46,110, + 93, 44, 32,116, 98, 44, 32,116,105,109,112,108, 41, 44, 10, + 32, 32, 32,116,121,112,101, 32, 61, 32,109, 91,109, 46,110, + 93, 44, 10, 32, 32, 32,109,111,100, 32, 61, 32, 99,111,110, + 99, 97,116, 40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 44, + 10, 32, 32, 32,105,115, 95,112, 97,114, 97,109,101,116,101, + 114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,101,116,101, + 114, 44, 10, 32, 32, 32,107,105,110,100, 32, 61, 32,107,105, + 110,100, 10, 32, 32,125, 10, 32,101,110,100, 10, 10, 32, 45, + 45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,111,114, + 109, 58, 32,109,111,100, 32,116,121,112,101, 42, 32,110, 97, + 109,101, 10, 32,108,111, 99, 97,108, 32,115, 49, 32, 61, 32, + 103,115,117, 98, 40,115, 44, 34, 40, 37, 98, 92, 91, 92, 93, + 41, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,110, 41, + 32,114,101,116,117,114,110, 32,103,115,117, 98, 40,110, 44, + 39, 37, 42, 39, 44, 39, 92, 49, 39, 41, 32,101,110,100, 41, + 10, 32,116, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116, + 111,107,101,110,115, 40,115, 49, 44, 39, 37, 42, 39, 41, 10, + 32,105,102, 32,116, 46,110, 32, 61, 61, 32, 50, 32,116,104, + 101,110, 10, 32, 32,116, 91, 50, 93, 32, 61, 32,103,115,117, + 98, 40,116, 91, 50, 93, 44, 39, 92, 49, 39, 44, 39, 37, 42, + 39, 41, 32, 45, 45, 32,114,101,115,116,111,114,101, 32, 42, + 32,105,110, 32,100,105,109,101,110,115,105,111,110, 32,101, + 120,112,114,101,115,115,105,111,110, 10, 32, 32, 45, 45,108, + 111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 40, + 116, 91, 49, 93, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, + 32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105, + 116, 95, 99, 95,116,111,107,101,110,115, 40,116, 91, 49, 93, + 44, 39, 37,115, 43, 39, 41, 10, 32, 32,114,101,116,117,114, + 110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,110,123, + 10, 32, 32, 32,110, 97,109,101, 32, 61, 32,116, 91, 50, 93, + 46, 46,116,109,112,100,101,102, 44, 10, 32, 32, 32,112,116, + 114, 32, 61, 32, 39, 42, 39, 44, 10, 32, 32, 32,116,121,112, + 101, 32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32, 32, 32, + 45, 45,116,121,112,101, 32, 61, 32,114,101, 98,117,105,108, + 100, 95,116,101,109,112,108, 97,116,101, 40,109, 91,109, 46, + 110, 93, 44, 32,116, 98, 44, 32,116,105,109,112,108, 41, 44, + 10, 32, 32, 32,109,111,100, 32, 61, 32, 99,111,110, 99, 97, + 116, 40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 32, 32, 32, + 44, 10, 32, 32, 32,105,115, 95,112, 97,114, 97,109,101,116, + 101,114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,101,116, + 101,114, 44, 10, 32, 32, 32,107,105,110,100, 32, 61, 32,107, + 105,110,100, 10, 32, 32,125, 10, 32,101,110,100, 10, 10, 32, + 105,102, 32,107,105,110,100, 32, 61, 61, 32, 39,118, 97,114, + 39, 32,116,104,101,110, 10, 32, 32, 45, 45, 32, 99,104,101, + 99,107, 32,116,104,101, 32,102,111,114,109, 58, 32,109,111, + 100, 32,116,121,112,101, 32,110, 97,109,101, 10, 32, 32, 45, + 45,116, 32, 61, 32,115,112,108,105,116, 40,115, 44, 39, 37, + 115, 37,115, 42, 39, 41, 10, 32, 32,116, 32, 61, 32,115,112, + 108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44, + 39, 37,115, 43, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32, + 118, 10, 32, 32,105,102, 32,102,105,110,100,116,121,112,101, + 40,116, 91,116, 46,110, 93, 41, 32,116,104,101,110, 32,118, + 32, 61, 32, 99,114,101, 97,116,101, 95,118, 97,114,110, 97, + 109,101, 40, 41, 32,101,108,115,101, 32,118, 32, 61, 32,116, + 91,116, 46,110, 93, 59, 32,116, 46,110, 32, 61, 32,116, 46, + 110, 45, 49, 32,101,110,100, 10, 32, 32,114,101,116,117,114, + 110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,110,123, + 10, 32, 32, 32,110, 97,109,101, 32, 61, 32,118, 46, 46,116, + 109,112,100,101,102, 44, 10, 32, 32, 32, 45, 45,116,121,112, + 101, 32, 61, 32,114,101, 98,117,105,108,100, 95,116,101,109, + 112,108, 97,116,101, 40,116, 91,116, 46,110, 93, 44, 32,116, + 98, 44, 32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,116, + 121,112,101, 32, 61, 32,116, 91,116, 46,110, 93, 44, 10, 32, + 32, 32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40, + 116, 44, 49, 44,116, 46,110, 45, 49, 41, 44, 10, 32, 32, 32, + 105,115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32, + 105,115, 95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, + 32, 32,107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, + 32,125, 10, 10, 32,101,108,115,101, 32, 45, 45, 32,107,105, + 110,100, 32, 61, 61, 32, 34,102,117,110, 99, 34, 10, 10, 32, + 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102, + 111,114,109, 58, 32,109,111,100, 32,116,121,112,101, 32,110, + 97,109,101, 10, 32, 32, 45, 45,116, 32, 61, 32,115,112,108, + 105,116, 40,115, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, + 32,116, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111, + 107,101,110,115, 40,115, 44, 39, 37,115, 43, 39, 41, 10, 32, + 32,108,111, 99, 97,108, 32,118, 32, 61, 32,116, 91,116, 46, + 110, 93, 32, 32, 45, 45, 32,108, 97,115,116, 32,119,111,114, + 100, 32,105,115, 32,116,104,101, 32,102,117,110, 99,116,105, + 111,110, 32,110, 97,109,101, 10, 32, 32,108,111, 99, 97,108, + 32,116,112, 44,109,100, 10, 32, 32,105,102, 32,116, 46,110, + 62, 49, 32,116,104,101,110, 10, 32, 32, 32,116,112, 32, 61, + 32,116, 91,116, 46,110, 45, 49, 93, 10, 32, 32, 32,109,100, + 32, 61, 32, 99,111,110, 99, 97,116, 40,116, 44, 49, 44,116, + 46,110, 45, 50, 41, 10, 32, 32,101,110,100, 10, 32, 32, 45, + 45,105,102, 32,116,112, 32,116,104,101,110, 32,116,112, 32, + 61, 32,114,101, 98,117,105,108,100, 95,116,101,109,112,108, + 97,116,101, 40,116,112, 44, 32,116, 98, 44, 32,116,105,109, + 112,108, 41, 32,101,110,100, 10, 32, 32,114,101,116,117,114, + 110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,110,123, + 10, 32, 32, 32,110, 97,109,101, 32, 61, 32,118, 44, 10, 32, + 32, 32,116,121,112,101, 32, 61, 32,116,112, 44, 10, 32, 32, + 32,109,111,100, 32, 61, 32,109,100, 44, 10, 32, 32, 32,105, + 115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105, + 115, 95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, 32, + 32,107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, 32, + 125, 10, 32,101,110,100, 10, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/declaration.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,118, 97,114,105, 97, + 98,108,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73, + 100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99, + 111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102, + 116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32, + 114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, + 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32, + 105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116, + 119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104, + 101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, + 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105, + 115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97, + 117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98, + 108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111, + 118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99, + 101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, + 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99, + 101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105, + 102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, + 32, 86, 97,114,105, 97, 98,108,101, 32, 99,108, 97,115,115, + 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, + 97, 32,101,120,116,101,114,110, 32,118, 97,114,105, 97, 98, + 108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99, 32, + 109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108, 97, + 115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32, 97, + 108,108, 32,102,105,101,108,100,115, 32,112,114,101,115,101, + 110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114, 97, + 116,105,111,110, 46, 10, 99,108, 97,115,115, 86, 97,114,105, + 97, 98,108,101, 32, 61, 32,123, 10, 32, 95,103,101,116, 32, + 61, 32,123,125, 44, 32, 32, 32, 45, 45, 32,109, 97,112,112, + 101,100, 32,103,101,116, 32,102,117,110, 99,116,105,111,110, + 115, 10, 32, 95,115,101,116, 32, 61, 32,123,125, 44, 32, 32, + 32, 45, 45, 32,109, 97,112,112,101,100, 32,115,101,116, 32, + 102,117,110, 99,116,105,111,110,115, 10,125, 10, 99,108, 97, + 115,115, 86, 97,114,105, 97, 98,108,101, 46, 95, 95,105,110, + 100,101,120, 32, 61, 32, 99,108, 97,115,115, 86, 97,114,105, + 97, 98,108,101, 10,115,101,116,109,101,116, 97,116, 97, 98, + 108,101, 40, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108, + 101, 44, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32, + 109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110, + 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 58, + 112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108, + 111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 86, 97,114,105, 97, 98,108,101,123, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, + 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97, + 109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,105,102, 32, + 115,101,108,102, 46,100,105,109, 32,116,104,101,110, 32,112, + 114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,100, + 105,109, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100, + 105,109, 46, 46, 34, 39, 44, 34, 41, 32,101,110,100, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 100,101,102, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, + 46,100,101,102, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,114,101, + 116, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,114, + 101,116, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110, + 116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99, + 108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 71, + 101,110,101,114, 97,116,101,115, 32, 67, 32,102,117,110, 99, + 116,105,111,110, 32,110, 97,109,101, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98, + 108,101, 58, 99,102,117,110, 99,110, 97,109,101, 32, 40,112, + 114,101,102,105,120, 41, 10, 32,108,111, 99, 97,108, 32,112, + 97,114,101,110,116, 32, 61, 32, 34, 34, 10, 32,108,111, 99, + 97,108, 32,117,110,115,105,103,110,101,100, 32, 61, 32, 34, + 34, 10, 32,108,111, 99, 97,108, 32,112,116,114, 32, 61, 32, + 34, 34, 10, 10, 32,108,111, 99, 97,108, 32,112, 32, 61, 32, + 115,101,108,102, 58,105,110,109,111,100,117,108,101, 40, 41, + 32,111,114, 32,115,101,108,102, 58,105,110,110, 97,109,101, + 115,112, 97, 99,101, 40, 41, 32,111,114, 32,115,101,108,102, + 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32,105,102, + 32,112, 32,116,104,101,110, 10, 32, 9,105,102, 32,115,101, + 108,102, 46,112, 97,114,101,110,116, 46, 99,108, 97,115,115, + 116,121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, + 32,116,104,101,110, 10, 9, 9,112, 97,114,101,110,116, 32, + 61, 32, 34, 95, 34, 32, 46, 46, 32,115,101,108,102, 46,112, + 97,114,101,110,116, 46,116,121,112,101, 10, 9,101,108,115, + 101, 10, 9, 32, 32,112, 97,114,101,110,116, 32, 61, 32, 34, + 95, 34, 32, 46, 46, 32,112, 10, 9,101,110,100, 10, 32,101, + 110,100, 10, 10, 32,105,102, 32,115,116,114,102,105,110,100, + 40,115,101,108,102, 46,109,111,100, 44, 34, 40,117,110,115, + 105,103,110,101,100, 41, 34, 41, 32,116,104,101,110, 10, 32, + 32,117,110,115,105,103,110,101,100, 32, 61, 32, 34, 95,117, + 110,115,105,103,110,101,100, 34, 10, 32,101,110,100, 10, 10, + 32,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, + 32, 34, 42, 34, 32,116,104,101,110, 32,112,116,114, 32, 61, + 32, 34, 95,112,116,114, 34, 10, 32,101,108,115,101,105,102, + 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 34, 38, + 34, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 34, 95, + 114,101,102, 34, 10, 32,101,110,100, 10, 10, 32,108,111, 99, + 97,108, 32,110, 97,109,101, 32, 61, 32, 32,112,114,101,102, + 105,120, 32, 46, 46, 32,112, 97,114,101,110,116, 32, 46, 46, + 32,117,110,115,105,103,110,101,100, 32, 46, 46, 32, 34, 95, + 34, 32, 46, 46, 32,103,115,117, 98, 40,115,101,108,102, 46, + 108,110, 97,109,101, 32,111,114, 32,115,101,108,102, 46,110, + 97,109,101, 44, 34, 46, 42, 58, 58, 34, 44, 34, 34, 41, 32, + 46, 46, 32,112,116,114, 10, 10, 9,110, 97,109,101, 32, 61, + 32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116,101, + 40,110, 97,109,101, 41, 10, 32,114,101,116,117,114,110, 32, + 110, 97,109,101, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99, + 104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97, + 32,118, 97,114,105, 97, 98,108,101, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98, + 108,101, 58,105,115,118, 97,114,105, 97, 98,108,101, 32, 40, + 41, 10, 32,114,101,116,117,114,110, 32,116,114,117,101, 10, + 101,110,100, 10, 10, 45, 45, 32,103,101,116, 32,118, 97,114, + 105, 97, 98,108,101, 32,118, 97,108,117,101, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, + 97, 98,108,101, 58,103,101,116,118, 97,108,117,101, 32, 40, + 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 44, 32,112, + 114,111,112, 95,103,101,116, 41, 10, 10, 9,108,111, 99, 97, + 108, 32,110, 97,109,101, 10, 9,105,102, 32,112,114,111,112, + 95,103,101,116, 32,116,104,101,110, 10, 10, 9, 9,110, 97, + 109,101, 32, 61, 32,112,114,111,112, 95,103,101,116, 46, 46, + 34, 40, 41, 34, 10, 9,101,108,115,101, 10, 9, 9,110, 97, + 109,101, 32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10, + 9,101,110,100, 10, 10, 9,105,102, 32, 99,108, 97,115,115, + 32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101, + 110, 10, 9, 32,114,101,116,117,114,110, 32,115,101,108,102, + 46,112, 97,114,101,110,116, 46,116,121,112,101, 46, 46, 39, + 58, 58, 39, 46, 46,110, 97,109,101, 10, 9,101,108,115,101, + 105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10, 9, + 32,114,101,116,117,114,110, 32, 39,115,101,108,102, 45, 62, + 39, 46, 46,110, 97,109,101, 10, 9,101,108,115,101, 10, 9, + 32,114,101,116,117,114,110, 32,110, 97,109,101, 10, 9,101, + 110,100, 10,101,110,100, 10, 10, 45, 45, 32,103,101,116, 32, + 118, 97,114,105, 97, 98,108,101, 32,112,111,105,110,116,101, + 114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, + 58,103,101,116,112,111,105,110,116,101,114,118, 97,108,117, + 101, 32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, + 41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, + 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32, + 114,101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39, + 58, 58,112, 39, 10, 32,101,108,115,101,105,102, 32, 99,108, + 97,115,115, 32,116,104,101,110, 10, 32, 32,114,101,116,117, + 114,110, 32, 39,115,101,108,102, 45, 62,112, 39, 10, 32,101, + 108,115,101, 10, 32, 32,114,101,116,117,114,110, 32, 39,112, + 39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, + 87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32,102, + 117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108, + 101, 58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 10, 32, + 108,111, 99, 97,108, 32, 99,108, 97,115,115, 32, 61, 32,115, + 101,108,102, 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, + 9,108,111, 99, 97,108, 32,112,114,111,112, 95,103,101,116, + 44,112,114,111,112, 95,115,101,116, 10, 9,105,102, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40,115,101,108,102, + 46,109,111,100, 44, 32, 39,116,111,108,117, 97, 95,112,114, + 111,112,101,114,116,121, 39, 41, 32,116,104,101,110, 10, 10, + 9, 9,108,111, 99, 97,108, 32, 95, 44, 95, 44,116,121,112, + 101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, + 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108, + 117, 97, 95,112,114,111,112,101,114,116,121, 95, 95, 40, 91, + 94, 37,115, 93, 42, 41, 34, 41, 10, 9, 9,116,121,112,101, + 32, 61, 32,116,121,112,101, 32,111,114, 32, 34,100,101,102, + 97,117,108,116, 34, 10, 9, 9,112,114,111,112, 95,103,101, + 116, 44,112,114,111,112, 95,115,101,116, 32, 61, 32,103,101, + 116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104, + 111,100,115, 40,116,121,112,101, 44, 32,115,101,108,102, 46, + 110, 97,109,101, 41, 10, 9, 9,115,101,108,102, 46,109,111, + 100, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, + 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108, + 117, 97, 95,112,114,111,112,101,114,116,121, 91, 94, 37,115, + 93, 42, 34, 44, 32, 34, 34, 41, 10, 9,101,110,100, 10, 10, + 32, 45, 45, 32,103,101,116, 32,102,117,110, 99,116,105,111, + 110, 32, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 10, 32,105,102, 32, 99,108, 97,115,115, + 32,116,104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, + 34, 47, 42, 32,103,101,116, 32,102,117,110, 99,116,105,111, + 110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34, + 32,111,102, 32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97, + 115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101, + 10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,103, + 101,116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44,115, + 101,108,102, 46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, + 10, 32,101,110,100, 10, 32,115,101,108,102, 46, 99,103,101, + 116,110, 97,109,101, 32, 61, 32,115,101,108,102, 58, 99,102, + 117,110, 99,110, 97,109,101, 40, 34,116,111,108,117, 97, 95, + 103,101,116, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, + 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, + 73, 83, 65, 66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, + 99,103,101,116,110, 97,109,101, 41, 10, 32,111,117,116,112, + 117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,105,110, + 116, 34, 44,115,101,108,102, 46, 99,103,101,116,110, 97,109, + 101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32, + 116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116, + 112,117,116, 40, 34,123, 34, 41, 10, 10, 32, 45, 45, 32,100, + 101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105,102, + 32,116,104,101, 32, 99, 97,115,101, 10, 32,108,111, 99, 97, + 108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115,101,108,102, 46,109,111, + 100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41, + 39, 41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110, + 100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116, + 104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,116, + 121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32, 61, + 32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 40, + 39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,116, + 121,112,101, 44, 39, 42, 41, 32, 39, 41, 10, 32, 32,108,111, + 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,103, + 101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110, 40, + 115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112, + 101, 41, 10, 32, 32,111,117,116,112,117,116, 40,116,111, 95, + 102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, + 49, 44, 48, 41, 59, 39, 41, 10, 32,101,108,115,101,105,102, + 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32, + 95, 44, 95, 44,115,101,108,102, 46,109,111,100, 32, 61, 32, + 115,116,114,102,105,110,100, 40,115,101,108,102, 46,109,111, + 100, 44, 39, 94, 37,115, 42,115,116, 97,116,105, 99, 37,115, + 37,115, 42, 40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10, + 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,115,101,108, + 102, 32,118, 97,108,117,101, 10, 32,105,102, 32, 99,108, 97, + 115,115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61, + 110,105,108, 32,116,104,101,110, 10, 9, 32,111,117,116,112, + 117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, 32, + 40, 33,115,101,108,102, 41, 32,116,111,108,117, 97, 95,101, + 114,114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34,105, + 110,118, 97,108,105,100, 32, 92, 39,115,101,108,102, 92, 39, + 32,105,110, 32, 97, 99, 99,101,115,115,105,110,103, 32,118, + 97,114,105, 97, 98,108,101, 32, 92, 39, 39, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 46, 46, 39, 92, 39, 34, 44, 78, + 85, 76, 76, 41, 59, 39, 41, 59, 10, 9, 9,111,117,116,112, + 117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, + 32,101,110,100, 10, 10, 32, 45, 45, 32,114,101,116,117,114, + 110, 32,118, 97,108,117,101, 10, 32,105,102, 32,115,116,114, + 105,110,103, 46,102,105,110,100, 40,115,101,108,102, 46,109, + 111,100, 44, 32, 39,116,111,108,117, 97, 95,105,110,104,101, + 114,105,116,115, 39, 41, 32,116,104,101,110, 10, 9,108,111, + 99, 97,108, 32,112,117,115,104, 95,102,117,110, 99, 32, 61, + 32,103,101,116, 95,112,117,115,104, 95,102,117,110, 99,116, + 105,111,110, 40,115,101,108,102, 46,116,121,112,101, 41, 10, + 32, 9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101, + 102, 32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110, + 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 32, 32, 39, + 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111, + 108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41,115,116, + 97,116,105, 99, 95, 99, 97,115,116, 60, 39, 46, 46,115,101, + 108,102, 46,116,121,112,101, 46, 46, 39, 42, 62, 40,115,101, + 108,102, 41, 44, 32, 34, 39, 44,115,101,108,102, 46,116,121, + 112,101, 44, 39, 34, 41, 59, 39, 41, 10, 9,111,117,116,112, + 117,116, 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10, 9, + 111,117,116,112,117,116, 40, 39, 32, 32, 39, 44,112,117,115, + 104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, + 83, 44, 40,118,111,105,100, 42, 41, 40, 40, 39, 46, 46,115, + 101,108,102, 46,116,121,112,101, 46, 46, 39, 42, 41,115,101, + 108,102, 41, 44, 32, 34, 39, 44,115,101,108,102, 46,116,121, + 112,101, 44, 39, 34, 41, 59, 39, 41, 10, 9,111,117,116,112, + 117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, + 32,101,108,115,101, 10, 9,108,111, 99, 97,108, 32,116, 44, + 99,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101, + 108,102, 46,116,121,112,101, 41, 10, 9,105,102, 32,116, 32, + 116,104,101,110, 10, 9, 9,111,117,116,112,117,116, 40, 39, + 32, 32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46, + 116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, + 44, 99,116, 44, 39, 41, 39, 46, 46,115,101,108,102, 58,103, + 101,116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115, + 116, 97,116,105, 99, 44,112,114,111,112, 95,103,101,116, 41, + 46, 46, 39, 41, 59, 39, 41, 10, 9,101,108,115,101, 10, 9, + 9,108,111, 99, 97,108, 32,112,117,115,104, 95,102,117,110, + 99, 32, 61, 32,103,101,116, 95,112,117,115,104, 95,102,117, + 110, 99,116,105,111,110, 40,115,101,108,102, 46,116,121,112, + 101, 41, 10, 9, 9,116, 32, 61, 32,115,101,108,102, 46,116, + 121,112,101, 10, 9, 9,105,102, 32,115,101,108,102, 46,112, + 116,114, 32, 61, 61, 32, 39, 38, 39, 32,111,114, 32,115,101, + 108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116,104, + 101,110, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, + 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40, + 116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, + 38, 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108, + 117,101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, + 44,112,114,111,112, 95,103,101,116, 41, 46, 46, 39, 44, 34, + 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 9, 9,101,108, + 115,101, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, + 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40, + 116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, + 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108,117, + 101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 44, + 112,114,111,112, 95,103,101,116, 41, 46, 46, 39, 44, 34, 39, + 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 9, 9,101,110,100, + 10, 9,101,110,100, 10, 32,101,110,100, 10, 32,111,117,116, + 112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 49, 59, + 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,125, 39, 41, + 10, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105, + 102, 32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10, + 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, 10, + 32, 45, 45, 32,115,101,116, 32,102,117,110, 99,116,105,111, + 110, 32, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 10, 32,105,102, 32,110,111,116, 32, 40, + 115,116,114,102,105,110,100, 40,115,101,108,102, 46,116,121, + 112,101, 44, 39, 99,111,110,115,116, 37,115, 43, 39, 41, 32, + 111,114, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 115,101,108,102, 46,109,111,100, 44, 32, 39,116,111,108,117, + 97, 95,114,101, 97,100,111,110,108,121, 39, 41, 32,111,114, + 32,115,116,114,105,110,103, 46,102,105,110,100, 40,115,101, + 108,102, 46,109,111,100, 44, 32, 39,116,111,108,117, 97, 95, + 105,110,104,101,114,105,116,115, 39, 41, 41, 32, 32,116,104, + 101,110, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32,116, + 104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 34, + 47, 42, 32,115,101,116, 32,102,117,110, 99,116,105,111,110, + 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34, 32, + 111,102, 32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,115, + 115, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32,101,108,115,101, + 10, 32, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32, + 115,101,116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44, + 115,101,108,102, 46,110, 97,109,101, 44, 34, 32, 42, 47, 34, + 41, 10, 32, 32,101,110,100, 10, 32, 32,115,101,108,102, 46, + 99,115,101,116,110, 97,109,101, 32, 61, 32,115,101,108,102, + 58, 99,102,117,110, 99,110, 97,109,101, 40, 34,116,111,108, + 117, 97, 95,115,101,116, 34, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 34, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, 34, 46, 46,115, + 101,108,102, 46, 99,115,101,116,110, 97,109,101, 41, 10, 32, + 32,111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,116, + 105, 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,115, + 101,116,110, 97,109,101, 44, 34, 40,108,117, 97, 95, 83,116, + 97,116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, 41, + 10, 32, 32,111,117,116,112,117,116, 40, 34,123, 34, 41, 10, + 10, 32, 32, 45, 45, 32,100,101, 99,108, 97,114,101, 32,115, + 101,108,102, 44, 32,105,102, 32,116,104,101, 32, 99, 97,115, + 101, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110, + 100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116, + 104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46, + 116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32, + 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116, 40, + 39, 40, 39, 44,115,101,108,102, 46,112, 97,114,101,110,116, + 46,116,121,112,101, 44, 39, 42, 41, 32, 39, 41, 10, 32, 32, + 32,108,111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, + 61, 32,103,101,116, 95,116,111, 95,102,117,110, 99,116,105, + 111,110, 40,115,101,108,102, 46,112, 97,114,101,110,116, 46, + 116,121,112,101, 41, 10, 32, 32, 32,111,117,116,112,117,116, + 40,116,111, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, + 97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10, 32, 32, 32, + 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 32,118, + 97,108,117,101, 10, 9, 9,101,110,100, 10, 32, 32, 45, 45, + 32, 99,104,101, 99,107, 32,116,121,112,101,115, 10, 9, 9, + 111,117,116,112,117,116, 40, 39, 35,105,102,110,100,101,102, + 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92, + 110, 39, 41, 10, 9, 9,111,117,116,112,117,116, 40, 39, 32, + 32,116,111,108,117, 97, 95, 69,114,114,111,114, 32,116,111, + 108,117, 97, 95,101,114,114, 59, 39, 41, 10, 32, 32,105,102, + 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116, 97,116, + 105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10, 32, 32, + 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, 32, 40, + 33,115,101,108,102, 41, 32,116,111,108,117, 97, 95,101,114, + 114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34,105,110, + 118, 97,108,105,100, 32, 92, 39,115,101,108,102, 92, 39, 32, + 105,110, 32, 97, 99, 99,101,115,115,105,110,103, 32,118, 97, + 114,105, 97, 98,108,101, 32, 92, 39, 39, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 39, 92, 39, 34, 44, 78, 85, + 76, 76, 41, 59, 39, 41, 59, 10, 32, 32,101,108,115,101,105, + 102, 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, + 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109,111,100, 32, + 61, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, + 109,111,100, 44, 39, 94, 37,115, 42,115,116, 97,116,105, 99, + 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10, 32, 32,101, + 110,100, 10, 10, 32, 32, 45, 45, 32, 99,104,101, 99,107, 32, + 118, 97,114,105, 97, 98,108,101, 32,116,121,112,101, 10, 32, + 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, 32, 40, + 39, 46, 46,115,101,108,102, 58,111,117,116, 99,104,101, 99, + 107,116,121,112,101, 40, 50, 41, 46, 46, 39, 41, 39, 41, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111, + 108,117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, + 95, 83, 44, 34, 35,118,105,110,118, 97,108,105,100, 32,116, + 121,112,101, 32,105,110, 32,118, 97,114,105, 97, 98,108,101, + 32, 97,115,115,105,103,110,109,101,110,116, 46, 34, 44, 38, + 116,111,108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10, 9, + 9,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102, + 92,110, 39, 41, 10, 10, 32, 32, 45, 45, 32, 97,115,115,105, + 103,110, 32,118, 97,108,117,101, 10, 9, 9,108,111, 99, 97, + 108, 32,100,101,102, 32, 61, 32, 48, 10, 9, 9,105,102, 32, + 115,101,108,102, 46,100,101,102, 32,126, 61, 32, 39, 39, 32, + 116,104,101,110, 32,100,101,102, 32, 61, 32,115,101,108,102, + 46,100,101,102, 32,101,110,100, 10, 9, 9,105,102, 32,115, + 101,108,102, 46,116,121,112,101, 32, 61, 61, 32, 39, 99,104, + 97,114, 42, 39, 32, 97,110,100, 32,115,101,108,102, 46,100, + 105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 32, 45, + 45, 32,105,115, 32,115,116,114,105,110,103, 10, 9, 9, 32, + 111,117,116,112,117,116, 40, 39, 32,115,116,114,110, 99,112, + 121, 40, 39, 41, 10, 9, 9, 9,105,102, 32, 99,108, 97,115, + 115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104, + 101,110, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40,115, + 101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, + 46, 46, 39, 58, 58, 39, 46, 46,115,101,108,102, 46,110, 97, + 109,101, 41, 10, 9, 9, 9,101,108,115,101,105,102, 32, 99, + 108, 97,115,115, 32,116,104,101,110, 10, 9, 9, 9, 9,111, + 117,116,112,117,116, 40, 39,115,101,108,102, 45, 62, 39, 46, + 46,115,101,108,102, 46,110, 97,109,101, 41, 10, 9, 9, 9, + 101,108,115,101, 10, 9, 9, 9, 9,111,117,116,112,117,116, + 40,115,101,108,102, 46,110, 97,109,101, 41, 10, 9, 9, 9, + 101,110,100, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, + 44,116,111,108,117, 97, 95,116,111,115,116,114,105,110,103, + 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 39, 44,100,101, + 102, 44, 39, 41, 44, 39, 44,115,101,108,102, 46,100,105,109, + 44, 39, 45, 49, 41, 59, 39, 41, 10, 9, 9,101,108,115,101, + 10, 9, 9, 9,108,111, 99, 97,108, 32,112,116,114, 32, 61, + 32, 39, 39, 10, 9, 9, 9,105,102, 32,115,101,108,102, 46, + 112,116,114,126, 61, 39, 39, 32,116,104,101,110, 32,112,116, + 114, 32, 61, 32, 39, 42, 39, 32,101,110,100, 10, 9, 9, 9, + 111,117,116,112,117,116, 40, 39, 32, 39, 41, 10, 9, 9, 9, + 108,111, 99, 97,108, 32,110, 97,109,101, 32, 61, 32,112,114, + 111,112, 95,115,101,116, 32,111,114, 32,115,101,108,102, 46, + 110, 97,109,101, 10, 9, 9, 9,105,102, 32, 99,108, 97,115, + 115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104, + 101,110, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40,115, + 101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, + 46, 46, 39, 58, 58, 39, 46, 46,110, 97,109,101, 41, 10, 9, + 9, 9,101,108,115,101,105,102, 32, 99,108, 97,115,115, 32, + 116,104,101,110, 10, 9, 9, 9, 9,111,117,116,112,117,116, + 40, 39,115,101,108,102, 45, 62, 39, 46, 46,110, 97,109,101, + 41, 10, 9, 9, 9,101,108,115,101, 10, 9, 9, 9, 9,111, + 117,116,112,117,116, 40,110, 97,109,101, 41, 10, 9, 9, 9, + 101,110,100, 10, 9, 9, 9,108,111, 99, 97,108, 32,116, 32, + 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46, + 116,121,112,101, 41, 10, 9, 9, 9,105,102, 32,112,114,111, + 112, 95,115,101,116, 32,116,104,101,110, 10, 9, 9, 9, 9, + 111,117,116,112,117,116, 40, 39, 40, 39, 41, 10, 9, 9, 9, + 101,108,115,101, 10, 9, 9, 9, 9,111,117,116,112,117,116, + 40, 39, 32, 61, 32, 39, 41, 10, 9, 9, 9,101,110,100, 10, + 9, 9, 9,105,102, 32,110,111,116, 32,116, 32, 97,110,100, + 32,112,116,114, 61, 61, 39, 39, 32,116,104,101,110, 32,111, + 117,116,112,117,116, 40, 39, 42, 39, 41, 32,101,110,100, 10, + 9, 9, 9,111,117,116,112,117,116, 40, 39, 40, 40, 39, 44, + 115,101,108,102, 46,109,111,100, 44,115,101,108,102, 46,116, + 121,112,101, 41, 10, 9, 9, 9,105,102, 32,110,111,116, 32, + 116, 32,116,104,101,110, 10, 9, 9, 9, 9,111,117,116,112, + 117,116, 40, 39, 42, 39, 41, 10, 9, 9, 9,101,110,100, 10, + 9, 9, 9,111,117,116,112,117,116, 40, 39, 41, 32, 39, 41, + 10, 9, 9, 9,105,102, 32,116, 32,116,104,101,110, 10, 9, + 9, 9, 9,105,102, 32,105,115,101,110,117,109, 40,115,101, + 108,102, 46,116,121,112,101, 41, 32,116,104,101,110, 10, 9, + 9, 9, 9, 9,111,117,116,112,117,116, 40, 39, 40,105,110, + 116, 41, 32, 39, 41, 10, 9, 9, 9, 9,101,110,100, 10, 9, + 9, 9, 9,111,117,116,112,117,116, 40, 39,116,111,108,117, + 97, 95,116,111, 39, 46, 46,116, 44, 39, 40,116,111,108,117, + 97, 95, 83, 44, 50, 44, 39, 44,100,101,102, 44, 39, 41, 41, + 39, 41, 10, 9, 9, 9,101,108,115,101, 10, 9, 9, 9, 9, + 108,111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, + 32,103,101,116, 95,116,111, 95,102,117,110, 99,116,105,111, + 110, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 9, 9, + 9, 9,111,117,116,112,117,116, 40,116,111, 95,102,117,110, + 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 39, + 44,100,101,102, 44, 39, 41, 41, 39, 41, 10, 9, 9, 9,101, + 110,100, 10, 9, 9, 9,105,102, 32,112,114,111,112, 95,115, + 101,116, 32,116,104,101,110, 10, 9, 9, 9, 9,111,117,116, + 112,117,116, 40, 34, 41, 34, 41, 10, 9, 9, 9,101,110,100, + 10, 9, 9, 9,111,117,116,112,117,116, 40, 34, 59, 34, 41, + 10, 9, 9,101,110,100, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 32,114,101,116,117,114,110, 32, 48, 59, 39, 41, 10, + 32, 32,111,117,116,112,117,116, 40, 39,125, 39, 41, 10, 32, + 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102, + 32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, + 65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10, 32, + 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, 32, + 101,110,100, 10, 10,101,110,100, 10, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98, + 108,101, 58,114,101,103,105,115,116,101,114, 32, 40,112,114, + 101, 41, 10, 10, 9,105,102, 32,110,111,116, 32,115,101,108, + 102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95, + 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10, 9, + 9,114,101,116,117,114,110, 10, 9,101,110,100, 10, 32,112, + 114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39, 39, 10, + 32,108,111, 99, 97,108, 32,112, 97,114,101,110,116, 32, 61, + 32,115,101,108,102, 58,105,110,109,111,100,117,108,101, 40, + 41, 32,111,114, 32,115,101,108,102, 58,105,110,110, 97,109, + 101,115,112, 97, 99,101, 40, 41, 32,111,114, 32,115,101,108, + 102, 58,105,110, 99,108, 97,115,115, 40, 41, 10, 32,105,102, + 32,110,111,116, 32,112, 97,114,101,110,116, 32,116,104,101, + 110, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 86, 97,114, + 105, 97, 98,108,101, 46, 95,119, 97,114,110,105,110,103, 61, + 61,110,105,108, 32,116,104,101,110, 10, 32, 32, 32,119, 97, + 114,110,105,110,103, 40, 34, 77, 97,112,112,105,110,103, 32, + 118, 97,114,105, 97, 98,108,101, 32,116,111, 32,103,108,111, + 98, 97,108, 32,109, 97,121, 32,100,101,103,114, 97,100,101, + 32,112,101,114,102,111,114,109, 97,110, 99,101, 34, 41, 10, + 32, 32, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108, + 101, 46, 95,119, 97,114,110,105,110,103, 32, 61, 32, 49, 10, + 32, 32,101,110,100, 10, 32,101,110,100, 10, 32,105,102, 32, + 115,101,108,102, 46, 99,115,101,116,110, 97,109,101, 32,116, + 104,101,110, 10, 32, 32,111,117,116,112,117,116, 40,112,114, + 101, 46, 46, 39,116,111,108,117, 97, 95,118, 97,114,105, 97, + 98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, + 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, + 44, 39, 46, 46,115,101,108,102, 46, 99,103,101,116,110, 97, + 109,101, 46, 46, 39, 44, 39, 46, 46,115,101,108,102, 46, 99, + 115,101,116,110, 97,109,101, 46, 46, 39, 41, 59, 39, 41, 10, + 32,101,108,115,101, 10, 32, 32,111,117,116,112,117,116, 40, + 112,114,101, 46, 46, 39,116,111,108,117, 97, 95,118, 97,114, + 105, 97, 98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 34, + 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, + 39, 34, 44, 39, 46, 46,115,101,108,102, 46, 99,103,101,116, + 110, 97,109,101, 46, 46, 39, 44, 78, 85, 76, 76, 41, 59, 39, + 41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, + 73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114, + 117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, + 95, 86, 97,114,105, 97, 98,108,101, 32, 40,116, 41, 10, 32, + 115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, + 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 41, 10, + 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116, + 117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67, + 111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69, + 120,112,101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, + 32,114,101,112,114,101,115,101,110,116,105,110,103, 32,116, + 104,101, 32,118, 97,114,105, 97, 98,108,101, 32,100,101, 99, + 108, 97,114, 97,116,105,111,110, 46, 10,102,117,110, 99,116, + 105,111,110, 32, 86, 97,114,105, 97, 98,108,101, 32, 40,115, + 41, 10, 32,114,101,116,117,114,110, 32, 95, 86, 97,114,105, + 97, 98,108,101, 32, 40, 68,101, 99,108, 97,114, 97,116,105, + 111,110, 40,115, 44, 39,118, 97,114, 39, 41, 41, 10,101,110, + 100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/variable.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 97,114,114, 97,121, + 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116, + 101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, + 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97, + 102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117, + 108, 32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32, + 97,114,114, 97,121, 46,108,117, 97, 44,118, 32, 49, 46, 49, + 32, 50, 48, 48, 48, 47, 49, 49, 47, 48, 54, 32, 50, 50, 58, + 48, 51, 58, 53, 55, 32, 99,101,108,101,115, 32, 69,120,112, + 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100, + 101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, + 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101, + 100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97, + 110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, + 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97, + 114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114, + 101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, + 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, + 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116, + 104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105, + 103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105, + 100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, + 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116, + 101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109, + 101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, + 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 65, + 114,114, 97,121, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82, + 101,112,114,101,115,101,110,116,115, 32, 97, 32,101,120,116, + 101,114,110, 32, 97,114,114, 97,121, 32,118, 97,114,105, 97, + 98,108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99, + 32,109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108, + 97,115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32, + 97,108,108, 32,102,105,101,108,100,115, 32,112,114,101,115, + 101,110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114, + 97,116,105,111,110, 46, 10, 99,108, 97,115,115, 65,114,114, + 97,121, 32, 61, 32,123, 10,125, 10, 99,108, 97,115,115, 65, + 114,114, 97,121, 46, 95, 95,105,110,100,101,120, 32, 61, 32, + 99,108, 97,115,115, 65,114,114, 97,121, 10,115,101,116,109, + 101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 65, + 114,114, 97,121, 44, 99,108, 97,115,115, 68,101, 99,108, 97, + 114, 97,116,105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105, + 110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58, + 112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108, + 111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 65,114,114, 97,121,123, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, + 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114, + 105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,116,121, + 112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,116, + 121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105, + 110,116, 40,105,100,101,110,116, 46, 46, 34, 32,112,116,114, + 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,112,116, + 114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, + 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, 32, + 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,101, + 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 32,100,101,102, 32, 32, 61, + 32, 39, 34, 46, 46,115,101,108,102, 46,100,101,102, 46, 46, + 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100, + 101,110,116, 46, 46, 34, 32,100,105,109, 32, 32, 61, 32, 39, + 34, 46, 46,115,101,108,102, 46,100,105,109, 46, 46, 34, 39, + 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32,114,101,116, 32, 32, 61, 32, 39, 34, 46, + 46,115,101,108,102, 46,114,101,116, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110, + 100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32, + 105,116, 32,105,115, 32, 97, 32,118, 97,114,105, 97, 98,108, + 101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 65,114,114, 97,121, 58,105,115,118, 97,114,105, 97, 98, + 108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110, 32,116, + 114,117,101, 10,101,110,100, 10, 10, 10, 45, 45, 32,103,101, + 116, 32,118, 97,114,105, 97, 98,108,101, 32,118, 97,108,117, + 101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 65,114,114, 97,121, 58,103,101,116,118, 97,108,117,101, + 32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 41, + 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32, + 115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,114, + 101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39, 58, + 58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, + 39, 91,116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, + 10, 32,101,108,115,101,105,102, 32, 99,108, 97,115,115, 32, + 116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 39, + 115,101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110, + 100,101,120, 93, 39, 10, 32,101,108,115,101, 10, 32, 32,114, + 101,116,117,114,110, 32,115,101,108,102, 46,110, 97,109,101, + 46, 46, 39, 91,116,111,108,117, 97, 95,105,110,100,101,120, + 93, 39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, + 32, 87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32, + 102,117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58, + 115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,108,111, 99, + 97,108, 32, 99,108, 97,115,115, 32, 61, 32,115,101,108,102, + 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32, 45, 45, + 32,103,101,116, 32,102,117,110, 99,116,105,111,110, 32, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104, + 101,110, 10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, + 32,103,101,116, 32,102,117,110, 99,116,105,111,110, 58, 34, + 44,115,101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102, + 32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, + 34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101, 10, 32, 32, + 111,117,116,112,117,116, 40, 34, 47, 42, 32,103,101,116, 32, + 102,117,110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, + 46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101, + 110,100, 10, 32,115,101,108,102, 46, 99,103,101,116,110, 97, + 109,101, 32, 61, 32,115,101,108,102, 58, 99,102,117,110, 99, + 110, 97,109,101, 40, 34,116,111,108,117, 97, 95,103,101,116, + 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102, + 110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, + 66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, 99,103,101, + 116,110, 97,109,101, 41, 10, 32,111,117,116,112,117,116, 40, + 34, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 34, 44, + 115,101,108,102, 46, 99,103,101,116,110, 97,109,101, 44, 34, + 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108, + 117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116,112,117,116, + 40, 34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, + 32,105,110,116, 32,116,111,108,117, 97, 95,105,110,100,101, + 120, 59, 34, 41, 10, 10, 32, 45, 45, 32,100,101, 99,108, 97, + 114,101, 32,115,101,108,102, 44, 32,105,102, 32,116,104,101, + 32, 99, 97,115,101, 10, 32,108,111, 99, 97,108, 32, 95, 44, + 95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116,114,102, + 105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, 94, + 37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41, 10, 32, + 105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116, + 97,116,105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101, + 108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 44, + 39, 42, 39, 44, 39,115,101,108,102, 59, 39, 41, 10, 32, 32, + 111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,112,117, + 115,104,115,116,114,105,110,103, 40,116,111,108,117, 97, 95, + 83, 44, 34, 46,115,101,108,102, 34, 41, 59, 39, 41, 10, 32, + 32,111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,114, + 97,119,103,101,116, 40,116,111,108,117, 97, 95, 83, 44, 49, + 41, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32,115,101,108,102, 32, 61, 32, 39, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 39, 40, 39, 44,115,101,108,102, 46,112, + 97,114,101,110,116, 46,116,121,112,101, 44, 39, 42, 41, 32, + 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,108,117, + 97, 95,116,111,117,115,101,114,100, 97,116, 97, 40,116,111, + 108,117, 97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32,101, + 108,115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104, + 101,110, 10, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109, + 111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101, + 108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97, + 116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10, + 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, + 32,105,110,100,101,120, 10, 9,111,117,116,112,117,116, 40, + 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, + 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9,111,117, + 116,112,117,116, 40, 39, 32,123, 39, 41, 10, 9,111,117,116, + 112,117,116, 40, 39, 32, 32,116,111,108,117, 97, 95, 69,114, + 114,111,114, 32,116,111,108,117, 97, 95,101,114,114, 59, 39, + 41, 10, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, + 32, 40, 33,116,111,108,117, 97, 95,105,115,110,117,109, 98, + 101,114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 44, + 38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39, 41, 10, + 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,108, + 117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95, + 83, 44, 34, 35,118,105,110,118, 97,108,105,100, 32,116,121, + 112,101, 32,105,110, 32, 97,114,114, 97,121, 32,105,110,100, + 101,120,105,110,103, 46, 34, 44, 38,116,111,108,117, 97, 95, + 101,114,114, 41, 59, 39, 41, 10, 9,111,117,116,112,117,116, + 40, 39, 32,125, 39, 41, 10, 9,111,117,116,112,117,116, 40, + 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 9,105,102, + 32,102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,104,101, + 110, 32, 45, 45, 32,102,111,114, 32, 99,111,109,112, 97,116, + 105, 98,105,108,105,116,121, 32,119,105,116,104, 32,116,111, + 108,117, 97, 53, 32, 63, 10, 9, 9,111,117,116,112,117,116, + 40, 39, 32,116,111,108,117, 97, 95,105,110,100,101,120, 32, + 61, 32, 40,105,110,116, 41,116,111,108,117, 97, 95,116,111, + 110,117,109, 98,101,114, 40,116,111,108,117, 97, 95, 83, 44, + 50, 44, 48, 41, 45, 49, 59, 39, 41, 10, 9,101,108,115,101, + 10, 9, 9,111,117,116,112,117,116, 40, 39, 32,116,111,108, + 117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110,116, + 41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101,114, + 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 59, 39, + 41, 10, 9,101,110,100, 10, 9,111,117,116,112,117,116, 40, + 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, + 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9,105,102, + 32,115,101,108,102, 46,100,105,109, 32, 97,110,100, 32,115, + 101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116, + 104,101,110, 10, 9, 32, 32,111,117,116,112,117,116, 40, 39, + 32,105,102, 32, 40,116,111,108,117, 97, 95,105,110,100,101, + 120, 60, 48, 32,124,124, 32,116,111,108,117, 97, 95,105,110, + 100,101,120, 62, 61, 39, 46, 46,115,101,108,102, 46,100,105, + 109, 46, 46, 39, 41, 39, 41, 10, 9,101,108,115,101, 10, 9, + 32, 32,111,117,116,112,117,116, 40, 39, 32,105,102, 32, 40, + 116,111,108,117, 97, 95,105,110,100,101,120, 60, 48, 41, 39, + 41, 10, 9,101,110,100, 10, 32,111,117,116,112,117,116, 40, + 39, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40, + 116,111,108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32, + 105,110,100,101,120,105,110,103, 32,111,117,116, 32,111,102, + 32,114, 97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59, + 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 35,101,110, + 100,105,102, 92,110, 39, 41, 10, 10, 32, 45, 45, 32,114,101, + 116,117,114,110, 32,118, 97,108,117,101, 10, 32,108,111, 99, + 97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115, + 105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, + 108,111, 99, 97,108, 32,112,117,115,104, 95,102,117,110, 99, + 32, 61, 32,103,101,116, 95,112,117,115,104, 95,102,117,110, + 99,116,105,111,110, 40,116, 41, 10, 32,105,102, 32,116, 32, + 116,104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46,116, + 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, + 99,116, 44, 39, 41, 39, 46, 46,115,101,108,102, 58,103,101, + 116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116, + 97,116,105, 99, 41, 46, 46, 39, 41, 59, 39, 41, 10, 32,101, + 108,115,101, 10, 9, 9,116, 32, 61, 32,115,101,108,102, 46, + 116,121,112,101, 10, 32, 32,105,102, 32,115,101,108,102, 46, + 112,116,114, 32, 61, 61, 32, 39, 38, 39, 32,111,114, 32,115, + 101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116, + 104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40, + 116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, + 38, 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108, + 117,101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, + 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, + 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116, + 112,117,116, 40, 39, 32, 39, 44,112,117,115,104, 95,102,117, + 110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118, + 111,105,100, 42, 41, 39, 46, 46,115,101,108,102, 58,103,101, + 116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116, + 97,116,105, 99, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, + 34, 41, 59, 39, 41, 10, 32, 32,101,110,100, 10, 32,101,110, + 100, 10, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116, + 117,114,110, 32, 49, 59, 39, 41, 10, 32,111,117,116,112,117, + 116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40, + 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,110,100, + 101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, + 69, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39, + 92,110, 39, 41, 10, 10, 32, 45, 45, 32,115,101,116, 32,102, + 117,110, 99,116,105,111,110, 32, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 32,105,102, + 32,110,111,116, 32,115,116,114,102,105,110,100, 40,115,101, + 108,102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 39, + 41, 32,116,104,101,110, 10, 32, 32,105,102, 32, 99,108, 97, + 115,115, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112, + 117,116, 40, 34, 47, 42, 32,115,101,116, 32,102,117,110, 99, + 116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, 97,109, + 101, 44, 34, 32,111,102, 32, 99,108, 97,115,115, 32, 34, 44, + 99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32, + 101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40, + 34, 47, 42, 32,115,101,116, 32,102,117,110, 99,116,105,111, + 110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34, + 32, 42, 47, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,115, + 101,108,102, 46, 99,115,101,116,110, 97,109,101, 32, 61, 32, + 115,101,108,102, 58, 99,102,117,110, 99,110, 97,109,101, 40, + 34,116,111,108,117, 97, 95,115,101,116, 34, 41, 10, 32, 32, + 111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,102, + 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, + 34, 46, 46,115,101,108,102, 46, 99,115,101,116,110, 97,109, + 101, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, 92,110, + 115,116, 97,116,105, 99, 32,105,110,116, 34, 44,115,101,108, + 102, 46, 99,115,101,116,110, 97,109,101, 44, 34, 40,108,117, + 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95, + 83, 41, 34, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, + 123, 34, 41, 10, 10, 32, 32, 45, 45, 32,100,101, 99,108, 97, + 114,101, 32,105,110,100,101,120, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 32,105,110,116, 32,116,111,108,117, 97, 95, + 105,110,100,101,120, 59, 39, 41, 10, 10, 32, 32, 45, 45, 32, + 100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105, + 102, 32,116,104,101, 32, 99, 97,115,101, 10, 32, 32,108,111, + 99, 97,108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32, + 61, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, + 109,111,100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105, + 99, 41, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115, + 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,110,105, + 108, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 32, 39, 44,115,101,108,102, 46,112, 97,114,101, + 110,116, 46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101, + 108,102, 59, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116, + 40, 39, 32,108,117, 97, 95,112,117,115,104,115,116,114,105, + 110,103, 40,116,111,108,117, 97, 95, 83, 44, 34, 46,115,101, + 108,102, 34, 41, 59, 39, 41, 10, 32, 32, 32,111,117,116,112, + 117,116, 40, 39, 32,108,117, 97, 95,114, 97,119,103,101,116, + 40,116,111,108,117, 97, 95, 83, 44, 49, 41, 59, 39, 41, 10, + 32, 32, 32,111,117,116,112,117,116, 40, 39, 32,115,101,108, + 102, 32, 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 40, 39, 44,115,101,108,102, 46,112, 97,114,101, + 110,116, 46,116,121,112,101, 44, 39, 42, 41, 32, 39, 41, 10, + 32, 32, 32,111,117,116,112,117,116, 40, 39,108,117, 97, 95, + 116,111,117,115,101,114,100, 97,116, 97, 40,116,111,108,117, + 97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32, 32,101,108, + 115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104,101, + 110, 10, 32, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109, + 111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101, + 108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97, + 116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10, + 32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32, 99,104,101, + 99,107, 32,105,110,100,101,120, 10, 9, 32,111,117,116,112, + 117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, + 9, 32,111,117,116,112,117,116, 40, 39, 32,123, 39, 41, 10, + 9, 32,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108, + 117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, 95, + 101,114,114, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 32,105,102, 32, 40, 33,116,111,108,117, 97, 95, + 105,115,110,117,109, 98,101,114, 40,116,111,108,117, 97, 95, + 83, 44, 50, 44, 48, 44, 38,116,111,108,117, 97, 95,101,114, + 114, 41, 41, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, + 39, 32, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, + 40,116,111,108,117, 97, 95, 83, 44, 34, 35,118,105,110,118, + 97,108,105,100, 32,116,121,112,101, 32,105,110, 32, 97,114, + 114, 97,121, 32,105,110,100,101,120,105,110,103, 46, 34, 44, + 38,116,111,108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 32,125, 39, 41, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 35,101,110,100,105, + 102, 92,110, 39, 41, 10, 10, 9,105,102, 32,102,108, 97,103, + 115, 91, 39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45, 32, + 102,111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105, + 116,121, 32,119,105,116,104, 32,116,111,108,117, 97, 53, 32, + 63, 10, 9, 9,111,117,116,112,117,116, 40, 39, 32,116,111, + 108,117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110, + 116, 41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101, + 114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 45, + 49, 59, 39, 41, 10, 9,101,108,115,101, 10, 9, 9,111,117, + 116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,105,110, + 100,101,120, 32, 61, 32, 40,105,110,116, 41,116,111,108,117, + 97, 95,116,111,110,117,109, 98,101,114, 40,116,111,108,117, + 97, 95, 83, 44, 50, 44, 48, 41, 59, 39, 41, 10, 9,101,110, + 100, 10, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,105, + 102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, + 69, 65, 83, 69, 92,110, 39, 41, 10, 9,105,102, 32,115,101, + 108,102, 46,100,105,109, 32, 97,110,100, 32,115,101,108,102, + 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110, + 10, 9, 32, 32,111,117,116,112,117,116, 40, 39, 32,105,102, + 32, 40,116,111,108,117, 97, 95,105,110,100,101,120, 60, 48, + 32,124,124, 32,116,111,108,117, 97, 95,105,110,100,101,120, + 62, 61, 39, 46, 46,115,101,108,102, 46,100,105,109, 46, 46, + 39, 41, 39, 41, 10, 9,101,108,115,101, 10, 9, 32, 32,111, + 117,116,112,117,116, 40, 39, 32,105,102, 32, 40,116,111,108, + 117, 97, 95,105,110,100,101,120, 60, 48, 41, 39, 41, 10, 9, + 101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111, + 108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32,105,110, + 100,101,120,105,110,103, 32,111,117,116, 32,111,102, 32,114, + 97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, + 10, 9, 9,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 10, 10, 32, 32, 45, 45, 32, 97,115, + 115,105,103,110, 32,118, 97,108,117,101, 10, 32, 32,108,111, + 99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10, 32, 32, + 105,102, 32,115,101,108,102, 46,112,116,114,126, 61, 39, 39, + 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39, 42, 39, + 32,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32, + 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,110, + 10, 32, 32, 32,111,117,116,112,117,116, 40, 99,108, 97,115, + 115, 46, 46, 39, 58, 58, 39, 46, 46,115,101,108,102, 46,110, + 97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110, + 100,101,120, 93, 39, 41, 10, 32, 32,101,108,115,101,105,102, + 32, 99,108, 97,115,115, 32,116,104,101,110, 10, 32, 32, 32, + 111,117,116,112,117,116, 40, 39,115,101,108,102, 45, 62, 39, + 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91, + 116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10, + 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112,117, + 116, 40,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91, + 116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10, + 32, 32,101,110,100, 10, 32, 32,108,111, 99, 97,108, 32,116, + 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, + 46,116,121,112,101, 41, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 61, 32, 39, 41, 10, 32, 32,105,102, 32,110,111, + 116, 32,116, 32, 97,110,100, 32,112,116,114, 61, 61, 39, 39, + 32,116,104,101,110, 32,111,117,116,112,117,116, 40, 39, 42, + 39, 41, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116, + 40, 39, 40, 40, 39, 44,115,101,108,102, 46,109,111,100, 44, + 115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102, + 32,110,111,116, 32,116, 32,116,104,101,110, 10, 32, 32, 32, + 111,117,116,112,117,116, 40, 39, 42, 39, 41, 10, 32, 32,101, + 110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 41, 32, + 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,100,101,102, 32, + 61, 32, 48, 10, 32, 32,105,102, 32,115,101,108,102, 46,100, + 101,102, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 32,100, + 101,102, 32, 61, 32,115,101,108,102, 46,100,101,102, 32,101, + 110,100, 10, 32, 32,105,102, 32,116, 32,116,104,101,110, 10, + 32, 32, 32,111,117,116,112,117,116, 40, 39,116,111,108,117, + 97, 95,116,111, 39, 46, 46,116, 44, 39, 40,116,111,108,117, + 97, 95, 83, 44, 51, 44, 39, 44,100,101,102, 44, 39, 41, 41, + 59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,108, + 111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32, + 103,101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110, + 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32, 32, + 111,117,116,112,117,116, 40,116,111, 95,102,117,110, 99, 44, + 39, 40,116,111,108,117, 97, 95, 83, 44, 51, 44, 39, 44,100, + 101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32,101,110,100, + 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116, + 117,114,110, 32, 48, 59, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40, 39,125, 39, 41, 10, 32, 32,111,117,116,112,117, + 116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102, + 110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, + 66, 76, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117, + 116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10, 10,101, + 110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, + 97,115,115, 65,114,114, 97,121, 58,114,101,103,105,115,116, + 101,114, 32, 40,112,114,101, 41, 10, 9,105,102, 32,110,111, + 116, 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, + 98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116, + 104,101,110, 10, 9, 9,114,101,116,117,114,110, 10, 9,101, + 110,100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32, + 111,114, 32, 39, 39, 10, 32,105,102, 32,115,101,108,102, 46, + 99,115,101,116,110, 97,109,101, 32,116,104,101,110, 10, 32, + 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116, + 111,108,117, 97, 95, 97,114,114, 97,121, 40,116,111,108,117, + 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, + 97,109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102, + 46, 99,103,101,116,110, 97,109,101, 46, 46, 39, 44, 39, 46, + 46,115,101,108,102, 46, 99,115,101,116,110, 97,109,101, 46, + 46, 39, 41, 59, 39, 41, 10, 32,101,108,115,101, 10, 32, 32, + 111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111, + 108,117, 97, 95, 97,114,114, 97,121, 40,116,111,108,117, 97, + 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97, + 109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102, 46, + 99,103,101,116,110, 97,109,101, 46, 46, 39, 44, 78, 85, 76, + 76, 41, 59, 39, 41, 10, 32,101,110,100, 10,101,110,100, 10, + 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111, + 110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116, + 105,111,110, 32, 95, 65,114,114, 97,121, 32, 40,116, 41, 10, + 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, + 44, 99,108, 97,115,115, 65,114,114, 97,121, 41, 10, 32, 97, + 112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114, + 110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110, + 115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112, + 101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114, + 101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101, + 32,118, 97,114,105, 97, 98,108,101, 32,100,101, 99,108, 97, + 114, 97,116,105,111,110, 46, 10,102,117,110, 99,116,105,111, + 110, 32, 65,114,114, 97,121, 32, 40,115, 41, 10, 32,114,101, + 116,117,114,110, 32, 95, 65,114,114, 97,121, 32, 40, 68,101, + 99,108, 97,114, 97,116,105,111,110, 40,115, 44, 39,118, 97, + 114, 39, 41, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/array.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73, + 100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99, + 111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102, + 116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32, + 114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, + 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32, + 105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116, + 119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104, + 101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, + 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105, + 115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97, + 117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98, + 108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111, + 118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99, + 101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, + 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99, + 101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105, + 102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, + 45, 32, 70,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, + 32, 97, 32,102,117,110, 99,116,105,111,110, 32,111,114, 32, + 97, 32, 99,108, 97,115,115, 32,109,101,116,104,111,100, 46, + 10, 45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105, + 110,103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115, + 116,111,114,101,100, 58, 10, 45, 45, 32, 32,109,111,100, 32, + 32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105,101, + 114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32,116, + 121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61, 32, + 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102, 32, + 114,101,112,114,101,115,101,110,116,105,110,103, 32, 97, 32, + 112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114,101, + 102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97,109, + 101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,108,110, + 97,109,101, 32, 61, 32,108,117, 97, 32,110, 97,109,101, 10, + 45, 45, 32, 32, 97,114,103,115, 32, 32, 61, 32,108,105,115, + 116, 32,111,102, 32, 97,114,103,117,109,101,110,116, 32,100, + 101, 99,108, 97,114, 97,116,105,111,110,115, 10, 45, 45, 32, + 32, 99,111,110,115,116, 32, 61, 32,105,102, 32,105,116, 32, + 105,115, 32, 97, 32,109,101,116,104,111,100, 32,114,101, 99, + 101,105,118,105,110,103, 32, 97, 32, 99,111,110,115,116, 32, + 34,116,104,105,115, 34, 46, 10, 99,108, 97,115,115, 70,117, + 110, 99,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100, + 32, 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, + 39, 39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10, + 32,110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32, 97,114, + 103,115, 32, 61, 32,123,110, 61, 48,125, 44, 10, 32, 99,111, + 110,115,116, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97, + 115,115, 70,117,110, 99,116,105,111,110, 46, 95, 95,105,110, + 100,101,120, 32, 61, 32, 99,108, 97,115,115, 70,117,110, 99, + 116,105,111,110, 10,115,101,116,109,101,116, 97,116, 97, 98, + 108,101, 40, 99,108, 97,115,115, 70,117,110, 99,116,105,111, + 110, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41, + 10, 10, 45, 45, 32,100,101, 99,108, 97,114,101, 32,116, 97, + 103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 70,117,110, 99,116,105,111,110, 58,100,101, 99,108, + 116,121,112,101, 32, 40, 41, 10, 32,115,101,108,102, 46,116, + 121,112,101, 32, 61, 32,116,121,112,101,118, 97,114, 40,115, + 101,108,102, 46,116,121,112,101, 41, 10, 32,105,102, 32,115, + 116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, + 44, 39, 99,111,110,115,116, 39, 41, 32,116,104,101,110, 10, + 9, 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32, 39, + 99,111,110,115,116, 32, 39, 46, 46,115,101,108,102, 46,116, + 121,112,101, 10, 9, 9,115,101,108,102, 46,109,111,100, 32, + 61, 32,103,115,117, 98, 40,115,101,108,102, 46,109,111,100, + 44, 39, 99,111,110,115,116, 39, 44, 39, 39, 41, 10, 9,101, + 110,100, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, + 119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115, + 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97, + 114,103,115, 91,105, 93, 58,100,101, 99,108,116,121,112,101, + 40, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101, + 110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 87,114,105, + 116,101, 32, 98,105,110,100,105,110,103, 32,102,117,110, 99, + 116,105,111,110, 10, 45, 45, 32, 79,117,116,112,117,116,115, + 32, 67, 47, 67, 43, 43, 32, 98,105,110,100,105,110,103, 32, + 102,117,110, 99,116,105,111,110, 46, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105, + 111,110, 58,115,117,112, 99,111,100,101, 32, 40,108,111, 99, + 97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 41, + 10, 10, 32,108,111, 99, 97,108, 32,111,118,101,114,108,111, + 97,100, 32, 61, 32,115,116,114,115,117, 98, 40,115,101,108, + 102, 46, 99,110, 97,109,101, 44, 45, 50, 44, 45, 49, 41, 32, + 45, 32, 49, 32, 32, 45, 45, 32,105,110,100,105, 99, 97,116, + 101, 32,111,118,101,114,108,111, 97,100,101,100, 32,102,117, + 110, 99, 10, 32,108,111, 99, 97,108, 32,110,114,101,116, 32, + 61, 32, 48, 32, 32, 32, 32, 32, 32, 45, 45, 32,110,117,109, + 98,101,114, 32,111,102, 32,114,101,116,117,114,110,101,100, + 32,118, 97,108,117,101,115, 10, 32,108,111, 99, 97,108, 32, + 99,108, 97,115,115, 32, 61, 32,115,101,108,102, 58,105,110, + 99,108, 97,115,115, 40, 41, 10, 32,108,111, 99, 97,108, 32, + 95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, + 39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41, + 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, + 10, 10, 32, 9,105,102, 32,115,101,108,102, 46,110, 97,109, + 101, 32, 61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32, + 115,101,108,102, 46,112, 97,114,101,110,116, 46,102,108, 97, + 103,115, 46,112,117,114,101, 95,118,105,114,116,117, 97,108, + 32,116,104,101,110, 10, 32, 9, 9, 45, 45, 32,110,111, 32, + 99,111,110,115,116,114,117, 99,116,111,114, 32,102,111,114, + 32, 99,108, 97,115,115,101,115, 32,119,105,116,104, 32,112, + 117,114,101, 32,118,105,114,116,117, 97,108, 32,109,101,116, + 104,111,100,115, 10, 32, 9, 9,114,101,116,117,114,110, 10, + 32, 9,101,110,100, 10, 10, 32, 9,105,102, 32,108,111, 99, + 97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32, + 116,104,101,110, 10, 9, 9,111,117,116,112,117,116, 40, 34, + 47, 42, 32,109,101,116,104,111,100, 58, 32,110,101,119, 95, + 108,111, 99, 97,108, 32,111,102, 32, 99,108, 97,115,115, 32, + 34, 44, 99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10, + 9,101,108,115,101, 10, 9, 9,111,117,116,112,117,116, 40, + 34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115,101, + 108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108, + 97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42, + 47, 34, 41, 10, 9,101,110,100, 10, 32,101,108,115,101, 10, + 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,102,117, + 110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, + 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,110,100, + 10, 10, 32,105,102, 32,108,111, 99, 97,108, 95, 99,111,110, + 115,116,114,117, 99,116,111,114, 32,116,104,101,110, 10, 32, + 32,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101, + 102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, + 95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46, + 46, 34, 95,108,111, 99, 97,108, 34, 41, 10, 32, 32,111,117, + 116,112,117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32, + 105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97,109,101, + 46, 46, 34, 95,108,111, 99, 97,108, 34, 44, 34, 40,108,117, + 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95, + 83, 41, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,111,117, + 116,112,117,116, 40, 34, 35,105,102,110,100,101,102, 32, 84, + 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, 34, 46, + 46,115,101,108,102, 46, 99,110, 97,109,101, 41, 10, 32, 32, + 111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,116,105, + 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97, + 109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, + 32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,101,110, + 100, 10, 32,111,117,116,112,117,116, 40, 34,123, 34, 41, 10, + 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,121,112,101, + 115, 10, 9,105,102, 32,111,118,101,114,108,111, 97,100, 32, + 60, 32, 48, 32,116,104,101,110, 10, 9, 32,111,117,116,112, + 117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, + 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, + 9,101,110,100, 10, 9,111,117,116,112,117,116, 40, 39, 32, + 116,111,108,117, 97, 95, 69,114,114,111,114, 32,116,111,108, + 117, 97, 95,101,114,114, 59, 39, 41, 10, 32,111,117,116,112, + 117,116, 40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10, 32, + 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10, 32, + 108,111, 99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32, + 99,108, 97,115,115, 32,116,104,101,110, 32,110, 97,114,103, + 61, 50, 32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32, + 101,110,100, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116, + 104,101,110, 10, 9, 9,108,111, 99, 97,108, 32,102,117,110, + 99, 32, 61, 32,103,101,116, 95,105,115, 95,102,117,110, 99, + 116,105,111,110, 40,115,101,108,102, 46,112, 97,114,101,110, + 116, 46,116,121,112,101, 41, 10, 9, 9,108,111, 99, 97,108, + 32,116,121,112,101, 32, 61, 32,115,101,108,102, 46,112, 97, + 114,101,110,116, 46,116,121,112,101, 10, 9, 9,105,102, 32, + 115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101,119, + 39, 32,111,114, 32,115,116, 97,116,105, 99,126, 61,110,105, + 108, 32,116,104,101,110, 10, 9, 9, 9,102,117,110, 99, 32, + 61, 32, 39,116,111,108,117, 97, 95,105,115,117,115,101,114, + 116, 97, 98,108,101, 39, 10, 9, 9, 9,116,121,112,101, 32, + 61, 32,115,101,108,102, 46,112, 97,114,101,110,116, 46,116, + 121,112,101, 10, 9, 9,101,110,100, 10, 9, 9,105,102, 32, + 115,101,108,102, 46, 99,111,110,115,116, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 9, 9, 9,116,121,112,101, 32, + 61, 32, 34, 99,111,110,115,116, 32, 34, 46, 46,116,121,112, + 101, 10, 9, 9,101,110,100, 10, 9, 9,111,117,116,112,117, + 116, 40, 39, 32, 32, 32, 32, 32, 33, 39, 46, 46,102,117,110, + 99, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, + 34, 39, 46, 46,116,121,112,101, 46, 46, 39, 34, 44, 48, 44, + 38,116,111,108,117, 97, 95,101,114,114, 41, 32,124,124, 92, + 110, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45, 32, 99,104, + 101, 99,107, 32, 97,114,103,115, 10, 32,105,102, 32,115,101, + 108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101, + 32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, + 10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32, + 119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115, + 91,105, 93, 32,100,111, 10, 32, 32, 32,108,111, 99, 97,108, + 32, 98,116,121,112,101, 32, 61, 32,105,115, 98, 97,115,105, + 99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46, + 116,121,112,101, 41, 10, 32, 32, 32,105,102, 32, 98,116,121, + 112,101, 32,126, 61, 32, 39,118, 97,108,117,101, 39, 32, 97, + 110,100, 32, 98,116,121,112,101, 32,126, 61, 32, 39,115,116, + 97,116,101, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,111, + 117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 39, 46, 46, + 115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,111,117, + 116, 99,104,101, 99,107,116,121,112,101, 40,110, 97,114,103, + 41, 46, 46, 39, 32,124,124, 92,110, 39, 41, 10, 32, 32, 32, + 101,110,100, 10, 32, 32, 32,105,102, 32, 98,116,121,112,101, + 32,126, 61, 32, 39,115,116, 97,116,101, 39, 32,116,104,101, + 110, 10, 9, 32, 32, 32,110, 97,114,103, 32, 61, 32,110, 97, + 114,103, 43, 49, 10, 32, 32, 32,101,110,100, 10, 32, 32, 32, + 105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,101, + 110,100, 32,111,102, 32,108,105,115,116, 10, 32,111,117,116, + 112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111,108,117, + 97, 95,105,115,110,111,111, 98,106, 40,116,111,108,117, 97, + 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39, 44, 38, + 116,111,108,117, 97, 95,101,114,114, 41, 92,110, 32, 41, 39, + 41, 10, 9,111,117,116,112,117,116, 40, 39, 32, 32,103,111, + 116,111, 32,116,111,108,117, 97, 95,108,101,114,114,111,114, + 59, 39, 41, 10, 10, 32,111,117,116,112,117,116, 40, 39, 32, + 101,108,115,101, 92,110, 39, 41, 10, 9,105,102, 32,111,118, + 101,114,108,111, 97,100, 32, 60, 32, 48, 32,116,104,101,110, + 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 10, 9,101,110,100, 10, 9,111,117, + 116,112,117,116, 40, 39, 32,123, 39, 41, 10, 10, 32, 45, 45, + 32,100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32, + 105,102, 32,116,104,101, 32, 99, 97,115,101, 10, 32,108,111, + 99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32, 99,108, + 97,115,115, 32,116,104,101,110, 32,110, 97,114,103, 61, 50, + 32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32,101,110, + 100, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, + 32,115,101,108,102, 46,110, 97,109,101,126, 61, 39,110,101, + 119, 39, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61, + 110,105,108, 32,116,104,101,110, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111,110, + 115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46, + 116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32, + 61, 32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, + 40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,115, + 101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, + 44, 39, 42, 41, 32, 39, 41, 10, 32, 32,108,111, 99, 97,108, + 32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95, + 116,111, 95,102,117,110, 99,116,105,111,110, 40,115,101,108, + 102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 41, 10, + 32, 32,111,117,116,112,117,116, 40,116,111, 95,102,117,110, + 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 48, + 41, 59, 39, 41, 10, 32,101,108,115,101,105,102, 32,115,116, + 97,116,105, 99, 32,116,104,101,110, 10, 32, 32, 95, 44, 95, + 44,115,101,108,102, 46,109,111,100, 32, 61, 32,115,116,114, + 102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, + 94, 37,115, 42,115,116, 97,116,105, 99, 37,115, 37,115, 42, + 40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45, + 32,100,101, 99,108, 97,114,101, 32,112, 97,114, 97,109,101, + 116,101,114,115, 10, 32,105,102, 32,115,101,108,102, 46, 97, + 114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126, 61, 32, + 39,118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32,108, + 111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104,105,108, + 101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32, + 100,111, 10, 32, 32, 32,115,101,108,102, 46, 97,114,103,115, + 91,105, 93, 58,100,101, 99,108, 97,114,101, 40,110, 97,114, + 103, 41, 10, 32, 32, 32,105,102, 32,105,115, 98, 97,115,105, + 99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46, + 116,121,112,101, 41, 32,126, 61, 32, 34,115,116, 97,116,101, + 34, 32,116,104,101,110, 10, 9, 32, 32, 32,110, 97,114,103, + 32, 61, 32,110, 97,114,103, 43, 49, 10, 32, 32, 32,101,110, + 100, 10, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, + 101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99, + 104,101, 99,107, 32,115,101,108,102, 10, 32,105,102, 32, 99, + 108, 97,115,115, 32, 97,110,100, 32,115,101,108,102, 46,110, + 97,109,101,126, 61, 39,110,101,119, 39, 32, 97,110,100, 32, + 115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,104,101, + 110, 10, 9, 32,111,117,116,112,117,116, 40, 39, 35,105,102, + 110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, + 65, 83, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117, + 116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,102, 41, + 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111, + 108,117, 97, 95, 83, 44, 34,105,110,118, 97,108,105,100, 32, + 92, 39,115,101,108,102, 92, 39, 32,105,110, 32,102,117,110, + 99,116,105,111,110, 32, 92, 39, 39, 46, 46,115,101,108,102, + 46,110, 97,109,101, 46, 46, 39, 92, 39, 34, 44, 78, 85, 76, + 76, 41, 59, 39, 41, 59, 10, 9, 32,111,117,116,112,117,116, + 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 32,101, + 110,100, 10, 10, 32, 45, 45, 32,103,101,116, 32, 97,114,114, + 97,121, 32,101,108,101,109,101,110,116, 32,118, 97,108,117, + 101,115, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104, + 101,110, 32,110, 97,114,103, 61, 50, 32,101,108,115,101, 32, + 110, 97,114,103, 61, 49, 32,101,110,100, 10, 32,105,102, 32, + 115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121, + 112,101, 32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104, + 101,110, 10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, + 32, 32,119,104,105,108,101, 32,115,101,108,102, 46, 97,114, + 103,115, 91,105, 93, 32,100,111, 10, 32, 32, 32,115,101,108, + 102, 46, 97,114,103,115, 91,105, 93, 58,103,101,116, 97,114, + 114, 97,121, 40,110, 97,114,103, 41, 10, 32, 32, 32,110, 97, + 114,103, 32, 61, 32,110, 97,114,103, 43, 49, 10, 32, 32, 32, + 105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,111,117,116, + 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108,117, + 97, 95,111,117,116,115,105,100,101, 34, 41, 10, 32, 45, 45, + 32, 99, 97,108,108, 32,102,117,110, 99,116,105,111,110, 10, + 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115, + 101,108,102, 46,110, 97,109,101, 61, 61, 39,100,101,108,101, + 116,101, 39, 32,116,104,101,110, 10, 32, 32,111,117,116,112, + 117,116, 40, 39, 32, 32, 77,116,111,108,117, 97, 95,100,101, + 108,101,116,101, 40,115,101,108,102, 41, 59, 39, 41, 10, 32, + 101,108,115,101,105,102, 32, 99,108, 97,115,115, 32, 97,110, + 100, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 61, 32, + 39,111,112,101,114, 97,116,111,114, 38, 91, 93, 39, 32,116, + 104,101,110, 10, 32, 32,105,102, 32,102,108, 97,103,115, 91, + 39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45, 32,102,111, + 114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,116,121, + 32,119,105,116,104, 32,116,111,108,117, 97, 53, 32, 63, 10, + 9,111,117,116,112,117,116, 40, 39, 32, 32,115,101,108,102, + 45, 62,111,112,101,114, 97,116,111,114, 91, 93, 40, 39, 44, + 115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,110, 97, + 109,101, 44, 39, 45, 49, 41, 32, 61, 32, 39, 44,115,101,108, + 102, 46, 97,114,103,115, 91, 50, 93, 46,110, 97,109,101, 44, + 39, 59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32, + 32,111,117,116,112,117,116, 40, 39, 32, 32,115,101,108,102, + 45, 62,111,112,101,114, 97,116,111,114, 91, 93, 40, 39, 44, + 115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,110, 97, + 109,101, 44, 39, 41, 32, 61, 32, 39, 44,115,101,108,102, 46, + 97,114,103,115, 91, 50, 93, 46,110, 97,109,101, 44, 39, 59, + 39, 41, 10, 32, 32,101,110,100, 10, 32,101,108,115,101, 10, + 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,123, 39, 41, + 10, 32, 32,105,102, 32,115,101,108,102, 46,116,121,112,101, + 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, + 46,116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39, + 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, + 40, 39, 32, 32, 39, 44,115,101,108,102, 46,109,111,100, 44, + 115,101,108,102, 46,116,121,112,101, 44,115,101,108,102, 46, + 112,116,114, 44, 39,116,111,108,117, 97, 95,114,101,116, 32, + 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116, 40, + 39, 40, 39, 44,115,101,108,102, 46,109,111,100, 44,115,101, + 108,102, 46,116,121,112,101, 44,115,101,108,102, 46,112,116, + 114, 44, 39, 41, 32, 39, 41, 10, 32, 32,101,108,115,101, 10, + 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 39, 41, + 10, 32, 32,101,110,100, 10, 32, 32,105,102, 32, 99,108, 97, + 115,115, 32, 97,110,100, 32,115,101,108,102, 46,110, 97,109, + 101, 61, 61, 39,110,101,119, 39, 32,116,104,101,110, 10, 32, + 32, 32,111,117,116,112,117,116, 40, 39, 77,116,111,108,117, + 97, 95,110,101,119, 40, 40, 39, 44,115,101,108,102, 46,116, + 121,112,101, 44, 39, 41, 40, 39, 41, 10, 32, 32,101,108,115, + 101,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115, + 116, 97,116,105, 99, 32,116,104,101,110, 10, 9,105,102, 32, + 111,117,116, 32,116,104,101,110, 10, 9, 9,111,117,116,112, + 117,116, 40,115,101,108,102, 46,110, 97,109,101, 44, 39, 40, + 39, 41, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,112, + 117,116, 40, 99,108, 97,115,115, 46, 46, 39, 58, 58, 39, 46, + 46,115,101,108,102, 46,110, 97,109,101, 44, 39, 40, 39, 41, + 10, 9,101,110,100, 10, 32, 32,101,108,115,101,105,102, 32, + 99,108, 97,115,115, 32,116,104,101,110, 10, 9,105,102, 32, + 111,117,116, 32,116,104,101,110, 10, 9, 9,111,117,116,112, + 117,116, 40,115,101,108,102, 46,110, 97,109,101, 44, 39, 40, + 39, 41, 10, 9,101,108,115,101, 10, 9, 32, 32,105,102, 32, + 115,101,108,102, 46, 99, 97,115,116, 95,111,112,101,114, 97, + 116,111,114, 32,116,104,101,110, 10, 9, 32, 32, 9, 45, 45, + 111,117,116,112,117,116, 40, 39,115,116, 97,116,105, 99, 95, + 99, 97,115,116, 60, 39, 44,115,101,108,102, 46,109,111,100, + 44,115,101,108,102, 46,116,121,112,101, 44,115,101,108,102, + 46,112,116,114, 44, 39, 62, 40, 42,115,101,108,102, 39, 41, + 10, 9, 9,111,117,116,112,117,116, 40, 39,115,101,108,102, + 45, 62,111,112,101,114, 97,116,111,114, 32, 39, 44,115,101, + 108,102, 46,109,111,100, 44,115,101,108,102, 46,116,121,112, + 101, 44, 39, 40, 39, 41, 10, 9, 32, 32,101,108,115,101, 10, + 9, 9,111,117,116,112,117,116, 40, 39,115,101,108,102, 45, + 62, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 44, 39, + 40, 39, 41, 10, 9, 32, 32,101,110,100, 10, 9,101,110,100, + 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112, + 117,116, 40,115,101,108,102, 46,110, 97,109,101, 44, 39, 40, + 39, 41, 10, 32, 32,101,110,100, 10, 10, 32, 32,105,102, 32, + 111,117,116, 32, 97,110,100, 32,110,111,116, 32,115,116, 97, + 116,105, 99, 32,116,104,101,110, 10, 32, 32, 9,111,117,116, + 112,117,116, 40, 39,115,101,108,102, 39, 41, 10, 9,105,102, + 32,115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 32, 97, + 110,100, 32,115,101,108,102, 46, 97,114,103,115, 91, 49, 93, + 46,110, 97,109,101, 32,126, 61, 32, 39, 39, 32,116,104,101, + 110, 10, 9, 9,111,117,116,112,117,116, 40, 39, 44, 39, 41, + 10, 9,101,110,100, 10, 32, 32,101,110,100, 10, 32, 32, 45, + 45, 32,119,114,105,116,101, 32,112, 97,114, 97,109,101,116, + 101,114,115, 10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, + 10, 32, 32,119,104,105,108,101, 32,115,101,108,102, 46, 97, + 114,103,115, 91,105, 93, 32,100,111, 10, 32, 32, 32,115,101, + 108,102, 46, 97,114,103,115, 91,105, 93, 58,112, 97,115,115, + 112, 97,114, 40, 41, 10, 32, 32, 32,105, 32, 61, 32,105, 43, + 49, 10, 32, 32, 32,105,102, 32,115,101,108,102, 46, 97,114, + 103,115, 91,105, 93, 32,116,104,101,110, 10, 32, 32, 32, 32, + 111,117,116,112,117,116, 40, 39, 44, 39, 41, 10, 32, 32, 32, + 101,110,100, 10, 32, 32,101,110,100, 10, 10, 32, 32,105,102, + 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,101,108,102, + 46,110, 97,109,101, 32, 61, 61, 32, 39,111,112,101,114, 97, + 116,111,114, 91, 93, 39, 32, 97,110,100, 32,102,108, 97,103, + 115, 91, 39, 49, 39, 93, 32,116,104,101,110, 10, 9,111,117, + 116,112,117,116, 40, 39, 45, 49, 41, 59, 39, 41, 10, 32, 32, + 101,108,115,101, 10, 9,105,102, 32, 99,108, 97,115,115, 32, + 97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 61, 61, + 39,110,101,119, 39, 32,116,104,101,110, 10, 9, 9,111,117, + 116,112,117,116, 40, 39, 41, 41, 59, 39, 41, 32, 45, 45, 32, + 99,108,111,115,101, 32, 77,116,111,108,117, 97, 95,110,101, + 119, 40, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,112, + 117,116, 40, 39, 41, 59, 39, 41, 10, 9,101,110,100, 10, 32, + 32,101,110,100, 10, 10, 32, 32, 45, 45, 32,114,101,116,117, + 114,110, 32,118, 97,108,117,101,115, 10, 32, 32,105,102, 32, + 115,101,108,102, 46,116,121,112,101, 32,126, 61, 32, 39, 39, + 32, 97,110,100, 32,115,101,108,102, 46,116,121,112,101, 32, + 126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10, + 32, 32, 32,110,114,101,116, 32, 61, 32,110,114,101,116, 32, + 43, 32, 49, 10, 32, 32, 32,108,111, 99, 97,108, 32,116, 44, + 99,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101, + 108,102, 46,116,121,112,101, 41, 10, 32, 32, 32,105,102, 32, + 116, 32,116,104,101,110, 10, 32, 32, 32, 9,105,102, 32,115, + 101,108,102, 46, 99, 97,115,116, 95,111,112,101,114, 97,116, + 111,114, 32, 97,110,100, 32, 95, 98, 97,115,105, 99, 95,114, + 97,119, 95,112,117,115,104, 91,116, 93, 32,116,104,101,110, + 10, 9, 9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 39, + 44, 95, 98, 97,115,105, 99, 95,114, 97,119, 95,112,117,115, + 104, 91,116, 93, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, + 40, 39, 44, 99,116, 44, 39, 41,116,111,108,117, 97, 95,114, + 101,116, 41, 59, 39, 41, 10, 32, 32, 32, 9,101,108,115,101, + 10, 9, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32, 32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46, + 116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, + 44, 99,116, 44, 39, 41,116,111,108,117, 97, 95,114,101,116, + 41, 59, 39, 41, 10, 9,101,110,100, 10, 32, 32, 32,101,108, + 115,101, 10, 9,116, 32, 61, 32,115,101,108,102, 46,116,121, + 112,101, 10, 9,110,101,119, 95,116, 32, 61, 32,115,116,114, + 105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, 99,111, + 110,115,116, 37,115, 43, 34, 44, 32, 34, 34, 41, 10, 9,108, + 111, 99, 97,108, 32,111,119,110,101,100, 32, 61, 32,102, 97, + 108,115,101, 10, 9,105,102, 32,115,116,114,105,110,103, 46, + 102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 32, + 34,116,111,108,117, 97, 95,111,119,110,101,100, 34, 41, 32, + 116,104,101,110, 10, 9, 9,111,119,110,101,100, 32, 61, 32, + 116,114,117,101, 10, 9,101,110,100, 10, 32, 32, 32, 32,108, + 111, 99, 97,108, 32,112,117,115,104, 95,102,117,110, 99, 32, + 61, 32,103,101,116, 95,112,117,115,104, 95,102,117,110, 99, + 116,105,111,110, 40,116, 41, 10, 32, 32, 32, 32,105,102, 32, + 115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32, + 116,104,101,110, 10, 32, 32, 32, 32, 32,111,117,116,112,117, + 116, 40, 39, 32, 32, 32,123, 39, 41, 10, 32, 32, 32, 32, 32, + 111,117,116,112,117,116, 40, 39, 35,105,102,100,101,102, 32, + 95, 95, 99,112,108,117,115,112,108,117,115, 92,110, 39, 41, + 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32, 32, 32,118,111,105,100, 42, 32,116,111,108,117, 97, 95, + 111, 98,106, 32, 61, 32, 77,116,111,108,117, 97, 95,110,101, + 119, 40, 40, 39, 44,110,101,119, 95,116, 44, 39, 41, 40,116, + 111,108,117, 97, 95,114,101,116, 41, 41, 59, 39, 41, 10, 32, + 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40, + 116,111,108,117, 97, 95, 83, 44,116,111,108,117, 97, 95,111, + 98,106, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, + 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, + 32, 32,116,111,108,117, 97, 95,114,101,103,105,115,116,101, + 114, 95,103, 99, 40,116,111,108,117, 97, 95, 83, 44,108,117, + 97, 95,103,101,116,116,111,112, 40,116,111,108,117, 97, 95, + 83, 41, 41, 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116, + 112,117,116, 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10, + 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, + 32, 32,118,111,105,100, 42, 32,116,111,108,117, 97, 95,111, + 98,106, 32, 61, 32,116,111,108,117, 97, 95, 99,111,112,121, + 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, + 41, 38,116,111,108,117, 97, 95,114,101,116, 44,115,105,122, + 101,111,102, 40, 39, 44,116, 44, 39, 41, 41, 59, 39, 41, 10, + 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, + 32, 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, + 40,116,111,108,117, 97, 95, 83, 44,116,111,108,117, 97, 95, + 111, 98,106, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, + 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, + 32, 32, 32,116,111,108,117, 97, 95,114,101,103,105,115,116, + 101,114, 95,103, 99, 40,116,111,108,117, 97, 95, 83, 44,108, + 117, 97, 95,103,101,116,116,111,112, 40,116,111,108,117, 97, + 95, 83, 41, 41, 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117, + 116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, + 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, + 32, 32, 32,125, 39, 41, 10, 32, 32, 32, 32,101,108,115,101, + 105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, + 39, 38, 39, 32,116,104,101,110, 10, 32, 32, 32, 32, 32,111, + 117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115, + 104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, + 83, 44, 40,118,111,105,100, 42, 41, 38,116,111,108,117, 97, + 95,114,101,116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, + 41, 10, 32, 32, 32, 32,101,108,115,101, 10, 9, 32,111,117, + 116,112,117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, + 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, + 44, 40,118,111,105,100, 42, 41,116,111,108,117, 97, 95,114, + 101,116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, + 9, 32,105,102, 32,111,119,110,101,100, 32,111,114, 32,108, + 111, 99, 97,108, 95, 99,111,110,115,116,114,117, 99,116,111, + 114, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32,111,117, + 116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, + 95,114,101,103,105,115,116,101,114, 95,103, 99, 40,116,111, + 108,117, 97, 95, 83, 44,108,117, 97, 95,103,101,116,116,111, + 112, 40,116,111,108,117, 97, 95, 83, 41, 41, 59, 39, 41, 10, + 9, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10, 32, + 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,108, + 111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104,105,108, + 101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32, + 100,111, 10, 32, 32, 32,110,114,101,116, 32, 61, 32,110,114, + 101,116, 32, 43, 32,115,101,108,102, 46, 97,114,103,115, 91, + 105, 93, 58,114,101,116,118, 97,108,117,101, 40, 41, 10, 32, + 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, + 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,125, 39, + 41, 10, 10, 32, 32, 45, 45, 32,115,101,116, 32, 97,114,114, + 97,121, 32,101,108,101,109,101,110,116, 32,118, 97,108,117, + 101,115, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32,116, + 104,101,110, 32,110, 97,114,103, 61, 50, 32,101,108,115,101, + 32,110, 97,114,103, 61, 49, 32,101,110,100, 10, 32, 32,105, + 102, 32,115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46, + 116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39, 32, + 116,104,101,110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105, + 61, 49, 10, 32, 32, 32,119,104,105,108,101, 32,115,101,108, + 102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10, 32, 32, + 32, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58, + 115,101,116, 97,114,114, 97,121, 40,110, 97,114,103, 41, 10, + 32, 32, 32, 32,110, 97,114,103, 32, 61, 32,110, 97,114,103, + 43, 49, 10, 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, + 32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 10, 32, + 32, 45, 45, 32,102,114,101,101, 32,100,121,110, 97,109,105, + 99, 97,108,108,121, 32, 97,108,108,111, 99, 97,116,101,100, + 32, 97,114,114, 97,121, 10, 32, 32,105,102, 32,115,101,108, + 102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101, 32, + 126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10, + 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32, + 32,119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103, + 115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,115,101,108, + 102, 46, 97,114,103,115, 91,105, 93, 58,102,114,101,101, 97, + 114,114, 97,121, 40, 41, 10, 32, 32, 32, 32,105, 32, 61, 32, + 105, 43, 49, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,110, + 100, 10, 32,101,110,100, 10, 10, 32,111,117,116,112,117,116, + 40, 39, 32,125, 39, 41, 10, 32,111,117,116,112,117,116, 40, + 39, 32,114,101,116,117,114,110, 32, 39, 46, 46,110,114,101, + 116, 46, 46, 39, 59, 39, 41, 10, 10, 32, 45, 45, 32, 99, 97, + 108,108, 32,111,118,101,114,108,111, 97,100,101,100, 32,102, + 117,110, 99,116,105,111,110, 32,111,114, 32,103,101,110,101, + 114, 97,116,101, 32,101,114,114,111,114, 10, 9,105,102, 32, + 111,118,101,114,108,111, 97,100, 32, 60, 32, 48, 32,116,104, + 101,110, 10, 10, 9, 9,111,117,116,112,117,116, 40, 39, 35, + 105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, + 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9, 9,111,117,116, + 112,117,116, 40, 39,116,111,108,117, 97, 95,108,101,114,114, + 111,114, 58, 92,110, 39, 41, 10, 9, 9,111,117,116,112,117, + 116, 40, 39, 32,116,111,108,117, 97, 95,101,114,114,111,114, + 40,116,111,108,117, 97, 95, 83, 44, 34, 35,102,101,114,114, + 111,114, 32,105,110, 32,102,117,110, 99,116,105,111,110, 32, + 92, 39, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, + 46, 46, 39, 92, 39, 46, 34, 44, 38,116,111,108,117, 97, 95, + 101,114,114, 41, 59, 39, 41, 10, 9, 9,111,117,116,112,117, + 116, 40, 39, 32,114,101,116,117,114,110, 32, 48, 59, 39, 41, + 10, 9, 9,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 10, 9,101,108,115,101, 10, 9, 9, + 108,111, 99, 97,108, 32, 95,108,111, 99, 97,108, 32, 61, 32, + 34, 34, 10, 9, 9,105,102, 32,108,111, 99, 97,108, 95, 99, + 111,110,115,116,114,117, 99,116,111,114, 32,116,104,101,110, + 10, 9, 9, 9, 95,108,111, 99, 97,108, 32, 61, 32, 34, 95, + 108,111, 99, 97,108, 34, 10, 9, 9,101,110,100, 10, 9, 9, + 111,117,116,112,117,116, 40, 39,116,111,108,117, 97, 95,108, + 101,114,114,111,114, 58, 92,110, 39, 41, 10, 9, 9,111,117, + 116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 39, + 46, 46,115,116,114,115,117, 98, 40,115,101,108,102, 46, 99, + 110, 97,109,101, 44, 49, 44, 45, 51, 41, 46, 46,102,111,114, + 109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,111,118,101,114, + 108,111, 97,100, 41, 46, 46, 95,108,111, 99, 97,108, 46, 46, + 39, 40,116,111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 9, + 101,110,100, 10, 32,111,117,116,112,117,116, 40, 39,125, 39, + 41, 10, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, + 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, + 10, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, + 10, 9, 45, 45, 32,114,101, 99,117,114,115,105,118,101, 32, + 99, 97,108,108, 32,116,111, 32,119,114,105,116,101, 32,108, + 111, 99, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111, + 114, 10, 9,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, + 32,115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101, + 119, 39, 32, 97,110,100, 32,110,111,116, 32,108,111, 99, 97, + 108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,116, + 104,101,110, 10, 10, 9, 9,115,101,108,102, 58,115,117,112, + 99,111,100,101, 40, 49, 41, 10, 9,101,110,100, 10, 10,101, + 110,100, 10, 10, 10, 45, 45, 32,114,101,103,105,115,116,101, + 114, 32,102,117,110, 99,116,105,111,110, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116, + 105,111,110, 58,114,101,103,105,115,116,101,114, 32, 40,112, + 114,101, 41, 10, 10, 9,105,102, 32,110,111,116, 32,115,101, + 108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, + 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10, + 9, 9,114,101,116,117,114,110, 10, 9,101,110,100, 10, 10, + 32, 9,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32, + 61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32,115,101, + 108,102, 46,112, 97,114,101,110,116, 46,102,108, 97,103,115, + 46,112,117,114,101, 95,118,105,114,116,117, 97,108, 32,116, + 104,101,110, 10, 32, 9, 9, 45, 45, 32,110,111, 32, 99,111, + 110,115,116,114,117, 99,116,111,114, 32,102,111,114, 32, 99, + 108, 97,115,115,101,115, 32,119,105,116,104, 32,112,117,114, + 101, 32,118,105,114,116,117, 97,108, 32,109,101,116,104,111, + 100,115, 10, 32, 9, 9,114,101,116,117,114,110, 10, 32, 9, + 101,110,100, 10, 10, 32,111,117,116,112,117,116, 40,112,114, + 101, 46, 46, 39,116,111,108,117, 97, 95,102,117,110, 99,116, + 105,111,110, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, + 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, + 44, 39, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46, + 46, 39, 41, 59, 39, 41, 10, 32, 32,105,102, 32,115,101,108, + 102, 46,110, 97,109,101, 32, 61, 61, 32, 39,110,101,119, 39, + 32,116,104,101,110, 10, 9, 32, 32,111,117,116,112,117,116, + 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,102,117, + 110, 99,116,105,111,110, 40,116,111,108,117, 97, 95, 83, 44, + 34,110,101,119, 95,108,111, 99, 97,108, 34, 44, 39, 46, 46, + 115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 95,108, + 111, 99, 97,108, 41, 59, 39, 41, 10, 9, 32, 32,111,117,116, + 112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, + 95,102,117,110, 99,116,105,111,110, 40,116,111,108,117, 97, + 95, 83, 44, 34, 46, 99, 97,108,108, 34, 44, 39, 46, 46,115, + 101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 95,108,111, + 99, 97,108, 41, 59, 39, 41, 10, 9, 32, 32, 45, 45,111,117, + 116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,115,101, + 116, 95, 99, 97,108,108, 95,101,118,101,110,116, 40,116,111, + 108,117, 97, 95, 83, 44, 39, 46, 46,115,101,108,102, 46, 99, + 110, 97,109,101, 46, 46, 39, 95,108,111, 99, 97,108, 44, 32, + 34, 39, 46, 46,115,101,108,102, 46,112, 97,114,101,110,116, + 46,116,121,112,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32, + 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 80,114, + 105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99, + 116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116, + 105,111,110, 58,112,114,105,110,116, 32, 40,105,100,101,110, + 116, 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, + 40,105,100,101,110,116, 46, 46, 34, 70,117,110, 99,116,105, + 111,110,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100, + 101,110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, + 34, 46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, + 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, + 46,115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46, + 115,101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32, 99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46, + 115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, + 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, + 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41, + 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104, + 105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, + 93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103, + 115, 91,105, 93, 58,112,114,105,110,116, 40,105,100,101,110, + 116, 46, 46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32, + 105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112, + 114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101, + 110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, + 32,105,116, 32,114,101,116,117,114,110,115, 32, 97,110, 32, + 111, 98,106,101, 99,116, 32, 98,121, 32,118, 97,108,117,101, + 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, + 70,117,110, 99,116,105,111,110, 58,114,101,113,117,105,114, + 101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116, 41, + 10, 9,108,111, 99, 97,108, 32,114, 32, 61, 32,102, 97,108, + 115,101, 10, 9,105,102, 32,115,101,108,102, 46,116,121,112, + 101, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,110,111,116, + 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116, + 121,112,101, 41, 32, 97,110,100, 32,115,101,108,102, 46,112, + 116,114, 61, 61, 39, 39, 32,116,104,101,110, 10, 9, 9,108, + 111, 99, 97,108, 32,116,121,112,101, 32, 61, 32,103,115,117, + 98, 40,115,101,108,102, 46,116,121,112,101, 44, 34, 37,115, + 42, 99,111,110,115,116, 37,115, 43, 34, 44, 34, 34, 41, 10, + 9, 32,116, 91,116,121,112,101, 93, 32, 61, 32, 34,116,111, + 108,117, 97, 95, 99,111,108,108,101, 99,116, 95, 34, 32, 46, + 46, 32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116, + 101, 40,116,121,112,101, 41, 10, 9, 32,114, 32, 61, 32,116, + 114,117,101, 10, 9,101,110,100, 10, 9,108,111, 99, 97,108, + 32,105, 61, 49, 10, 9,119,104,105,108,101, 32,115,101,108, + 102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10, 9, 9, + 114, 32, 61, 32,115,101,108,102, 46, 97,114,103,115, 91,105, + 93, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99, + 116,105,111,110, 40,116, 41, 32,111,114, 32,114, 10, 9, 9, + 105, 32, 61, 32,105, 43, 49, 10, 9,101,110,100, 10, 9,114, + 101,116,117,114,110, 32,114, 10,101,110,100, 10, 10, 45, 45, + 32,100,101,116,101,114,109,105,110,101, 32,108,117, 97, 32, + 102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 32,111, + 118,101,114,108,111, 97,100, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110, + 58,111,118,101,114,108,111, 97,100, 32, 40, 41, 10, 32,114, + 101,116,117,114,110, 32,115,101,108,102, 46,112, 97,114,101, + 110,116, 58,111,118,101,114,108,111, 97,100, 40,115,101,108, + 102, 46,108,110, 97,109,101, 41, 10,101,110,100, 10, 10, 10, + 102,117,110, 99,116,105,111,110, 32,112, 97,114, 97,109, 95, + 111, 98,106,101, 99,116, 40,112, 97,114, 41, 32, 45, 45, 32, + 114,101,116,117,114,110,115, 32,116,114,117,101, 32,105,102, + 32,116,104,101, 32,112, 97,114, 97,109,101,116,101,114, 32, + 104, 97,115, 32, 97,110, 32,111, 98,106,101, 99,116, 32, 97, + 115, 32,105,116,115, 32,100,101,102, 97,117,108,116, 32,118, + 97,108,117,101, 10, 10, 9,105,102, 32,110,111,116, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114, 44, + 32, 39, 61, 39, 41, 32,116,104,101,110, 32,114,101,116,117, + 114,110, 32,102, 97,108,115,101, 32,101,110,100, 32, 45, 45, + 32,105,116, 32,104, 97,115, 32,110,111, 32,100,101,102, 97, + 117,108,116, 32,118, 97,108,117,101, 10, 10, 9,108,111, 99, + 97,108, 32, 95, 44, 95, 44,100,101,102, 32, 61, 32,115,116, + 114,105,110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32, + 34, 61, 40, 46, 42, 41, 36, 34, 41, 10, 10, 9,105,102, 32, + 115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114, + 44, 32, 34,124, 34, 41, 32,116,104,101,110, 32, 45, 45, 32, + 97, 32,108,105,115,116, 32,111,102, 32,102,108, 97,103,115, + 10, 10, 9, 9,114,101,116,117,114,110, 32,116,114,117,101, + 10, 9,101,110,100, 10, 10, 9,105,102, 32,115,116,114,105, + 110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 37, + 42, 34, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39, + 115, 32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116, + 104, 32, 97, 32,100,101,102, 97,117,108,116, 32,118, 97,108, + 117,101, 10, 10, 9, 9,105,102, 32,115,116,114,105,110,103, + 46,102,105,110,100, 40,112, 97,114, 44, 32, 39, 61, 37,115, + 42,110,101,119, 39, 41, 32,111,114, 32,115,116,114,105,110, + 103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 37, 40, + 34, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39,115, + 32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116,104, + 32, 97,110, 32,105,110,115,116, 97,110, 99,101, 32, 97,115, + 32,100,101,102, 97,117,108,116, 32,112, 97,114, 97,109,101, + 116,101,114, 46, 46, 32,105,115, 32,116,104, 97,116, 32,118, + 97,108,105,100, 63, 10, 9, 9, 9,114,101,116,117,114,110, + 32,116,114,117,101, 10, 9, 9,101,110,100, 10, 9, 9,114, + 101,116,117,114,110, 32,102, 97,108,115,101, 32, 45, 45, 32, + 100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 32,105, + 115, 32, 39, 78, 85, 76, 76, 39, 32,111,114, 32,115,111,109, + 101,116,104,105,110,103, 10, 9,101,110,100, 10, 10, 10, 9, + 105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 112, 97,114, 44, 32, 34, 91, 37, 40, 38, 93, 34, 41, 32,116, + 104,101,110, 10, 9, 9,114,101,116,117,114,110, 32,116,114, + 117,101, 10, 9,101,110,100, 32, 45, 45, 32,100,101,102, 97, + 117,108,116, 32,118, 97,108,117,101, 32,105,115, 32, 97, 32, + 99,111,110,115,116,114,117, 99,116,111,114, 32, 99, 97,108, + 108, 32, 40,109,111,115,116, 32,108,105,107,101,108,121, 32, + 102,111,114, 32, 97, 32, 99,111,110,115,116, 32,114,101,102, + 101,114,101,110, 99,101, 41, 10, 10, 9, 45, 45,105,102, 32, + 115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114, + 44, 32, 34, 38, 34, 41, 32,116,104,101,110, 10, 10, 9, 45, + 45, 9,105,102, 32,115,116,114,105,110,103, 46,102,105,110, + 100, 40,100,101,102, 44, 32, 34, 58, 34, 41, 32,111,114, 32, + 115,116,114,105,110,103, 46,102,105,110,100, 40,100,101,102, + 44, 32, 34, 94, 37,115, 42,110,101,119, 37,115, 43, 34, 41, + 32,116,104,101,110, 10, 10, 9, 45, 45, 9, 9, 45, 45, 32, + 105,116, 39,115, 32, 97, 32,114,101,102,101,114,101,110, 99, + 101, 32,119,105,116,104, 32,100,101,102, 97,117,108,116, 32, + 116,111, 32,115,111,109,101,116,104,105,110,103, 32,108,105, + 107,101, 32, 67,108, 97,115,115, 58, 58,109,101,109, 98,101, + 114, 44, 32,111,114, 32, 39,110,101,119, 32, 67,108, 97,115, + 115, 39, 10, 9, 45, 45, 9, 9,114,101,116,117,114,110, 32, + 116,114,117,101, 10, 9, 45, 45, 9,101,110,100, 10, 9, 45, + 45,101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,102, + 97,108,115,101, 32, 45, 45, 32, 63, 10,101,110,100, 10, 10, + 102,117,110, 99,116,105,111,110, 32,115,116,114,105,112, 95, + 108, 97,115,116, 95, 97,114,103, 40, 97,108,108, 95, 97,114, + 103,115, 44, 32,108, 97,115,116, 95, 97,114,103, 41, 32, 45, + 45, 32,115,116,114,105,112,115, 32,116,104,101, 32,100,101, + 102, 97,117,108,116, 32,118, 97,108,117,101, 32,102,114,111, + 109, 32,116,104,101, 32,108, 97,115,116, 32, 97,114,103,117, + 109,101,110,116, 10, 10, 9,108,111, 99, 97,108, 32, 95, 44, + 95, 44,115, 95, 97,114,103, 32, 61, 32,115,116,114,105,110, + 103, 46,102,105,110,100, 40,108, 97,115,116, 95, 97,114,103, + 44, 32, 34, 94, 40, 91, 94, 61, 93, 43, 41, 34, 41, 10, 9, + 108, 97,115,116, 95, 97,114,103, 32, 61, 32,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,108, 97,115,116, 95, 97,114, + 103, 44, 32, 34, 40, 91, 37, 37, 37, 40, 37, 41, 93, 41, 34, + 44, 32, 34, 37, 37, 37, 49, 34, 41, 59, 10, 9, 97,108,108, + 95, 97,114,103,115, 32, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40, 97,108,108, 95, 97,114,103,115, 44, 32, + 34, 37,115, 42, 44, 37,115, 42, 34, 46, 46,108, 97,115,116, + 95, 97,114,103, 46, 46, 34, 37,115, 42, 37, 41, 37,115, 42, + 36, 34, 44, 32, 34, 41, 34, 41, 10, 9,114,101,116,117,114, + 110, 32, 97,108,108, 95, 97,114,103,115, 44, 32,115, 95, 97, + 114,103, 10,101,110,100, 10, 10, 10, 10, 45, 45, 32, 73,110, + 116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117, 99, + 116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95, 70, + 117,110, 99,116,105,111,110, 32, 40,116, 41, 10, 32,115,101, + 116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, + 97,115,115, 70,117,110, 99,116,105,111,110, 41, 10, 10, 32, + 105,102, 32,116, 46, 99,111,110,115,116, 32,126, 61, 32, 39, + 99,111,110,115,116, 39, 32, 97,110,100, 32,116, 46, 99,111, + 110,115,116, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 10, + 32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108, + 105,100, 32, 39, 99,111,110,115,116, 39, 32,115,112,101, 99, + 105,102,105, 99, 97,116,105,111,110, 34, 41, 10, 32,101,110, + 100, 10, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32, + 105,102, 32,116, 58,105,110, 99,108, 97,115,115, 40, 41, 32, + 116,104,101,110, 10, 32, 45, 45,112,114,105,110,116, 32, 40, + 39,116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116, + 46,110, 97,109,101, 46, 46, 39, 44, 32,112, 97,114,101,110, + 116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116, 46, + 112, 97,114,101,110,116, 46,110, 97,109,101, 41, 10, 32, 32, + 105,102, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 116, 46,110, 97,109,101, 44, 32, 34, 37, 98, 60, 62, 34, 44, + 32, 34, 34, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40,116, 46,112, 97,114,101,110,116, 46,111, + 114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,114, + 32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 44, + 32, 34, 37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32,116,104, + 101,110, 10, 32, 32, 32,116, 46,110, 97,109,101, 32, 61, 32, + 39,110,101,119, 39, 10, 32, 32, 32,116, 46,108,110, 97,109, + 101, 32, 61, 32, 39,110,101,119, 39, 10, 32, 32, 32,116, 46, + 112, 97,114,101,110,116, 46, 95,110,101,119, 32, 61, 32,116, + 114,117,101, 10, 32, 32, 32,116, 46,116,121,112,101, 32, 61, + 32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 10, + 32, 32, 32,116, 46,112,116,114, 32, 61, 32, 39, 42, 39, 10, + 32, 32,101,108,115,101,105,102, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,116, 46,110, 97,109,101, 44, 32, 34, + 37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32, 61, 61, 32, 39, + 126, 39, 46, 46,115,116,114,105,110,103, 46,103,115,117, 98, + 40,116, 46,112, 97,114,101,110,116, 46,111,114,105,103,105, + 110, 97,108, 95,110, 97,109,101, 32,111,114, 32,116, 46,112, + 97,114,101,110,116, 46,110, 97,109,101, 44, 32, 34, 37, 98, + 60, 62, 34, 44, 32, 34, 34, 41, 32,116,104,101,110, 10, 32, + 32, 32,116, 46,110, 97,109,101, 32, 61, 32, 39,100,101,108, + 101,116,101, 39, 10, 32, 32, 32,116, 46,108,110, 97,109,101, + 32, 61, 32, 39,100,101,108,101,116,101, 39, 10, 32, 32, 32, + 116, 46,112, 97,114,101,110,116, 46, 95,100,101,108,101,116, + 101, 32, 61, 32,116,114,117,101, 10, 32, 32,101,110,100, 10, + 32,101,110,100, 10, 32,116, 46, 99,110, 97,109,101, 32, 61, + 32,116, 58, 99,102,117,110, 99,110, 97,109,101, 40, 34,116, + 111,108,117, 97, 34, 41, 46, 46,116, 58,111,118,101,114,108, + 111, 97,100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, + 116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116, + 114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99, + 116,115, 32,116,104,114,101,101, 32,115,116,114,105,110,103, + 115, 58, 32,111,110,101, 32,114,101,112,114,101,115,101,110, + 116,105,110,103, 32,116,104,101, 32,102,117,110, 99,116,105, + 111,110, 32,100,101, 99,108, 97,114, 97,116,105,111,110, 44, + 10, 45, 45, 32, 97,110,111,116,104,101,114, 32,114,101,112, + 114,101,115,101,110,116,105,110,103, 32,116,104,101, 32, 97, + 114,103,117,109,101,110,116, 32,108,105,115,116, 44, 32, 97, + 110,100, 32,116,104,101, 32,116,104,105,114,100, 32,114,101, + 112,114,101,115,101,110,116,105,110,103, 10, 45, 45, 32,116, + 104,101, 32, 34, 99,111,110,115,116, 34, 32,111,114, 32,101, + 109,112,116,121, 32,115,116,114,105,110,103, 46, 10,102,117, + 110, 99,116,105,111,110, 32, 70,117,110, 99,116,105,111,110, + 32, 40,100, 44, 97, 44, 99, 41, 10, 32, 45, 45,108,111, 99, + 97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116, + 114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 44, 39, 44, + 39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101, + 32, 98,114, 97, 99,101,115, 10, 32, 45, 45,108,111, 99, 97, + 108, 32,116, 32, 61, 32,115,112,108,105,116, 95,112, 97,114, + 97,109,115, 40,115,116,114,115,117, 98, 40, 97, 44, 50, 44, + 45, 50, 41, 41, 10, 10, 9,105,102, 32,110,111,116, 32,102, + 108, 97,103,115, 91, 39, 87, 39, 93, 32, 97,110,100, 32,115, + 116,114,105,110,103, 46,102,105,110,100, 40, 97, 44, 32, 34, + 37, 46, 37, 46, 37, 46, 37,115, 42, 37, 41, 34, 41, 32,116, + 104,101,110, 10, 10, 9, 9,119, 97,114,110,105,110,103, 40, + 34, 70,117,110, 99,116,105,111,110,115, 32,119,105,116,104, + 32,118, 97,114,105, 97, 98,108,101, 32, 97,114,103,117,109, + 101,110,116,115, 32, 40, 96, 46, 46, 46, 39, 41, 32, 97,114, + 101, 32,110,111,116, 32,115,117,112,112,111,114,116,101,100, + 46, 32, 73,103,110,111,114,105,110,103, 32, 34, 46, 46,100, + 46, 46, 97, 46, 46, 99, 41, 10, 9, 9,114,101,116,117,114, + 110, 32,110,105,108, 10, 9,101,110,100, 10, 10, 10, 32,108, + 111, 99, 97,108, 32,105, 61, 49, 10, 32,108,111, 99, 97,108, + 32,108, 32, 61, 32,123,110, 61, 48,125, 10, 10, 32, 9, 97, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 97, 44, 32, 34, 37,115, 42, 40, 91, 37, 40, 37, 41, 93, 41, + 37,115, 42, 34, 44, 32, 34, 37, 49, 34, 41, 10, 9,108,111, + 99, 97,108, 32,116, 44,115,116,114,105,112, 44,108, 97,115, + 116, 32, 61, 32,115,116,114,105,112, 95,112, 97,114,115, 40, + 115,116,114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 41, + 59, 10, 9,105,102, 32,115,116,114,105,112, 32,116,104,101, + 110, 10, 9, 9, 45, 45,108,111, 99, 97,108, 32,110,115, 32, + 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115,116, + 114,115,117, 98, 40, 97, 44, 49, 44, 45, 50, 41, 44, 32, 49, + 44, 32, 45, 40,115,116,114,105,110,103, 46,108,101,110, 40, + 108, 97,115,116, 41, 43, 49, 41, 41, 10, 9, 9,108,111, 99, + 97,108, 32,110,115, 32, 61, 32,106,111,105,110, 40,116, 44, + 32, 34, 44, 34, 44, 32, 49, 44, 32,108, 97,115,116, 45, 49, + 41, 10, 10, 9, 9,110,115, 32, 61, 32, 34, 40, 34, 46, 46, + 115,116,114,105,110,103, 46,103,115,117, 98, 40,110,115, 44, + 32, 34, 37,115, 42, 44, 37,115, 42, 36, 34, 44, 32, 34, 34, + 41, 46, 46, 39, 41, 39, 10, 9, 9, 45, 45,110,115, 32, 61, + 32,115,116,114,105,112, 95,100,101,102, 97,117,108,116,115, + 40,110,115, 41, 10, 10, 9, 9, 70,117,110, 99,116,105,111, + 110, 40,100, 44, 32,110,115, 44, 32, 99, 41, 10, 9, 9,102, + 111,114, 32,105, 61, 49, 44,108, 97,115,116, 32,100,111, 10, + 9, 9, 9,116, 91,105, 93, 32, 61, 32,115,116,114,105,110, + 103, 46,103,115,117, 98, 40,116, 91,105, 93, 44, 32, 34, 61, + 46, 42, 36, 34, 44, 32, 34, 34, 41, 10, 9, 9,101,110,100, + 10, 9,101,110,100, 10, 10, 32,119,104,105,108,101, 32,116, + 91,105, 93, 32,100,111, 10, 32, 32,108, 46,110, 32, 61, 32, + 108, 46,110, 43, 49, 10, 32, 32,108, 91,108, 46,110, 93, 32, + 61, 32, 68,101, 99,108, 97,114, 97,116,105,111,110, 40,116, + 91,105, 93, 44, 39,118, 97,114, 39, 44,116,114,117,101, 41, + 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, + 10, 32,108,111, 99, 97,108, 32,102, 32, 61, 32, 68,101, 99, + 108, 97,114, 97,116,105,111,110, 40,100, 44, 39,102,117,110, + 99, 39, 41, 10, 32,102, 46, 97,114,103,115, 32, 61, 32,108, + 10, 32,102, 46, 99,111,110,115,116, 32, 61, 32, 99, 10, 32, + 114,101,116,117,114,110, 32, 95, 70,117,110, 99,116,105,111, + 110, 40,102, 41, 10,101,110,100, 10, 10,102,117,110, 99,116, + 105,111,110, 32,106,111,105,110, 40,116, 44, 32,115,101,112, + 44, 32,102,105,114,115,116, 44, 32,108, 97,115,116, 41, 10, + 10, 9,102,105,114,115,116, 32, 61, 32,102,105,114,115,116, + 32,111,114, 32, 49, 10, 9,108, 97,115,116, 32, 61, 32,108, + 97,115,116, 32,111,114, 32,116, 97, 98,108,101, 46,103,101, + 116,110, 40,116, 41, 10, 9,108,111, 99, 97,108, 32,108,115, + 101,112, 32, 61, 32, 34, 34, 10, 9,108,111, 99, 97,108, 32, + 114,101,116, 32, 61, 32, 34, 34, 10, 9,108,111, 99, 97,108, + 32,108,111,111,112, 32, 61, 32,102, 97,108,115,101, 10, 9, + 102,111,114, 32,105, 32, 61, 32,102,105,114,115,116, 44,108, + 97,115,116, 32,100,111, 10, 10, 9, 9,114,101,116, 32, 61, + 32,114,101,116, 46, 46,108,115,101,112, 46, 46,116, 91,105, + 93, 10, 9, 9,108,115,101,112, 32, 61, 32,115,101,112, 10, + 9, 9,108,111,111,112, 32, 61, 32,116,114,117,101, 10, 9, + 101,110,100, 10, 9,105,102, 32,110,111,116, 32,108,111,111, + 112, 32,116,104,101,110, 10, 9, 9,114,101,116,117,114,110, + 32, 34, 34, 10, 9,101,110,100, 10, 10, 9,114,101,116,117, + 114,110, 32,114,101,116, 10,101,110,100, 10, 10,102,117,110, + 99,116,105,111,110, 32,115,116,114,105,112, 95,112, 97,114, + 115, 40,115, 41, 10, 10, 9,108,111, 99, 97,108, 32,116, 32, + 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110, + 115, 40,115, 44, 32, 39, 44, 39, 41, 10, 9,108,111, 99, 97, + 108, 32,115,116,114,105,112, 32, 61, 32,102, 97,108,115,101, + 10, 9,108,111, 99, 97,108, 32,108, 97,115,116, 10, 10, 9, + 102,111,114, 32,105, 61,116, 46,110, 44, 49, 44, 45, 49, 32, + 100,111, 10, 10, 9, 9,105,102, 32,110,111,116, 32,115,116, + 114,105,112, 32, 97,110,100, 32,112, 97,114, 97,109, 95,111, + 98,106,101, 99,116, 40,116, 91,105, 93, 41, 32,116,104,101, + 110, 10, 9, 9, 9,108, 97,115,116, 32, 61, 32,105, 10, 9, + 9, 9,115,116,114,105,112, 32, 61, 32,116,114,117,101, 10, + 9, 9,101,110,100, 10, 9, 9, 45, 45,105,102, 32,115,116, + 114,105,112, 32,116,104,101,110, 10, 9, 9, 45, 45, 9,116, + 91,105, 93, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 40,116, 91,105, 93, 44, 32, 34, 61, 46, 42, 36, 34, + 44, 32, 34, 34, 41, 10, 9, 9, 45, 45,101,110,100, 10, 9, + 101,110,100, 10, 10, 9,114,101,116,117,114,110, 32,116, 44, + 115,116,114,105,112, 44,108, 97,115,116, 10, 10,101,110,100, + 10, 10,102,117,110, 99,116,105,111,110, 32,115,116,114,105, + 112, 95,100,101,102, 97,117,108,116,115, 40,115, 41, 10, 10, + 9,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40,115, 44, 32, 34, 94, 37, 40, 34, 44, 32, 34, 34, 41, + 10, 9,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 40,115, 44, 32, 34, 37, 41, 36, 34, 44, 32, 34, 34, + 41, 10, 10, 9,108,111, 99, 97,108, 32,116, 32, 61, 32,115, + 112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, + 44, 32, 34, 44, 34, 41, 10, 9,108,111, 99, 97,108, 32,115, + 101,112, 44, 32,114,101,116, 32, 61, 32, 34, 34, 44, 34, 34, + 10, 9,102,111,114, 32,105, 61, 49, 44,116, 46,110, 32,100, + 111, 10, 9, 9,116, 91,105, 93, 32, 61, 32,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,116, 91,105, 93, 44, 32, 34, + 61, 46, 42, 36, 34, 44, 32, 34, 34, 41, 10, 9, 9,114,101, + 116, 32, 61, 32,114,101,116, 46, 46,115,101,112, 46, 46,116, + 91,105, 93, 10, 9, 9,115,101,112, 32, 61, 32, 34, 44, 34, + 10, 9,101,110,100, 10, 10, 9,114,101,116,117,114,110, 32, + 34, 40, 34, 46, 46,114,101,116, 46, 46, 34, 41, 34, 10,101, + 110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/function.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32,111,112,101,114, 97, + 116,111,114, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73, + 100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99, + 111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102, + 116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32, + 114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, + 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32, + 105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116, + 119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104, + 101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, + 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105, + 115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97, + 117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98, + 108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111, + 118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99, + 101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, + 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99, + 101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105, + 102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, + 32, 79,112,101,114, 97,116,111,114, 32, 99,108, 97,115,115, + 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, + 97,110, 32,111,112,101,114, 97,116,111,114, 32,102,117,110, + 99,116,105,111,110, 32,111,114, 32, 97, 32, 99,108, 97,115, + 115, 32,111,112,101,114, 97,116,111,114, 32,109,101,116,104, + 111,100, 46, 10, 45, 45, 32, 73,116, 32,115,116,111,114,101, + 115, 32,116,104,101, 32,115, 97,109,101, 32,102,105,101,108, + 100,115, 32, 97,115, 32,102,117,110, 99,116,105,111,110,115, + 32,100,111, 32,112,108,117,115, 58, 10, 45, 45, 32, 32,107, + 105,110,100, 32, 61, 32,115,101,116, 32,111,102, 32, 99,104, + 97,114, 97, 99,116,101,114, 32,114,101,112,114,101,115,101, + 110,116,105,110,103, 32,116,104,101, 32,111,112,101,114, 97, + 116,111,114, 32, 40, 97,115, 32,105,116, 32, 97,112,112,101, + 114,115, 32,105,110, 32, 67, 43, 43, 32, 99,111,100,101, 41, + 10, 99,108, 97,115,115, 79,112,101,114, 97,116,111,114, 32, + 61, 32,123, 10, 32,107,105,110,100, 32, 61, 32, 39, 39, 44, + 10,125, 10, 99,108, 97,115,115, 79,112,101,114, 97,116,111, + 114, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97, + 115,115, 79,112,101,114, 97,116,111,114, 10,115,101,116,109, + 101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 79, + 112,101,114, 97,116,111,114, 44, 99,108, 97,115,115, 70,117, + 110, 99,116,105,111,110, 41, 10, 10, 45, 45, 32,116, 97, 98, + 108,101, 32,116,111, 32,116,114, 97,110,115,102,111,114,109, + 32,111,112,101,114, 97,116,111,114, 32,107,105,110,100, 32, + 105,110,116,111, 32,116,104,101, 32, 97,112,112,114,111,112, + 114,105, 97,116,101, 32,116, 97,103, 32,109,101,116,104,111, + 100, 32,110, 97,109,101, 10, 95, 84, 77, 32, 61, 32,123, 91, + 39, 43, 39, 93, 32, 61, 32, 39, 97,100,100, 39, 44, 10, 32, + 32, 32, 32, 32, 32, 32, 91, 39, 45, 39, 93, 32, 61, 32, 39, + 115,117, 98, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, + 42, 39, 93, 32, 61, 32, 39,109,117,108, 39, 44, 10, 32, 32, + 32, 32, 32, 32, 32, 91, 39, 47, 39, 93, 32, 61, 32, 39,100, + 105,118, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 60, + 39, 93, 32, 61, 32, 39,108,116, 39, 44, 10, 32, 32, 32, 32, + 32, 32, 32, 91, 39, 60, 61, 39, 93, 32, 61, 32, 39,108,101, + 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 61, 61, 39, + 93, 32, 61, 32, 39,101,113, 39, 44, 10, 32, 32, 32, 32, 32, + 32, 32, 91, 39, 91, 93, 39, 93, 32, 61, 32, 39,103,101,116, + 105, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 38, 91, + 93, 39, 93, 32, 61, 32, 39,115,101,116,105, 39, 44, 10, 32, + 32, 32, 32, 32, 32, 32, 45, 45, 91, 39, 45, 62, 39, 93, 32, + 61, 32, 39,102,108,101, 99,104,105,116, 97, 39, 44, 10, 32, + 32, 32, 32, 32, 32,125, 10, 10, 10, 45, 45, 32, 80,114,105, + 110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 79,112,101,114, 97,116, + 111,114, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, + 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40, + 105,100,101,110,116, 46, 46, 34, 79,112,101,114, 97,116,111, + 114,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,107,105,110,100, 32, 32, 61, 32, 39, + 34, 46, 46,115,101,108,102, 46,107,105,110,100, 46, 46, 34, + 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101, + 110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, + 46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, + 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, + 46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46, + 115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115, + 101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, + 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108, + 101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32, + 100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103,115, 91, + 105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, + 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105, + 110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, + 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115, + 115, 79,112,101,114, 97,116,111,114, 58,115,117,112, 99,111, + 100,101, 95,116,109,112, 40, 41, 10, 10, 9,105,102, 32,110, + 111,116, 32, 95, 84, 77, 91,115,101,108,102, 46,107,105,110, + 100, 93, 32,116,104,101,110, 10, 9, 9,114,101,116,117,114, + 110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110, + 46,115,117,112, 99,111,100,101, 40,115,101,108,102, 41, 10, + 9,101,110,100, 10, 10, 9, 45, 45, 32,110,111, 32,111,118, + 101,114,108,111, 97,100, 44, 32,110,111, 32,112, 97,114, 97, + 109,101,116,101,114,115, 44, 32, 97,108,119, 97,121,115, 32, + 105,110, 99,108, 97,115,115, 10, 9,111,117,116,112,117,116, + 40, 34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115, + 101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99, + 108, 97,115,115, 32, 34, 44,115,101,108,102, 58,105,110, 99, + 108, 97,115,115, 40, 41, 44, 34, 32, 42, 47, 34, 41, 10, 10, + 9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101, + 102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, + 95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 41, + 10, 9,111,117,116,112,117,116, 40, 34, 92,110,115,116, 97, + 116,105, 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99, + 110, 97,109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116, + 101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 10, + 9,105,102, 32,111,118,101,114,108,111, 97,100, 32, 60, 32, + 48, 32,116,104,101,110, 10, 9, 32,111,117,116,112,117,116, + 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, + 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 9,101, + 110,100, 10, 9,111,117,116,112,117,116, 40, 39, 32,116,111, + 108,117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, + 95,101,114,114, 59, 39, 41, 10, 9,111,117,116,112,117,116, + 40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10, 9, 45, 45, + 32, 99,104,101, 99,107, 32,115,101,108,102, 10, 9,108,111, + 99, 97,108, 32,105,115, 95,102,117,110, 99, 32, 61, 32,103, + 101,116, 95,105,115, 95,102,117,110, 99,116,105,111,110, 40, + 115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112, + 101, 41, 10, 9,111,117,116,112,117,116, 40, 39, 32, 32, 32, + 32, 32, 33, 39, 46, 46,105,115, 95,102,117,110, 99, 46, 46, + 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 34, 39, 46, + 46,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121, + 112,101, 46, 46, 39, 34, 44, 48, 44, 38,116,111,108,117, 97, + 95,101,114,114, 41, 32,124,124, 92,110, 39, 41, 10, 9,111, + 117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111, + 108,117, 97, 95,105,115,110,111,111, 98,106, 40,116,111,108, + 117, 97, 95, 83, 44, 50, 44, 38,116,111,108,117, 97, 95,101, + 114,114, 41, 92,110, 32, 41, 39, 41, 10, 9,111,117,116,112, + 117,116, 40, 39, 32, 32,103,111,116,111, 32,116,111,108,117, + 97, 95,108,101,114,114,111,114, 59, 39, 41, 10, 10, 9,111, + 117,116,112,117,116, 40, 39, 32,101,108,115,101, 92,110, 39, + 41, 10, 9,111,117,116,112,117,116, 40, 39, 35,101,110,100, + 105,102, 92,110, 39, 41, 32, 45, 45, 32,116,111,108,117, 97, + 95,114,101,108,101, 97,115,101, 10, 9,111,117,116,112,117, + 116, 40, 39, 32,123, 39, 41, 10, 10, 9, 45, 45, 32,100,101, + 99,108, 97,114,101, 32,115,101,108,102, 10, 9,111,117,116, + 112,117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111, + 110,115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116, + 46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, + 32, 61, 32, 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, + 40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,115, + 101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, + 44, 39, 42, 41, 32, 39, 41, 10, 9,108,111, 99, 97,108, 32, + 116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,116, + 111, 95,102,117,110, 99, 40,115,101,108,102, 46,112, 97,114, + 101,110,116, 46,116,121,112,101, 41, 10, 9,111,117,116,112, + 117,116, 40,116,111, 95,102,117,110, 99, 44, 39, 40,116,111, + 108,117, 97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10, 10, + 9, 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10, + 9,111,117,116,112,117,116, 40, 39, 35,105,102,110,100,101, + 102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, + 92,110, 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 32, + 32,105,102, 32, 40, 33,115,101,108,102, 41, 32,116,111,108, + 117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95, + 83, 44, 34,105,110,118, 97,108,105,100, 32, 92, 39,115,101, + 108,102, 92, 39, 32,105,110, 32,102,117,110, 99,116,105,111, + 110, 32, 92, 39, 39, 46, 46,115,101,108,102, 46,110, 97,109, + 101, 46, 46, 39, 92, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, + 41, 59, 10, 9,111,117,116,112,117,116, 40, 39, 35,101,110, + 100,105,102, 92,110, 39, 41, 10, 10, 9, 45, 45, 32, 99, 97, + 115,116, 32,115,101,108,102, 10, 9,111,117,116,112,117,116, + 40, 39, 32, 32, 39, 44,115,101,108,102, 46,109,111,100, 44, + 115,101,108,102, 46,116,121,112,101, 44,115,101,108,102, 46, + 112,116,114, 44, 39,116,111,108,117, 97, 95,114,101,116, 32, + 61, 32, 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 40, + 39, 44,115,101,108,102, 46,109,111,100, 44,115,101,108,102, + 46,116,121,112,101, 44,115,101,108,102, 46,112,116,114, 44, + 39, 41, 40, 42,115,101,108,102, 41, 59, 39, 41, 10, 10, 9, + 45, 45, 32,114,101,116,117,114,110, 32,118, 97,108,117,101, + 10, 9,108,111, 99, 97,108, 32,116, 44, 99,116, 32, 61, 32, + 105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121, + 112,101, 41, 10, 9,105,102, 32,116, 32,116,104,101,110, 10, + 9, 9,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111, + 108,117, 97, 95,112,117,115,104, 39, 46, 46,116, 46, 46, 39, + 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,116, 44, + 39, 41,116,111,108,117, 97, 95,114,101,116, 41, 59, 39, 41, + 10, 9,101,108,115,101, 10, 9, 9,116, 32, 61, 32,115,101, + 108,102, 46,116,121,112,101, 10, 9, 9,108,111, 99, 97,108, + 32,112,117,115,104, 95,102,117,110, 99, 32, 61, 32,103,101, + 116, 95,112,117,115,104, 95,102,117,110, 99,116,105,111,110, + 40,116, 41, 10, 9, 9,110,101,119, 95,116, 32, 61, 32,115, + 116,114,105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, + 99,111,110,115,116, 37,115, 43, 34, 44, 32, 34, 34, 41, 10, + 9, 9,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, + 61, 32, 39, 39, 32,116,104,101,110, 10, 9, 9, 9,111,117, + 116,112,117,116, 40, 39, 32, 32, 32,123, 39, 41, 10, 9, 9, + 9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101,102, + 32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110, 39, + 41, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, 32, + 32, 32,118,111,105,100, 42, 32,116,111,108,117, 97, 95,111, + 98,106, 32, 61, 32, 77,116,111,108,117, 97, 95,110,101,119, + 40, 40, 39, 44,110,101,119, 95,116, 44, 39, 41, 40,116,111, + 108,117, 97, 95,114,101,116, 41, 41, 59, 39, 41, 10, 9, 9, + 9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, 39, 44, + 112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108, + 117, 97, 95, 83, 44,116,111,108,117, 97, 95,111, 98,106, 44, + 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 9, 9, 9, + 111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108, + 117, 97, 95,114,101,103,105,115,116,101,114, 95,103, 99, 40, + 116,111,108,117, 97, 95, 83, 44,108,117, 97, 95,103,101,116, + 116,111,112, 40,116,111,108,117, 97, 95, 83, 41, 41, 59, 39, + 41, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 35,101, + 108,115,101, 92,110, 39, 41, 10, 9, 9, 9,111,117,116,112, + 117,116, 40, 39, 32, 32, 32, 32,118,111,105,100, 42, 32,116, + 111,108,117, 97, 95,111, 98,106, 32, 61, 32,116,111,108,117, + 97, 95, 99,111,112,121, 40,116,111,108,117, 97, 95, 83, 44, + 40,118,111,105,100, 42, 41, 38,116,111,108,117, 97, 95,114, + 101,116, 44,115,105,122,101,111,102, 40, 39, 44,116, 44, 39, + 41, 41, 59, 39, 41, 10, 9, 9, 9,111,117,116,112,117,116, + 40, 39, 32, 32, 32, 32, 39, 44,112,117,115,104, 95,102,117, + 110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44,116,111, + 108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116, 44, 39, 34, + 41, 59, 39, 41, 10, 9, 9, 9,111,117,116,112,117,116, 40, + 39, 32, 32, 32, 32,116,111,108,117, 97, 95,114,101,103,105, + 115,116,101,114, 95,103, 99, 40,116,111,108,117, 97, 95, 83, + 44,108,117, 97, 95,103,101,116,116,111,112, 40,116,111,108, + 117, 97, 95, 83, 41, 41, 59, 39, 41, 10, 9, 9, 9,111,117, + 116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, + 41, 10, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, 32, + 32,125, 39, 41, 10, 9, 9,101,108,115,101,105,102, 32,115, + 101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39, 32, + 116,104,101,110, 10, 9, 9, 9,111,117,116,112,117,116, 40, + 39, 32, 32, 32, 39, 44,112,117,115,104, 95,102,117,110, 99, + 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105, + 100, 42, 41, 38,116,111,108,117, 97, 95,114,101,116, 44, 34, + 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 9, 9,101,108, + 115,101, 10, 9, 9, 9,105,102, 32,108,111, 99, 97,108, 95, + 99,111,110,115,116,114,117, 99,116,111,114, 32,116,104,101, + 110, 10, 9, 9, 9, 9,111,117,116,112,117,116, 40, 39, 32, + 32, 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, + 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 32, + 42, 41,116,111,108,117, 97, 95,114,101,116, 44, 34, 39, 44, + 116, 44, 39, 34, 41, 59, 39, 41, 10, 9, 9, 9, 9,111,117, + 116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, + 95,114,101,103,105,115,116,101,114, 95,103, 99, 40,116,111, + 108,117, 97, 95, 83, 44,108,117, 97, 95,103,101,116,116,111, + 112, 40,116,111,108,117, 97, 95, 83, 41, 41, 59, 39, 41, 10, + 9, 9, 9,101,108,115,101, 10, 9, 9, 9, 9,111,117,116, + 112,117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, 95, + 102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, + 40,118,111,105,100, 42, 41,116,111,108,117, 97, 95,114,101, + 116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 9, + 9, 9,101,110,100, 10, 9, 9,101,110,100, 10, 9,101,110, + 100, 10, 10, 9,111,117,116,112,117,116, 40, 39, 32, 32,125, + 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 32,114,101, + 116,117,114,110, 32, 49, 59, 39, 41, 10, 10, 9,111,117,116, + 112,117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, + 76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, + 10, 9,111,117,116,112,117,116, 40, 39,116,111,108,117, 97, + 95,108,101,114,114,111,114, 58, 92,110, 39, 41, 10, 9,111, + 117,116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,101, + 114,114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34, 35, + 102,101,114,114,111,114, 32,105,110, 32,102,117,110, 99,116, + 105,111,110, 32, 92, 39, 39, 46, 46,115,101,108,102, 46,108, + 110, 97,109,101, 46, 46, 39, 92, 39, 46, 34, 44, 38,116,111, + 108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10, 9,111,117, + 116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 48, + 59, 39, 41, 10, 9,111,117,116,112,117,116, 40, 39, 35,101, + 110,100,105,102, 92,110, 39, 41, 10, 10, 10, 9,111,117,116, + 112,117,116, 40, 39,125, 39, 41, 10, 9,111,117,116,112,117, + 116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102, + 110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, + 66, 76, 69, 92,110, 39, 41, 10, 9,111,117,116,112,117,116, + 40, 39, 92,110, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32, + 73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114, + 117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, + 95, 79,112,101,114, 97,116,111,114, 32, 40,116, 41, 10, 32, + 115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, + 99,108, 97,115,115, 79,112,101,114, 97,116,111,114, 41, 10, + 10, 32,105,102, 32,116, 46, 99,111,110,115,116, 32,126, 61, + 32, 39, 99,111,110,115,116, 39, 32, 97,110,100, 32,116, 46, + 99,111,110,115,116, 32,126, 61, 32, 39, 39, 32,116,104,101, + 110, 10, 32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, + 97,108,105,100, 32, 39, 99,111,110,115,116, 39, 32,115,112, + 101, 99,105,102,105, 99, 97,116,105,111,110, 34, 41, 10, 32, + 101,110,100, 10, 10, 32, 97,112,112,101,110,100, 40,116, 41, + 10, 32,105,102, 32,110,111,116, 32,116, 58,105,110, 99,108, + 97,115,115, 40, 41, 32,116,104,101,110, 10, 32, 32,101,114, + 114,111,114, 40, 34, 35,111,112,101,114, 97,116,111,114, 32, + 99, 97,110, 32,111,110,108,121, 32, 98,101, 32,100,101,102, + 105,110,101,100, 32, 97,115, 32, 99,108, 97,115,115, 32,109, + 101,109, 98,101,114, 34, 41, 10, 32,101,110,100, 10, 10, 32, + 45, 45,116, 46,110, 97,109,101, 32, 61, 32,116, 46,110, 97, + 109,101, 32, 46, 46, 32, 34, 95, 34, 32, 46, 46, 32, 40, 95, + 84, 77, 91,116, 46,107,105,110,100, 93, 32,111,114, 32,116, + 46,107,105,110,100, 41, 10, 32,116, 46, 99,110, 97,109,101, + 32, 61, 32,116, 58, 99,102,117,110, 99,110, 97,109,101, 40, + 34,116,111,108,117, 97, 34, 41, 46, 46,116, 58,111,118,101, + 114,108,111, 97,100, 40,116, 41, 10, 32,116, 46,110, 97,109, + 101, 32, 61, 32, 34,111,112,101,114, 97,116,111,114, 34, 32, + 46, 46, 32,116, 46,107,105,110,100, 32, 32, 45, 45, 32,115, + 101,116, 32, 97,112,112,114,111,112,114,105, 97,116,101, 32, + 99, 97,108,108,105,110,103, 32,110, 97,109,101, 10, 32,114, + 101,116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, + 32, 67,111,110,115,116,114,117, 99,116,111,114, 10,102,117, + 110, 99,116,105,111,110, 32, 79,112,101,114, 97,116,111,114, + 32, 40,100, 44,107, 44, 97, 44, 99, 41, 10, 10, 9,108,111, + 99, 97,108, 32,111,112, 95,107, 32, 61, 32,115,116,114,105, + 110,103, 46,103,115,117, 98, 40,107, 44, 32, 34, 94, 37,115, + 42, 34, 44, 32, 34, 34, 41, 10, 9,111,112, 95,107, 32, 61, + 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,107, 44, + 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, 41, 10, 9, 45, + 45,105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, + 40,107, 44, 32, 34, 94, 91, 37,119, 95, 58, 37,100, 60, 62, + 37, 42, 37, 38, 93, 43, 36, 34, 41, 32,116,104,101,110, 10, + 9,105,102, 32,100, 32, 61, 61, 32, 34,111,112,101,114, 97, + 116,111,114, 34, 32, 97,110,100, 32,107, 32,126, 61, 32, 39, + 39, 32,116,104,101,110, 10, 10, 9, 9,100, 32, 61, 32,107, + 46, 46, 34, 32,111,112,101,114, 97,116,111,114, 34, 10, 9, + 101,108,115,101,105,102, 32,110,111,116, 32, 95, 84, 77, 91, + 111,112, 95,107, 93, 32,116,104,101,110, 10, 10, 9, 9,105, + 102, 32,102,108, 97,103,115, 91, 39, 87, 39, 93, 32,116,104, + 101,110, 10, 9, 9, 9,101,114,114,111,114, 40, 34,116,111, + 108,117, 97, 58, 32,110,111, 32,115,117,112,112,111,114,116, + 32,102,111,114, 32,111,112,101,114, 97,116,111,114, 34, 32, + 46, 46, 32,102, 46,107,105,110,100, 41, 10, 9, 9,101,108, + 115,101, 10, 9, 9, 9,119, 97,114,110,105,110,103, 40, 34, + 78,111, 32,115,117,112,112,111,114,116, 32,102,111,114, 32, + 111,112,101,114, 97,116,111,114, 32, 34, 46, 46,111,112, 95, + 107, 46, 46, 34, 44, 32,105,103,110,111,114,105,110,103, 34, + 41, 10, 9, 9, 9,114,101,116,117,114,110, 32,110,105,108, + 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 10, 9,108, + 111, 99, 97,108, 32,114,101,102, 32, 61, 32, 39, 39, 10, 32, + 108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116, + 95, 99, 95,116,111,107,101,110,115, 40,115,116,114,115,117, + 98, 40, 97, 44, 50, 44,115,116,114,108,101,110, 40, 97, 41, + 45, 49, 41, 44, 39, 44, 39, 41, 32, 45, 45, 32,101,108,105, + 109,105,110, 97,116,101, 32, 98,114, 97, 99,101,115, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 32,108,111, 99, 97, + 108, 32,108, 32, 61, 32,123,110, 61, 48,125, 10, 32,119,104, + 105,108,101, 32,116, 91,105, 93, 32,100,111, 10, 32, 32,108, + 46,110, 32, 61, 32,108, 46,110, 43, 49, 10, 32, 32,108, 91, + 108, 46,110, 93, 32, 61, 32, 68,101, 99,108, 97,114, 97,116, + 105,111,110, 40,116, 91,105, 93, 44, 39,118, 97,114, 39, 41, + 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, + 10, 32,105,102, 32,107, 32, 61, 61, 32, 39, 91, 93, 39, 32, + 116,104,101,110, 10, 9, 32,108,111, 99, 97,108, 32, 95, 10, + 9, 32, 95, 44, 32, 95, 44, 32,114,101,102, 32, 61, 32,115, + 116,114,102,105,110,100, 40,100, 44, 39, 40, 38, 41, 39, 41, + 10, 32, 32,100, 32, 61, 32,103,115,117, 98, 40,100, 44, 39, + 38, 39, 44, 39, 39, 41, 10, 32,101,108,115,101,105,102, 32, + 107, 61, 61, 39, 38, 91, 93, 39, 32,116,104,101,110, 10, 32, + 32,108, 46,110, 32, 61, 32,108, 46,110, 43, 49, 10, 32, 32, + 108, 91,108, 46,110, 93, 32, 61, 32, 68,101, 99,108, 97,114, + 97,116,105,111,110, 40,100, 44, 39,118, 97,114, 39, 41, 10, + 32, 32,108, 91,108, 46,110, 93, 46,110, 97,109,101, 32, 61, + 32, 39,116,111,108,117, 97, 95,118, 97,108,117,101, 39, 10, + 32,101,110,100, 10, 32,108,111, 99, 97,108, 32,102, 32, 61, + 32, 68,101, 99,108, 97,114, 97,116,105,111,110, 40,100, 44, + 39,102,117,110, 99, 39, 41, 10, 32,105,102, 32,107, 32, 61, + 61, 32, 39, 91, 93, 39, 32, 97,110,100, 32, 40,108, 91, 49, + 93, 61, 61,110,105,108, 32,111,114, 32,105,115, 98, 97,115, + 105, 99, 40,108, 91, 49, 93, 46,116,121,112,101, 41,126, 61, + 39,110,117,109, 98,101,114, 39, 41, 32,116,104,101,110, 10, + 32, 32,101,114,114,111,114, 40, 39,111,112,101,114, 97,116, + 111,114, 91, 93, 32, 99, 97,110, 32,111,110,108,121, 32, 98, + 101, 32,100,101,102,105,110,101,100, 32,102,111,114, 32,110, + 117,109,101,114,105, 99, 32,105,110,100,101,120, 46, 39, 41, + 10, 32,101,110,100, 10, 32,102, 46, 97,114,103,115, 32, 61, + 32,108, 10, 32,102, 46, 99,111,110,115,116, 32, 61, 32, 99, + 10, 32,102, 46,107,105,110,100, 32, 61, 32,111,112, 95,107, + 10, 32,102, 46,108,110, 97,109,101, 32, 61, 32, 34, 46, 34, + 46, 46, 40, 95, 84, 77, 91,102, 46,107,105,110,100, 93, 32, + 111,114, 32,102, 46,107,105,110,100, 41, 10, 32,105,102, 32, + 110,111,116, 32, 95, 84, 77, 91,102, 46,107,105,110,100, 93, + 32,116,104,101,110, 10, 32, 9,102, 46, 99, 97,115,116, 95, + 111,112,101,114, 97,116,111,114, 32, 61, 32,116,114,117,101, + 10, 32,101,110,100, 10, 32,105,102, 32,102, 46,107,105,110, + 100, 32, 61, 61, 32, 39, 91, 93, 39, 32, 97,110,100, 32,114, + 101,102, 61, 61, 39, 38, 39, 32, 97,110,100, 32,102, 46, 99, + 111,110,115,116,126, 61, 39, 99,111,110,115,116, 39, 32,116, + 104,101,110, 10, 32, 32, 79,112,101,114, 97,116,111,114, 40, + 100, 44, 39, 38, 39, 46, 46,107, 44, 97, 44, 99, 41, 32, 9, + 45, 45, 32, 99,114,101, 97,116,101, 32, 99,111,114,114,101, + 115,112,111,100,105,110,103, 32,115,101,116, 32,111,112,101, + 114, 97,116,111,114, 10, 32,101,110,100, 10, 32,114,101,116, + 117,114,110, 32, 95, 79,112,101,114, 97,116,111,114, 40,102, + 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/operator.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 10, 95,103,108,111, 98, 97,108, 95,116,101,109,112,108, 97, + 116,101,115, 32, 61, 32,123,125, 10, 10, 99,108, 97,115,115, + 84,101,109,112,108, 97,116,101, 67,108, 97,115,115, 32, 61, + 32,123, 10, 10, 9,110, 97,109,101, 32, 61, 32, 39, 39, 44, + 10, 9, 98,111,100,121, 32, 61, 32, 39, 39, 44, 10, 9,112, + 97,114,101,110,116,115, 32, 61, 32,123,125, 44, 10, 9, 97, + 114,103,115, 32, 61, 32,123,125, 44, 32, 45, 45, 32,116,104, + 101, 32,116,101,109,112,108, 97,116,101, 32, 97,114,103,117, + 109,101,110,116,115, 10,125, 10, 10, 99,108, 97,115,115, 84, + 101,109,112,108, 97,116,101, 67,108, 97,115,115, 46, 95, 95, + 105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 84,101, + 109,112,108, 97,116,101, 67,108, 97,115,115, 10, 10, 10,102, + 117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 84,101, + 109,112,108, 97,116,101, 67,108, 97,115,115, 58,116,104,114, + 111,119, 40,116,121,112,101,115, 44, 32,108,111, 99, 97,108, + 95,115, 99,111,112,101, 41, 10, 10, 9, 45, 45,105,102, 32, + 116, 97, 98,108,101, 46,103,101,116,110, 40,116,121,112,101, + 115, 41, 32,126, 61, 32,116, 97, 98,108,101, 46,103,101,116, + 110, 40,115,101,108,102, 46, 97,114,103,115, 41, 32,116,104, + 101,110, 10, 9, 45, 45, 9,101,114,114,111,114, 40, 34, 35, + 105,110,118, 97,108,105,100, 32,112, 97,114, 97,109,101,116, + 101,114, 32, 99,111,117,110,116, 34, 41, 10, 9, 45, 45,101, + 110,100, 10, 10, 9, 45, 45, 32,114,101,112,108, 97, 99,101, + 10, 9,102,111,114, 32,105, 32, 61, 49, 32, 44, 32,116,121, + 112,101,115, 46,110, 32,100,111, 10, 10, 9, 9,108,111, 99, + 97,108, 32, 73,108, 32, 61, 32,115,112,108,105,116, 95, 99, + 95,116,111,107,101,110,115, 40,116,121,112,101,115, 91,105, + 93, 44, 32, 34, 32, 34, 41, 10, 9, 9,105,102, 32,116, 97, + 98,108,101, 46,103,101,116,110, 40, 73,108, 41, 32,126, 61, + 32,116, 97, 98,108,101, 46,103,101,116,110, 40,115,101,108, + 102, 46, 97,114,103,115, 41, 32,116,104,101,110, 10, 9, 9, + 9,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105, + 100, 32,112, 97,114, 97,109,101,116,101,114, 32, 99,111,117, + 110,116, 32,102,111,114, 32, 34, 46, 46,116,121,112,101,115, + 91,105, 93, 41, 10, 9, 9,101,110,100, 10, 9, 9,108,111, + 99, 97,108, 32, 98, 73, 32, 61, 32,115,101,108,102, 46, 98, + 111,100,121, 10, 9, 9,108,111, 99, 97,108, 32,112, 73, 32, + 61, 32,123,125, 10, 9, 9,102,111,114, 32,106, 32, 61, 32, + 49, 44,115,101,108,102, 46, 97,114,103,115, 46,110, 32,100, + 111, 10, 9, 9, 9, 45, 45, 84,108, 91,106, 93, 32, 61, 32, + 102,105,110,100,116,121,112,101, 40, 84,108, 91,106, 93, 41, + 32,111,114, 32, 84,108, 91,106, 93, 10, 9, 9, 9, 98, 73, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 98, 73, 44, 32, 34, 40, 91, 94, 95, 37,119, 93, 41, 34, 46, + 46,115,101,108,102, 46, 97,114,103,115, 91,106, 93, 46, 46, + 34, 40, 91, 94, 95, 37,119, 93, 41, 34, 44, 32, 34, 37, 49, + 34, 46, 46, 73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41, + 10, 9, 9, 9,105,102, 32,115,101,108,102, 46,112, 97,114, + 101,110,116,115, 32,116,104,101,110, 10, 9, 9, 9, 9,102, + 111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,103,101, + 116,110, 40,115,101,108,102, 46,112, 97,114,101,110,116,115, + 41, 32,100,111, 10, 9, 9, 9, 9, 9,112, 73, 91,105, 93, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 115,101,108,102, 46,112, 97,114,101,110,116,115, 91,105, 93, + 44, 32, 34, 40, 91, 94, 95, 37,119, 93, 63, 41, 34, 46, 46, + 115,101,108,102, 46, 97,114,103,115, 91,106, 93, 46, 46, 34, + 40, 91, 94, 95, 37,119, 93, 63, 41, 34, 44, 32, 34, 37, 49, + 34, 46, 46, 73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41, + 10, 9, 9, 9, 9,101,110,100, 10, 9, 9, 9,101,110,100, + 10, 9, 9,101,110,100, 10, 9, 9, 45, 45,108,111, 99, 97, + 108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34, 46, + 46,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,121, + 112,101,115, 91,105, 93, 44, 32, 34, 37,115, 43, 34, 44, 32, + 34, 44, 34, 41, 46, 46, 34, 62, 34, 10, 9, 9,108,111, 99, + 97,108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34, + 46, 46, 99,111,110, 99, 97,116, 40, 73,108, 44, 32, 49, 44, + 32,116, 97, 98,108,101, 46,103,101,116,110, 40, 73,108, 41, + 44, 32, 34, 44, 34, 41, 46, 46, 34, 62, 34, 10, 9, 9, 97, + 112,112,101,110,100, 32, 61, 32,115,116,114,105,110,103, 46, + 103,115,117, 98, 40, 97,112,112,101,110,100, 44, 32, 34, 37, + 115, 42, 44, 37,115, 42, 34, 44, 32, 34, 44, 34, 41, 10, 9, + 9, 97,112,112,101,110,100, 32, 61, 32,115,116,114,105,110, + 103, 46,103,115,117, 98, 40, 97,112,112,101,110,100, 44, 32, + 34, 62, 62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10, 9, 9, + 102,111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,103, + 101,116,110, 40,112, 73, 41, 32,100,111, 10, 9, 9, 9, 45, + 45,112, 73, 91,105, 93, 32, 61, 32,115,116,114,105,110,103, + 46,103,115,117, 98, 40,112, 73, 91,105, 93, 44, 32, 34, 62, + 62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10, 9, 9, 9,112, + 73, 91,105, 93, 32, 61, 32,114,101,115,111,108,118,101, 95, + 116,101,109,112,108, 97,116,101, 95,116,121,112,101,115, 40, + 112, 73, 91,105, 93, 41, 10, 9, 9,101,110,100, 10, 9, 9, + 98, 73, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, + 98, 40, 98, 73, 44, 32, 34, 62, 62, 34, 44, 32, 34, 62, 32, + 62, 34, 41, 10, 9, 9,108,111, 99, 97,108, 32,110, 32, 61, + 32,115,101,108,102, 46,110, 97,109,101, 10, 9, 9,105,102, + 32,108,111, 99, 97,108, 95,115, 99,111,112,101, 32,116,104, + 101,110, 10, 9, 9, 9,110, 32, 61, 32,115,101,108,102, 46, + 108,111, 99, 97,108, 95,110, 97,109,101, 10, 9, 9,101,110, + 100, 10, 10, 9, 9, 67,108, 97,115,115, 40,110, 46, 46, 97, + 112,112,101,110,100, 44, 32,112, 73, 44, 32, 98, 73, 41, 10, + 9,101,110,100, 10,101,110,100, 10, 10, 10,102,117,110, 99, + 116,105,111,110, 32, 84,101,109,112,108, 97,116,101, 67,108, + 97,115,115, 40,110, 97,109,101, 44, 32,112, 97,114,101,110, + 116,115, 44, 32, 98,111,100,121, 44, 32,112, 97,114, 97,109, + 101,116,101,114,115, 41, 10, 10, 9,108,111, 99, 97,108, 32, + 111, 32, 61, 32,123, 10, 9, 10, 9, 9,112, 97,114,101,110, + 116,115, 32, 61, 32,112, 97,114,101,110,116,115, 44, 10, 9, + 9, 98,111,100,121, 32, 61, 32, 98,111,100,121, 44, 10, 9, + 9, 97,114,103,115, 32, 61, 32,112, 97,114, 97,109,101,116, + 101,114,115, 44, 10, 9,125, 10, 9, 10, 9,108,111, 99, 97, + 108, 32,111,110, 97,109,101, 32, 61, 32,115,116,114,105,110, + 103, 46,103,115,117, 98, 40,110, 97,109,101, 44, 32, 34, 64, + 46, 42, 36, 34, 44, 32, 34, 34, 41, 10, 9,111,110, 97,109, + 101, 32, 61, 32,103,101,116,110, 97,109,101,115,112, 97, 99, + 101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101, + 114, 46, 99,117,114,114, 41, 46, 46,111,110, 97,109,101, 10, + 9,111, 46,110, 97,109,101, 32, 61, 32,111,110, 97,109,101, + 10, 10, 9,111, 46,108,111, 99, 97,108, 95,110, 97,109,101, + 32, 61, 32,110, 97,109,101, 10, 9, 10, 9,115,101,116,109, + 101,116, 97,116, 97, 98,108,101, 40,111, 44, 32, 99,108, 97, + 115,115, 84,101,109,112,108, 97,116,101, 67,108, 97,115,115, + 41, 10, 10, 9,105,102, 32, 95,103,108,111, 98, 97,108, 95, + 116,101,109,112,108, 97,116,101,115, 91,111,110, 97,109,101, + 93, 32,116,104,101,110, 10, 9, 9,119, 97,114,110,105,110, + 103, 40, 34, 68,117,112,108,105, 99, 97,116,101, 32,100,101, + 99,108, 97,114, 97,116,105,111,110, 32,111,102, 32,116,101, + 109,112,108, 97,116,101, 32, 34, 46, 46,111,110, 97,109,101, + 41, 10, 9,101,108,115,101, 10, 9, 9, 95,103,108,111, 98, + 97,108, 95,116,101,109,112,108, 97,116,101,115, 91,111,110, + 97,109,101, 93, 32, 61, 32,111, 10, 9,101,110,100, 10, 10, + 9,114,101,116,117,114,110, 32,111, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/template_class.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,116,111,108,117, 97, 58, 32, 99,108, 97,115,115, + 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116, + 101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, + 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97, + 102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117, + 108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, + 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, + 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97, + 114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100, + 105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110, + 100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, + 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114, + 101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,101, + 117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, + 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, + 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104, + 111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, + 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,100, + 101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32, + 115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101, + 115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101, + 110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, + 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 67,108, + 97,115,115, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101, + 112,114,101,115,101,110,116,115, 32, 97, 32, 99,108, 97,115, + 115, 32,100,101,102,105,110,105,116,105,111,110, 46, 10, 45, + 45, 32, 83,116,111,114,101,115, 32,116,104,101, 32,102,111, + 108,108,111,119,105,110,103, 32,102,105,101,108,100,115, 58, + 10, 45, 45, 32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99, + 108, 97,115,115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32, + 32, 98, 97,115,101, 32, 61, 32, 99,108, 97,115,115, 32, 98, + 97,115,101, 44, 32,105,102, 32, 97,110,121, 32, 40,111,110, + 108,121, 32,115,105,110,103,108,101, 32,105,110,104,101,114, + 105,116, 97,110, 99,101, 32,105,115, 32,115,117,112,112,111, + 114,116,101,100, 41, 10, 45, 45, 32, 32, 32, 32,123,105,125, + 32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101,109, + 98,101,114,115, 10, 99,108, 97,115,115, 67,108, 97,115,115, + 32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121,112,101, + 32, 61, 32, 39, 99,108, 97,115,115, 39, 44, 10, 32,110, 97, + 109,101, 32, 61, 32, 39, 39, 44, 10, 32, 98, 97,115,101, 32, + 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, + 39, 44, 10, 32, 98,116,121,112,101, 32, 61, 32, 39, 39, 44, + 10, 32, 99,116,121,112,101, 32, 61, 32, 39, 39, 44, 10,125, + 10, 99,108, 97,115,115, 67,108, 97,115,115, 46, 95, 95,105, + 110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,108, 97, + 115,115, 10,115,101,116,109,101,116, 97,116, 97, 98,108,101, + 40, 99,108, 97,115,115, 67,108, 97,115,115, 44, 99,108, 97, + 115,115, 67,111,110,116, 97,105,110,101,114, 41, 10, 10, 10, + 45, 45, 32,114,101,103,105,115,116,101,114, 32, 99,108, 97, + 115,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 67,108, 97,115,115, 58,114,101,103,105,115,116,101, + 114, 32, 40,112,114,101, 41, 10, 10, 9,105,102, 32,110,111, + 116, 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, + 98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116, + 104,101,110, 10, 9, 9,114,101,116,117,114,110, 10, 9,101, + 110,100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32, + 111,114, 32, 39, 39, 10, 32,112,117,115,104, 40,115,101,108, + 102, 41, 10, 9,105,102, 32, 95, 99,111,108,108,101, 99,116, + 91,115,101,108,102, 46,116,121,112,101, 93, 32,116,104,101, + 110, 10, 9, 9,111,117,116,112,117,116, 40,112,114,101, 44, + 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,115, + 112,108,117,115, 92,110, 39, 41, 10, 32, 32,111,117,116,112, + 117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95, + 99, 99,108, 97,115,115, 40,116,111,108,117, 97, 95, 83, 44, + 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46, + 46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46,116,121, + 112,101, 46, 46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102, + 46, 98,116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46, 95, + 99,111,108,108,101, 99,116, 91,115,101,108,102, 46,116,121, + 112,101, 93, 46, 46, 39, 41, 59, 39, 41, 10, 9, 9,111,117, + 116,112,117,116, 40,112,114,101, 44, 39, 35,101,108,115,101, + 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,112, + 114,101, 46, 46, 39,116,111,108,117, 97, 95, 99, 99,108, 97, + 115,115, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46, + 115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, + 34, 39, 46, 46,115,101,108,102, 46,116,121,112,101, 46, 46, + 39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46, 98,116,121, + 112,101, 46, 46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, + 10, 9, 9,111,117,116,112,117,116, 40,112,114,101, 44, 39, + 35,101,110,100,105,102, 92,110, 39, 41, 10, 9,101,108,115, + 101, 10, 32, 32,111,117,116,112,117,116, 40,112,114,101, 46, + 46, 39,116,111,108,117, 97, 95, 99, 99,108, 97,115,115, 40, + 116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108, + 102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 34, 39, 46, + 46,115,101,108,102, 46,116,121,112,101, 46, 46, 39, 34, 44, + 34, 39, 46, 46,115,101,108,102, 46, 98,116,121,112,101, 46, + 46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 10, 9,101, + 110,100, 10, 9,105,102, 32,115,101,108,102, 46,101,120,116, + 114, 97, 95, 98, 97,115,101,115, 32,116,104,101,110, 10, 9, + 9,102,111,114, 32,107, 44, 98, 97,115,101, 32,105,110, 32, + 105,112, 97,105,114,115, 40,115,101,108,102, 46,101,120,116, + 114, 97, 95, 98, 97,115,101,115, 41, 32,100,111, 10, 9, 9, + 9, 45, 45, 32,110,111,116, 32,110,111,119, 10, 32, 32, 32, + 45, 45,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39, + 32,116,111,108,117, 97, 95, 97,100,100, 98, 97,115,101, 40, + 116,111,108,117, 97, 95, 83, 44, 32, 34, 39, 46, 46,115,101, + 108,102, 46,116,121,112,101, 46, 46, 39, 34, 44, 32, 34, 39, + 46, 46, 98, 97,115,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, + 9, 9,101,110,100, 10, 9,101,110,100, 10, 32,111,117,116, + 112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, + 95, 98,101,103,105,110,109,111,100,117,108,101, 40,116,111, + 108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46, + 108,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32, + 108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108, + 101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32, + 115,101,108,102, 91,105, 93, 58,114,101,103,105,115,116,101, + 114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32, 32,105, + 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,111,117, + 116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, + 97, 95,101,110,100,109,111,100,117,108,101, 40,116,111,108, + 117, 97, 95, 83, 41, 59, 39, 41, 10, 9,112,111,112, 40, 41, + 10,101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110, + 32, 99,111,108,108,101, 99,116,105,111,110, 32,114,101,113, + 117,105,114,101,109,101,110,116, 10,102,117,110, 99,116,105, + 111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58,114, + 101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111, + 110, 32, 40,116, 41, 10, 9,105,102, 32,115,101,108,102, 46, + 102,108, 97,103,115, 46,112,114,111,116,101, 99,116,101,100, + 95,100,101,115,116,114,117, 99,116,111,114, 32,111,114, 32, + 40,110,111,116, 32,115,101,108,102, 58, 99,104,101, 99,107, + 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, + 41, 41, 32,116,104,101,110, 10, 9, 9,114,101,116,117,114, + 110, 32,102, 97,108,115,101, 10, 9,101,110,100, 10, 32,112, + 117,115,104, 40,115,101,108,102, 41, 10, 9,108,111, 99, 97, + 108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,108,111, + 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101, 32, + 115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,114, 32, + 61, 32,115,101,108,102, 91,105, 93, 58,114,101,113,117,105, + 114,101, 99,111,108,108,101, 99,116,105,111,110, 40,116, 41, + 32,111,114, 32,114, 10, 32, 32,105, 32, 61, 32,105, 43, 49, + 10, 32,101,110,100, 10, 9,112,111,112, 40, 41, 10, 9, 45, + 45, 32,111,110,108,121, 32, 99,108, 97,115,115, 32,116,104, + 97,116, 32,101,120,112,111,114,116,115, 32,100,101,115,116, + 114,117, 99,116,111,114, 32, 99, 97,110, 32, 98,101, 32, 97, + 112,112,114,111,112,114,105, 97,116,101,108,121, 32, 99,111, + 108,108,101, 99,116,101,100, 10, 9, 45, 45, 32, 99,108, 97, + 115,115,101,115, 32,116,104, 97,116, 32,101,120,112,111,114, + 116, 32, 99,111,110,115,116,114,117, 99,116,111,114,115, 32, + 110,101,101,100, 32,116,111, 32,104, 97,118,101, 32, 97, 32, + 99,111,108,108,101, 99,116,111,114, 32, 40,111,118,101,114, + 114,105,100,101,100, 32, 98,121, 32, 45, 68, 32,102,108, 97, + 103, 32,111,110, 32, 99,111,109,109, 97,110,100, 32,108,105, + 110,101, 41, 10, 9,105,102, 32,115,101,108,102, 46, 95,100, + 101,108,101,116,101, 32,111,114, 32, 40, 40,110,111,116, 32, + 102,108, 97,103,115, 91, 39, 68, 39, 93, 41, 32, 97,110,100, + 32,115,101,108,102, 46, 95,110,101,119, 41, 32,116,104,101, + 110, 10, 9, 9, 45, 45,116, 91,115,101,108,102, 46,116,121, + 112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95, 99,111, + 108,108,101, 99,116, 95, 34, 32, 46, 46, 32,103,115,117, 98, + 40,115,101,108,102, 46,116,121,112,101, 44, 34, 58, 58, 34, + 44, 34, 95, 34, 41, 10, 9, 9,116, 91,115,101,108,102, 46, + 116,121,112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95, + 99,111,108,108,101, 99,116, 95, 34, 32, 46, 46, 32, 99,108, + 101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,115,101, + 108,102, 46,116,121,112,101, 41, 10, 9, 9,114, 32, 61, 32, + 116,114,117,101, 10, 9,101,110,100, 10, 32,114,101,116,117, + 114,110, 32,114, 10,101,110,100, 10, 10, 45, 45, 32,111,117, + 116,112,117,116, 32,116, 97,103,115, 10,102,117,110, 99,116, + 105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58, + 100,101, 99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117, + 115,104, 40,115,101,108,102, 41, 10, 9,115,101,108,102, 46, + 116,121,112,101, 32, 61, 32,114,101,103,116,121,112,101, 40, + 115,101,108,102, 46,111,114,105,103,105,110, 97,108, 95,110, + 97,109,101, 32,111,114, 32,115,101,108,102, 46,110, 97,109, + 101, 41, 10, 9,115,101,108,102, 46, 98,116,121,112,101, 32, + 61, 32,116,121,112,101,118, 97,114, 40,115,101,108,102, 46, + 98, 97,115,101, 41, 10, 9,115,101,108,102, 46, 99,116,121, + 112,101, 32, 61, 32, 39, 99,111,110,115,116, 32, 39, 46, 46, + 115,101,108,102, 46,116,121,112,101, 10, 9,105,102, 32,115, + 101,108,102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115, + 32,116,104,101,110, 10, 9, 9,102,111,114, 32,105, 61, 49, + 44,116, 97, 98,108,101, 46,103,101,116,110, 40,115,101,108, + 102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115, 41, 32, + 100,111, 10, 9, 9, 9,115,101,108,102, 46,101,120,116,114, + 97, 95, 98, 97,115,101,115, 91,105, 93, 32, 61, 32,116,121, + 112,101,118, 97,114, 40,115,101,108,102, 46,101,120,116,114, + 97, 95, 98, 97,115,101,115, 91,105, 93, 41, 10, 9, 9,101, + 110,100, 10, 9,101,110,100, 10, 32,108,111, 99, 97,108, 32, + 105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, + 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105, + 93, 58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32, + 105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 9,112, + 111,112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80, + 114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, + 99,116,105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115, + 115, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, 44, + 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,105, + 100,101,110,116, 46, 46, 34, 67,108, 97,115,115,123, 34, 41, + 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, + 34, 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32, 98, 97,115,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46, 98, 97,115,101, 46, 46, 34, 39, 59, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32, + 112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, + 98,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108, + 102, 46, 98,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, + 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, + 32, 99,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101, + 108,102, 46, 99,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, + 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104, + 105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, + 32, 32,115,101,108,102, 91,105, 93, 58,112,114,105,110,116, + 40,105,100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34, + 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110, + 100, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, + 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110, + 100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97, + 115,115, 67,108, 97,115,115, 58,115,101,116, 95,112,114,111, + 116,101, 99,116,101,100, 95,100,101,115,116,114,117, 99,116, + 111,114, 40,112, 41, 10, 9,115,101,108,102, 46,102,108, 97, + 103,115, 46,112,114,111,116,101, 99,116,101,100, 95,100,101, + 115,116,114,117, 99,116,111,114, 32, 61, 32,115,101,108,102, + 46,102,108, 97,103,115, 46,112,114,111,116,101, 99,116,101, + 100, 95,100,101,115,116,114,117, 99,116,111,114, 32,111,114, + 32,112, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,116,101, + 114,110, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111, + 114, 10,102,117,110, 99,116,105,111,110, 32, 95, 67,108, 97, + 115,115, 32, 40,116, 41, 10, 32,115,101,116,109,101,116, 97, + 116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 67,108, + 97,115,115, 41, 10, 32,116, 58, 98,117,105,108,100,110, 97, + 109,101,115, 40, 41, 10, 32, 97,112,112,101,110,100, 40,116, + 41, 10, 32,114,101,116,117,114,110, 32,116, 10,101,110,100, + 10, 10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111, + 114, 10, 45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104, + 101, 32,110, 97,109,101, 44, 32,116,104,101, 32, 98, 97,115, + 101, 32, 40, 97,114,114, 97,121, 41, 32, 97,110,100, 32,116, + 104,101, 32, 98,111,100,121, 32,111,102, 32,116,104,101, 32, + 99,108, 97,115,115, 46, 10,102,117,110, 99,116,105,111,110, + 32, 67,108, 97,115,115, 32, 40,110, 44,112, 44, 98, 41, 10, + 10, 9,105,102, 32,116, 97, 98,108,101, 46,103,101,116,110, + 40,112, 41, 32, 62, 32, 49, 32,116,104,101,110, 10, 9, 9, + 98, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40, + 98, 44, 32, 49, 44, 32, 45, 50, 41, 10, 9, 9,102,111,114, + 32,105, 61, 50, 44,116, 97, 98,108,101, 46,103,101,116,110, + 40,112, 41, 44, 49, 32,100,111, 10, 9, 9, 9, 98, 32, 61, + 32, 98, 46, 46, 34, 92,110, 32,116,111,108,117, 97, 95,105, + 110,104,101,114,105,116,115, 32, 34, 46, 46,112, 91,105, 93, + 46, 46, 34, 32, 95, 95, 34, 46, 46,112, 91,105, 93, 46, 46, + 34, 95, 95, 59, 92,110, 34, 10, 9, 9,101,110,100, 10, 9, + 9, 98, 32, 61, 32, 98, 46, 46, 34, 92,110,125, 34, 10, 9, + 101,110,100, 10, 10, 9, 45, 45, 32, 99,104,101, 99,107, 32, + 102,111,114, 32,116,101,109,112,108, 97,116,101, 10, 9, 98, + 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40, + 98, 44, 32, 34, 94,123, 37,115, 42, 84, 69, 77, 80, 76, 65, + 84, 69, 95, 66, 73, 78, 68, 34, 44, 32, 34,123, 92,110, 84, + 79, 76, 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, + 73, 78, 68, 34, 41, 10, 9,108,111, 99, 97,108, 32,116, 44, + 95, 44, 84, 44, 73, 32, 61, 32,115,116,114,105,110,103, 46, + 102,105,110,100, 40, 98, 44, 32, 39, 94,123, 37,115, 42, 84, + 79, 76, 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, + 73, 78, 68, 37,115, 42, 37, 40, 43, 37,115, 42, 92, 34, 63, + 40, 91, 94, 92, 34, 44, 93, 42, 41, 92, 34, 63, 37,115, 42, + 44, 37,115, 42, 40, 91, 94, 37, 41, 93, 42, 41, 37,115, 42, + 37, 41, 43, 39, 41, 10, 9,105,102, 32,116, 32,116,104,101, + 110, 10, 10, 9, 9, 45, 45, 32,114,101,109,111,118,101, 32, + 113,117,111,116,101,115, 10, 9, 9, 73, 32, 61, 32,115,116, + 114,105,110,103, 46,103,115,117, 98, 40, 73, 44, 32, 34, 92, + 34, 34, 44, 32, 34, 34, 41, 10, 9, 9, 84, 32, 61, 32,115, + 116,114,105,110,103, 46,103,115,117, 98, 40, 84, 44, 32, 34, + 92, 34, 34, 44, 32, 34, 34, 41, 10, 9, 9, 45, 45, 32,103, + 101,116, 32,116,121,112,101, 32,108,105,115,116, 10, 9, 9, + 108,111, 99, 97,108, 32,116,121,112,101,115, 32, 61, 32,115, + 112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40, 73, + 44, 32, 34, 44, 34, 41, 10, 9, 9, 45, 45, 32,114,101,109, + 111,118,101, 32, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73, + 78, 68, 32,108,105,110,101, 10, 9, 9,108,111, 99, 97,108, + 32, 98,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115, + 117, 98, 40, 98, 44, 32, 34, 94,123, 37,115, 42, 84, 79, 76, + 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73, 78, + 68, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34,123, 92, + 110, 34, 41, 10, 9, 9, 9, 10, 9, 9,108,111, 99, 97,108, + 32, 84,108, 32, 61, 32,115,112,108,105,116, 40, 84, 44, 32, + 34, 32, 34, 41, 10, 9, 9,108,111, 99, 97,108, 32,116, 99, + 32, 61, 32, 84,101,109,112,108, 97,116,101, 67,108, 97,115, + 115, 40,110, 44, 32,112, 44, 32, 98,115, 44, 32, 84,108, 41, + 10, 10, 9, 9, 10, 9, 9,116, 99, 58,116,104,114,111,119, + 40,116,121,112,101,115, 44, 32,116,114,117,101, 41, 10, 9, + 9, 45, 45,102,111,114, 32,105, 61, 49, 44,116,121,112,101, + 115, 46,110, 32,100,111, 10, 9, 9, 45, 45, 9,116, 99, 58, + 116,104,114,111,119, 40,115,112,108,105,116, 95, 99, 95,116, + 111,107,101,110,115, 40,116,121,112,101,115, 91,105, 93, 44, + 32, 34, 32, 34, 41, 44, 32,116,114,117,101, 41, 10, 9, 9, + 45, 45,101,110,100, 10, 9, 9,114,101,116,117,114,110, 10, + 9,101,110,100, 10, 9, 10, 9,108,111, 99, 97,108, 32,109, + 98, 97,115,101, 10, 10, 9,105,102, 32,112, 32,116,104,101, + 110, 10, 9, 9,109, 98, 97,115,101, 32, 61, 32,116, 97, 98, + 108,101, 46,114,101,109,111,118,101, 40,112, 44, 32, 49, 41, + 10, 9, 9,105,102, 32,110,111,116, 32,112, 91, 49, 93, 32, + 116,104,101,110, 32,112, 32, 61, 32,110,105,108, 32,101,110, + 100, 10, 9,101,110,100, 10, 10, 9,109, 98, 97,115,101, 32, + 61, 32,109, 98, 97,115,101, 32, 97,110,100, 32,114,101,115, + 111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95,116, + 121,112,101,115, 40,109, 98, 97,115,101, 41, 10, 10, 9,108, + 111, 99, 97,108, 32, 99, 10, 9,108,111, 99, 97,108, 32,111, + 110, 97,109,101, 32, 61, 32,115,116,114,105,110,103, 46,103, + 115,117, 98, 40,110, 44, 32, 34, 64, 46, 42, 36, 34, 44, 32, + 34, 34, 41, 10, 9,111,110, 97,109,101, 32, 61, 32,103,101, + 116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115, + 115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, + 41, 46, 46,111,110, 97,109,101, 10, 10, 9,105,102, 32, 95, + 103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91, + 111,110, 97,109,101, 93, 32,116,104,101,110, 10, 9, 9, 99, + 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115, + 115,101,115, 91,111,110, 97,109,101, 93, 10, 9, 9,105,102, + 32,109, 98, 97,115,101, 32, 97,110,100, 32, 40, 40,110,111, + 116, 32, 99, 46, 98, 97,115,101, 41, 32,111,114, 32, 99, 46, + 98, 97,115,101, 32, 61, 61, 32, 34, 34, 41, 32,116,104,101, + 110, 10, 9, 9, 9, 99, 46, 98, 97,115,101, 32, 61, 32,109, + 98, 97,115,101, 10, 9, 9,101,110,100, 10, 9,101,108,115, + 101, 10, 9, 9, 99, 32, 61, 32, 95, 67,108, 97,115,115, 40, + 95, 67,111,110,116, 97,105,110,101,114,123,110, 97,109,101, + 61,110, 44, 32, 98, 97,115,101, 61,109, 98, 97,115,101, 44, + 32,101,120,116,114, 97, 95, 98, 97,115,101,115, 61,112,125, + 41, 10, 10, 9, 9,108,111, 99, 97,108, 32,102,116, 32, 61, + 32,103,101,116,110, 97,109,101,115,112, 97, 99,101, 40, 99, + 46,112, 97,114,101,110,116, 41, 46, 46, 99, 46,111,114,105, + 103,105,110, 97,108, 95,110, 97,109,101, 10, 9, 9, 97,112, + 112,101,110,100, 95,103,108,111, 98, 97,108, 95,116,121,112, + 101, 40,102,116, 44, 32, 99, 41, 10, 9,101,110,100, 10, 10, + 9,112,117,115,104, 40, 99, 41, 10, 9, 99, 58,112, 97,114, + 115,101, 40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115, + 116,114,108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, + 32,101,108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99, + 101,115, 10, 9,112,111,112, 40, 41, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/class.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32,109, 97,114,107, 32,117,112, 32, 99,111,109,109, + 101,110,116,115, 32, 97,110,100, 32,115,116,114,105,110,103, + 115, 10, 83, 84, 82, 49, 32, 61, 32, 34, 92, 48, 48, 49, 34, + 10, 83, 84, 82, 50, 32, 61, 32, 34, 92, 48, 48, 50, 34, 10, + 83, 84, 82, 51, 32, 61, 32, 34, 92, 48, 48, 51, 34, 10, 83, + 84, 82, 52, 32, 61, 32, 34, 92, 48, 48, 52, 34, 10, 82, 69, + 77, 32, 32, 61, 32, 34, 92, 48, 48, 53, 34, 10, 65, 78, 89, + 32, 32, 61, 32, 34, 40, 91, 92, 48, 48, 49, 45, 92, 48, 48, + 53, 93, 41, 34, 10, 69, 83, 67, 49, 32, 61, 32, 34, 92, 48, + 48, 54, 34, 10, 69, 83, 67, 50, 32, 61, 32, 34, 92, 48, 48, + 55, 34, 10, 10, 77, 65, 83, 75, 32, 61, 32,123, 32, 45, 45, + 32,116,104,101, 32,115,117, 98,115,116,105,116,117,116,105, + 111,110, 32,111,114,100,101,114, 32,105,115, 32,105,109,112, + 111,114,116, 97,110,116, 10, 32,123, 69, 83, 67, 49, 44, 32, + 34, 92, 92, 39, 34,125, 44, 10, 32,123, 69, 83, 67, 50, 44, + 32, 39, 92, 92, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 49, + 44, 32, 34, 39, 34,125, 44, 10, 32,123, 83, 84, 82, 50, 44, + 32, 39, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 51, 44, 32, + 34, 37, 91, 37, 91, 34,125, 44, 10, 32,123, 83, 84, 82, 52, + 44, 32, 34, 37, 93, 37, 93, 34,125, 44, 10, 32,123, 82, 69, + 77, 32, 44, 32, 34, 37, 45, 37, 45, 34,125, 44, 10,125, 10, + 10,102,117,110, 99,116,105,111,110, 32,109, 97,115,107, 32, + 40,115, 41, 10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44, + 103,101,116,110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10, + 32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65, + 83, 75, 91,105, 93, 91, 50, 93, 44, 77, 65, 83, 75, 91,105, + 93, 91, 49, 93, 41, 10, 32,101,110,100, 10, 32,114,101,116, + 117,114,110, 32,115, 10,101,110,100, 10, 10,102,117,110, 99, + 116,105,111,110, 32,117,110,109, 97,115,107, 32, 40,115, 41, + 10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44,103,101,116, + 110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10, 32, 32,115, + 32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65, 83, 75, 91, + 105, 93, 91, 49, 93, 44, 77, 65, 83, 75, 91,105, 93, 91, 50, + 93, 41, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110, + 32,115, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111, + 110, 32, 99,108,101, 97,110, 32, 40,115, 41, 10, 32, 45, 45, + 32, 99,104,101, 99,107, 32,102,111,114, 32, 99,111,109,112, + 105,108, 97,116,105,111,110, 32,101,114,114,111,114, 10, 32, + 108,111, 99, 97,108, 32, 99,111,100,101, 32, 61, 32, 34,114, + 101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, 32, + 40, 41, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34, + 92,110, 32,101,110,100, 34, 10, 32,105,102, 32,110,111,116, + 32,100,111,115,116,114,105,110,103, 40, 99,111,100,101, 41, + 32,116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, + 110,105,108, 10, 32,101,110,100, 10, 10, 32,105,102, 32,102, + 108, 97,103,115, 91, 39, 67, 39, 93, 32,116,104,101,110, 10, + 32, 9,114,101,116,117,114,110, 32,115, 10, 32,101,110,100, + 10, 10, 32,108,111, 99, 97,108, 32, 83, 32, 61, 32, 34, 34, + 32, 45, 45, 32,115, 97,118,101,100, 32,115,116,114,105,110, + 103, 10, 10, 32,115, 32, 61, 32,109, 97,115,107, 40,115, 41, + 10, 10, 32, 45, 45, 32,114,101,109,111,118,101, 32, 98,108, + 97,110,107,115, 32, 97,110,100, 32, 99,111,109,109,101,110, + 116,115, 10, 32,119,104,105,108,101, 32, 49, 32,100,111, 10, + 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100, 32, 61, + 32,115,116,114,102,105,110,100, 40,115, 44, 65, 78, 89, 41, + 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32, + 32, 83, 32, 61, 32, 83, 46, 46,115,116,114,115,117, 98, 40, + 115, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32, 32,115, 32, 61, + 32,115,116,114,115,117, 98, 40,115, 44, 98, 43, 49, 41, 10, + 32, 32, 32,105,102, 32,100, 61, 61, 83, 84, 82, 49, 32,111, + 114, 32,100, 61, 61, 83, 84, 82, 50, 32,116,104,101,110, 10, + 32, 32, 32, 32,101, 32, 61, 32,115,116,114,102,105,110,100, + 40,115, 44,100, 41, 10, 32, 32, 32, 32, 83, 32, 61, 32, 83, + 32, 46, 46,100, 46, 46,115,116,114,115,117, 98, 40,115, 44, + 49, 44,101, 41, 10, 32, 32, 32, 32,115, 32, 61, 32,115,116, + 114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32, 32, + 101,108,115,101,105,102, 32,100, 61, 61, 83, 84, 82, 51, 32, + 116,104,101,110, 10, 32, 32, 32, 32,101, 32, 61, 32,115,116, + 114,102,105,110,100, 40,115, 44, 83, 84, 82, 52, 41, 10, 32, + 32, 32, 32, 83, 32, 61, 32, 83, 46, 46,100, 46, 46,115,116, + 114,115,117, 98, 40,115, 44, 49, 44,101, 41, 10, 32, 32, 32, + 32,115, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44,101, + 43, 49, 41, 10, 32, 32, 32,101,108,115,101,105,102, 32,100, + 61, 61, 82, 69, 77, 32,116,104,101,110, 10, 32, 32, 32, 32, + 115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 91, 94, 92, + 110, 93, 42, 40, 92,110, 63, 41, 34, 44, 34, 37, 49, 34, 44, + 49, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,108,115, + 101, 10, 32, 32, 32, 83, 32, 61, 32, 83, 46, 46,115, 10, 32, + 32, 32, 98,114,101, 97,107, 10, 32, 32,101,110,100, 10, 32, + 101,110,100, 10, 32, 45, 45, 32,101,108,105,109,105,110, 97, + 116,101, 32,117,110,101, 99,101,115,115, 97,114,121, 32,115, + 112, 97, 99,101,115, 10, 32, 83, 32, 61, 32,103,115,117, 98, + 40, 83, 44, 34, 91, 32, 92,116, 93, 43, 34, 44, 34, 32, 34, + 41, 10, 32, 83, 32, 61, 32,103,115,117, 98, 40, 83, 44, 34, + 91, 32, 92,116, 93, 42, 92,110, 91, 32, 92,116, 93, 42, 34, + 44, 34, 92,110, 34, 41, 10, 9, 83, 32, 61, 32,103,115,117, + 98, 40, 83, 44, 34, 92,110, 43, 34, 44, 34, 92,110, 34, 41, + 10, 32, 83, 32, 61, 32,117,110,109, 97,115,107, 40, 83, 41, + 10, 32,114,101,116,117,114,110, 32, 83, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/clean.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 45, 45, 32, 71,101,110,101,114, 97,116,101, 32, 98,105,110, + 100,105,110,103, 32, 99,111,100,101, 10, 45, 45, 32, 87,114, + 105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, + 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, + 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, + 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 76, 97, + 115,116, 32,117,112,100, 97,116,101, 58, 32, 65,112,114, 32, + 50, 48, 48, 51, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, + 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32, + 105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114, + 101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105, + 115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, + 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, + 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, + 32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117, + 110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, + 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97, + 110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111, + 114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97, + 116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, + 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115, + 117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, + 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110, + 116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97, + 116,105,111,110,115, 46, 10, 10,102,117,110, 99,116,105,111, + 110, 32,112, 97,114,115,101, 95,101,120,116,114, 97, 40, 41, + 10, 10, 9,102,111,114, 32,107, 44,118, 32,105,110, 32,105, + 112, 97,105,114,115, 40, 95,101,120,116,114, 97, 95,112, 97, + 114, 97,109,101,116,101,114,115, 32,111,114, 32,123,125, 41, + 32,100,111, 10, 9, 9, 10, 9, 9,108,111, 99, 97,108, 32, + 98, 44,101, 44,110, 97,109,101, 44,118, 97,108,117,101, 32, + 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,118, + 44, 32, 34, 94, 40, 91, 94, 61, 93, 42, 41, 61, 40, 46, 42, + 41, 36, 34, 41, 10, 9, 9,105,102, 32, 98, 32,116,104,101, + 110, 10, 9, 9, 9, 95,101,120,116,114, 97, 95,112, 97,114, + 97,109,101,116,101,114,115, 91,110, 97,109,101, 93, 32, 61, + 32,118, 97,108,117,101, 10, 9, 9,101,108,115,101, 10, 9, + 9, 9, 95,101,120,116,114, 97, 95,112, 97,114, 97,109,101, + 116,101,114,115, 91,118, 93, 32, 61, 32,116,114,117,101, 10, + 9, 9,101,110,100, 10, 9,101,110,100, 10,101,110,100, 10, + 10,102,117,110, 99,116,105,111,110, 32,100,111,105,116, 32, + 40, 41, 10, 9, 45, 45, 32,100,101,102,105,110,101, 32,112, + 97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,105,102, + 32,110,111,116, 32,112,114,111,118,105,100,101,100, 10, 9, + 105,102, 32,110,111,116, 32,102,108, 97,103,115, 46,110, 32, + 116,104,101,110, 10, 9, 9,105,102, 32,102,108, 97,103,115, + 46,102, 32,116,104,101,110, 10, 9, 9, 9,102,108, 97,103, + 115, 46,110, 32, 61, 32,103,115,117, 98, 40,102,108, 97,103, + 115, 46,102, 44, 34, 37, 46, 46, 42, 36, 34, 44, 34, 34, 41, + 10, 9, 9, 9, 95, 44, 95, 44,102,108, 97,103,115, 46,110, + 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40, + 102,108, 97,103,115, 46,110, 44, 32, 34, 40, 91, 94, 47, 92, + 92, 93, 42, 41, 36, 34, 41, 10, 9, 9,101,108,115,101, 10, + 9, 9, 9,101,114,114,111,114, 40, 34, 35,110,111, 32,112, + 97, 99,107, 97,103,101, 32,110, 97,109,101, 32,110,111,114, + 32,105,110,112,117,116, 32,102,105,108,101, 32,112,114,111, + 118,105,100,101,100, 34, 41, 10, 9, 9,101,110,100, 10, 9, + 101,110,100, 10, 10, 9, 45, 45, 32,112, 97,114,115,101, 32, + 116, 97, 98,108,101, 32,119,105,116,104, 32,101,120,116,114, + 97, 32,112, 97,114, 97,109,116,101,114,115, 10, 9,112, 97, + 114,115,101, 95,101,120,116,114, 97, 40, 41, 10, 10, 9, 45, + 45, 32,100,111, 32,116,104,105,115, 32, 97,102,116,101,114, + 32,115,101,116,116,105,110,103, 32,116,104,101, 32,112, 97, + 99,107, 97,103,101, 32,110, 97,109,101, 10, 9,105,102, 32, + 102,108, 97,103,115, 91, 39, 76, 39, 93, 32,116,104,101,110, + 10, 9, 9,100,111,102,105,108,101, 40,102,108, 97,103,115, + 91, 39, 76, 39, 93, 41, 10, 9,101,110,100, 10, 10, 9, 45, + 45, 32, 97,100,100, 32, 99,112,112,115,116,114,105,110,103, + 10, 9,105,102, 32,110,111,116, 32,102,108, 97,103,115, 91, + 39, 83, 39, 93, 32,116,104,101,110, 10, 9, 9, 95, 98, 97, + 115,105, 99, 91, 39,115,116,114,105,110,103, 39, 93, 32, 61, + 32, 39, 99,112,112,115,116,114,105,110,103, 39, 10, 9, 9, + 95, 98, 97,115,105, 99, 91, 39,115,116,100, 58, 58,115,116, + 114,105,110,103, 39, 93, 32, 61, 32, 39, 99,112,112,115,116, + 114,105,110,103, 39, 10, 9, 9, 95, 98, 97,115,105, 99, 95, + 99,116,121,112,101, 46, 99,112,112,115,116,114,105,110,103, + 32, 61, 32, 39, 99,111,110,115,116, 32, 99,104, 97,114, 42, + 39, 10, 9,101,110,100, 10, 10, 9, 45, 45, 32,112,114,111, + 99, 99,101,115,115, 32,112, 97, 99,107, 97,103,101, 10, 9, + 108,111, 99, 97,108, 32,112, 32, 32, 61, 32, 80, 97, 99,107, + 97,103,101, 40,102,108, 97,103,115, 46,110, 44,102,108, 97, + 103,115, 46,102, 41, 10, 10, 9,105,102, 32,102,108, 97,103, + 115, 46,112, 32,116,104,101,110, 10, 9, 9,114,101,116,117, + 114,110, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,111,110, + 108,121, 32,112, 97,114,115,101, 10, 9,101,110,100, 10, 10, + 9,105,102, 32,102,108, 97,103,115, 46,111, 32,116,104,101, + 110, 10, 9, 9,108,111, 99, 97,108, 32,115,116, 44,109,115, + 103, 32, 61, 32,119,114,105,116,101,116,111, 40,102,108, 97, + 103,115, 46,111, 41, 10, 9, 9,105,102, 32,110,111,116, 32, + 115,116, 32,116,104,101,110, 10, 9, 9, 9,101,114,114,111, + 114, 40, 39, 35, 39, 46, 46,109,115,103, 41, 10, 9, 9,101, + 110,100, 10, 9,101,110,100, 10, 10, 9,112, 58,100,101, 99, + 108,116,121,112,101, 40, 41, 10, 9,105,102, 32,102,108, 97, + 103,115, 46, 80, 32,116,104,101,110, 10, 9, 9,112, 58,112, + 114,105,110,116, 40, 41, 10, 9,101,108,115,101, 10, 9, 9, + 112, 58,112,114,101, 97,109, 98,108,101, 40, 41, 10, 9, 9, + 112, 58,115,117,112, 99,111,100,101, 40, 41, 10, 9, 9,112, + 58,114,101,103,105,115,116,101,114, 40, 41, 10, 9, 9,112, + 117,115,104, 40,112, 41, 10, 9, 9,112,111,115,116, 95,111, + 117,116,112,117,116, 95,104,111,111,107, 40,112, 41, 10, 9, + 9,112,111,112, 40, 41, 10, 9,101,110,100, 10, 10, 9,105, + 102, 32,102,108, 97,103,115, 46,111, 32,116,104,101,110, 10, + 9, 9,119,114,105,116,101,116,111, 40, 41, 10, 9,101,110, + 100, 10, 10, 9, 45, 45, 32,119,114,105,116,101, 32,104,101, + 97,100,101,114, 32,102,105,108,101, 10, 9,105,102, 32,110, + 111,116, 32,102,108, 97,103,115, 46, 80, 32,116,104,101,110, + 10, 9, 9,105,102, 32,102,108, 97,103,115, 46, 72, 32,116, + 104,101,110, 10, 9, 9, 9,108,111, 99, 97,108, 32,115,116, + 44,109,115,103, 32, 61, 32,119,114,105,116,101,116,111, 40, + 102,108, 97,103,115, 46, 72, 41, 10, 9, 9, 9,105,102, 32, + 110,111,116, 32,115,116, 32,116,104,101,110, 10, 9, 9, 9, + 9,101,114,114,111,114, 40, 39, 35, 39, 46, 46,109,115,103, + 41, 10, 9, 9, 9,101,110,100, 10, 9, 9, 9,112, 58,104, + 101, 97,100,101,114, 40, 41, 10, 9, 9, 9,119,114,105,116, + 101,116,111, 40, 41, 10, 9, 9,101,110,100, 10, 9,101,110, + 100, 10,101,110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: lua/tolua++/src/bin/lua/doit.lua"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + + { /* begin embedded lua code */ + int top = lua_gettop(tolua_S); + static unsigned char B[] = { + 10,108,111, 99, 97,108, 32,101,114,114, 44,109,115,103, 32, + 61, 32,112, 99, 97,108,108, 40,100,111,105,116, 41, 10,105, + 102, 32,110,111,116, 32,101,114,114, 32,116,104,101,110, 10, + 32,108,111, 99, 97,108, 32, 95, 44, 95, 44,108, 97, 98,101, + 108, 44,109,115,103, 32, 61, 32,115,116,114,102,105,110,100, + 40,109,115,103, 44, 34, 40, 46, 45, 58, 46, 45, 58, 37,115, + 42, 41, 40, 46, 42, 41, 34, 41, 10, 32,116,111,108,117, 97, + 95,101,114,114,111,114, 40,109,115,103, 44,108, 97, 98,101, + 108, 41, 10, 32,112,114,105,110,116, 40,100,101, 98,117,103, + 46,116,114, 97, 99,101, 98, 97, 99,107, 40, 41, 41, 10,101, + 110,100,32 + }; + tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code 23"); + lua_settop(tolua_S, top); + } /* end of embedded lua code */ + + tolua_endmodule(tolua_S); + return 1; +} + + +#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 + TOLUA_API int luaopen_tolua (lua_State* tolua_S) { + return tolua_tolua_open(tolua_S); +}; +#endif + diff --git a/tolua++-1.0.93/src/bin/toluabind_default.h b/tolua++-1.0.93/src/bin/toluabind_default.h new file mode 100644 index 000000000..c31a14875 --- /dev/null +++ b/tolua++-1.0.93/src/bin/toluabind_default.h @@ -0,0 +1,8 @@ +/* +** Lua binding: tolua +** Generated automatically by tolua++-1.0.8pre2 on Tue Dec 13 01:43:55 2005. +*/ + +/* Exported function */ +TOLUA_API int tolua_tolua_open (lua_State* tolua_S); + diff --git a/tolua++-1.0.93/src/lib/SCsub b/tolua++-1.0.93/src/lib/SCsub new file mode 100644 index 000000000..2f9a24691 --- /dev/null +++ b/tolua++-1.0.93/src/lib/SCsub @@ -0,0 +1,18 @@ +Import('env') + + +sources = [ + 'tolua_event.c', + 'tolua_is.c', + 'tolua_map.c', + 'tolua_push.c', + 'tolua_to.c', + ] + +env.lib_target_static = env.Library('#/lib/'+env['tolua_lib']+'_static', sources) + +if env['shared']: + env.lib_target = env.SharedLibrary('#lib/'+env['tolua_lib'], sources) +else: + env.lib_target = env.Library('#/lib/'+env['tolua_lib'], sources) + diff --git a/tolua++-1.0.93/src/lib/tolua_event.c b/tolua++-1.0.93/src/lib/tolua_event.c new file mode 100644 index 000000000..8258867b4 --- /dev/null +++ b/tolua++-1.0.93/src/lib/tolua_event.c @@ -0,0 +1,536 @@ +/* tolua: event functions +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include <stdio.h> + +#include "tolua++.h" + +/* Store at ubox + * It stores, creating the corresponding table if needed, + * the pair key/value in the corresponding ubox table +*/ +static void storeatubox (lua_State* L, int lo) +{ + #ifdef LUA_VERSION_NUM + lua_getfenv(L, lo); + if (lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pop(L, 1); + lua_newtable(L); + lua_pushvalue(L, -1); + lua_setfenv(L, lo); /* stack: k,v,table */ + }; + lua_insert(L, -3); + lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */ + lua_pop(L, 1); + #else + /* stack: key value (to be stored) */ + lua_pushstring(L,"tolua_peers"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: k v ubox */ + lua_pushvalue(L,lo); + lua_rawget(L,-2); /* stack: k v ubox ubox[u] */ + if (!lua_istable(L,-1)) + { + lua_pop(L,1); /* stack: k v ubox */ + lua_newtable(L); /* stack: k v ubox table */ + lua_pushvalue(L,1); + lua_pushvalue(L,-2); /* stack: k v ubox table u table */ + lua_rawset(L,-4); /* stack: k v ubox ubox[u]=table */ + } + lua_insert(L,-4); /* put table before k */ + lua_pop(L,1); /* pop ubox */ + lua_rawset(L,-3); /* store at table */ + lua_pop(L,1); /* pop ubox[u] */ + #endif +} + +/* Module index function +*/ +static int module_index_event (lua_State* L) +{ + lua_pushstring(L,".get"); + lua_rawget(L,-3); + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { + lua_call(L,0,1); + return 1; + } + else if (lua_istable(L,-1)) + return 1; + } + /* call old index meta event */ + if (lua_getmetatable(L,1)) + { + lua_pushstring(L,"__index"); + lua_rawget(L,-2); + lua_pushvalue(L,1); + lua_pushvalue(L,2); + if (lua_isfunction(L,-1)) + { + lua_call(L,2,1); + return 1; + } + else if (lua_istable(L,-1)) + { + lua_gettable(L,-3); + return 1; + } + } + lua_pushnil(L); + return 1; +} + +/* Module newindex function +*/ +static int module_newindex_event (lua_State* L) +{ + lua_pushstring(L,".set"); + lua_rawget(L,-4); + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); /* only to be compatible with non-static vars */ + lua_pushvalue(L,3); /* value */ + lua_call(L,2,0); + return 0; + } + } + /* call old newindex meta event */ + if (lua_getmetatable(L,1) && lua_getmetatable(L,-1)) + { + lua_pushstring(L,"__newindex"); + lua_rawget(L,-2); + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_pushvalue(L,3); + lua_call(L,3,0); + } + } + lua_settop(L,3); + lua_rawset(L,-3); + return 0; +} + +/* Class index function + * If the object is a userdata (ie, an object), it searches the field in + * the alternative table stored in the corresponding "ubox" table. +*/ +static int class_index_event (lua_State* L) +{ + int t = lua_type(L,1); + if (t == LUA_TUSERDATA) + { + /* Access alternative table */ + #ifdef LUA_VERSION_NUM /* new macro on version 5.1 */ + lua_getfenv(L,1); + if (!lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pushvalue(L, 2); /* key */ + lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */ + if (!lua_isnil(L, -1)) + return 1; + }; + #else + lua_pushstring(L,"tolua_peers"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: obj key ubox */ + lua_pushvalue(L,1); + lua_rawget(L,-2); /* stack: obj key ubox ubox[u] */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* stack: obj key ubox ubox[u] value */ + if (!lua_isnil(L,-1)) + return 1; + } + #endif + lua_settop(L,2); /* stack: obj key */ + /* Try metatables */ + lua_pushvalue(L,1); /* stack: obj key obj */ + while (lua_getmetatable(L,-1)) + { /* stack: obj key obj mt */ + lua_remove(L,-2); /* stack: obj key mt */ + if (lua_isnumber(L,2)) /* check if key is a numeric value */ + { + /* try operator[] */ + lua_pushstring(L,".geti"); + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + } + else + { + lua_pushvalue(L,2); /* stack: obj key mt key */ + lua_rawget(L,-2); /* stack: obj key mt value */ + if (!lua_isnil(L,-1)) + return 1; + else + lua_pop(L,1); + /* try C/C++ variable */ + lua_pushstring(L,".get"); + lua_rawget(L,-2); /* stack: obj key mt tget */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); + lua_rawget(L,-2); /* stack: obj key mt value */ + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + else if (lua_istable(L,-1)) + { + /* deal with array: create table to be returned and cache it in ubox */ + void* u = *((void**)lua_touserdata(L,1)); + lua_newtable(L); /* stack: obj key mt value table */ + lua_pushstring(L,".self"); + lua_pushlightuserdata(L,u); + lua_rawset(L,-3); /* store usertype in ".self" */ + lua_insert(L,-2); /* stack: obj key mt table value */ + lua_setmetatable(L,-2); /* set stored value as metatable */ + lua_pushvalue(L,-1); /* stack: obj key met table table */ + lua_pushvalue(L,2); /* stack: obj key mt table table key */ + lua_insert(L,-2); /* stack: obj key mt table key table */ + storeatubox(L,1); /* stack: obj key mt table */ + return 1; + } + } + } + lua_settop(L,3); + } + lua_pushnil(L); + return 1; + } + else if (t== LUA_TTABLE) + { + module_index_event(L); + return 1; + } + lua_pushnil(L); + return 1; +} + +/* Newindex function + * It first searches for a C/C++ varaible to be set. + * Then, it either stores it in the alternative ubox table (in the case it is + * an object) or in the own table (that represents the class or module). +*/ +static int class_newindex_event (lua_State* L) +{ + int t = lua_type(L,1); + if (t == LUA_TUSERDATA) + { + /* Try accessing a C/C++ variable to be set */ + lua_getmetatable(L,1); + while (lua_istable(L,-1)) /* stack: t k v mt */ + { + if (lua_isnumber(L,2)) /* check if key is a numeric value */ + { + /* try operator[] */ + lua_pushstring(L,".seti"); + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_pushvalue(L,3); + lua_call(L,3,0); + return 0; + } + } + else + { + lua_pushstring(L,".set"); + lua_rawget(L,-2); /* stack: t k v mt tset */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); + lua_rawget(L,-2); /* stack: t k v mt tset func */ + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,3); + lua_call(L,2,0); + return 0; + } + lua_pop(L,1); /* stack: t k v mt tset */ + } + lua_pop(L,1); /* stack: t k v mt */ + if (!lua_getmetatable(L,-1)) /* stack: t k v mt mt */ + lua_pushnil(L); + lua_remove(L,-2); /* stack: t k v mt */ + } + } + lua_settop(L,3); /* stack: t k v */ + + /* then, store as a new field */ + storeatubox(L,1); + } + else if (t== LUA_TTABLE) + { + module_newindex_event(L); + } + return 0; +} + +static int class_call_event(lua_State* L) { + + if (lua_istable(L, 1)) { + lua_pushstring(L, ".call"); + lua_rawget(L, 1); + if (lua_isfunction(L, -1)) { + + lua_insert(L, 1); + lua_call(L, lua_gettop(L)-1, 1); + + return 1; + }; + }; + tolua_error(L,"Attempt to call a non-callable object.",NULL); + return 0; +}; + +static int do_operator (lua_State* L, const char* op) +{ + if (lua_isuserdata(L,1)) + { + /* Try metatables */ + lua_pushvalue(L,1); /* stack: op1 op2 */ + while (lua_getmetatable(L,-1)) + { /* stack: op1 op2 op1 mt */ + lua_remove(L,-2); /* stack: op1 op2 mt */ + lua_pushstring(L,op); /* stack: op1 op2 mt key */ + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + lua_settop(L,3); + } + } + tolua_error(L,"Attempt to perform operation on an invalid operand",NULL); + return 0; +} + +static int class_add_event (lua_State* L) +{ + return do_operator(L,".add"); +} + +static int class_sub_event (lua_State* L) +{ + return do_operator(L,".sub"); +} + +static int class_mul_event (lua_State* L) +{ + return do_operator(L,".mul"); +} + +static int class_div_event (lua_State* L) +{ + return do_operator(L,".div"); +} + +static int class_lt_event (lua_State* L) +{ + return do_operator(L,".lt"); +} + +static int class_le_event (lua_State* L) +{ + return do_operator(L,".le"); +} + +static int class_eq_event (lua_State* L) +{ + /* copying code from do_operator here to return false when no operator is found */ + if (lua_isuserdata(L,1)) + { + /* Try metatables */ + lua_pushvalue(L,1); /* stack: op1 op2 */ + while (lua_getmetatable(L,-1)) + { /* stack: op1 op2 op1 mt */ + lua_remove(L,-2); /* stack: op1 op2 mt */ + lua_pushstring(L,".eq"); /* stack: op1 op2 mt key */ + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + lua_settop(L,3); + } + } + + lua_settop(L, 3); + lua_pushboolean(L, 0); + return 1; +} + +/* +static int class_gc_event (lua_State* L) +{ + void* u = *((void**)lua_touserdata(L,1)); + fprintf(stderr, "collecting: looking at %p\n", u); + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_call(L,1,0); + lua_pushlightuserdata(L,u); + lua_pushnil(L); + lua_rawset(L,-3); + } + lua_pop(L,2); + return 0; +} +*/ +TOLUA_API int class_gc_event (lua_State* L) +{ + void* u = *((void**)lua_touserdata(L,1)); + int top; + /*fprintf(stderr, "collecting: looking at %p\n", u);*/ + /* + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + */ + lua_pushvalue(L, lua_upvalueindex(1)); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); /* stack: gc umt */ + lua_getmetatable(L,1); /* stack: gc umt mt */ + /*fprintf(stderr, "checking type\n");*/ + top = lua_gettop(L); + if (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */ + { + /*fprintf(stderr, "Found type!\n");*/ + /* get gc function */ + lua_pushliteral(L,".collector"); + lua_rawget(L,-2); /* stack: gc umt mt collector */ + if (lua_isfunction(L,-1)) { + /*fprintf(stderr, "Found .collector!\n");*/ + } + else { + lua_pop(L,1); + /*fprintf(stderr, "Using default cleanup\n");*/ + lua_pushcfunction(L,tolua_default_collect); + } + + lua_pushvalue(L,1); /* stack: gc umt mt collector u */ + lua_call(L,1,0); + + lua_pushlightuserdata(L,u); /* stack: gc umt mt u */ + lua_pushnil(L); /* stack: gc umt mt u nil */ + lua_rawset(L,-5); /* stack: gc umt mt */ + } + lua_pop(L,3); + return 0; +} + + +/* Register module events + * It expects the metatable on the top of the stack +*/ +TOLUA_API void tolua_moduleevents (lua_State* L) +{ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,module_index_event); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,module_newindex_event); + lua_rawset(L,-3); +} + +/* Check if the object on the top has a module metatable +*/ +TOLUA_API int tolua_ismodulemetatable (lua_State* L) +{ + int r = 0; + if (lua_getmetatable(L,-1)) + { + lua_pushstring(L,"__index"); + lua_rawget(L,-2); + r = (lua_tocfunction(L,-1) == module_index_event); + lua_pop(L,2); + } + return r; +} + +/* Register class events + * It expects the metatable on the top of the stack +*/ +TOLUA_API void tolua_classevents (lua_State* L) +{ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,class_index_event); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,class_newindex_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__add"); + lua_pushcfunction(L,class_add_event); + lua_rawset(L,-3); + lua_pushstring(L,"__sub"); + lua_pushcfunction(L,class_sub_event); + lua_rawset(L,-3); + lua_pushstring(L,"__mul"); + lua_pushcfunction(L,class_mul_event); + lua_rawset(L,-3); + lua_pushstring(L,"__div"); + lua_pushcfunction(L,class_div_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__lt"); + lua_pushcfunction(L,class_lt_event); + lua_rawset(L,-3); + lua_pushstring(L,"__le"); + lua_pushcfunction(L,class_le_event); + lua_rawset(L,-3); + lua_pushstring(L,"__eq"); + lua_pushcfunction(L,class_eq_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__call"); + lua_pushcfunction(L,class_call_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__gc"); + lua_pushstring(L, "tolua_gc_event"); + lua_rawget(L, LUA_REGISTRYINDEX); + /*lua_pushcfunction(L,class_gc_event);*/ + lua_rawset(L,-3); +} + diff --git a/tolua++-1.0.93/src/lib/tolua_event.h b/tolua++-1.0.93/src/lib/tolua_event.h new file mode 100644 index 000000000..898f33dfc --- /dev/null +++ b/tolua++-1.0.93/src/lib/tolua_event.h @@ -0,0 +1,24 @@ +/* tolua: event functions +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#ifndef TOLUA_EVENT_H +#define TOLUA_EVENT_H + +#include "tolua++.h" + +TOLUA_API void tolua_moduleevents (lua_State* L); +TOLUA_API int tolua_ismodulemetatable (lua_State* L); +TOLUA_API void tolua_classevents (lua_State* L); + +#endif diff --git a/tolua++-1.0.93/src/lib/tolua_is.c b/tolua++-1.0.93/src/lib/tolua_is.c new file mode 100644 index 000000000..add337d19 --- /dev/null +++ b/tolua++-1.0.93/src/lib/tolua_is.c @@ -0,0 +1,621 @@ +/* tolua: functions to check types. +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "lauxlib.h" + +#include <stdlib.h> +#include <string.h> + +/* a fast check if a is b, without parameter validation + i.e. if b is equal to a or a superclass of a. */ +TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index) +{ + int result; + if (lua_rawequal(L,mt_indexa,mt_indexb)) + result = 1; + else + { + if (super_index) { + lua_pushvalue(L, super_index); + } else { + lua_pushliteral(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ + }; + lua_pushvalue(L,mt_indexa); /* stack: super mta */ + lua_rawget(L,-2); /* stack: super super[mta] */ + lua_pushvalue(L,mt_indexb); /* stack: super super[mta] mtb */ + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super super[mta] typenameB */ + lua_rawget(L,-2); /* stack: super super[mta] bool */ + result = lua_toboolean(L,-1); + lua_pop(L,3); + } + return result; +} + +/* Push and returns the corresponding object typename */ +TOLUA_API const char* tolua_typename (lua_State* L, int lo) +{ + int tag = lua_type(L,lo); + if (tag == LUA_TNONE) + lua_pushstring(L,"[no object]"); + else if (tag != LUA_TUSERDATA && tag != LUA_TTABLE) + lua_pushstring(L,lua_typename(L,tag)); + else if (tag == LUA_TUSERDATA) + { + if (!lua_getmetatable(L,lo)) + lua_pushstring(L,lua_typename(L,tag)); + else + { + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isstring(L,-1)) + { + lua_pop(L,1); + lua_pushstring(L,"[undefined]"); + } + } + } + else /* is table */ + { + lua_pushvalue(L,lo); + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isstring(L,-1)) + { + lua_pop(L,1); + lua_pushstring(L,"table"); + } + else + { + lua_pushstring(L,"class "); + lua_insert(L,-2); + lua_concat(L,2); + } + } + return lua_tostring(L,-1); +} + +TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err) +{ + if (msg[0] == '#') + { + const char* expected = err->type; + const char* provided = tolua_typename(L,err->index); + if (msg[1]=='f') + { + int narg = err->index; + if (err->array) + luaL_error(L,"%s\n argument #%d is array of '%s'; array of '%s' expected.\n", + msg+2,narg,provided,expected); + else + luaL_error(L,"%s\n argument #%d is '%s'; '%s' expected.\n", + msg+2,narg,provided,expected); + } + else if (msg[1]=='v') + { + if (err->array) + luaL_error(L,"%s\n value is array of '%s'; array of '%s' expected.\n", + msg+2,provided,expected); + else + luaL_error(L,"%s\n value is '%s'; '%s' expected.\n", + msg+2,provided,expected); + } + } + else + luaL_error(L,msg); +} + +/* the equivalent of lua_is* for usertable */ +static int lua_isusertable (lua_State* L, int lo, const const char* type) +{ + int r = 0; + if (lo < 0) lo = lua_gettop(L)+lo+1; + lua_pushvalue(L,lo); + lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[t] */ + if (lua_isstring(L,-1)) + { + r = strcmp(lua_tostring(L,-1),type)==0; + if (!r) + { + /* try const */ + lua_pushstring(L,"const "); + lua_insert(L,-2); + lua_concat(L,2); + r = lua_isstring(L,-1) && strcmp(lua_tostring(L,-1),type)==0; + } + } + lua_pop(L, 1); + return r; +} + +int push_table_instance(lua_State* L, int lo) { + + if (lua_istable(L, lo)) { + + lua_pushstring(L, ".c_instance"); + lua_gettable(L, lo); + if (lua_isuserdata(L, -1)) { + + lua_replace(L, lo); + return 1; + } else { + + lua_pop(L, 1); + return 0; + }; + } else { + return 0; + }; + + return 0; +}; + +/* the equivalent of lua_is* for usertype */ +static int lua_isusertype (lua_State* L, int lo, const char* type) +{ + if (!lua_isuserdata(L,lo)) { + if (!push_table_instance(L, lo)) { + return 0; + }; + }; + { + /* check if it is of the same type */ + int r; + const char *tn; + if (lua_getmetatable(L,lo)) /* if metatable? */ + { + lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[mt] */ + tn = lua_tostring(L,-1); + r = tn && (strcmp(tn,type) == 0); + lua_pop(L, 1); + if (r) + return 1; + else + { + /* check if it is a specialized class */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* get super */ + lua_getmetatable(L,lo); + lua_rawget(L,-2); /* get super[mt] */ + if (lua_istable(L,-1)) + { + int b; + lua_pushstring(L,type); + lua_rawget(L,-2); /* get super[mt][type] */ + b = lua_toboolean(L,-1); + lua_pop(L,3); + if (b) + return 1; + } + } + } + } + return 0; +} + +TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err) +{ + if (lua_gettop(L)<abs(lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "[no object]"; + return 0; +} + +TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnil(L,lo) || lua_isboolean(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "boolean"; + return 0; +} + +TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnumber(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "number"; + return 0; +} + +TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnil(L,lo) || lua_isstring(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "string"; + return 0; +} + +TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_istable(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "table"; + return 0; +} + +TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isusertable(L,lo,type)) + return 1; + err->index = lo; + err->array = 0; + err->type = type; + return 0; +} + + +TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnil(L,lo) || lua_isuserdata(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "userdata"; + return 0; +} + +TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err) { + + if (lua_gettop(L)<abs(lo)) + return 0; /* somebody else should chack this */ + if (!lua_isnil(L, lo)) + return 0; + + err->index = lo; + err->array = 0; + err->type = "value"; + return 1; +}; + +TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def || abs(lo)<=lua_gettop(L)) /* any valid index */ + return 1; + err->index = lo; + err->array = 0; + err->type = "value"; + return 0; +} + +TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnil(L,lo) || lua_isusertype(L,lo,type)) + return 1; + err->index = lo; + err->array = 0; + err->type = type; + return 0; +} + +TOLUA_API int tolua_isvaluearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + return 1; +} + +TOLUA_API int tolua_isbooleanarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "boolean"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isnumberarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!lua_isnumber(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "number"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isstringarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "string"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_istablearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (! lua_istable(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "table"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isuserdataarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "userdata"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isusertypearray + (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->type = type; + err->array = 1; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +#if 0 +int tolua_isbooleanfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "boolean"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isnumberfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!lua_isnumber(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "number"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isstringfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "string"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_istablefield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i+1); + lua_gettable(L,lo); + if (! lua_istable(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "table"; + return 0; + } + lua_pop(L,1); +} + +int tolua_isusertablefield + (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (! lua_isusertable(L,-1,type) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = type; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isuserdatafield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "userdata"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isusertypefield + (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isusertype(L,-1,type)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->type = type; + err->array = 1; + return 0; + } + lua_pop(L,1); + return 1; +} + +#endif diff --git a/tolua++-1.0.93/src/lib/tolua_map.c b/tolua++-1.0.93/src/lib/tolua_map.c new file mode 100644 index 000000000..d00e7069b --- /dev/null +++ b/tolua++-1.0.93/src/lib/tolua_map.c @@ -0,0 +1,704 @@ +/* tolua: functions to map features +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "tolua_event.h" +#include "lauxlib.h" + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +/* Create metatable + * Create and register new metatable +*/ +static int tolua_newmetatable (lua_State* L, char* name) +{ + int r = luaL_newmetatable(L,name); + + #ifdef LUA_VERSION_NUM /* only lua 5.1 */ + if (r) { + lua_pushvalue(L, -1); + lua_pushstring(L, name); + lua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */ + }; + #endif + + if (r) + tolua_classevents(L); /* set meta events */ + lua_pop(L,1); + return r; +} + +/* Map super classes + * It sets 'name' as being also a 'base', mapping all super classes of 'base' in 'name' +*/ +static void mapsuper (lua_State* L, const char* name, const char* base) +{ + /* push registry.super */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ + luaL_getmetatable(L,name); /* stack: super mt */ + lua_rawget(L,-2); /* stack: super table */ + if (lua_isnil(L,-1)) + { + /* create table */ + lua_pop(L,1); + lua_newtable(L); /* stack: super table */ + luaL_getmetatable(L,name); /* stack: super table mt */ + lua_pushvalue(L,-2); /* stack: super table mt table */ + lua_rawset(L,-4); /* stack: super table */ + } + + /* set base as super class */ + lua_pushstring(L,base); + lua_pushboolean(L,1); + lua_rawset(L,-3); /* stack: super table */ + + /* set all super class of base as super class of name */ + luaL_getmetatable(L,base); /* stack: super table base_mt */ + lua_rawget(L,-3); /* stack: super table base_table */ + if (lua_istable(L,-1)) + { + /* traverse base table */ + lua_pushnil(L); /* first key */ + while (lua_next(L,-2) != 0) + { + /* stack: ... base_table key value */ + lua_pushvalue(L,-2); /* stack: ... base_table key value key */ + lua_insert(L,-2); /* stack: ... base_table key key value */ + lua_rawset(L,-5); /* stack: ... base_table key */ + } + } + lua_pop(L,3); /* stack: <empty> */ +} + +/* creates a 'tolua_ubox' table for base clases, and +// expects the metatable and base metatable on the stack */ +static void set_ubox(lua_State* L) { + + /* mt basemt */ + if (!lua_isnil(L, -1)) { + lua_pushstring(L, "tolua_ubox"); + lua_rawget(L,-2); + } else { + lua_pushnil(L); + }; + /* mt basemt base_ubox */ + if (!lua_isnil(L,-1)) { + lua_pushstring(L, "tolua_ubox"); + lua_insert(L, -2); + /* mt basemt key ubox */ + lua_rawset(L,-4); + /* (mt with ubox) basemt */ + } else { + /* mt basemt nil */ + lua_pop(L, 1); + lua_pushstring(L,"tolua_ubox"); lua_newtable(L); + /* make weak value metatable for ubox table to allow userdata to be + garbage-collected */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ + lua_setmetatable(L, -2); /* stack:mt basemt string ubox */ + lua_rawset(L,-4); + }; + +}; + +/* Map inheritance + * It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name' +*/ +static void mapinheritance (lua_State* L, const char* name, const char* base) +{ + /* set metatable inheritance */ + luaL_getmetatable(L,name); + + if (base && *base) + luaL_getmetatable(L,base); + else { + + if (lua_getmetatable(L, -1)) { /* already has a mt, we don't overwrite it */ + lua_pop(L, 2); + return; + }; + luaL_getmetatable(L,"tolua_commonclass"); + }; + + set_ubox(L); + + lua_setmetatable(L,-2); + lua_pop(L,1); +} + +/* Object type +*/ +static int tolua_bnd_type (lua_State* L) +{ + tolua_typename(L,lua_gettop(L)); + return 1; +} + +/* Take ownership +*/ +static int tolua_bnd_takeownership (lua_State* L) +{ + int success = 0; + if (lua_isuserdata(L,1)) + { + if (lua_getmetatable(L,1)) /* if metatable? */ + { + lua_pop(L,1); /* clear metatable off stack */ + /* force garbage collection to avoid C to reuse a to-be-collected address */ + #ifdef LUA_VERSION_NUM + lua_gc(L, LUA_GCCOLLECT, 0); + #else + lua_setgcthreshold(L,0); + #endif + + success = tolua_register_gc(L,1); + } + } + lua_pushboolean(L,success!=0); + return 1; +} + +/* Release ownership +*/ +static int tolua_bnd_releaseownership (lua_State* L) +{ + int done = 0; + if (lua_isuserdata(L,1)) + { + void* u = *((void**)lua_touserdata(L,1)); + /* force garbage collection to avoid releasing a to-be-collected address */ + #ifdef LUA_VERSION_NUM + lua_gc(L, LUA_GCCOLLECT, 0); + #else + lua_setgcthreshold(L,0); + #endif + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); + lua_getmetatable(L,1); + if (lua_rawequal(L,-1,-2)) /* check that we are releasing the correct type */ + { + lua_pushlightuserdata(L,u); + lua_pushnil(L); + lua_rawset(L,-5); + done = 1; + } + } + lua_pushboolean(L,done!=0); + return 1; +} + +/* Type casting +*/ +static int tolua_bnd_cast (lua_State* L) +{ + +/* // old code + void* v = tolua_tousertype(L,1,NULL); + const char* s = tolua_tostring(L,2,NULL); + if (v && s) + tolua_pushusertype(L,v,s); + else + lua_pushnil(L); + return 1; +*/ + + void* v; + const char* s; + if (lua_islightuserdata(L, 1)) { + v = tolua_touserdata(L, 1, NULL); + } else { + v = tolua_tousertype(L, 1, 0); + }; + + s = tolua_tostring(L,2,NULL); + if (v && s) + tolua_pushusertype(L,v,s); + else + lua_pushnil(L); + return 1; +} + +/* Inheritance +*/ +static int tolua_bnd_inherit (lua_State* L) { + + /* stack: lua object, c object */ + lua_pushstring(L, ".c_instance"); + lua_pushvalue(L, -2); + lua_rawset(L, -4); + /* l_obj[".c_instance"] = c_obj */ + + return 0; +}; + +#ifdef LUA_VERSION_NUM /* lua 5.1 */ +static int tolua_bnd_setpeer(lua_State* L) { + + /* stack: userdata, table */ + if (!lua_isuserdata(L, -2)) { + lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected."); + lua_error(L); + }; + + if (lua_isnil(L, -1)) { + + lua_pop(L, 1); + lua_pushvalue(L, TOLUA_NOPEER); + }; + lua_setfenv(L, -2); + + return 0; +}; + +static int tolua_bnd_getpeer(lua_State* L) { + + /* stack: userdata */ + lua_getfenv(L, -1); + if (lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pop(L, 1); + lua_pushnil(L); + }; + return 1; +}; +#endif + +/* static int class_gc_event (lua_State* L); */ + +TOLUA_API void tolua_open (lua_State* L) +{ + int top = lua_gettop(L); + lua_pushstring(L,"tolua_opened"); + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isboolean(L,-1)) + { + lua_pushstring(L,"tolua_opened"); lua_pushboolean(L,1); lua_rawset(L,LUA_REGISTRYINDEX); + + #ifndef LUA_VERSION_NUM /* only prior to lua 5.1 */ + /* create peer object table */ + lua_pushstring(L, "tolua_peers"); lua_newtable(L); + /* make weak key metatable for peers indexed by userdata object */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "k"); lua_rawset(L, -3); /* stack: string peers mt */ + lua_setmetatable(L, -2); /* stack: string peers */ + lua_rawset(L,LUA_REGISTRYINDEX); + #endif + + /* create object ptr -> udata mapping table */ + lua_pushstring(L,"tolua_ubox"); lua_newtable(L); + /* make weak value metatable for ubox table to allow userdata to be + garbage-collected */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ + lua_setmetatable(L, -2); /* stack: string ubox */ + lua_rawset(L,LUA_REGISTRYINDEX); + + lua_pushstring(L,"tolua_super"); lua_newtable(L); lua_rawset(L,LUA_REGISTRYINDEX); + lua_pushstring(L,"tolua_gc"); lua_newtable(L);lua_rawset(L,LUA_REGISTRYINDEX); + + /* create gc_event closure */ + lua_pushstring(L, "tolua_gc_event"); + lua_pushstring(L, "tolua_gc"); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushstring(L, "tolua_super"); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushcclosure(L, class_gc_event, 2); + lua_rawset(L, LUA_REGISTRYINDEX); + + tolua_newmetatable(L,"tolua_commonclass"); + + tolua_module(L,NULL,0); + tolua_beginmodule(L,NULL); + tolua_module(L,"tolua",0); + tolua_beginmodule(L,"tolua"); + tolua_function(L,"type",tolua_bnd_type); + tolua_function(L,"takeownership",tolua_bnd_takeownership); + tolua_function(L,"releaseownership",tolua_bnd_releaseownership); + tolua_function(L,"cast",tolua_bnd_cast); + tolua_function(L,"inherit", tolua_bnd_inherit); + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + tolua_function(L, "setpeer", tolua_bnd_setpeer); + tolua_function(L, "getpeer", tolua_bnd_getpeer); + #endif + + tolua_endmodule(L); + tolua_endmodule(L); + } + lua_settop(L,top); +} + +/* Copy a C object +*/ +TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size) +{ + void* clone = (void*)malloc(size); + if (clone) + memcpy(clone,value,size); + else + tolua_error(L,"insuficient memory",NULL); + return clone; +} + +/* Default collect function +*/ +TOLUA_API int tolua_default_collect (lua_State* tolua_S) +{ + void* self = tolua_tousertype(tolua_S,1,0); + free(self); + return 0; +} + +/* Do clone +*/ +TOLUA_API int tolua_register_gc (lua_State* L, int lo) +{ + int success = 1; + void *value = *(void **)lua_touserdata(L,lo); + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,value); + lua_rawget(L,-2); + if (!lua_isnil(L,-1)) /* make sure that object is not already owned */ + success = 0; + else + { + lua_pushlightuserdata(L,value); + lua_getmetatable(L,lo); + lua_rawset(L,-4); + } + lua_pop(L,2); + return success; +} + +/* Register a usertype + * It creates the correspoding metatable in the registry, for both 'type' and 'const type'. + * It maps 'const type' as being also a 'type' +*/ +TOLUA_API void tolua_usertype (lua_State* L, const char* type) +{ + char ctype[128] = "const "; + strncat(ctype,type,120); + + /* create both metatables */ + if (tolua_newmetatable(L,ctype) && tolua_newmetatable(L,type)) + mapsuper(L,type,ctype); /* 'type' is also a 'const type' */ +} + + +/* Begin module + * It pushes the module (or class) table on the stack +*/ +TOLUA_API void tolua_beginmodule (lua_State* L, const char* name) +{ + if (name) + { + lua_pushstring(L,name); + lua_rawget(L,-2); + } + else + lua_pushvalue(L,LUA_GLOBALSINDEX); +} + +/* End module + * It pops the module (or class) from the stack +*/ +TOLUA_API void tolua_endmodule (lua_State* L) +{ + lua_pop(L,1); +} + +/* Map module + * It creates a new module +*/ +#if 1 +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) +{ + if (name) + { + /* tolua module */ + lua_pushstring(L,name); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) /* check if module already exists */ + { + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,name); + lua_pushvalue(L,-2); + lua_rawset(L,-4); /* assing module into module */ + } + } + else + { + /* global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + } + if (hasvar) + { + if (!tolua_ismodulemetatable(L)) /* check if it already has a module metatable */ + { + /* create metatable to get/set C/C++ variable */ + lua_newtable(L); + tolua_moduleevents(L); + if (lua_getmetatable(L,-2)) + lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ + lua_setmetatable(L,-2); + } + } + lua_pop(L,1); /* pop module */ +} +#else +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) +{ + if (name) + { + /* tolua module */ + lua_pushstring(L,name); + lua_newtable(L); + } + else + { + /* global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + } + if (hasvar) + { + /* create metatable to get/set C/C++ variable */ + lua_newtable(L); + tolua_moduleevents(L); + if (lua_getmetatable(L,-2)) + lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ + lua_setmetatable(L,-2); + } + if (name) + lua_rawset(L,-3); /* assing module into module */ + else + lua_pop(L,1); /* pop global table */ +} +#endif + +static void push_collector(lua_State* L, const char* type, lua_CFunction col) { + + /* push collector function, but only if it's not NULL, or if there's no + collector already */ + if (!col) return; + luaL_getmetatable(L,type); + lua_pushstring(L,".collector"); + /* + if (!col) { + lua_pushvalue(L, -1); + lua_rawget(L, -3); + if (!lua_isnil(L, -1)) { + lua_pop(L, 3); + return; + }; + lua_pop(L, 1); + }; + // */ + lua_pushcfunction(L,col); + + lua_rawset(L,-3); + lua_pop(L, 1); +}; + +/* Map C class + * It maps a C class, setting the appropriate inheritance and super classes. +*/ +TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col) +{ + char cname[128] = "const "; + char cbase[128] = "const "; + strncat(cname,name,120); + strncat(cbase,base,120); + + mapinheritance(L,name,base); + mapinheritance(L,cname,name); + + mapsuper(L,cname,cbase); + mapsuper(L,name,base); + + lua_pushstring(L,lname); + + push_collector(L, name, col); + /* + luaL_getmetatable(L,name); + lua_pushstring(L,".collector"); + lua_pushcfunction(L,col); + + lua_rawset(L,-3); + */ + + luaL_getmetatable(L,name); + lua_rawset(L,-3); /* assign class metatable to module */ + + /* now we also need to store the collector table for the const + instances of the class */ + push_collector(L, cname, col); + /* + luaL_getmetatable(L,cname); + lua_pushstring(L,".collector"); + lua_pushcfunction(L,col); + lua_rawset(L,-3); + lua_pop(L,1); + */ + + +} + +/* Add base + * It adds additional base classes to a class (for multiple inheritance) + * (not for now) +TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) { + + char cname[128] = "const "; + char cbase[128] = "const "; + strncat(cname,name,120); + strncat(cbase,base,120); + + mapsuper(L,cname,cbase); + mapsuper(L,name,base); +}; +*/ + +/* Map function + * It assigns a function into the current module (or class) +*/ +TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func) +{ + lua_pushstring(L,name); + lua_pushcfunction(L,func); + lua_rawset(L,-3); +} + +/* sets the __call event for the class (expects the class' main table on top) */ +/* never really worked :( +TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type) { + + lua_getmetatable(L, -1); + //luaL_getmetatable(L, type); + lua_pushstring(L,"__call"); + lua_pushcfunction(L,func); + lua_rawset(L,-3); + lua_pop(L, 1); +}; +*/ + +/* Map constant number + * It assigns a constant number into the current module (or class) +*/ +TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value) +{ + lua_pushstring(L,name); + tolua_pushnumber(L,value); + lua_rawset(L,-3); +} + + +/* Map variable + * It assigns a variable into the current module (or class) +*/ +TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) +{ + /* get func */ + lua_pushstring(L,".get"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .get table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".get"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + lua_pushcfunction(L,get); + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .get table */ + + /* set func */ + if (set) + { + lua_pushstring(L,".set"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .set table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".set"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + lua_pushcfunction(L,set); + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .set table */ + } +} + +/* Access const array + * It reports an error when trying to write into a const array +*/ +static int const_array (lua_State* L) +{ + luaL_error(L,"value of const array cannot be changed"); + return 0; +} + +/* Map an array + * It assigns an array into the current module (or class) +*/ +TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) +{ + lua_pushstring(L,".get"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .get table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".get"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + + lua_newtable(L); /* create array metatable */ + lua_pushvalue(L,-1); + lua_setmetatable(L,-2); /* set the own table as metatable (for modules) */ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,get); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,set?set:const_array); + lua_rawset(L,-3); + + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .get table */ +} + + +TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name) { + + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + luaL_loadbuffer(L, B, size, name) || lua_pcall(L, 0, 0, 0); + #else + lua_dobuffer(L, B, size, name); + #endif +}; + diff --git a/tolua++-1.0.93/src/lib/tolua_push.c b/tolua++-1.0.93/src/lib/tolua_push.c new file mode 100644 index 000000000..639414755 --- /dev/null +++ b/tolua++-1.0.93/src/lib/tolua_push.c @@ -0,0 +1,171 @@ +/* tolua: functions to push C values. +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "lauxlib.h" + +#include <stdlib.h> + +TOLUA_API void tolua_pushvalue (lua_State* L, int lo) +{ + lua_pushvalue(L,lo); +} + +TOLUA_API void tolua_pushboolean (lua_State* L, int value) +{ + lua_pushboolean(L,value); +} + +TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value) +{ + lua_pushnumber(L,value); +} + +TOLUA_API void tolua_pushstring (lua_State* L, const char* value) +{ + if (value == NULL) + lua_pushnil(L); + else + lua_pushstring(L,value); +} + +TOLUA_API void tolua_pushuserdata (lua_State* L, void* value) +{ + if (value == NULL) + lua_pushnil(L); + else + lua_pushlightuserdata(L,value); +} + +TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type) +{ + if (value == NULL) + lua_pushnil(L); + else + { + luaL_getmetatable(L, type); + lua_pushstring(L,"tolua_ubox"); + lua_rawget(L,-2); /* stack: mt ubox */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); + lua_pushstring(L, "tolua_ubox"); + lua_rawget(L, LUA_REGISTRYINDEX); + }; + lua_pushlightuserdata(L,value); + lua_rawget(L,-2); /* stack: mt ubox ubox[u] */ + if (lua_isnil(L,-1)) + { + lua_pop(L,1); /* stack: mt ubox */ + lua_pushlightuserdata(L,value); + *(void**)lua_newuserdata(L,sizeof(void *)) = value; /* stack: mt ubox u newud */ + lua_pushvalue(L,-1); /* stack: mt ubox u newud newud */ + lua_insert(L,-4); /* stack: mt newud ubox u newud */ + lua_rawset(L,-3); /* stack: mt newud ubox */ + lua_pop(L,1); /* stack: mt newud */ + /*luaL_getmetatable(L,type);*/ + lua_pushvalue(L, -2); /* stack: mt newud mt */ + lua_setmetatable(L,-2); /* stack: mt newud */ + + #ifdef LUA_VERSION_NUM + lua_pushvalue(L, TOLUA_NOPEER); + lua_setfenv(L, -2); + #endif + } + else + { + /* check the need of updating the metatable to a more specialized class */ + lua_insert(L,-2); /* stack: mt ubox[u] ubox */ + lua_pop(L,1); /* stack: mt ubox[u] */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: mt ubox[u] super */ + lua_getmetatable(L,-2); /* stack: mt ubox[u] super mt */ + lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] */ + if (lua_istable(L,-1)) + { + lua_pushstring(L,type); /* stack: mt ubox[u] super super[mt] type */ + lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] flag */ + if (lua_toboolean(L,-1) == 1) /* if true */ + { + lua_pop(L,3); /* mt ubox[u]*/ + lua_remove(L, -2); + return; + } + } + /* type represents a more specilized type */ + /*luaL_getmetatable(L,type); // stack: mt ubox[u] super super[mt] flag mt */ + lua_pushvalue(L, -5); /* stack: mt ubox[u] super super[mt] flag mt */ + lua_setmetatable(L,-5); /* stack: mt ubox[u] super super[mt] flag */ + lua_pop(L,3); /* stack: mt ubox[u] */ + } + lua_remove(L, -2); /* stack: ubox[u]*/ + } +} + +TOLUA_API void tolua_pushusertype_and_takeownership (lua_State* L, void* value, const char* type) +{ + tolua_pushusertype(L,value,type); + tolua_register_gc(L,lua_gettop(L)); +} + +TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v) +{ + lua_pushnumber(L,index); + lua_pushvalue(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v) +{ + lua_pushnumber(L,index); + lua_pushboolean(L,v); + lua_settable(L,lo); +} + + +TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v) +{ + lua_pushnumber(L,index); + tolua_pushnumber(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v) +{ + lua_pushnumber(L,index); + tolua_pushstring(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v) +{ + lua_pushnumber(L,index); + tolua_pushuserdata(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type) +{ + lua_pushnumber(L,index); + tolua_pushusertype(L,v,type); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type) +{ + lua_pushnumber(L,index); + tolua_pushusertype(L,v,type); + tolua_register_gc(L,lua_gettop(L)); + lua_settable(L,lo); +} + diff --git a/tolua++-1.0.93/src/lib/tolua_to.c b/tolua++-1.0.93/src/lib/tolua_to.c new file mode 100644 index 000000000..542ca67d1 --- /dev/null +++ b/tolua++-1.0.93/src/lib/tolua_to.c @@ -0,0 +1,133 @@ +/* tolua: funcitons to convert to C types +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" + +#include <string.h> +#include <stdlib.h> + +TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def) +{ + return lua_gettop(L)<abs(narg) ? def : lua_tonumber(L,narg); +} + +TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def) +{ + return lua_gettop(L)<abs(narg) ? def : lua_tostring(L,narg); +} + +TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def) +{ + + /* return lua_gettop(L)<abs(narg) ? def : lua_touserdata(L,narg); */ + + if (lua_gettop(L)<abs(narg)) { + return def; + }; + + if (lua_islightuserdata(L, narg)) { + + return lua_touserdata(L,narg); + }; + + return tolua_tousertype(L, narg, def); +} + +extern int push_table_instance(lua_State* L, int lo); + +TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def) +{ + if (lua_gettop(L)<abs(narg)) + return def; + else + { + void* u; + if (!lua_isuserdata(L, narg)) { + if (!push_table_instance(L, narg)) return NULL; + }; + u = lua_touserdata(L,narg); + return (u==NULL) ? NULL : *((void**)u); /* nil represents NULL */ + } +} + +TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def) +{ + return lua_gettop(L)<abs(narg) ? def : narg; +} + +TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def) +{ + return lua_gettop(L)<abs(narg) ? def : lua_toboolean(L,narg); +} + +TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def) +{ + double v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : lua_tonumber(L,-1); + lua_pop(L,1); + return v; +} + +TOLUA_API const char* tolua_tofieldstring +(lua_State* L, int lo, int index, const char* def) +{ + const char* v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : lua_tostring(L,-1); + lua_pop(L,1); + return v; +} + +TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def) +{ + void* v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : lua_touserdata(L,-1); + lua_pop(L,1); + return v; +} + +TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def) +{ + void* v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : (*(void **)(lua_touserdata(L, -1))); /* lua_unboxpointer(L,-1); */ + lua_pop(L,1); + return v; +} + +TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def) +{ + int v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : lo; + lua_pop(L,1); + return v; +} + +TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def) +{ + int v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? 0 : lua_toboolean(L,-1); + lua_pop(L,1); + return v; +} diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcproj b/tolua++-1.0.93/win32/tolualib/tolualib.vcproj new file mode 100644 index 000000000..d7118af0e --- /dev/null +++ b/tolua++-1.0.93/win32/tolualib/tolualib.vcproj @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="tolualib"
+ ProjectGUID="{9DDCB327-0D20-460F-A7F8-DE038163CD63}"
+ RootNamespace="tolualib"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="../../include;"C:\Program Files (x86)\Lua\5.1\include""
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="lua51.lib"
+ AdditionalLibraryDirectories="C:\Program Files (x86)\Lua\5.1\lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\src\lib\tolua_event.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_is.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_map.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_push.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_to.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\src\lib\tolua_event.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user b/tolua++-1.0.93/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user new file mode 100644 index 000000000..82b07e6b1 --- /dev/null +++ b/tolua++-1.0.93/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="9,00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="LAPTOPF"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="LAPTOPF"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj b/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj new file mode 100644 index 000000000..17730685e --- /dev/null +++ b/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{AB745E71-04B2-454F-A806-A0D553DAE08C}</ProjectGuid>
+ <RootNamespace>tolualib</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetName>tolua++</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>../../include;C:\Program Files (x86)\Lua\5.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalLibraryDirectories>C:\Program Files (x86)\Lua\5.1\lib</AdditionalLibraryDirectories>
+ <AdditionalDependencies>lua51.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\lib\tolua_event.c" />
+ <ClCompile Include="..\..\src\lib\tolua_is.c" />
+ <ClCompile Include="..\..\src\lib\tolua_map.c" />
+ <ClCompile Include="..\..\src\lib\tolua_push.c" />
+ <ClCompile Include="..\..\src\lib\tolua_to.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\lib\tolua_event.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.filters b/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.filters new file mode 100644 index 000000000..899d07e76 --- /dev/null +++ b/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.filters @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\lib\tolua_event.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_is.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_map.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_push.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_to.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\lib\tolua_event.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.user b/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.user new file mode 100644 index 000000000..695b5c78b --- /dev/null +++ b/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.user @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project>
\ No newline at end of file diff --git a/tolua++-1.0.93/win32/vc7/clean.bat b/tolua++-1.0.93/win32/vc7/clean.bat new file mode 100644 index 000000000..96beb28a5 --- /dev/null +++ b/tolua++-1.0.93/win32/vc7/clean.bat @@ -0,0 +1,15 @@ +del *.ncb
+del *.ilk
+del *.lib
+del *.exp
+del *.map
+del *.pdb
+del *.bsc
+del applog.txt
+del tmpl83.00c.vcproj.LAPTOPF.Kevin.user
+del *.suo /AH
+del debug\*.* /Q
+del release\*.* /Q
+rd release /Q
+rd debug /Q
+
diff --git a/tolua++-1.0.93/win32/vc7/toluapp.sln b/tolua++-1.0.93/win32/vc7/toluapp.sln new file mode 100644 index 000000000..2ef8458ca --- /dev/null +++ b/tolua++-1.0.93/win32/vc7/toluapp.sln @@ -0,0 +1,45 @@ +Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "toluapp", "toluapp.vcproj", "{71891C1A-E328-4258-AC3F-6F9698C6D8B4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tolualib", "..\tolualib\tolualib.vcproj", "{9DDCB327-0D20-460F-A7F8-DE038163CD63}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ withLua50_Debug|Win32 = withLua50_Debug|Win32
+ withLua50_Release|Win32 = withLua50_Release|Win32
+ withLua51_Debug|Win32 = withLua51_Debug|Win32
+ withLua51_Release|Win32 = withLua51_Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.Debug|Win32.ActiveCfg = withLua51_Debug|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.Debug|Win32.Build.0 = withLua51_Debug|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.Release|Win32.ActiveCfg = withLua51_Release|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.Release|Win32.Build.0 = withLua51_Release|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua50_Debug|Win32.ActiveCfg = withLua51_Release|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua50_Debug|Win32.Build.0 = withLua51_Release|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua50_Release|Win32.ActiveCfg = withLua50_Release|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua50_Release|Win32.Build.0 = withLua50_Release|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua51_Debug|Win32.ActiveCfg = withLua51_Debug|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua51_Debug|Win32.Build.0 = withLua51_Debug|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua51_Release|Win32.ActiveCfg = withLua51_Release|Win32
+ {71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua51_Release|Win32.Build.0 = withLua51_Release|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.Debug|Win32.Build.0 = Debug|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.Release|Win32.ActiveCfg = Release|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.Release|Win32.Build.0 = Release|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.withLua50_Debug|Win32.ActiveCfg = Debug|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.withLua50_Debug|Win32.Build.0 = Debug|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.withLua50_Release|Win32.ActiveCfg = Release|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.withLua50_Release|Win32.Build.0 = Release|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.withLua51_Debug|Win32.ActiveCfg = Debug|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.withLua51_Debug|Win32.Build.0 = Debug|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.withLua51_Release|Win32.ActiveCfg = Release|Win32
+ {9DDCB327-0D20-460F-A7F8-DE038163CD63}.withLua51_Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcproj b/tolua++-1.0.93/win32/vc7/toluapp.vcproj new file mode 100644 index 000000000..59916924d --- /dev/null +++ b/tolua++-1.0.93/win32/vc7/toluapp.vcproj @@ -0,0 +1,391 @@ +<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="toluapp"
+ ProjectGUID="{71891C1A-E328-4258-AC3F-6F9698C6D8B4}"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="withLua50_Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""..\..\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="lua50.lib"
+ OutputFile="..\..\bin\tolua++_d.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/tolua++.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="withLua50_Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""..\..\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="lua50.lib"
+ OutputFile="..\..\bin\tolua++.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\..\lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="withLua51_Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""..\..\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Lua5.1.lib"
+ OutputFile="..\..\bin\tolua++_d.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/tolua++.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="withLua51_Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include;"C:\Program Files (x86)\Lua\5.1\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="lua5.1.lib"
+ OutputFile="..\..\bin\tolua++.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\..\lib;"C:\Program Files (x86)\Lua\5.1\lib""
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="ƒ\[ƒX ƒtƒ@ƒCƒ‹"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\src\bin\tolua.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_event.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_event.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_is.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_map.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_push.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\lib\tolua_to.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\bin\toluabind.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="ƒwƒbƒ_[ ƒtƒ@ƒCƒ‹"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="ƒŠƒ\[ƒX ƒtƒ@ƒCƒ‹"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user b/tolua++-1.0.93/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user new file mode 100644 index 000000000..46f7034c2 --- /dev/null +++ b/tolua++-1.0.93/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="9,00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="withLua50_Debug|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="LAPTOPF"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="withLua50_Release|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="LAPTOPF"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="withLua51_Debug|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="LAPTOPF"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="withLua51_Release|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="LAPTOPF"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj b/tolua++-1.0.93/win32/vc7/toluapp.vcxproj new file mode 100644 index 000000000..967da40b3 --- /dev/null +++ b/tolua++-1.0.93/win32/vc7/toluapp.vcxproj @@ -0,0 +1,176 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="withLua50_Debug|Win32">
+ <Configuration>withLua50_Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="withLua50_Release|Win32">
+ <Configuration>withLua50_Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="withLua51_Debug|Win32">
+ <Configuration>withLua51_Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="withLua51_Release|Win32">
+ <Configuration>withLua51_Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{71891C1A-E328-4258-AC3F-6F9698C6D8B4}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='withLua51_Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='withLua51_Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='withLua50_Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='withLua50_Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='withLua51_Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='withLua51_Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='withLua50_Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='withLua50_Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='withLua50_Debug|Win32'">Debug\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='withLua50_Debug|Win32'">Debug\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='withLua50_Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='withLua50_Release|Win32'">Release\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='withLua50_Release|Win32'">Release\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='withLua50_Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='withLua51_Debug|Win32'">$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='withLua51_Debug|Win32'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='withLua51_Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='withLua51_Release|Win32'">$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='withLua51_Release|Win32'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='withLua51_Release|Win32'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='withLua50_Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>lua50.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>..\..\bin\tolua++_d.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>$(OutDir)tolua++.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='withLua50_Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>lua50.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>..\..\bin\tolua++.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='withLua51_Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>Lua5.1.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>..\..\bin\tolua++_d.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>$(OutDir)tolua++.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='withLua51_Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;C:\Program Files (x86)\Lua\5.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>lua5.1.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>..\..\bin\tolua++.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib;C:\Program Files (x86)\Lua\5.1\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\bin\tolua.c" />
+ <ClCompile Include="..\..\src\lib\tolua_event.c" />
+ <ClCompile Include="..\..\src\lib\tolua_is.c" />
+ <ClCompile Include="..\..\src\lib\tolua_map.c" />
+ <ClCompile Include="..\..\src\lib\tolua_push.c" />
+ <ClCompile Include="..\..\src\lib\tolua_to.c" />
+ <ClCompile Include="..\..\src\bin\toluabind.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\lib\tolua_event.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.filters b/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.filters new file mode 100644 index 000000000..b204b932e --- /dev/null +++ b/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.filters @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="ソース ファイル">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="ヘッダー ファイル">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="リソース ファイル">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\bin\tolua.c">
+ <Filter>ソース ファイル</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_event.c">
+ <Filter>ソース ファイル</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_is.c">
+ <Filter>ソース ファイル</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_map.c">
+ <Filter>ソース ファイル</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_push.c">
+ <Filter>ソース ファイル</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lib\tolua_to.c">
+ <Filter>ソース ファイル</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\bin\toluabind.c">
+ <Filter>ソース ファイル</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\lib\tolua_event.h">
+ <Filter>ソース ファイル</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.user b/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.user new file mode 100644 index 000000000..695b5c78b --- /dev/null +++ b/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.user @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project>
\ No newline at end of file diff --git a/webadmin/template.html b/webadmin/template.html new file mode 100644 index 000000000..8e0fb21de --- /dev/null +++ b/webadmin/template.html @@ -0,0 +1,359 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="icon" href="data:application/octet-stream;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQQAAAAAAgIDBRghJ5o5TlumCg0QCQAAAAABAgIEAAEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAgAAAAMAAAAACQwPMxsnL88jMz3/S2d6/0xoetcaIig6AAAAAAEBAQMBAQEDAAAAAAAAAAAAAAAAAQEBAwAAAAAEAwMEFhwhgRomMPwfLTj/IC86/DJHWPxKaH3/TGN0/jk+QYgEBgcFAAAAAAEBAgMAAAAAAAAAAgAAAAAKDRAuHSMpzB8rNP8dKTP8FiIp/QkXGv8sSEr/QV1u/UhnefxWdIb/P1dm0BIYHDEAAAAAAAEBAgAAAAARGB1oIC44/R0rNf8PGiL7DxUa/gwdHv8JKSP/HUdC/x9HQf81W17+Qllv+0lkef9ObYH+Ii42bAAAAAAAAAAAFyIqyBopMf8THSX6BRkY/wIbGP8HHhv/FTs1/yJhVP8lZ1b/H05I/xcuNf8jPET6UWp+/0xqfdAAAAAAAQECBxEcI9oOHh//BRgV/QwsJv8NKyb/EDEr/xU3Mv8zeW7/MHpr/ydqXP8oalz/HVtO/i9KUf9AW2zgBwkLDQEEBBgKGhfuCCMd/w4uKf4RNC7/FTcy/w8yLv8PMi7/LXFn/y55av86gW//OoV7/y11av4YTkj/GkFB8gUICh4BCActCSUf+xAxKv8TNjD/EzYx/w8xLP8PMCr/Fjgy/zp+c/8yfXP/OoN5/zN9cf86hHb/NHlt/y1xZP4LGhc0BhEORQ8zLP8SNC7+EDIt/xEzLf8PMCv/DTAs/w4xKv8vdWT/PYh4/y93bf8sdWj/N4R3/zWBdv43hHn/EysoTQgXFWEQMy//DzEs/Q8xK/8SNC3/FjUv/xEuK/8WPjf/OIBw/0OEdP83e27/N31w/zN8bP8vdWj8Mn5z/xg3MmgLHRp8FDkz/xExLPwNKyT/EjIs/xpEPP8kX1T/OY2C/0KVhv8zgG//NH9z/zuBdf8xeGX/PIF1/DSAdf8cRDyEDCMenBEvJ/8VODT4IVZM/C11af06inv/QZaG/z2Rgf84iXz/O5F+/z2Nff85iX3+OYJ2/DuBdPg5g3X/IVBIohIzLaUydGb/RJiJ/TyYiv88k4P/O4t6/j+Rg/w+j3/9PYt5/TyOgfwuhHf+Nox+/zyViP9Aloj9Q5WC/yxiVa0ECgkHEyciLh1BOWwsZV2sN39y4juNfv5Cmon/O5OF/z2Shf86kYT/NoyA/ziGeeUqZlywHEI8chAjHzQDBwUKAAAAAAAAAAAAAAAAAAAAAAQIBwsSKCQ9JU9GgDN2a8owdGjLH0xFghMpJUAFDAsNAAAAAAAAAAAAAAAAAAAAAP5/AAD8PwAA8A8AAOAHAADAAwAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAAAAAAAAAAAAAAA4AcAAPw/AAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBBAAAAAEAAAAAGB4leTRGUpAICQsDAAAAAAECAgQAAAEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAgABAQQAAAAADA4RHRsjK7UaJi7/U3SH/1Z1isgbJCosAAAAAAEBAgMBAQECAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQMAAAABAAAAABgeJGEkMz3wHSw1/yExOvxLaHn8TWuA/2SJovkzRVB1AAAAAAAAAAACAgIEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQIBAQEEAAAAAAoLDhkcJS2xHy03/xkmL/0fLjb8IC85/0FabP9IZHX8O1Jj/GCFnP9KZHTBEhccIwAAAAABAQIEAQEBAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEDAAAAAgAAAAAXHSJZICw27BQeJv8aJzD7JTZC/iQ1P/8nOUX/JzpJ/0hjdf9FX3H+V3iO+01tgv9Wanj0R0dHZwAAAAAAAAABAQICAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQEBBAAAAAAMDAwUJCouqSAwOv8XIir9Exwj/CM0P/8eLDf/IzM+/xclLv8oPlD/NUla/0Vhc/9EXnH/OU5f/DxPX/xudHn/Ulxjtg8WGxsAAAAAAQICBAEBAQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAwAAAAIAAAAAFhofUTI0NugdJSv/Gicw+yQ0P/0YJC7/GCQt/xEbJP8QGSD/CxUb/yhMTf9AWmz/PVds/z5Xaf8+VWf/Q15x/jtTZPtJX3D/VneK7iUxOlsAAAAAAAAAAgECAgMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAACAkLER4oMKIdKTL/GCEn/RQfJ/weLDb/Gigy/x0lLP8aJS7/DiAj/wgOE/8HFRn/Gks8/0BNS/8xUFv/VXyS/0ZseP9Ye5D/XH+U/0Zhc/xFX3L9SGN2/ztPXqkPFBYUAAAAAAEBAQIAAAAAAAAAAAAAAAAAAAABAAAAABUbIUoqOkbjHy43/xIcJPseLTb9Gicv/xQgKP8NEhn/ISIk/xYkKv8MKyP/Bh0b/wYiHf8RQzz/JTE2/yNYT/8tTVX/KVRM/1N5if9dgJj/RmBy/0pmev1KZXn7Qltt/1NxhOcgKjJOAAAAAAAAAAEAAAAAAQEBBAAAAAATGiBhIjE8/xwrNPwXIyv8His1/yMzPf8OFh7/BgwS/wQSEv8IDxT/CxQa/wUfG/8HJyL/ES0m/ylrYv8YPD//E0I2/xg8Mv8UQTP/LklT/zJHWf80Slv/Ql1x/1yAmP8/VWf8Smd7/E5rgP8fKTFuAAAAAAEBAQQAAQEEAAAAABYhJ5QaJy//FSAo+RglLv8iMz3/Ex8o/wUOEv8GIR3/BB8a/wQYFv8EEBL/Ax4a/wsqJv8VODL/JGhY/xhXTP8kWUv/KWNT/ypuWf8aMDX/HCU0/yEwPv8iMD7/M0dY/0FdcP9egpr6W36T/zlQXacAAAAAAQEBBAAAAAMAAAAAFR8mrR0rNP8YJCz8Fykt/xYiKv8FCRD/BRkY/wglIf8FHhr/AxsY/wYhHf8PKyb/FTo2/xU7N/8ralj/IGRY/ydpV/8wdWr/JW1g/xw9P/8dSkn/FjQ0/xQ/O/8aMDf/TVhi/0ljdvxYe5D/R2NyvgAAAAAAAAACAAAAAQAAAAANFRzGEh0m/x0uN/wKHRn/Bg4T/wMUEv8JJyH/Dy0p/wYjH/8IJB//Gjsz/xQyK/8TNDD/DjMu/z96a/8veG3/J3Fg/zd8b/8oa1//FExD/yhjVv8aWEb/ImRa/xhXTv86SUz/QlNl/Uhmff9bfpPWAAAAAAAAAAAAAAAAAQIDAxEaI9wSIyj/CBYW/QYWE/8HGRr/CSsi/wosI/8RMSz/ES4o/wwtKP8QMy7/Cisn/w8uKv8YNzD/Pod9/zB/df82e3L/Mnho/yduWP8ueW3/N3Zq/ypyZf8nbV3/IFxT/xE4Of8zT1z+Mldc/ztRY+kHCwwNAAAAAAAAAAABBQUSER0d7wwcGP8IIxv+CSId/wsgHP8QMiz/EjYx/w4vKv8XODP/EjIu/w4yLv8KLir/Cywn/w8wKv8qcWj/MH50/ylzYf8ve2j/JnFb/zh+bf8+hHr/LXhu/zJ+bf8wcGf/E09G/x4/Qv4jVEz/IS8++QcKDR0AAAAAAAAAAAEIBiUGFBP+BxgU/wsrJP4HJSD/ES8q/w4xLv8OMi7/FjUu/xM3Mv8XOzf/FDg0/xEzL/8TODT/Cy4q/yRlW/83e3H/KG9g/zSEeP9AhXj/P35u/0GMgf8wf3b/NoR8/yxzaP8hXVT/ED88/xdQSP4gVFL/Bg4QMgAAAAAAAAAAAwsKOgUdGv8NJyH9Dy8p/w8xKf8WOjb/DDEs/xI2MP8UNzD/DTAo/xM2MP8MLib/FTUx/xU1MP8OMy7/PXdo/0KLgP8udW3/JnJo/zyFef9Ai4H/PYd+/y54a/8mcmn/O3xv/zR1aP8obmD/I2JY/CFmWf8LIBpJAAAAAAAAAAAGFBFSCSsk/wssJPwMLib/EjEo/xU3Mv8OMij/HEA4/w4zMP8OMSz/EDAq/wktJ/8NMCv/FDEp/xU3Mf89gnj/PYyA/zyDef8udWv/N4Z8/zB8cv8zd27/LnZj/0GOev9FjYD/OoR7/zuEdv8+gHD7O4Z6/xo2L2IAAAAAAAAAAAcYE20MMCn/EDEr+w4vJv8WODP/EzMv/w8yLP8TODT/DS8q/xAwKv8IKyf/DC8s/w8wK/8MLST/FTQt/zaBdv8pd2P/P4t2/zaEef85e27/Nnpt/y11bP8xeW//QJCD/zyMgf8we2n/N4N6/yduZPtBkYj/Ik5JfAAAAAAAAAAADyMfiBA0Lv8PMiz7GDk1/xAxLf8RMS3/DzIt/xAyLP8PMCf/FzQu/w4vKf8OMC3/EzQv/wgsJ/8JLCf/ImlT/zV3Zf9IkHv/OYh7/yNuaP80e2//KXJp/yNtXf82gnb/MH10/yp3av9AjoX/MH10+zB7cP8eT0mWAAAAAAAAAAARLCiiDjMu/wotJvsTODT/DC8r/wkqJf8PMCj/EDIr/w0yKv8ZOzb/FjUv/xQ2M/8TOjb/DS8r/xk8NP8ocGL/QIV0/0WBcf9Cf3D/Mnhu/zd6bv84e27/KXRk/zh7bP8tdmX/M3lt/zR6bP8veWj8MHxx/y1dUq8AAAAAAAAAAAsnJLsRMi7/DC4q/BU0Lv8OMSz/DS4p/xg4Mv8SNi//ETAq/xs/N/8aPTX/ETEs/xQvKv8YMyv/H05F/yZya/9Km4j/SI+A/zp6a/9Cf23/RYh7/zuGe/86e2v/RYuA/y57af86e2r/J29l/ypyZ/w+jIL/KWVbxwAAAAAAAAAADysn0Rc6Nf8PMS39DS8q/xUzLf8QMiz/DS8l/xEyKv8UNC//EzEs/xAtI/8QMyv/H1FN/zeBeP9CnI//Q5SF/0aRff87h3f/LXVl/yJsWv8xe3T/Q4l+/zh5Zf8reWT/Lnlm/zqHef84fHD/Im9p/Th/dP8pa2HcAAYGBwQIBw4TMy3kFjsy/xI1L/4PMSz/GTo1/xIyKv8KKyL/EzAq/xA0MP8ZQjr/JF1T/zp/cP8xiHb/LIh6/0egkf9Gn5D/NYZ2/ziGcv8whXr/NYuA/zN9dP9Ahnz/Mn91/yNrWP85emb/QYJ3/0SLe/8vd2/+NXpq/zF2ZuwHEREXBxAPIRI3MPQVNSv/GTcw/hY0Lv8UNDH/Cysn/xQ2MP8oX1f/KnFn/0ONf/8yinz/MIh9/z6JeP85in//No+H/yyBdv82iX7/QZOE/yt/aP87jnn/R417/zaFef89kIP/M3dq/0OHev84gXf/R5KA/0KJfv4yf3P/NXhn+hEeGysDDww3EjQr/hcyLP8JJx//Ciwp/yJQSv8ybmD/MYJv/zmUiP8ug3X/QIp8/zyOfP9ElYX/T5yN/0KWhf88i3f/PYh4/ziHfP9El4X/P5aC/zaMf/9Ek4b/M4R2/z2ThP85iX7/Qop9/y+BeP83emz/NHlm/zeCef4mcmn/CyAcQgQTEVQVOTH/GT85/CRYTfstdWr8QJWL/j+Thv8thHT/N4l7/zaIdP85hnL/PI58/zmOfv8+lIb/RZF+/0COe/9AkH7/Qot2/0CTgv8+mI3/MIh2/zOFcv88joL/OY+F/zeFev83in//N4x+/jyFcPw3f237OHpv+0iQf/8fRj1fCh4cTyRkWOxFnIj+TqSR/0idiP9Qo5P/M4N5/Sp9cPs+k4X8RJeL/jqLev8/j37/RpaH/z2SiP84hnn/PZKI/zCHdv86jXz/P46E/zSIfv8xiHv/J31x/y6Eef4rgG/8OYx9+zyPhv05jIH/SZ6Q/1Wyof8/lH//Oohx9yJHPV4AAAAABhAOChw2LzkmTEV3MGxcuDuHdu1Akob/QpuP/0uZiP8yh3r/MIB0/DuKffs4in38PpaD/j6ZjP89kYT/PpCC/0CNgP82g3b+MIV6/S6EevspfHP8Po5//0ihkP8+mon/N4+B/zKCdPM1c2jDH01FhBoyK0YEDQoRAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQsKDxUuKkIsXliDMnRpwjeEcfRCloH/RJuK/zyRgP9AlIP/PYx+/TKEdvw8kIH8Q5eM/TSLf/8+lYX/SJyM/zuYjf8+lIj3O4F1ySVZU4wWMy1LBhAMFgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAgIDAQICBAEBAQIAAAAAAAAAAAAAAAAAAAAACxQRFhk2MkomWFGLOXhryEiZhvRElYf/N46G/zCGef9Dk4P/O5CF9SVpYMsrWlCQFzg0UAwZFxoAAAAAAAAAAAAAAAAAAAAAAAAAAgECAgQBAgIDAAEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAgIDAQMCBAEBAQIAAAAAAAAAAAAAAAAAAAAACBcTHx4+OVw5dWmnK2peqBo5Ml0MHBkiAAICAQAAAAAAAAAAAAAAAAABAQEBAgIEAQICAwABAQIAAAAAAAAAAAAAAAAAAAAAAAAAAP//f////D////gf///gB///wAP//wAA//4AAH/4AAAf8AAAD+AAAAfAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAOAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAHwAAAH/gAAf//gB////n//">
+<title>{TITLE}</title>
+
+<style type="text/css" media="screen">
+
+ /* reset CSS */
+
+ html, body, div, span, applet, object, iframe,
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+ a, abbr, acronym, address, big, cite, code,
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
+ small, strike, strong, sub, sup, tt, var,
+ b, u, i, center,
+ dl, dt, dd, ol, ul, li,
+ fieldset, form, label, legend,
+ table, caption, tbody, tfoot, thead, tr, th, td {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ font-size: 100%;
+ vertical-align: baseline;
+ background: transparent;
+ }
+ body {
+ line-height: 1;
+ }
+ ol, ul {
+ list-style: none;
+ }
+ blockquote, q {
+ quotes: none;
+ }
+
+ /* remember to define focus styles! */
+ :focus {
+ outline: 0;
+ }
+
+ /* remove textarea resize at Safari */
+ textarea {
+ resize: none;
+ }
+
+ /* remember to highlight inserts somehow! */
+ ins {
+ text-decoration: none;
+ }
+ del {
+ text-decoration: line-through;
+ }
+
+ /* tables still need 'cellspacing="0"' in the markup */
+ table {
+ border-collapse: collapse;
+ border-spacing: 0;
+ }
+
+
+ /*
+ Origional from http://www.perspectived.com/
+ Modified by Ben Phelps
+ Made for FakeTruth - MCServer
+ */
+
+ /* Basic ---------------------------------------- */
+
+ .clear { clear: both; }
+
+ body {
+ background: white;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #646464;
+ text-align: center;
+ }
+
+ #wrapper {
+ text-align: left;
+ width: 930px;
+ margin: 0 auto;
+ }
+
+ /* Logo ---------------------------------------- */
+
+ h1 {
+ margin: 15px 0 10px 5px;
+ width: 180px;
+ height: 36px;
+ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAAkCAMAAAAXdeBDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAuVQTFRFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAs7OzAAAAAAAAoqKiAAAAvLy8AAAAlZWVtbW1j4+Pra2tiYmJp6enAAAAhISEoaGhAAAAgICAm5ube3t7lZWVd3d3kZGRc3NzjIyMbGxsg4ODgICAeHh43NzcdXV1cnJyy8vLWVlZbGxswcHB09PTvLy8uLi4tLS0sLCwvLy8uLi4tbW1oaGhnp6era2tm5ubqqqq39/f29vblZWV09PT4ODgz8/P3NzckZGRxcXF0tLSwsLCzs7Oy8vLyMjIt7e3vLy85ubm7u7u3d3d5+fn2tra5OTk19fX1dXV3t7e29vb2dnZ1tbW0dHRv7+/8PDw7u7u6+vr8fHx5ubm4+Pj7Ozs4eHh3t7e5+fn5OTk2tra4uLi39/f1dXV3d3d29vb2dnZ19fX1dXV0tLS9fX18/Pzzs7O7u7u8/PzycnJ6urq6Ojo7+/v5ubm7Ozs4+Pj4eHh39/f5ubm5OTk4uLi4ODg2NjY3Nzc29vb19fX8vLy9/f39fX17e3t8/Pz6+vr8fHx7+/v5+fn7e3t5eXl6+vr6enp6Ojo4ODg39/f9PT0+Pj48fHx9vb27+/v9PT07e3t8/Pz7Ozs8fHx7+/v6Ojo7u7u5+fn7Ozs5eXl6urq5OTk6enp5+fn5ubm5OTk+Pj49/f39fX19PT0+fn58vLy8fHx9fX19PT08vLy8fHx6urq+Pj49vb29fX19PT08vLy8PDw+/v7+vr6+Pj49/f39vb29fX18/Pz/f39+/v7+vr6+fn5+Pj49/f3/f39/Pz8+vr6/v7+/f39a5KrdZmxf6G2iai8kq/BnLbHpr7NsMXSuszYxNPdxmZTynBeznpqztvj0YV11Y+B2OLp2ZmM3aOY4a2j4enu5Liv6MK66/D07MzG8NbR9ODd9fj59+vo+/X0ucu1kQAAANl0Uk5TAAECAwQFBgcICQoLDA0ODxAREhMUFBUWFhcXGBgYGRkaGhsbGxwcHB0dHh4fHyEhIiQkJSYnKCgpKSorLC0uLzAxMjIzMzc4Ojo6Ozs8Pj4/P0BBQ0VISUtLTExNTk5PUFFTV1dYWVpbXFxdXl5fYGBhYmJjZGVmZ2doaWprbGxtbW5ub3BxcXJzdHV2d3l6e3x9fX5+f4CAgYGCg4SIi4yNjY6Oj4+QkJGSkpOTlJSVlZaXmJqbnJ2dnp+foKGip6+wsbKztb6/wMHCw8TOz9DR0tPf4OHv8LXp8fEAAAi/SURBVHja3Zh/dBRXFcdhZ+a9eTPzZnaXmJam0FYUEQWLrVVbqdZaf6EWQW2txN/SWiAmxFqtIlWr9bdWqkbwF6WQYIq/+WFpwSZqTahhg6RhNptkl9nsbjeb2eyv+dv73g6wlcyewXMazvGek3Dm5jLv8+689733vTn/q81ldr5zzsWxuVWr55sbCAiiBCYKAeZ1nYIgigJ4Zh2Zj+0OXesTgQ987pOEZUVVVYXISIJQPi3mJETG0kXADggIL5CRWDMy57kCaDgdBMgK1de0gi2jGsESZJt5iXpjS8utGkHiLFMDIHrNgfJBFYs1i0Ei73iifIAggIEHrNDWnuGpFFg50vEKVYbcArNye0+lUCj13aUgYbahRbInbqbu1zAf2XXpR8bN1CZZYItA1jb0pcaiJrdYorxzIRYFYN7qZC2wTOVXMuR+dqGR2hU3Y4NLFSlwJtGIfmbKNFOt4BIkQndOj5rR8dMpsETMjCae+gASJbLKSSftUsWeSJbWz3aqgXBvPGomOnWWajfRoWOjAN2uIWBedOh0NJoYPvJgW1tb+47I1Jg5Vl6AsPrkZLLU+f5bdjjpzNOzDo1pdzw2Fi2vVlBVFgRMf5oyYXl8lmIk00MJc7S8e6mhU02jerC5JzFavgyRlztWbl9j2NC3lvJbpMDFgJ6Ojh/VZb4XA5KycmhkNAXQOpG1ncDfv9HQQNsQZsK3cNvTn5SQ0lKwCveEdYWQd25BrugxUQHjAl/fPKL9Q2t747F/x82pjSpXC0Gme+EJoNt1Vb2jHI1FVlMmawFWYiQgB6mWCIcOaVgCA2ZX3BEGQyI4vAsXWN1of9Bd8diJZ0dG+3QiwuSRsq4cHf8rgzao3jMWnX5Al88oMdNnAQRPlOlwMrcvrBMYk2WrWmyIqlGqqYRJPE+kwK2a0Jr8wo9nNPzRL/QvTpupH4HsAQ4DLX+ZQQeNN02b8W6DSLWVh5mA+EbcHaKkWhF5sdGWdfREIj0dyzSCBDAJY1nGCKo/r/9uguEB/uQZLQZ8Qe+JxwZffGx0ZGixgiSsbXzOTDz2RQYdDm1PmFNrNXTee+ZKMpO8fP+DhiYjAGLF5oYux86m01nb6bqBACr+4Id1/cZHH7pUxne+HkE63fp7522A5xn9IiHgF7ppM6DuokRWjD7Av+7zDHrevEgsFgkq0vndnVtcMvmhjkUKJFvEyqf7ckkrmU7Dr1zfXQTLXyoWv95ZydnblB8UKut5BYL/Rw4Uih9S6Qav6B9CnD/oSGPj0fFouVmn+sOwUH7W9DmmHg0Nw9H4Xp0IM1Z/KOOFjDVhR7ZqMpbVO5yMlS2eGhw8VYTJOC9RtOPp9Ak7adk/picnMv/UZL5jyO0ly+4INntGP+QfOhxeXY6O9c4L31QeGettaLyHQTeuKJsALQdm3PyI0Na+UtZKl3ZSjS7uzVr23z7e0Nj00t8Wk2nnZaoeSadtK1s6uJD+xLYKLSBOTJp6sklnxXLP6AOXin6XRyRoGLsS5nObm34HctccCrdz6GsYNJ0JmquFrOjNvcV0srQrFN5tW/bh5aHQvPm/KQHFVkULDsK3n/x7s0bURZDqPtAg+DxrSlau+5JOz2gVCX434nGod4uhpDzzielo/HFdD7bXzbSbbBHJmvEAbMjK5qZTyUz/8qCuhzsZxf0qUUODaSt94n06rB3aYVulZhVLMgXRcd5SL1oM+IamCtEeTpmn/wFyt1JV9ba6a9qlZtgKUE9kjn0vb+W/FdapsYtTaBgrDCP/3bAiQX4XD01ke6B8qisdkPf5364TDcy+oQkmRu/YyGmmITKhbXXVwy10DFtSgjsgjX/KWc41IeMshQj+wTT4dBxg3cx2iGHbvCuXdN58yb560XP8Q8sSUpunzOho/xICX73trE5P33yeTgOre0KDNYLp1Y5l/xkwrm0In6UICMSArTUYVmHGMLNlTjLbGw69chj+aWjorhftHxoECWrh43HoouEluAodNNZMzVQRWQty2wJJ5NRIexU0fAz6tU2dVQomyVUM+ExCtXGspvjnLOGh0N460RcELQQkcn15/AnAFxCHbvPqPUSE9xedKyBDHPpqBm1blXc/5lKwfkRSOIbBNwQ8vQEW8x+uexaWtqEb2z2jLxSaadjb/vJWLAUCLnRtlye4bQ7CYPK7Slb+ayrMhfUqt1Ss/PeLlv17RvFVqsisEcQqx2C7+FyqfwmJXqcp2ke9oi8YGl4tSkgSAM6Fph799KcU7SSkLEgJxoSGYYVW3v5MZqIAFN8I65qqvu6RLUQLcgx4r9ukO0n7X5lsr04w0fu9on1CI5VDY4F/fN5DAnRriq3u2pMLrTm5XKVBjcvvDoPTCO8uJSePzr+3YFlp5ztNDUEjuO6pXP4rtAaDp/rI5ETBKn5MRbDl2zyifUMrDFrFgdoeTuHQyrkz4hCcEcF29PMz4lXKlVAk8r3fXHtzey8rw+8JzTtsW5POH++9dkV7twM1ehtlH/w4K6duqteWLCgphiyyJeUd7cMAkDwK0AQ9D5psAuhN5NxpfMQ9jY/y07gsK6ucSSubL1UKWYttJ5UuBY5kruA4BWjf7IOXqxRaoLPJgK5Dh36j0Mo6EJjBEo9on9AifiQeG8BSLbSA7wbou7HHvYcsSUhZ9aQ9YYFN5CJbVRnJ6pLDxYzFLVM8dDkhykA6PSDDe91UQ39X7fV4i+gZ7ceA6tW/HviCVNumwAh4f3k/ljxvmAQBkSs7TpYKheLQnusVJIIMErqxr1TI5QqVvg0gZAjfNzBwH3Lfy0DJeod31ezBO9qXsfOPexqqnQlagGa8y1MJFqviB85bW1o+QiHNTHEENrn3tnZ1tb6RsmMBkyJUcznJ5PIyyRX8OtF+jEsGG/S/fPyIOdOtKZuf2+NhonAPBLqTI6qmKQTDLPhrmbjXjnPmuW60/wtqryt07/tp3oA8z8MdCHHXjBcC7mOd6Bfk7r3udC94aDf6/9T+AzWzIkAbVeu4AAAAAElFTkSuQmCC) no-repeat left top;
+ }
+
+ h1 a {
+ display: block;
+ width: 225px;
+ height: 28px;
+ }
+
+ h1 span { display: none; }
+
+ a {
+ color: #646464;
+ }
+
+ /* Container ---------------------------------------- */
+
+ #containerHolder {
+ background: #eee;
+ padding: 5px;
+ }
+
+
+ #container {
+ background: #fff url(data:image/gif;base64,R0lGODlhtAABAIAAAN3d3f///yH5BAAAAAAALAAAAAC0AAEAAAIMjI+py+0Po5y0WgYKADs%3D) repeat-y left top;
+ border: 1px solid #ddd;
+ width: 918px;
+
+ }
+
+ #connectHolder {
+ background: #eee;
+ padding: 5px;
+ margin-bottom:8px;
+ }
+
+
+ #connect {
+ border: 1px solid #ddd;
+ background-color: #fff;
+ padding:5px;
+ width: 908px;
+ }
+
+ .pics {
+ height: 375px;
+ width: 600px;
+ }
+
+ .pics img {
+ padding: 5px;
+ border: 1px solid #ddd;
+ background-color: #eee;
+ width: 600px;
+ height: 375px;
+ margin-left: 15px;
+ }
+
+ /* Login -------------------------------------- */
+
+ #loginLogo {
+ margin: 0 auto;
+ margin-top:100px;
+ width: 180px;
+ height: 36px;
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAAkCAMAAAAXdeBDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAuVQTFRFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAs7OzAAAAAAAAoqKiAAAAvLy8AAAAlZWVtbW1j4+Pra2tiYmJp6enAAAAhISEoaGhAAAAgICAm5ube3t7lZWVd3d3kZGRc3NzjIyMbGxsg4ODgICAeHh43NzcdXV1cnJyy8vLWVlZbGxswcHB09PTvLy8uLi4tLS0sLCwvLy8uLi4tbW1oaGhnp6era2tm5ubqqqq39/f29vblZWV09PT4ODgz8/P3NzckZGRxcXF0tLSwsLCzs7Oy8vLyMjIt7e3vLy85ubm7u7u3d3d5+fn2tra5OTk19fX1dXV3t7e29vb2dnZ1tbW0dHRv7+/8PDw7u7u6+vr8fHx5ubm4+Pj7Ozs4eHh3t7e5+fn5OTk2tra4uLi39/f1dXV3d3d29vb2dnZ19fX1dXV0tLS9fX18/Pzzs7O7u7u8/PzycnJ6urq6Ojo7+/v5ubm7Ozs4+Pj4eHh39/f5ubm5OTk4uLi4ODg2NjY3Nzc29vb19fX8vLy9/f39fX17e3t8/Pz6+vr8fHx7+/v5+fn7e3t5eXl6+vr6enp6Ojo4ODg39/f9PT0+Pj48fHx9vb27+/v9PT07e3t8/Pz7Ozs8fHx7+/v6Ojo7u7u5+fn7Ozs5eXl6urq5OTk6enp5+fn5ubm5OTk+Pj49/f39fX19PT0+fn58vLy8fHx9fX19PT08vLy8fHx6urq+Pj49vb29fX19PT08vLy8PDw+/v7+vr6+Pj49/f39vb29fX18/Pz/f39+/v7+vr6+fn5+Pj49/f3/f39/Pz8+vr6/v7+/f39a5KrdZmxf6G2iai8kq/BnLbHpr7NsMXSuszYxNPdxmZTynBeznpqztvj0YV11Y+B2OLp2ZmM3aOY4a2j4enu5Liv6MK66/D07MzG8NbR9ODd9fj59+vo+/X0ucu1kQAAANl0Uk5TAAECAwQFBgcICQoLDA0ODxAREhMUFBUWFhcXGBgYGRkaGhsbGxwcHB0dHh4fHyEhIiQkJSYnKCgpKSorLC0uLzAxMjIzMzc4Ojo6Ozs8Pj4/P0BBQ0VISUtLTExNTk5PUFFTV1dYWVpbXFxdXl5fYGBhYmJjZGVmZ2doaWprbGxtbW5ub3BxcXJzdHV2d3l6e3x9fX5+f4CAgYGCg4SIi4yNjY6Oj4+QkJGSkpOTlJSVlZaXmJqbnJ2dnp+foKGip6+wsbKztb6/wMHCw8TOz9DR0tPf4OHv8LXp8fEAAAi/SURBVHja3Zh/dBRXFcdhZ+a9eTPzZnaXmJam0FYUEQWLrVVbqdZaf6EWQW2txN/SWiAmxFqtIlWr9bdWqkbwF6WQYIq/+WFpwSZqTahhg6RhNptkl9nsbjeb2eyv+dv73g6wlcyewXMazvGek3Dm5jLv8+689733vTn/q81ldr5zzsWxuVWr55sbCAiiBCYKAeZ1nYIgigJ4Zh2Zj+0OXesTgQ987pOEZUVVVYXISIJQPi3mJETG0kXADggIL5CRWDMy57kCaDgdBMgK1de0gi2jGsESZJt5iXpjS8utGkHiLFMDIHrNgfJBFYs1i0Ei73iifIAggIEHrNDWnuGpFFg50vEKVYbcArNye0+lUCj13aUgYbahRbInbqbu1zAf2XXpR8bN1CZZYItA1jb0pcaiJrdYorxzIRYFYN7qZC2wTOVXMuR+dqGR2hU3Y4NLFSlwJtGIfmbKNFOt4BIkQndOj5rR8dMpsETMjCae+gASJbLKSSftUsWeSJbWz3aqgXBvPGomOnWWajfRoWOjAN2uIWBedOh0NJoYPvJgW1tb+47I1Jg5Vl6AsPrkZLLU+f5bdjjpzNOzDo1pdzw2Fi2vVlBVFgRMf5oyYXl8lmIk00MJc7S8e6mhU02jerC5JzFavgyRlztWbl9j2NC3lvJbpMDFgJ6Ojh/VZb4XA5KycmhkNAXQOpG1ncDfv9HQQNsQZsK3cNvTn5SQ0lKwCveEdYWQd25BrugxUQHjAl/fPKL9Q2t747F/x82pjSpXC0Gme+EJoNt1Vb2jHI1FVlMmawFWYiQgB6mWCIcOaVgCA2ZX3BEGQyI4vAsXWN1of9Bd8diJZ0dG+3QiwuSRsq4cHf8rgzao3jMWnX5Al88oMdNnAQRPlOlwMrcvrBMYk2WrWmyIqlGqqYRJPE+kwK2a0Jr8wo9nNPzRL/QvTpupH4HsAQ4DLX+ZQQeNN02b8W6DSLWVh5mA+EbcHaKkWhF5sdGWdfREIj0dyzSCBDAJY1nGCKo/r/9uguEB/uQZLQZ8Qe+JxwZffGx0ZGixgiSsbXzOTDz2RQYdDm1PmFNrNXTee+ZKMpO8fP+DhiYjAGLF5oYux86m01nb6bqBACr+4Id1/cZHH7pUxne+HkE63fp7522A5xn9IiHgF7ppM6DuokRWjD7Av+7zDHrevEgsFgkq0vndnVtcMvmhjkUKJFvEyqf7ckkrmU7Dr1zfXQTLXyoWv95ZydnblB8UKut5BYL/Rw4Uih9S6Qav6B9CnD/oSGPj0fFouVmn+sOwUH7W9DmmHg0Nw9H4Xp0IM1Z/KOOFjDVhR7ZqMpbVO5yMlS2eGhw8VYTJOC9RtOPp9Ak7adk/picnMv/UZL5jyO0ly+4INntGP+QfOhxeXY6O9c4L31QeGettaLyHQTeuKJsALQdm3PyI0Na+UtZKl3ZSjS7uzVr23z7e0Nj00t8Wk2nnZaoeSadtK1s6uJD+xLYKLSBOTJp6sklnxXLP6AOXin6XRyRoGLsS5nObm34HctccCrdz6GsYNJ0JmquFrOjNvcV0srQrFN5tW/bh5aHQvPm/KQHFVkULDsK3n/x7s0bURZDqPtAg+DxrSlau+5JOz2gVCX434nGod4uhpDzzielo/HFdD7bXzbSbbBHJmvEAbMjK5qZTyUz/8qCuhzsZxf0qUUODaSt94n06rB3aYVulZhVLMgXRcd5SL1oM+IamCtEeTpmn/wFyt1JV9ba6a9qlZtgKUE9kjn0vb+W/FdapsYtTaBgrDCP/3bAiQX4XD01ke6B8qisdkPf5364TDcy+oQkmRu/YyGmmITKhbXXVwy10DFtSgjsgjX/KWc41IeMshQj+wTT4dBxg3cx2iGHbvCuXdN58yb560XP8Q8sSUpunzOho/xICX73trE5P33yeTgOre0KDNYLp1Y5l/xkwrm0In6UICMSArTUYVmHGMLNlTjLbGw69chj+aWjorhftHxoECWrh43HoouEluAodNNZMzVQRWQty2wJJ5NRIexU0fAz6tU2dVQomyVUM+ExCtXGspvjnLOGh0N460RcELQQkcn15/AnAFxCHbvPqPUSE9xedKyBDHPpqBm1blXc/5lKwfkRSOIbBNwQ8vQEW8x+uexaWtqEb2z2jLxSaadjb/vJWLAUCLnRtlye4bQ7CYPK7Slb+ayrMhfUqt1Ss/PeLlv17RvFVqsisEcQqx2C7+FyqfwmJXqcp2ke9oi8YGl4tSkgSAM6Fph799KcU7SSkLEgJxoSGYYVW3v5MZqIAFN8I65qqvu6RLUQLcgx4r9ukO0n7X5lsr04w0fu9on1CI5VDY4F/fN5DAnRriq3u2pMLrTm5XKVBjcvvDoPTCO8uJSePzr+3YFlp5ztNDUEjuO6pXP4rtAaDp/rI5ETBKn5MRbDl2zyifUMrDFrFgdoeTuHQyrkz4hCcEcF29PMz4lXKlVAk8r3fXHtzey8rw+8JzTtsW5POH++9dkV7twM1ehtlH/w4K6duqteWLCgphiyyJeUd7cMAkDwK0AQ9D5psAuhN5NxpfMQ9jY/y07gsK6ucSSubL1UKWYttJ5UuBY5kruA4BWjf7IOXqxRaoLPJgK5Dh36j0Mo6EJjBEo9on9AifiQeG8BSLbSA7wbou7HHvYcsSUhZ9aQ9YYFN5CJbVRnJ6pLDxYzFLVM8dDkhykA6PSDDe91UQ39X7fV4i+gZ7ceA6tW/HviCVNumwAh4f3k/ljxvmAQBkSs7TpYKheLQnusVJIIMErqxr1TI5QqVvg0gZAjfNzBwH3Lfy0DJeod31ezBO9qXsfOPexqqnQlagGa8y1MJFqviB85bW1o+QiHNTHEENrn3tnZ1tb6RsmMBkyJUcznJ5PIyyRX8OtF+jEsGG/S/fPyIOdOtKZuf2+NhonAPBLqTI6qmKQTDLPhrmbjXjnPmuW60/wtqryt07/tp3oA8z8MdCHHXjBcC7mOd6Bfk7r3udC94aDf6/9T+AzWzIkAbVeu4AAAAAElFTkSuQmCC);
+ }
+
+ #loginHolder {
+ background: #eee;
+ padding: 5px;
+ width: 310px;
+ margin: 0 auto;
+ height: 90px;
+ margin-top:20px;
+ }
+
+ #login {
+ padding:10px;
+ width: 288px;
+ height: 68px;
+ border: 1px solid #ddd;
+ background:#fff;
+ text-align: left;
+ }
+
+
+ /* Sidebar ---------------------------------------- */
+
+ #sidebar {
+ width: 179px;
+ float: left;
+ }
+
+ #sidebar .sideNav { width: 179px; }
+
+ #sidebar .sideNav li { border-bottom: 1px solid #ddd; width: 179px; }
+
+ #sidebar .sideNav li a {
+ display: block;
+ color: #646464;
+ background: #f6f6f6;
+ text-decoration: none;
+ height: 29px;
+ line-height: 29px;
+ padding: 0 19px;
+ width: 141px;
+ }
+
+ #sidebar .sideNav li a:hover { background: #fdfcf6; }
+
+ #sidebar .sideNav li a.active, #sidebar .sideNav li a.active:hover {
+ background: #f0f7fa;
+ color: #c66653;
+ }
+
+ /* Breadcrumb ---------------------------------------- */
+
+ h2 {
+ width: 718px;
+ float: right;
+ color: #646464;
+ font-size: 16px;
+ line-height: 16px;
+ font-weight: bold;
+ margin: 20px 0 0 0;
+ padding: 0 0 10px 0;
+ border-bottom: 1px solid #ddd;
+ }
+
+ h2 a {
+ color: #646464;
+ text-decoration: none;
+ }
+
+ h2 a.active { color: #c66653; }
+
+ h2 a:hover { text-decoration: underline; }
+
+ /* Content ---------------------------------------- */
+
+ #main {
+ width: 700px;
+ float: right;
+ padding: 0 19px 0 0;
+ }
+
+ #main p {
+
+ padding: 10px;
+
+ }
+
+ h3 {
+ font-size: 14px;
+ line-height: 14px;
+ font-weight: bold;
+ color: #5494af;
+ padding: 0 0 0 10px;
+ margin: 20px 0 10px;
+ }
+
+ #main table {
+ border-top: 1px solid #ddd;
+ width: 700px;
+ }
+
+ #main table th {
+ text-align: left;
+ }
+
+ #main table tr td {
+ background: #f6f6f6;
+ padding: 0px 20px;
+ height: 29px;
+ line-height: 29px;
+ border-bottom: 1px solid #ddd;
+ }
+
+ #main table tr.odd td {
+ background: #fbfbfb;
+ }
+
+ #main table tr:hover td { background: #fdfcf6; }
+
+ #main table .action {
+ text-align: right;
+ padding: 0 20px 0 10px;
+ }
+
+ #main table tr .action a { margin: 0 0 0 10px; text-decoration: none; color: #9b9b9b; }
+ #main table tr:hover .action .edit { color: #c5a059; }
+ #main table tr:hover .action .delete { color: #a02b2b; }
+ #main table tr:hover .action .view { color: #55a34a; }
+
+ #main table tr:hover .action a:hover { text-decoration: underline; }
+
+ fieldset {
+ border: 1px solid #ddd;
+ padding: 19px;
+ margin: 0 0 20px 0;
+ background: #fbfbfb;
+ }
+
+ form p { margin: 0 0 14px 0; float: left; width: 100%; }
+
+ label {
+ display: block;
+ width: 100%;
+ margin: 0 0 7px 0;
+ line-height: 12px;
+ }
+
+ /* Footer ---------------------------------------- */
+
+ #footer {
+ margin: 10px 0 30px 0;
+ font-size: 11px;
+ line-height: 11px;
+ color: #9B9B9B;
+ padding: 0 0 0 5px;
+ }
+
+ #footer a { color: #9B9B9B; }
+
+ #footer a:hover { text-decoration: none; }
+</style>
+
+</head>
+
+<body>
+ <div id="wrapper">
+ <!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
+ <h1><a href="./"><span>{TITLE}</span></a></h1>
+
+ <div id="containerHolder">
+ <div id="container">
+ <div id="sidebar">
+ <ul class="sideNav">
+ {MENU}
+ </ul>
+ <!-- // .sideNav -->
+ </div>
+ <!-- // #sidebar -->
+
+ <!-- h2 stays for breadcrumbs -->
+ <h2>Welcome {USERNAME}</h2>
+
+ <div id="main">
+
+ <p>{CONTENT}</p>
+
+ </div>
+ <!-- // #main -->
+
+ <div class="clear"></div>
+ </div>
+ <!-- // #container -->
+ </div>
+ <!-- // #containerHolder -->
+
+ <p id="footer">Memory Usage: {MEM}Mb</p>
+ </div>
+ <!-- // #wrapper -->
+</body>
+</html>
diff --git a/zlib-1.2.5/adler32.c b/zlib-1.2.5/adler32.c new file mode 100644 index 000000000..65ad6a5ad --- /dev/null +++ b/zlib-1.2.5/adler32.c @@ -0,0 +1,169 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2007 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#define local static + +local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); + +#define BASE 65521UL /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +/* use NO_DIVIDE if your processor does not do division in hardware */ +#ifdef NO_DIVIDE +# define MOD(a) \ + do { \ + if (a >= (BASE << 16)) a -= (BASE << 16); \ + if (a >= (BASE << 15)) a -= (BASE << 15); \ + if (a >= (BASE << 14)) a -= (BASE << 14); \ + if (a >= (BASE << 13)) a -= (BASE << 13); \ + if (a >= (BASE << 12)) a -= (BASE << 12); \ + if (a >= (BASE << 11)) a -= (BASE << 11); \ + if (a >= (BASE << 10)) a -= (BASE << 10); \ + if (a >= (BASE << 9)) a -= (BASE << 9); \ + if (a >= (BASE << 8)) a -= (BASE << 8); \ + if (a >= (BASE << 7)) a -= (BASE << 7); \ + if (a >= (BASE << 6)) a -= (BASE << 6); \ + if (a >= (BASE << 5)) a -= (BASE << 5); \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +# define MOD4(a) \ + do { \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +#else +# define MOD(a) a %= BASE +# define MOD4(a) a %= BASE +#endif + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) { + adler += buf[0]; + if (adler >= BASE) + adler -= BASE; + sum2 += adler; + if (sum2 >= BASE) + sum2 -= BASE; + return adler | (sum2 << 16); + } + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (buf == Z_NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) { + while (len--) { + adler += *buf++; + sum2 += adler; + } + if (adler >= BASE) + adler -= BASE; + MOD4(sum2); /* only added so many BASE's */ + return adler | (sum2 << 16); + } + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; + n = NMAX / 16; /* NMAX is divisible by 16 */ + do { + DO16(buf); /* 16 sums unrolled */ + buf += 16; + } while (--n); + MOD(adler); + MOD(sum2); + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + if (len) { /* avoid modulos if none remaining */ + while (len >= 16) { + len -= 16; + DO16(buf); + buf += 16; + } + while (len--) { + adler += *buf++; + sum2 += adler; + } + MOD(adler); + MOD(sum2); + } + + /* return recombined sums */ + return adler | (sum2 << 16); +} + +/* ========================================================================= */ +local uLong adler32_combine_(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + unsigned long sum1; + unsigned long sum2; + unsigned rem; + + /* the derivation of this formula is left as an exercise for the reader */ + rem = (unsigned)(len2 % BASE); + sum1 = adler1 & 0xffff; + sum2 = rem * sum1; + MOD(sum2); + sum1 += (adler2 & 0xffff) + BASE - 1; + sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; + if (sum1 >= BASE) sum1 -= BASE; + if (sum1 >= BASE) sum1 -= BASE; + if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 >= BASE) sum2 -= BASE; + return sum1 | (sum2 << 16); +} + +/* ========================================================================= */ +uLong ZEXPORT adler32_combine(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} + +uLong ZEXPORT adler32_combine64(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} diff --git a/zlib-1.2.5/compress.c b/zlib-1.2.5/compress.c new file mode 100644 index 000000000..ea4dfbe9d --- /dev/null +++ b/zlib-1.2.5/compress.c @@ -0,0 +1,80 @@ +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; + int level; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; +#ifdef MAXSEG_64K + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; +#endif + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; + + err = deflateInit(&stream, level); + if (err != Z_OK) return err; + + err = deflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + deflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = deflateEnd(&stream); + return err; +} + +/* =========================================================================== + */ +int ZEXPORT compress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); +} + +/* =========================================================================== + If the default memLevel or windowBits for deflateInit() is changed, then + this function needs to be updated. + */ +uLong ZEXPORT compressBound (sourceLen) + uLong sourceLen; +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13; +} diff --git a/zlib-1.2.5/crc32.c b/zlib-1.2.5/crc32.c new file mode 100644 index 000000000..91be372d2 --- /dev/null +++ b/zlib-1.2.5/crc32.c @@ -0,0 +1,442 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2006, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing + * tables for updating the shift register in one step with three exclusive-ors + * instead of four steps with four exclusive-ors. This results in about a + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + */ + +#ifdef MAKECRCH +# include <stdio.h> +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for STDC and FAR definitions */ + +#define local static + +/* Find a four-byte integer type for crc32_little() and crc32_big(). */ +#ifndef NOBYFOUR +# ifdef STDC /* need ANSI C limits.h to determine sizes */ +# include <limits.h> +# define BYFOUR +# if (UINT_MAX == 0xffffffffUL) + typedef unsigned int u4; +# else +# if (ULONG_MAX == 0xffffffffUL) + typedef unsigned long u4; +# else +# if (USHRT_MAX == 0xffffffffUL) + typedef unsigned short u4; +# else +# undef BYFOUR /* can't find a four-byte integer type! */ +# endif +# endif +# endif +# endif /* STDC */ +#endif /* !NOBYFOUR */ + +/* Definitions for doing the crc four data bytes at a time. */ +#ifdef BYFOUR +# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ + (((w)&0xff00)<<8)+(((w)&0xff)<<24)) + local unsigned long crc32_little OF((unsigned long, + const unsigned char FAR *, unsigned)); + local unsigned long crc32_big OF((unsigned long, + const unsigned char FAR *, unsigned)); +# define TBLS 8 +#else +# define TBLS 1 +#endif /* BYFOUR */ + +/* Local functions for crc concatenation */ +local unsigned long gf2_matrix_times OF((unsigned long *mat, + unsigned long vec)); +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); +local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2); + + +#ifdef DYNAMIC_CRC_TABLE + +local volatile int crc_table_empty = 1; +local unsigned long FAR crc_table[TBLS][256]; +local void make_crc_table OF((void)); +#ifdef MAKECRCH + local void write_table OF((FILE *, const unsigned long FAR *)); +#endif /* MAKECRCH */ +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The first table is simply the CRC of all possible eight bit values. This is + all the information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. The remaining tables + allow for word-at-a-time CRC calculation for both big-endian and little- + endian machines, where a word is four bytes. +*/ +local void make_crc_table() +{ + unsigned long c; + int n, k; + unsigned long poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static volatile int first = 1; /* flag to limit concurrent making */ + static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* See if another task is already doing this (not thread-safe, but better + than nothing -- significantly reduces duration of vulnerability in + case the advice about DYNAMIC_CRC_TABLE is ignored) */ + if (first) { + first = 0; + + /* make exclusive-or pattern from polynomial (0xedb88320UL) */ + poly = 0UL; + for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) + poly |= 1UL << (31 - p[n]); + + /* generate a crc for every 8-bit value */ + for (n = 0; n < 256; n++) { + c = (unsigned long)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[0][n] = c; + } + +#ifdef BYFOUR + /* generate crc for each value followed by one, two, and three zeros, + and then the byte reversal of those as well as the first table */ + for (n = 0; n < 256; n++) { + c = crc_table[0][n]; + crc_table[4][n] = REV(c); + for (k = 1; k < 4; k++) { + c = crc_table[0][c & 0xff] ^ (c >> 8); + crc_table[k][n] = c; + crc_table[k + 4][n] = REV(c); + } + } +#endif /* BYFOUR */ + + crc_table_empty = 0; + } + else { /* not first */ + /* wait for the other guy to finish (not efficient, but rare) */ + while (crc_table_empty) + ; + } + +#ifdef MAKECRCH + /* write out CRC tables to crc32.h */ + { + FILE *out; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); + fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); + fprintf(out, "local const unsigned long FAR "); + fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); + write_table(out, crc_table[0]); +# ifdef BYFOUR + fprintf(out, "#ifdef BYFOUR\n"); + for (k = 1; k < 8; k++) { + fprintf(out, " },\n {\n"); + write_table(out, crc_table[k]); + } + fprintf(out, "#endif\n"); +# endif /* BYFOUR */ + fprintf(out, " }\n};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH +local void write_table(out, table) + FILE *out; + const unsigned long FAR *table; +{ + int n; + + for (n = 0; n < 256; n++) + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); +} +#endif /* MAKECRCH */ + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const unsigned long FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + return (const unsigned long FAR *)crc_table; +} + +/* ========================================================================= */ +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; +{ + if (buf == Z_NULL) return 0UL; + +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + +#ifdef BYFOUR + if (sizeof(void *) == sizeof(ptrdiff_t)) { + u4 endian; + + endian = 1; + if (*((unsigned char *)(&endian))) + return crc32_little(crc, buf, len); + else + return crc32_big(crc, buf, len); + } +#endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; + while (len >= 8) { + DO8; + len -= 8; + } + if (len) do { + DO1; + } while (--len); + return crc ^ 0xffffffffUL; +} + +#ifdef BYFOUR + +/* ========================================================================= */ +#define DOLIT4 c ^= *buf4++; \ + c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 + +/* ========================================================================= */ +local unsigned long crc32_little(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = (u4)crc; + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + while (len >= 32) { + DOLIT32; + len -= 32; + } + while (len >= 4) { + DOLIT4; + len -= 4; + } + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + } while (--len); + c = ~c; + return (unsigned long)c; +} + +/* ========================================================================= */ +#define DOBIG4 c ^= *++buf4; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + +/* ========================================================================= */ +local unsigned long crc32_big(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = REV((u4)crc); + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; + } + while (len >= 4) { + DOBIG4; + len -= 4; + } + buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + } while (--len); + c = ~c; + return (unsigned long)(REV(c)); +} + +#endif /* BYFOUR */ + +#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ + +/* ========================================================================= */ +local unsigned long gf2_matrix_times(mat, vec) + unsigned long *mat; + unsigned long vec; +{ + unsigned long sum; + + sum = 0; + while (vec) { + if (vec & 1) + sum ^= *mat; + vec >>= 1; + mat++; + } + return sum; +} + +/* ========================================================================= */ +local void gf2_matrix_square(square, mat) + unsigned long *square; + unsigned long *mat; +{ + int n; + + for (n = 0; n < GF2_DIM; n++) + square[n] = gf2_matrix_times(mat, mat[n]); +} + +/* ========================================================================= */ +local uLong crc32_combine_(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + int n; + unsigned long row; + unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ + unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ + + /* degenerate case (also disallow negative lengths) */ + if (len2 <= 0) + return crc1; + + /* put operator for one zero bit in odd */ + odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ + row = 1; + for (n = 1; n < GF2_DIM; n++) { + odd[n] = row; + row <<= 1; + } + + /* put operator for two zero bits in even */ + gf2_matrix_square(even, odd); + + /* put operator for four zero bits in odd */ + gf2_matrix_square(odd, even); + + /* apply len2 zeros to crc1 (first square will put the operator for one + zero byte, eight zero bits, in even) */ + do { + /* apply zeros operator for this bit of len2 */ + gf2_matrix_square(even, odd); + if (len2 & 1) + crc1 = gf2_matrix_times(even, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + if (len2 == 0) + break; + + /* another iteration of the loop with odd and even swapped */ + gf2_matrix_square(odd, even); + if (len2 & 1) + crc1 = gf2_matrix_times(odd, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + } while (len2 != 0); + + /* return combined crc */ + crc1 ^= crc2; + return crc1; +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} + +uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} diff --git a/zlib-1.2.5/crc32.h b/zlib-1.2.5/crc32.h new file mode 100644 index 000000000..8053b6117 --- /dev/null +++ b/zlib-1.2.5/crc32.h @@ -0,0 +1,441 @@ +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const unsigned long FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, + 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, + 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, + 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, + 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, + 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, + 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, + 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, + 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, + 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, + 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, + 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, + 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, + 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, + 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, + 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, + 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, + 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, + 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, + 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, + 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, + 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, + 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, + 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, + 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, + 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, + 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, + 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, + 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, + 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, + 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, + 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, + 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, + 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, + 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, + 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, + 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, + 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, + 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, + 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, + 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, + 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, + 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, + 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, + 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, + 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, + 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, + 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, + 0xed3498beUL + }, + { + 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, + 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, + 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, + 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, + 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, + 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, + 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, + 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, + 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, + 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, + 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, + 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, + 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, + 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, + 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, + 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, + 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, + 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, + 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, + 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, + 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, + 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, + 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, + 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, + 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, + 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, + 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, + 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, + 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, + 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, + 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, + 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, + 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, + 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, + 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, + 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, + 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, + 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, + 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, + 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, + 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, + 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, + 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, + 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, + 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, + 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, + 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, + 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, + 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, + 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, + 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, + 0xf10605deUL +#endif + } +}; diff --git a/zlib-1.2.5/deflate.c b/zlib-1.2.5/deflate.c new file mode 100644 index 000000000..5c4022f3d --- /dev/null +++ b/zlib-1.2.5/deflate.c @@ -0,0 +1,1834 @@ +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process depends on being able to identify portions + * of the input text which are identical to earlier input (within a + * sliding window trailing behind the input currently being processed). + * + * The most straightforward technique turns out to be the fastest for + * most input files: try all possible matches and select the longest. + * The key feature of this algorithm is that insertions into the string + * dictionary are very simple and thus fast, and deletions are avoided + * completely. Insertions are performed at each input character, whereas + * string matches are performed only when the previous match ends. So it + * is preferable to spend more time in matches to allow very fast string + * insertions and avoid deletions. The matching algorithm for small + * strings is inspired from that of Rabin & Karp. A brute force approach + * is used to find longer strings when a small match has been found. + * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze + * (by Leonid Broukhis). + * A previous version of this file used a more sophisticated algorithm + * (by Fiala and Greene) which is guaranteed to run in linear amortized + * time, but has a larger average cost, uses more memory and is patented. + * However the F&G algorithm may be faster for some highly redundant + * files if the parameter max_chain_length (described below) is too large. + * + * ACKNOWLEDGEMENTS + * + * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and + * I found it in 'freeze' written by Leonid Broukhis. + * Thanks to many people for bug reports and testing. + * + * REFERENCES + * + * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". + * Available in http://www.ietf.org/rfc/rfc1951.txt + * + * A description of the Rabin and Karp algorithm is given in the book + * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. + * + * Fiala,E.R., and Greene,D.H. + * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 + * + */ + +/* @(#) $Id$ */ + +#include "deflate.h" + +const char deflate_copyright[] = + " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* =========================================================================== + * Function prototypes. + */ +typedef enum { + need_more, /* block not completed, need more input or more output */ + block_done, /* block flush performed */ + finish_started, /* finish started, need only more output at next deflate */ + finish_done /* finish done, accept no more input or output */ +} block_state; + +typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +/* Compression function. Returns the block state after the call. */ + +local void fill_window OF((deflate_state *s)); +local block_state deflate_stored OF((deflate_state *s, int flush)); +local block_state deflate_fast OF((deflate_state *s, int flush)); +#ifndef FASTEST +local block_state deflate_slow OF((deflate_state *s, int flush)); +#endif +local block_state deflate_rle OF((deflate_state *s, int flush)); +local block_state deflate_huff OF((deflate_state *s, int flush)); +local void lm_init OF((deflate_state *s)); +local void putShortMSB OF((deflate_state *s, uInt b)); +local void flush_pending OF((z_streamp strm)); +local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifdef ASMV + void match_init OF((void)); /* asm code initialization */ + uInt longest_match OF((deflate_state *s, IPos cur_match)); +#else +local uInt longest_match OF((deflate_state *s, IPos cur_match)); +#endif + +#ifdef DEBUG +local void check_match OF((deflate_state *s, IPos start, IPos match, + int length)); +#endif + +/* =========================================================================== + * Local data + */ + +#define NIL 0 +/* Tail of hash chains */ + +#ifndef TOO_FAR +# define TOO_FAR 4096 +#endif +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +typedef struct config_s { + ush good_length; /* reduce lazy search above this match length */ + ush max_lazy; /* do not perform lazy search above this match length */ + ush nice_length; /* quit search above this match length */ + ush max_chain; + compress_func func; +} config; + +#ifdef FASTEST +local const config configuration_table[2] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ +#else +local const config configuration_table[10] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ +/* 2 */ {4, 5, 16, 8, deflate_fast}, +/* 3 */ {4, 6, 32, 32, deflate_fast}, + +/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ +/* 5 */ {8, 16, 32, 32, deflate_slow}, +/* 6 */ {8, 16, 128, 128, deflate_slow}, +/* 7 */ {8, 32, 128, 256, deflate_slow}, +/* 8 */ {32, 128, 258, 1024, deflate_slow}, +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ +#endif + +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different + * meaning. + */ + +#define EQUAL 0 +/* result of memcmp for equal strings */ + +#ifndef NO_DUMMY_DECL +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ +#endif + +/* =========================================================================== + * Update a hash value with the given input byte + * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * input characters, so that a running hash key can be computed from the + * previous key instead of complete recalculation each time. + */ +#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask) + + +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of str are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif + +/* =========================================================================== + * Initialize the hash table (avoiding 64K overflow for 16 bit systems). + * prev[] will be initialized on the fly. + */ +#define CLEAR_HASH(s) \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + +/* ========================================================================= */ +int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; + int level; + const char *version; + int stream_size; +{ + return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, version, stream_size); + /* To do: ignore strm->next_in if we use it as window */ +} + +/* ========================================================================= */ +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + version, stream_size) + z_streamp strm; + int level; + int method; + int windowBits; + int memLevel; + int strategy; + const char *version; + int stream_size; +{ + deflate_state *s; + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + + ushf *overlay; + /* We overlay pending_buf and d_buf+l_buf. This works since the average + * output size for (length,distance) codes is <= 24 bits. + */ + + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; + } + if (strm == Z_NULL) return Z_STREAM_ERROR; + + strm->msg = Z_NULL; + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } +#ifdef GZIP + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } +#endif + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ + s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); + if (s == Z_NULL) return Z_MEM_ERROR; + strm->state = (struct internal_state FAR *)s; + s->strm = strm; + + s->wrap = wrap; + s->gzhead = Z_NULL; + s->w_bits = windowBits; + s->w_size = 1 << s->w_bits; + s->w_mask = s->w_size - 1; + + s->hash_bits = memLevel + 7; + s->hash_size = 1 << s->hash_bits; + s->hash_mask = s->hash_size - 1; + s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->high_water = 0; /* nothing written to s->window yet */ + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + s->pending_buf = (uchf *) overlay; + s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { + s->status = FINISH_STATE; + strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + deflateEnd (strm); + return Z_MEM_ERROR; + } + s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + + s->level = level; + s->strategy = strategy; + s->method = (Byte)method; + + return deflateReset(strm); +} + +/* ========================================================================= */ +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) + z_streamp strm; + const Bytef *dictionary; + uInt dictLength; +{ + deflate_state *s; + uInt length = dictLength; + uInt n; + IPos hash_head = 0; + + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || + strm->state->wrap == 2 || + (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) + return Z_STREAM_ERROR; + + s = strm->state; + if (s->wrap) + strm->adler = adler32(strm->adler, dictionary, dictLength); + + if (length < MIN_MATCH) return Z_OK; + if (length > s->w_size) { + length = s->w_size; + dictionary += dictLength - length; /* use the tail of the dictionary */ + } + zmemcpy(s->window, dictionary, length); + s->strstart = length; + s->block_start = (long)length; + + /* Insert all strings in the hash table (except for the last two bytes). + * s->lookahead stays null, so s->ins_h will be recomputed at the next + * call of fill_window. + */ + s->ins_h = s->window[0]; + UPDATE_HASH(s, s->ins_h, s->window[1]); + for (n = 0; n <= length - MIN_MATCH; n++) { + INSERT_STRING(s, n, hash_head); + } + if (hash_head) hash_head = 0; /* to make compiler happy */ + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + return Z_STREAM_ERROR; + } + + strm->total_in = strm->total_out = 0; + strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ + strm->data_type = Z_UNKNOWN; + + s = (deflate_state *)strm->state; + s->pending = 0; + s->pending_out = s->pending_buf; + + if (s->wrap < 0) { + s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ + } + s->status = s->wrap ? INIT_STATE : BUSY_STATE; + strm->adler = +#ifdef GZIP + s->wrap == 2 ? crc32(0L, Z_NULL, 0) : +#endif + adler32(0L, Z_NULL, 0); + s->last_flush = Z_NO_FLUSH; + + _tr_init(s); + lm_init(s); + + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateSetHeader (strm, head) + z_streamp strm; + gz_headerp head; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (strm->state->wrap != 2) return Z_STREAM_ERROR; + strm->state->gzhead = head; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePrime (strm, bits, value) + z_streamp strm; + int bits; + int value; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + strm->state->bi_valid = bits; + strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateParams(strm, level, strategy) + z_streamp strm; + int level; + int strategy; +{ + deflate_state *s; + compress_func func; + int err = Z_OK; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + func = configuration_table[s->level].func; + + if ((strategy != s->strategy || func != configuration_table[level].func) && + strm->total_in != 0) { + /* Flush the last buffer: */ + err = deflate(strm, Z_BLOCK); + } + if (s->level != level) { + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; + } + s->strategy = strategy; + return err; +} + +/* ========================================================================= */ +int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) + z_streamp strm; + int good_length; + int max_lazy; + int nice_length; + int max_chain; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + s->good_match = good_length; + s->max_lazy_match = max_lazy; + s->nice_match = nice_length; + s->max_chain_length = max_chain; + return Z_OK; +} + +/* ========================================================================= + * For the default windowBits of 15 and memLevel of 8, this function returns + * a close to exact, as well as small, upper bound on the compressed size. + * They are coded as constants here for a reason--if the #define's are + * changed, then this function needs to be changed as well. The return + * value for 15 and 8 only works for those exact settings. + * + * For any setting other than those defaults for windowBits and memLevel, + * the value returned is a conservative worst case for the maximum expansion + * resulting from using fixed blocks instead of stored blocks, which deflate + * can emit on compressed data for some combinations of the parameters. + * + * This function could be more sophisticated to provide closer upper bounds for + * every combination of windowBits and memLevel. But even the conservative + * upper bound of about 14% expansion does not seem onerous for output buffer + * allocation. + */ +uLong ZEXPORT deflateBound(strm, sourceLen) + z_streamp strm; + uLong sourceLen; +{ + deflate_state *s; + uLong complen, wraplen; + Bytef *str; + + /* conservative upper bound for compressed data */ + complen = sourceLen + + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + + /* if can't get parameters, return conservative bound plus zlib wrapper */ + if (strm == Z_NULL || strm->state == Z_NULL) + return complen + 6; + + /* compute wrapper length */ + s = strm->state; + switch (s->wrap) { + case 0: /* raw deflate */ + wraplen = 0; + break; + case 1: /* zlib wrapper */ + wraplen = 6 + (s->strstart ? 4 : 0); + break; + case 2: /* gzip wrapper */ + wraplen = 18; + if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ + if (s->gzhead->extra != Z_NULL) + wraplen += 2 + s->gzhead->extra_len; + str = s->gzhead->name; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + str = s->gzhead->comment; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + if (s->gzhead->hcrc) + wraplen += 2; + } + break; + default: /* for compiler happiness */ + wraplen = 6; + } + + /* if not default parameters, return conservative bound */ + if (s->w_bits != 15 || s->hash_bits != 8 + 7) + return complen + wraplen; + + /* default settings: return tight bound for that case */ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13 - 6 + wraplen; +} + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +local void putShortMSB (s, b) + deflate_state *s; + uInt b; +{ + put_byte(s, (Byte)(b >> 8)); + put_byte(s, (Byte)(b & 0xff)); +} + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->next_out buffer and copying into it. + * (See also read_buf()). + */ +local void flush_pending(strm) + z_streamp strm; +{ + unsigned len = strm->state->pending; + + if (len > strm->avail_out) len = strm->avail_out; + if (len == 0) return; + + zmemcpy(strm->next_out, strm->state->pending_out, len); + strm->next_out += len; + strm->state->pending_out += len; + strm->total_out += len; + strm->avail_out -= len; + strm->state->pending -= len; + if (strm->state->pending == 0) { + strm->state->pending_out = strm->state->pending_buf; + } +} + +/* ========================================================================= */ +int ZEXPORT deflate (strm, flush) + z_streamp strm; + int flush; +{ + int old_flush; /* value of flush param for previous deflate call */ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + flush > Z_BLOCK || flush < 0) { + return Z_STREAM_ERROR; + } + s = strm->state; + + if (strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0) || + (s->status == FINISH_STATE && flush != Z_FINISH)) { + ERR_RETURN(strm, Z_STREAM_ERROR); + } + if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); + + s->strm = strm; /* just in case */ + old_flush = s->last_flush; + s->last_flush = flush; + + /* Write the header */ + if (s->status == INIT_STATE) { +#ifdef GZIP + if (s->wrap == 2) { + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == Z_NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s->status = BUSY_STATE; + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != Z_NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); + } + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, + s->pending); + s->gzindex = 0; + s->status = EXTRA_STATE; + } + } + else +#endif + { + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; + else + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + } + } +#ifdef GZIP + if (s->status == EXTRA_STATE) { + if (s->gzhead->extra != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + + while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) + break; + } + put_byte(s, s->gzhead->extra[s->gzindex]); + s->gzindex++; + } + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (s->gzindex == s->gzhead->extra_len) { + s->gzindex = 0; + s->status = NAME_STATE; + } + } + else + s->status = NAME_STATE; + } + if (s->status == NAME_STATE) { + if (s->gzhead->name != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->name[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) { + s->gzindex = 0; + s->status = COMMENT_STATE; + } + } + else + s->status = COMMENT_STATE; + } + if (s->status == COMMENT_STATE) { + if (s->gzhead->comment != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->comment[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) + s->status = HCRC_STATE; + } + else + s->status = HCRC_STATE; + } + if (s->status == HCRC_STATE) { + if (s->gzhead->hcrc) { + if (s->pending + 2 > s->pending_buf_size) + flush_pending(strm); + if (s->pending + 2 <= s->pending_buf_size) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + strm->adler = crc32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + } + } + else + s->status = BUSY_STATE; + } +#endif + + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && flush <= old_flush && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm->avail_in != 0 || s->lookahead != 0 || + (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { + block_state bstate; + + bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : + (s->strategy == Z_RLE ? deflate_rle(s, flush) : + (*(configuration_table[s->level].func))(s, flush)); + + if (bstate == finish_started || bstate == finish_done) { + s->status = FINISH_STATE; + } + if (bstate == need_more || bstate == finish_started) { + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate == block_done) { + if (flush == Z_PARTIAL_FLUSH) { + _tr_align(s); + } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + _tr_stored_block(s, (char*)0, 0L, 0); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush == Z_FULL_FLUSH) { + CLEAR_HASH(s); /* forget history */ + if (s->lookahead == 0) { + s->strstart = 0; + s->block_start = 0L; + } + } + } + flush_pending(strm); + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + Assert(strm->avail_out > 0, "bug2"); + + if (flush != Z_FINISH) return Z_OK; + if (s->wrap <= 0) return Z_STREAM_END; + + /* Write the trailer */ +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); + put_byte(s, (Byte)(strm->total_in & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); + } + else +#endif + { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ + return s->pending != 0 ? Z_OK : Z_STREAM_END; +} + +/* ========================================================================= */ +int ZEXPORT deflateEnd (strm) + z_streamp strm; +{ + int status; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + + status = strm->state->status; + if (status != INIT_STATE && + status != EXTRA_STATE && + status != NAME_STATE && + status != COMMENT_STATE && + status != HCRC_STATE && + status != BUSY_STATE && + status != FINISH_STATE) { + return Z_STREAM_ERROR; + } + + /* Deallocate in reverse order of allocations: */ + TRY_FREE(strm, strm->state->pending_buf); + TRY_FREE(strm, strm->state->head); + TRY_FREE(strm, strm->state->prev); + TRY_FREE(strm, strm->state->window); + + ZFREE(strm, strm->state); + strm->state = Z_NULL; + + return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state. + * To simplify the source, this is not supported for 16-bit MSDOS (which + * doesn't have enough memory anyway to duplicate compression states). + */ +int ZEXPORT deflateCopy (dest, source) + z_streamp dest; + z_streamp source; +{ +#ifdef MAXSEG_64K + return Z_STREAM_ERROR; +#else + deflate_state *ds; + deflate_state *ss; + ushf *overlay; + + + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + return Z_STREAM_ERROR; + } + + ss = source->state; + + zmemcpy(dest, source, sizeof(z_stream)); + + ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); + if (ds == Z_NULL) return Z_MEM_ERROR; + dest->state = (struct internal_state FAR *) ds; + zmemcpy(ds, ss, sizeof(deflate_state)); + ds->strm = dest; + + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); + overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); + ds->pending_buf = (uchf *) overlay; + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { + deflateEnd (dest); + return Z_MEM_ERROR; + } + /* following zmemcpy do not work for 16-bit MSDOS */ + zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); + zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); + ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); + ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; + ds->bl_desc.dyn_tree = ds->bl_tree; + + return Z_OK; +#endif /* MAXSEG_64K */ +} + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local int read_buf(strm, buf, size) + z_streamp strm; + Bytef *buf; + unsigned size; +{ + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + if (strm->state->wrap == 1) { + strm->adler = adler32(strm->adler, strm->next_in, len); + } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, strm->next_in, len); + } +#endif + zmemcpy(buf, strm->next_in, len); + strm->next_in += len; + strm->total_in += len; + + return (int)len; +} + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init (s) + deflate_state *s; +{ + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +#ifndef FASTEST +#ifdef ASMV + match_init(); /* initialize the asm code */ +#endif +#endif +} + +#ifndef FASTEST +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +#ifndef ASMV +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or + * match.S. The code will be functionally equivalent. + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + int best_len = s->prev_length; /* best match length so far */ + int nice_match = s->nice_match; /* stop if match long enough */ + IPos limit = s->strstart > (IPos)MAX_DIST(s) ? + s->strstart - (IPos)MAX_DIST(s) : NIL; + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + Posf *prev = s->prev; + uInt wmask = s->w_mask; + +#ifdef UNALIGNED_OK + /* Compare two bytes at a time. Note: this is not always beneficial. + * Try with and without -DUNALIGNED_OK to check. + */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; + register ush scan_start = *(ushf*)scan; + register ush scan_end = *(ushf*)(scan+best_len-1); +#else + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end = scan[best_len]; +#endif + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s->prev_length >= s->good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + Assert(cur_match < s->strstart, "no future"); + match = s->window + cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) + /* This code assumes sizeof(unsigned short) == 2. Do not use + * UNALIGNED_OK if your compiler uses a different size. + */ + if (*(ushf*)(match+best_len-1) != scan_end || + *(ushf*)match != scan_start) continue; + + /* It is not necessary to compare scan[2] and match[2] since they are + * always equal when the other bytes match, given that the hash keys + * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at + * strstart+3, +5, ... up to strstart+257. We check for insufficient + * lookahead only every 4th comparison; the 128th check will be made + * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * necessary to put more guard bytes at the end of the window, or + * to check more often for insufficient lookahead. + */ + Assert(scan[2] == match[2], "scan[2]?"); + scan++, match++; + do { + } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + scan < strend); + /* The funny "do {}" generates better code on most compilers */ + + /* Here, scan <= window+strstart+257 */ + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + if (*scan == *match) scan++; + + len = (MAX_MATCH - 1) - (int)(strend-scan); + scan = strend - (MAX_MATCH-1); + +#else /* UNALIGNED_OK */ + + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match++; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + scan = strend - MAX_MATCH; + +#endif /* UNALIGNED_OK */ + + if (len > best_len) { + s->match_start = cur_match; + best_len = len; + if (len >= nice_match) break; +#ifdef UNALIGNED_OK + scan_end = *(ushf*)(scan+best_len-1); +#else + scan_end1 = scan[best_len-1]; + scan_end = scan[best_len]; +#endif + } + } while ((cur_match = prev[cur_match & wmask]) > limit + && --chain_length != 0); + + if ((uInt)best_len <= s->lookahead) return (uInt)best_len; + return s->lookahead; +} +#endif /* ASMV */ + +#else /* FASTEST */ + +/* --------------------------------------------------------------------------- + * Optimized version for FASTEST only + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + Assert(cur_match < s->strstart, "no future"); + + match = s->window + cur_match; + + /* Return failure if the match length is less than 2: + */ + if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match += 2; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + + if (len < MIN_MATCH) return MIN_MATCH - 1; + + s->match_start = cur_match; + return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; +} + +#endif /* FASTEST */ + +#ifdef DEBUG +/* =========================================================================== + * Check that the match at match_start is indeed a match. + */ +local void check_match(s, start, match, length) + deflate_state *s; + IPos start, match; + int length; +{ + /* check that the match is indeed a match */ + if (zmemcmp(s->window + match, + s->window + start, length) != EQUAL) { + fprintf(stderr, " start %u, match %u, length %d\n", + start, match, length); + do { + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); + z_error("invalid match"); + } + if (z_verbose > 1) { + fprintf(stderr,"\\[%d,%d]", start-match, length); + do { putc(s->window[start++], stderr); } while (--length != 0); + } +} +#else +# define check_match(s, start, match, length) +#endif /* DEBUG */ + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(s) + deflate_state *s; +{ + register unsigned n, m; + register Posf *p; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s->strstart >= wsize+MAX_DIST(s)) { + + zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); + + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif + more += wsize; + } + if (s->strm->avail_in == 0) return; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead >= MIN_MATCH) { + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ + if (s->high_water < s->window_size) { + ulg curr = s->strstart + (ulg)(s->lookahead); + ulg init; + + if (s->high_water < curr) { + /* Previous high water mark below current data -- zero WIN_INIT + * bytes or up to end of window, whichever is less. + */ + init = s->window_size - curr; + if (init > WIN_INIT) + init = WIN_INIT; + zmemzero(s->window + curr, (unsigned)init); + s->high_water = curr + init; + } + else if (s->high_water < (ulg)curr + WIN_INIT) { + /* High water mark at or above current data, but below current data + * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up + * to end of window, whichever is less. + */ + init = (ulg)curr + WIN_INIT - s->high_water; + if (init > s->window_size - s->high_water) + init = s->window_size - s->high_water; + zmemzero(s->window + s->high_water, (unsigned)init); + s->high_water += init; + } + } +} + +/* =========================================================================== + * Flush the current block, with given end-of-file flag. + * IN assertion: strstart is set to the end of the current match. + */ +#define FLUSH_BLOCK_ONLY(s, last) { \ + _tr_flush_block(s, (s->block_start >= 0L ? \ + (charf *)&s->window[(unsigned)s->block_start] : \ + (charf *)Z_NULL), \ + (ulg)((long)s->strstart - s->block_start), \ + (last)); \ + s->block_start = s->strstart; \ + flush_pending(s->strm); \ + Tracev((stderr,"[FLUSH]")); \ +} + +/* Same but force premature exit if necessary. */ +#define FLUSH_BLOCK(s, last) { \ + FLUSH_BLOCK_ONLY(s, last); \ + if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +local block_state deflate_stored(s, flush) + deflate_state *s; + int flush; +{ + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + ulg max_block_size = 0xffff; + ulg max_start; + + if (max_block_size > s->pending_buf_size - 5) { + max_block_size = s->pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s->lookahead <= 1) { + + Assert(s->strstart < s->w_size+MAX_DIST(s) || + s->block_start >= (long)s->w_size, "slide too late"); + + fill_window(s); + if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + + if (s->lookahead == 0) break; /* flush the current block */ + } + Assert(s->block_start >= 0L, "block gone"); + + s->strstart += s->lookahead; + s->lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; + if (s->strstart == 0 || (ulg)s->strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; + FLUSH_BLOCK(s, 0); + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { + FLUSH_BLOCK(s, 0); + } + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +local block_state deflate_fast(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of the hash chain */ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + } + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->match_start, s->match_length); + + _tr_tally_dist(s, s->strstart - s->match_start, + s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ +#ifndef FASTEST + if (s->match_length <= s->max_insert_length && + s->lookahead >= MIN_MATCH) { + s->match_length--; /* string at strstart already in table */ + do { + s->strstart++; + INSERT_STRING(s, s->strstart, hash_head); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s->match_length != 0); + s->strstart++; + } else +#endif + { + s->strstart += s->match_length; + s->match_length = 0; + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +#ifndef FASTEST +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +local block_state deflate_slow(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of hash chain */ + int bflush; /* set if current block must be flushed */ + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + */ + s->prev_length = s->match_length, s->prev_match = s->match_start; + s->match_length = MIN_MATCH-1; + + if (hash_head != NIL && s->prev_length < s->max_lazy_match && + s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + + if (s->match_length <= 5 && (s->strategy == Z_FILTERED +#if TOO_FAR <= 32767 + || (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR) +#endif + )) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s->match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { + uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + check_match(s, s->strstart-1, s->prev_match, s->prev_length); + + _tr_tally_dist(s, s->strstart -1 - s->prev_match, + s->prev_length - MIN_MATCH, bflush); + + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s->lookahead -= s->prev_length-1; + s->prev_length -= 2; + do { + if (++s->strstart <= max_insert) { + INSERT_STRING(s, s->strstart, hash_head); + } + } while (--s->prev_length != 0); + s->match_available = 0; + s->match_length = MIN_MATCH-1; + s->strstart++; + + if (bflush) FLUSH_BLOCK(s, 0); + + } else if (s->match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { + FLUSH_BLOCK_ONLY(s, 0); + } + s->strstart++; + s->lookahead--; + if (s->strm->avail_out == 0) return need_more; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s->match_available = 1; + s->strstart++; + s->lookahead--; + } + } + Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s->match_available) { + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + s->match_available = 0; + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} +#endif /* FASTEST */ + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +local block_state deflate_rle(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + uInt prev; /* byte at distance one to match */ + Bytef *scan, *strend; /* scan goes up to strend for length of run */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest encodable run. + */ + if (s->lookahead < MAX_MATCH) { + fill_window(s); + if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s->match_length = 0; + if (s->lookahead >= MIN_MATCH && s->strstart > 0) { + scan = s->window + s->strstart - 1; + prev = *scan; + if (prev == *++scan && prev == *++scan && prev == *++scan) { + strend = s->window + s->strstart + MAX_MATCH; + do { + } while (prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + scan < strend); + s->match_length = MAX_MATCH - (int)(strend - scan); + if (s->match_length > s->lookahead) + s->match_length = s->lookahead; + } + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->strstart - 1, s->match_length); + + _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + s->strstart += s->match_length; + s->match_length = 0; + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +local block_state deflate_huff(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s->lookahead == 0) { + fill_window(s); + if (s->lookahead == 0) { + if (flush == Z_NO_FLUSH) + return need_more; + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s->match_length = 0; + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} diff --git a/zlib-1.2.5/deflate.h b/zlib-1.2.5/deflate.h new file mode 100644 index 000000000..cbf0d1ea5 --- /dev/null +++ b/zlib-1.2.5/deflate.h @@ -0,0 +1,342 @@ +/* deflate.h -- internal compression state + * Copyright (C) 1995-2010 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef DEFLATE_H +#define DEFLATE_H + +#include "zutil.h" + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer creation by deflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip encoding + should be left enabled. */ +#ifndef NO_GZIP +# define GZIP +#endif + +/* =========================================================================== + * Internal compression state. + */ + +#define LENGTH_CODES 29 +/* number of length codes, not counting the special END_BLOCK code */ + +#define LITERALS 256 +/* number of literal bytes 0..255 */ + +#define L_CODES (LITERALS+1+LENGTH_CODES) +/* number of Literal or Length codes, including the END_BLOCK code */ + +#define D_CODES 30 +/* number of distance codes */ + +#define BL_CODES 19 +/* number of codes used to transfer the bit lengths */ + +#define HEAP_SIZE (2*L_CODES+1) +/* maximum heap size */ + +#define MAX_BITS 15 +/* All codes must not exceed MAX_BITS bits */ + +#define INIT_STATE 42 +#define EXTRA_STATE 69 +#define NAME_STATE 73 +#define COMMENT_STATE 91 +#define HCRC_STATE 103 +#define BUSY_STATE 113 +#define FINISH_STATE 666 +/* Stream status */ + + +/* Data structure describing a single value and its code string. */ +typedef struct ct_data_s { + union { + ush freq; /* frequency count */ + ush code; /* bit string */ + } fc; + union { + ush dad; /* father node in Huffman tree */ + ush len; /* length of bit string */ + } dl; +} FAR ct_data; + +#define Freq fc.freq +#define Code fc.code +#define Dad dl.dad +#define Len dl.len + +typedef struct static_tree_desc_s static_tree_desc; + +typedef struct tree_desc_s { + ct_data *dyn_tree; /* the dynamic tree */ + int max_code; /* largest code with non zero frequency */ + static_tree_desc *stat_desc; /* the corresponding static tree */ +} FAR tree_desc; + +typedef ush Pos; +typedef Pos FAR Posf; +typedef unsigned IPos; + +/* A Pos is an index in the character window. We use short instead of int to + * save space in the various tables. IPos is used only for parameter passing. + */ + +typedef struct internal_state { + z_streamp strm; /* pointer back to this zlib stream */ + int status; /* as the name implies */ + Bytef *pending_buf; /* output still pending */ + ulg pending_buf_size; /* size of pending_buf */ + Bytef *pending_out; /* next pending byte to output to the stream */ + uInt pending; /* nb of bytes in the pending buffer */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + gz_headerp gzhead; /* gzip header information to write */ + uInt gzindex; /* where in extra, name, or comment */ + Byte method; /* STORED (for zip only) or DEFLATED */ + int last_flush; /* value of flush param for previous deflate call */ + + /* used by deflate.c: */ + + uInt w_size; /* LZ77 window size (32K by default) */ + uInt w_bits; /* log2(w_size) (8..16) */ + uInt w_mask; /* w_size - 1 */ + + Bytef *window; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. Also, it limits + * the window size to 64K, which is quite useful on MSDOS. + * To do: use the user input buffer as sliding window. + */ + + ulg window_size; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + Posf *prev; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + Posf *head; /* Heads of the hash chains or NIL. */ + + uInt ins_h; /* hash index of string to be inserted */ + uInt hash_size; /* number of elements in hash table */ + uInt hash_bits; /* log2(hash_size) */ + uInt hash_mask; /* hash_size-1 */ + + uInt hash_shift; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + long block_start; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + uInt match_length; /* length of best match */ + IPos prev_match; /* previous match */ + int match_available; /* set if previous match exists */ + uInt strstart; /* start of string to insert */ + uInt match_start; /* start of matching string */ + uInt lookahead; /* number of valid bytes ahead in window */ + + uInt prev_length; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + uInt max_chain_length; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + uInt max_lazy_match; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ +# define max_insert_length max_lazy_match + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + int level; /* compression level (1..9) */ + int strategy; /* favor or force Huffman coding*/ + + uInt good_match; + /* Use a faster search when the previous match is longer than this */ + + int nice_match; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + /* Didn't use ct_data typedef below to supress compiler warning */ + struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + struct tree_desc_s l_desc; /* desc. for literal tree */ + struct tree_desc_s d_desc; /* desc. for distance tree */ + struct tree_desc_s bl_desc; /* desc. for bit length tree */ + + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + int heap_len; /* number of elements in the heap */ + int heap_max; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + uch depth[2*L_CODES+1]; + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + uchf *l_buf; /* buffer for literals or lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + uInt last_lit; /* running index in l_buf */ + + ushf *d_buf; + /* Buffer for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ + uInt matches; /* number of string matches in current block */ + int last_eob_len; /* bit length of EOB code for last block */ + +#ifdef DEBUG + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ +#endif + + ush bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + ulg high_water; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ + +} FAR deflate_state; + +/* Output a byte on the stream. + * IN assertion: there is enough room in pending_buf. + */ +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} + + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) +/* In order to simplify the code, particularly on 16 bit machines, match + * distances are limited to MAX_DIST instead of WSIZE. + */ + +#define WIN_INIT MAX_MATCH +/* Number of bytes after end of data in window to initialize in order to avoid + memory checker errors from longest match routines */ + + /* in trees.c */ +void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); +int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); +void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); +void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); +void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); + +#define d_code(dist) \ + ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) +/* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. _dist_code[256] and _dist_code[257] are never + * used. + */ + +#ifndef DEBUG +/* Inline versions of _tr_tally for speed: */ + +#if defined(GEN_TREES_H) || !defined(STDC) + extern uch ZLIB_INTERNAL _length_code[]; + extern uch ZLIB_INTERNAL _dist_code[]; +#else + extern const uch ZLIB_INTERNAL _length_code[]; + extern const uch ZLIB_INTERNAL _dist_code[]; +#endif + +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->last_lit] = 0; \ + s->l_buf[s->last_lit++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (length); \ + ush dist = (distance); \ + s->d_buf[s->last_lit] = dist; \ + s->l_buf[s->last_lit++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +#else +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +# define _tr_tally_dist(s, distance, length, flush) \ + flush = _tr_tally(s, distance, length) +#endif + +#endif /* DEFLATE_H */ diff --git a/zlib-1.2.5/example.c b/zlib-1.2.5/example.c new file mode 100644 index 000000000..604736f15 --- /dev/null +++ b/zlib-1.2.5/example.c @@ -0,0 +1,565 @@ +/* example.c -- usage example of the zlib compression library + * Copyright (C) 1995-2006 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zlib.h" +#include <stdio.h> + +#ifdef STDC +# include <string.h> +# include <stdlib.h> +#endif + +#if defined(VMS) || defined(RISCOS) +# define TESTFILE "foo-gz" +#else +# define TESTFILE "foo.gz" +#endif + +#define CHECK_ERR(err, msg) { \ + if (err != Z_OK) { \ + fprintf(stderr, "%s error: %d\n", msg, err); \ + exit(1); \ + } \ +} + +const char hello[] = "hello, hello!"; +/* "hello world" would be more standard, but the repeated "hello" + * stresses the compression code better, sorry... + */ + +const char dictionary[] = "hello"; +uLong dictId; /* Adler32 value of the dictionary */ + +void test_compress OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_gzio OF((const char *fname, + Byte *uncompr, uLong uncomprLen)); +void test_deflate OF((Byte *compr, uLong comprLen)); +void test_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_deflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_flush OF((Byte *compr, uLong *comprLen)); +void test_sync OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_dict_deflate OF((Byte *compr, uLong comprLen)); +void test_dict_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +int main OF((int argc, char *argv[])); + +/* =========================================================================== + * Test compress() and uncompress() + */ +void test_compress(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + uLong len = (uLong)strlen(hello)+1; + + err = compress(compr, &comprLen, (const Bytef*)hello, len); + CHECK_ERR(err, "compress"); + + strcpy((char*)uncompr, "garbage"); + + err = uncompress(uncompr, &uncomprLen, compr, comprLen); + CHECK_ERR(err, "uncompress"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad uncompress\n"); + exit(1); + } else { + printf("uncompress(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test read/write of .gz files + */ +void test_gzio(fname, uncompr, uncomprLen) + const char *fname; /* compressed file name */ + Byte *uncompr; + uLong uncomprLen; +{ +#ifdef NO_GZCOMPRESS + fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); +#else + int err; + int len = (int)strlen(hello)+1; + gzFile file; + z_off_t pos; + + file = gzopen(fname, "wb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + gzputc(file, 'h'); + if (gzputs(file, "ello") != 4) { + fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); + exit(1); + } + if (gzprintf(file, ", %s!", "hello") != 8) { + fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); + exit(1); + } + gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ + gzclose(file); + + file = gzopen(fname, "rb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + strcpy((char*)uncompr, "garbage"); + + if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { + fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); + exit(1); + } else { + printf("gzread(): %s\n", (char*)uncompr); + } + + pos = gzseek(file, -8L, SEEK_CUR); + if (pos != 6 || gztell(file) != pos) { + fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", + (long)pos, (long)gztell(file)); + exit(1); + } + + if (gzgetc(file) != ' ') { + fprintf(stderr, "gzgetc error\n"); + exit(1); + } + + if (gzungetc(' ', file) != ' ') { + fprintf(stderr, "gzungetc error\n"); + exit(1); + } + + gzgets(file, (char*)uncompr, (int)uncomprLen); + if (strlen((char*)uncompr) != 7) { /* " hello!" */ + fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello + 6)) { + fprintf(stderr, "bad gzgets after gzseek\n"); + exit(1); + } else { + printf("gzgets() after gzseek: %s\n", (char*)uncompr); + } + + gzclose(file); +#endif +} + +/* =========================================================================== + * Test deflate() with small buffers + */ +void test_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + uLong len = (uLong)strlen(hello)+1; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + + while (c_stream.total_in != len && c_stream.total_out < comprLen) { + c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + } + /* Finish the stream, still forcing small buffers: */ + for (;;) { + c_stream.avail_out = 1; + err = deflate(&c_stream, Z_FINISH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "deflate"); + } + + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with small buffers + */ +void test_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 0; + d_stream.next_out = uncompr; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { + d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate\n"); + exit(1); + } else { + printf("inflate(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test deflate() with large buffers and dynamic change of compression level + */ +void test_large_deflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_SPEED); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + /* At this point, uncompr is still mostly zeroes, so it should compress + * very well: + */ + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + if (c_stream.avail_in != 0) { + fprintf(stderr, "deflate not greedy\n"); + exit(1); + } + + /* Feed in already compressed data and switch to no compression: */ + deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); + c_stream.next_in = compr; + c_stream.avail_in = (uInt)comprLen/2; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + /* Switch back to compressing mode: */ + deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with large buffers + */ +void test_large_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + for (;;) { + d_stream.next_out = uncompr; /* discard the output */ + d_stream.avail_out = (uInt)uncomprLen; + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "large inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (d_stream.total_out != 2*uncomprLen + comprLen/2) { + fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); + exit(1); + } else { + printf("large_inflate(): OK\n"); + } +} + +/* =========================================================================== + * Test deflate() with full flush + */ +void test_flush(compr, comprLen) + Byte *compr; + uLong *comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + uInt len = (uInt)strlen(hello)+1; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + c_stream.avail_in = 3; + c_stream.avail_out = (uInt)*comprLen; + err = deflate(&c_stream, Z_FULL_FLUSH); + CHECK_ERR(err, "deflate"); + + compr[3]++; /* force an error in first compressed block */ + c_stream.avail_in = len - 3; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + CHECK_ERR(err, "deflate"); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); + + *comprLen = c_stream.total_out; +} + +/* =========================================================================== + * Test inflateSync() + */ +void test_sync(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 2; /* just read the zlib header */ + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + inflate(&d_stream, Z_NO_FLUSH); + CHECK_ERR(err, "inflate"); + + d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ + err = inflateSync(&d_stream); /* but skip the damaged part */ + CHECK_ERR(err, "inflateSync"); + + err = inflate(&d_stream, Z_FINISH); + if (err != Z_DATA_ERROR) { + fprintf(stderr, "inflate should report DATA_ERROR\n"); + /* Because of incorrect adler32 */ + exit(1); + } + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + printf("after inflateSync(): hel%s\n", (char *)uncompr); +} + +/* =========================================================================== + * Test deflate() with preset dictionary + */ +void test_dict_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + err = deflateSetDictionary(&c_stream, + (const Bytef*)dictionary, sizeof(dictionary)); + CHECK_ERR(err, "deflateSetDictionary"); + + dictId = c_stream.adler; + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + c_stream.next_in = (Bytef*)hello; + c_stream.avail_in = (uInt)strlen(hello)+1; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with a preset dictionary + */ +void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + for (;;) { + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + if (err == Z_NEED_DICT) { + if (d_stream.adler != dictId) { + fprintf(stderr, "unexpected dictionary"); + exit(1); + } + err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, + sizeof(dictionary)); + } + CHECK_ERR(err, "inflate with dict"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate with dict\n"); + exit(1); + } else { + printf("inflate with dictionary: %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Usage: example [output.gz [input.gz]] + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + Byte *compr, *uncompr; + uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ + uLong uncomprLen = comprLen; + static const char* myVersion = ZLIB_VERSION; + + if (zlibVersion()[0] != myVersion[0]) { + fprintf(stderr, "incompatible zlib version\n"); + exit(1); + + } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { + fprintf(stderr, "warning: different zlib version\n"); + } + + printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", + ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); + + compr = (Byte*)calloc((uInt)comprLen, 1); + uncompr = (Byte*)calloc((uInt)uncomprLen, 1); + /* compr and uncompr are cleared to avoid reading uninitialized + * data and to ensure that uncompr compresses well. + */ + if (compr == Z_NULL || uncompr == Z_NULL) { + printf("out of memory\n"); + exit(1); + } + test_compress(compr, comprLen, uncompr, uncomprLen); + + test_gzio((argc > 1 ? argv[1] : TESTFILE), + uncompr, uncomprLen); + + test_deflate(compr, comprLen); + test_inflate(compr, comprLen, uncompr, uncomprLen); + + test_large_deflate(compr, comprLen, uncompr, uncomprLen); + test_large_inflate(compr, comprLen, uncompr, uncomprLen); + + test_flush(compr, &comprLen); + test_sync(compr, comprLen, uncompr, uncomprLen); + comprLen = uncomprLen; + + test_dict_deflate(compr, comprLen); + test_dict_inflate(compr, comprLen, uncompr, uncomprLen); + + free(compr); + free(uncompr); + + return 0; +} diff --git a/zlib-1.2.5/gzclose.c b/zlib-1.2.5/gzclose.c new file mode 100644 index 000000000..caeb99a31 --- /dev/null +++ b/zlib-1.2.5/gzclose.c @@ -0,0 +1,25 @@ +/* gzclose.c -- zlib gzclose() function + * Copyright (C) 2004, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* gzclose() is in a separate file so that it is linked in only if it is used. + That way the other gzclose functions can be used instead to avoid linking in + unneeded compression or decompression routines. */ +int ZEXPORT gzclose(file) + gzFile file; +{ +#ifndef NO_GZCOMPRESS + gz_statep state; + + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); +#else + return gzclose_r(file); +#endif +} diff --git a/zlib-1.2.5/gzguts.h b/zlib-1.2.5/gzguts.h new file mode 100644 index 000000000..0f8fb79f8 --- /dev/null +++ b/zlib-1.2.5/gzguts.h @@ -0,0 +1,132 @@ +/* gzguts.h -- zlib internal header definitions for gz* operations + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef _LARGEFILE64_SOURCE +# ifndef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# endif +# ifdef _FILE_OFFSET_BITS +# undef _FILE_OFFSET_BITS +# endif +#endif + +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include <stdio.h> +#include "zlib.h" +#ifdef STDC +# include <string.h> +# include <stdlib.h> +# include <limits.h> +#endif +#include <fcntl.h> + +#ifdef NO_DEFLATE /* for compatibility with old definition */ +# define NO_GZCOMPRESS +#endif + +#ifdef _MSC_VER +# include <io.h> +# define vsnprintf _vsnprintf +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +/* gz* functions always use library allocation functions */ +#ifndef STDC + extern voidp malloc OF((uInt size)); + extern void free OF((voidpf ptr)); +#endif + +/* get errno and strerror definition */ +#if defined UNDER_CE +# include <windows.h> +# define zstrerror() gz_strwinerror((DWORD)GetLastError()) +#else +# ifdef STDC +# include <errno.h> +# define zstrerror() strerror(errno) +# else +# define zstrerror() "stdio error (consult errno)" +# endif +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); +#endif + +/* default i/o buffer size -- double this for output when reading */ +#define GZBUFSIZE 8192 + +/* gzip modes, also provide a little integrity check on the passed structure */ +#define GZ_NONE 0 +#define GZ_READ 7247 +#define GZ_WRITE 31153 +#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ + +/* values for gz_state how */ +#define LOOK 0 /* look for a gzip header */ +#define COPY 1 /* copy input directly */ +#define GZIP 2 /* decompress a gzip stream */ + +/* internal gzip file state data structure */ +typedef struct { + /* used for both reading and writing */ + int mode; /* see gzip modes above */ + int fd; /* file descriptor */ + char *path; /* path or fd for error messages */ + z_off64_t pos; /* current position in uncompressed data */ + unsigned size; /* buffer size, zero if not allocated yet */ + unsigned want; /* requested buffer size, default is GZBUFSIZE */ + unsigned char *in; /* input buffer */ + unsigned char *out; /* output buffer (double-sized when reading) */ + unsigned char *next; /* next output data to deliver or write */ + /* just for reading */ + unsigned have; /* amount of output data unused at next */ + int eof; /* true if end of input file reached */ + z_off64_t start; /* where the gzip data started, for rewinding */ + z_off64_t raw; /* where the raw data started, for seeking */ + int how; /* 0: get header, 1: copy, 2: decompress */ + int direct; /* true if last read direct, false if gzip */ + /* just for writing */ + int level; /* compression level */ + int strategy; /* compression strategy */ + /* seek request */ + z_off64_t skip; /* amount to skip (already rewound if backwards) */ + int seek; /* true if seek request pending */ + /* error information */ + int err; /* error code */ + char *msg; /* error message */ + /* zlib inflate or deflate stream */ + z_stream strm; /* stream structure in-place (not a pointer) */ +} gz_state; +typedef gz_state FAR *gz_statep; + +/* shared functions */ +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +#if defined UNDER_CE +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); +#endif + +/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t + value -- needed when comparing unsigned to z_off64_t, which is signed + (possible z_off64_t types off_t, off64_t, and long are all signed) */ +#ifdef INT_MAX +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) +#else +unsigned ZLIB_INTERNAL gz_intmax OF((void)); +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) +#endif diff --git a/zlib-1.2.5/gzlib.c b/zlib-1.2.5/gzlib.c new file mode 100644 index 000000000..603e60ed5 --- /dev/null +++ b/zlib-1.2.5/gzlib.c @@ -0,0 +1,537 @@ +/* gzlib.c -- zlib functions common to reading and writing gzip files + * Copyright (C) 2004, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define LSEEK lseek64 +#else +# define LSEEK lseek +#endif + +/* Local functions */ +local void gz_reset OF((gz_statep)); +local gzFile gz_open OF((const char *, int, const char *)); + +#if defined UNDER_CE + +/* Map the Windows error number in ERROR to a locale-dependent error message + string and return a pointer to it. Typically, the values for ERROR come + from GetLastError. + + The string pointed to shall not be modified by the application, but may be + overwritten by a subsequent call to gz_strwinerror + + The gz_strwinerror function does not change the current setting of + GetLastError. */ +char ZLIB_INTERNAL *gz_strwinerror (error) + DWORD error; +{ + static char buf[1024]; + + wchar_t *msgbuf; + DWORD lasterr = GetLastError(); + DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, + error, + 0, /* Default language */ + (LPVOID)&msgbuf, + 0, + NULL); + if (chars != 0) { + /* If there is an \r\n appended, zap it. */ + if (chars >= 2 + && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { + chars -= 2; + msgbuf[chars] = 0; + } + + if (chars > sizeof (buf) - 1) { + chars = sizeof (buf) - 1; + msgbuf[chars] = 0; + } + + wcstombs(buf, msgbuf, chars + 1); + LocalFree(msgbuf); + } + else { + sprintf(buf, "unknown win32 error (%ld)", error); + } + + SetLastError(lasterr); + return buf; +} + +#endif /* UNDER_CE */ + +/* Reset gzip file state */ +local void gz_reset(state) + gz_statep state; +{ + if (state->mode == GZ_READ) { /* for reading ... */ + state->have = 0; /* no output data available */ + state->eof = 0; /* not at end of file */ + state->how = LOOK; /* look for gzip header */ + state->direct = 1; /* default for empty file */ + } + state->seek = 0; /* no seek request pending */ + gz_error(state, Z_OK, NULL); /* clear error */ + state->pos = 0; /* no uncompressed data yet */ + state->strm.avail_in = 0; /* no input data yet */ +} + +/* Open a gzip file either by name or file descriptor. */ +local gzFile gz_open(path, fd, mode) + const char *path; + int fd; + const char *mode; +{ + gz_statep state; + + /* allocate gzFile structure to return */ + state = malloc(sizeof(gz_state)); + if (state == NULL) + return NULL; + state->size = 0; /* no buffers allocated yet */ + state->want = GZBUFSIZE; /* requested buffer size */ + state->msg = NULL; /* no error message yet */ + + /* interpret mode */ + state->mode = GZ_NONE; + state->level = Z_DEFAULT_COMPRESSION; + state->strategy = Z_DEFAULT_STRATEGY; + while (*mode) { + if (*mode >= '0' && *mode <= '9') + state->level = *mode - '0'; + else + switch (*mode) { + case 'r': + state->mode = GZ_READ; + break; +#ifndef NO_GZCOMPRESS + case 'w': + state->mode = GZ_WRITE; + break; + case 'a': + state->mode = GZ_APPEND; + break; +#endif + case '+': /* can't read and write at the same time */ + free(state); + return NULL; + case 'b': /* ignore -- will request binary anyway */ + break; + case 'f': + state->strategy = Z_FILTERED; + break; + case 'h': + state->strategy = Z_HUFFMAN_ONLY; + break; + case 'R': + state->strategy = Z_RLE; + break; + case 'F': + state->strategy = Z_FIXED; + default: /* could consider as an error, but just ignore */ + ; + } + mode++; + } + + /* must provide an "r", "w", or "a" */ + if (state->mode == GZ_NONE) { + free(state); + return NULL; + } + + /* save the path name for error messages */ + state->path = malloc(strlen(path) + 1); + if (state->path == NULL) { + free(state); + return NULL; + } + strcpy(state->path, path); + + /* open the file with the appropriate mode (or just use fd) */ + state->fd = fd != -1 ? fd : + open(path, +#ifdef O_LARGEFILE + O_LARGEFILE | +#endif +#ifdef O_BINARY + O_BINARY | +#endif + (state->mode == GZ_READ ? + O_RDONLY : + (O_WRONLY | O_CREAT | ( + state->mode == GZ_WRITE ? + O_TRUNC : + O_APPEND))), + 0666); + if (state->fd == -1) { + free(state->path); + free(state); + return NULL; + } + if (state->mode == GZ_APPEND) + state->mode = GZ_WRITE; /* simplify later checks */ + + /* save the current position for rewinding (only if reading) */ + if (state->mode == GZ_READ) { + state->start = LSEEK(state->fd, 0, SEEK_CUR); + if (state->start == -1) state->start = 0; + } + + /* initialize stream */ + gz_reset(state); + + /* return stream */ + return (gzFile)state; +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzopen(path, mode) + const char *path; + const char *mode; +{ + return gz_open(path, -1, mode); +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzopen64(path, mode) + const char *path; + const char *mode; +{ + return gz_open(path, -1, mode); +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzdopen(fd, mode) + int fd; + const char *mode; +{ + char *path; /* identifier for error messages */ + gzFile gz; + + if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) + return NULL; + sprintf(path, "<fd:%d>", fd); /* for debugging */ + gz = gz_open(path, fd, mode); + free(path); + return gz; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzbuffer(file, size) + gzFile file; + unsigned size; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* make sure we haven't already allocated memory */ + if (state->size != 0) + return -1; + + /* check and set requested size */ + if (size == 0) + return -1; + state->want = size; + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzrewind(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* back up and start over */ + if (LSEEK(state->fd, state->start, SEEK_SET) == -1) + return -1; + gz_reset(state); + return 0; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gzseek64(file, offset, whence) + gzFile file; + z_off64_t offset; + int whence; +{ + unsigned n; + z_off64_t ret; + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* check that there's no error */ + if (state->err != Z_OK) + return -1; + + /* can only seek from start or relative to current position */ + if (whence != SEEK_SET && whence != SEEK_CUR) + return -1; + + /* normalize offset to a SEEK_CUR specification */ + if (whence == SEEK_SET) + offset -= state->pos; + else if (state->seek) + offset += state->skip; + state->seek = 0; + + /* if within raw area while reading, just go there */ + if (state->mode == GZ_READ && state->how == COPY && + state->pos + offset >= state->raw) { + ret = LSEEK(state->fd, offset - state->have, SEEK_CUR); + if (ret == -1) + return -1; + state->have = 0; + state->eof = 0; + state->seek = 0; + gz_error(state, Z_OK, NULL); + state->strm.avail_in = 0; + state->pos += offset; + return state->pos; + } + + /* calculate skip amount, rewinding if needed for back seek when reading */ + if (offset < 0) { + if (state->mode != GZ_READ) /* writing -- can't go backwards */ + return -1; + offset += state->pos; + if (offset < 0) /* before start of file! */ + return -1; + if (gzrewind(file) == -1) /* rewind, then skip to offset */ + return -1; + } + + /* if reading, skip what's in output buffer (one less gzgetc() check) */ + if (state->mode == GZ_READ) { + n = GT_OFF(state->have) || (z_off64_t)state->have > offset ? + (unsigned)offset : state->have; + state->have -= n; + state->next += n; + state->pos += n; + offset -= n; + } + + /* request skip (if not zero) */ + if (offset) { + state->seek = 1; + state->skip = offset; + } + return state->pos + offset; +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gzseek(file, offset, whence) + gzFile file; + z_off_t offset; + int whence; +{ + z_off64_t ret; + + ret = gzseek64(file, (z_off64_t)offset, whence); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gztell64(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* return position */ + return state->pos + (state->seek ? state->skip : 0); +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gztell(file) + gzFile file; +{ + z_off64_t ret; + + ret = gztell64(file); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gzoffset64(file) + gzFile file; +{ + z_off64_t offset; + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* compute and return effective offset in file */ + offset = LSEEK(state->fd, 0, SEEK_CUR); + if (offset == -1) + return -1; + if (state->mode == GZ_READ) /* reading */ + offset -= state->strm.avail_in; /* don't count buffered input */ + return offset; +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gzoffset(file) + gzFile file; +{ + z_off64_t ret; + + ret = gzoffset64(file); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzeof(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return 0; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return 0; + + /* return end-of-file state */ + return state->mode == GZ_READ ? + (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0; +} + +/* -- see zlib.h -- */ +const char * ZEXPORT gzerror(file, errnum) + gzFile file; + int *errnum; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return NULL; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return NULL; + + /* return error information */ + if (errnum != NULL) + *errnum = state->err; + return state->msg == NULL ? "" : state->msg; +} + +/* -- see zlib.h -- */ +void ZEXPORT gzclearerr(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return; + + /* clear error and end-of-file */ + if (state->mode == GZ_READ) + state->eof = 0; + gz_error(state, Z_OK, NULL); +} + +/* Create an error message in allocated memory and set state->err and + state->msg accordingly. Free any previous error message already there. Do + not try to free or allocate space if the error is Z_MEM_ERROR (out of + memory). Simply save the error message as a static string. If there is an + allocation failure constructing the error message, then convert the error to + out of memory. */ +void ZLIB_INTERNAL gz_error(state, err, msg) + gz_statep state; + int err; + const char *msg; +{ + /* free previously allocated message and clear */ + if (state->msg != NULL) { + if (state->err != Z_MEM_ERROR) + free(state->msg); + state->msg = NULL; + } + + /* set error code, and if no message, then done */ + state->err = err; + if (msg == NULL) + return; + + /* for an out of memory error, save as static string */ + if (err == Z_MEM_ERROR) { + state->msg = (char *)msg; + return; + } + + /* construct error message with path */ + if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { + state->err = Z_MEM_ERROR; + state->msg = (char *)"out of memory"; + return; + } + strcpy(state->msg, state->path); + strcat(state->msg, ": "); + strcat(state->msg, msg); + return; +} + +#ifndef INT_MAX +/* portably return maximum value for an int (when limits.h presumed not + available) -- we need to do this to cover cases where 2's complement not + used, since C standard permits 1's complement and sign-bit representations, + otherwise we could just use ((unsigned)-1) >> 1 */ +unsigned ZLIB_INTERNAL gz_intmax() +{ + unsigned p, q; + + p = 1; + do { + q = p; + p <<= 1; + p++; + } while (p > q); + return q >> 1; +} +#endif diff --git a/zlib-1.2.5/gzread.c b/zlib-1.2.5/gzread.c new file mode 100644 index 000000000..548201ab0 --- /dev/null +++ b/zlib-1.2.5/gzread.c @@ -0,0 +1,653 @@ +/* gzread.c -- zlib functions for reading gzip files + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* Local functions */ +local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); +local int gz_avail OF((gz_statep)); +local int gz_next4 OF((gz_statep, unsigned long *)); +local int gz_head OF((gz_statep)); +local int gz_decomp OF((gz_statep)); +local int gz_make OF((gz_statep)); +local int gz_skip OF((gz_statep, z_off64_t)); + +/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from + state->fd, and update state->eof, state->err, and state->msg as appropriate. + This function needs to loop on read(), since read() is not guaranteed to + read the number of bytes requested, depending on the type of descriptor. */ +local int gz_load(state, buf, len, have) + gz_statep state; + unsigned char *buf; + unsigned len; + unsigned *have; +{ + int ret; + + *have = 0; + do { + ret = read(state->fd, buf + *have, len - *have); + if (ret <= 0) + break; + *have += ret; + } while (*have < len); + if (ret < 0) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + if (ret == 0) + state->eof = 1; + return 0; +} + +/* Load up input buffer and set eof flag if last data loaded -- return -1 on + error, 0 otherwise. Note that the eof flag is set when the end of the input + file is reached, even though there may be unused data in the buffer. Once + that data has been used, no more attempts will be made to read the file. + gz_avail() assumes that strm->avail_in == 0. */ +local int gz_avail(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + + if (state->err != Z_OK) + return -1; + if (state->eof == 0) { + if (gz_load(state, state->in, state->size, + (unsigned *)&(strm->avail_in)) == -1) + return -1; + strm->next_in = state->in; + } + return 0; +} + +/* Get next byte from input, or -1 if end or error. */ +#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \ + (strm->avail_in == 0 ? -1 : \ + (strm->avail_in--, *(strm->next_in)++))) + +/* Get a four-byte little-endian integer and return 0 on success and the value + in *ret. Otherwise -1 is returned and *ret is not modified. */ +local int gz_next4(state, ret) + gz_statep state; + unsigned long *ret; +{ + int ch; + unsigned long val; + z_streamp strm = &(state->strm); + + val = NEXT(); + val += (unsigned)NEXT() << 8; + val += (unsigned long)NEXT() << 16; + ch = NEXT(); + if (ch == -1) + return -1; + val += (unsigned long)ch << 24; + *ret = val; + return 0; +} + +/* Look for gzip header, set up for inflate or copy. state->have must be zero. + If this is the first time in, allocate required memory. state->how will be + left unchanged if there is no more input data available, will be set to COPY + if there is no gzip header and direct copying will be performed, or it will + be set to GZIP for decompression, and the gzip header will be skipped so + that the next available input data is the raw deflate stream. If direct + copying, then leftover input data from the input buffer will be copied to + the output buffer. In that case, all further file reads will be directly to + either the output buffer or a user buffer. If decompressing, the inflate + state and the check value will be initialized. gz_head() will return 0 on + success or -1 on failure. Failures may include read errors or gzip header + errors. */ +local int gz_head(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + int flags; + unsigned len; + + /* allocate read buffers and inflate memory */ + if (state->size == 0) { + /* allocate buffers */ + state->in = malloc(state->want); + state->out = malloc(state->want << 1); + if (state->in == NULL || state->out == NULL) { + if (state->out != NULL) + free(state->out); + if (state->in != NULL) + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + state->size = state->want; + + /* allocate inflate memory */ + state->strm.zalloc = Z_NULL; + state->strm.zfree = Z_NULL; + state->strm.opaque = Z_NULL; + state->strm.avail_in = 0; + state->strm.next_in = Z_NULL; + if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */ + free(state->out); + free(state->in); + state->size = 0; + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + } + + /* get some data in the input buffer */ + if (strm->avail_in == 0) { + if (gz_avail(state) == -1) + return -1; + if (strm->avail_in == 0) + return 0; + } + + /* look for the gzip magic header bytes 31 and 139 */ + if (strm->next_in[0] == 31) { + strm->avail_in--; + strm->next_in++; + if (strm->avail_in == 0 && gz_avail(state) == -1) + return -1; + if (strm->avail_in && strm->next_in[0] == 139) { + /* we have a gzip header, woo hoo! */ + strm->avail_in--; + strm->next_in++; + + /* skip rest of header */ + if (NEXT() != 8) { /* compression method */ + gz_error(state, Z_DATA_ERROR, "unknown compression method"); + return -1; + } + flags = NEXT(); + if (flags & 0xe0) { /* reserved flag bits */ + gz_error(state, Z_DATA_ERROR, "unknown header flags set"); + return -1; + } + NEXT(); /* modification time */ + NEXT(); + NEXT(); + NEXT(); + NEXT(); /* extra flags */ + NEXT(); /* operating system */ + if (flags & 4) { /* extra field */ + len = (unsigned)NEXT(); + len += (unsigned)NEXT() << 8; + while (len--) + if (NEXT() < 0) + break; + } + if (flags & 8) /* file name */ + while (NEXT() > 0) + ; + if (flags & 16) /* comment */ + while (NEXT() > 0) + ; + if (flags & 2) { /* header crc */ + NEXT(); + NEXT(); + } + /* an unexpected end of file is not checked for here -- it will be + noticed on the first request for uncompressed data */ + + /* set up for decompression */ + inflateReset(strm); + strm->adler = crc32(0L, Z_NULL, 0); + state->how = GZIP; + state->direct = 0; + return 0; + } + else { + /* not a gzip file -- save first byte (31) and fall to raw i/o */ + state->out[0] = 31; + state->have = 1; + } + } + + /* doing raw i/o, save start of raw data for seeking, copy any leftover + input to output -- this assumes that the output buffer is larger than + the input buffer, which also assures space for gzungetc() */ + state->raw = state->pos; + state->next = state->out; + if (strm->avail_in) { + memcpy(state->next + state->have, strm->next_in, strm->avail_in); + state->have += strm->avail_in; + strm->avail_in = 0; + } + state->how = COPY; + state->direct = 1; + return 0; +} + +/* Decompress from input to the provided next_out and avail_out in the state. + If the end of the compressed data is reached, then verify the gzip trailer + check value and length (modulo 2^32). state->have and state->next are set + to point to the just decompressed data, and the crc is updated. If the + trailer is verified, state->how is reset to LOOK to look for the next gzip + stream or raw data, once state->have is depleted. Returns 0 on success, -1 + on failure. Failures may include invalid compressed data or a failed gzip + trailer verification. */ +local int gz_decomp(state) + gz_statep state; +{ + int ret; + unsigned had; + unsigned long crc, len; + z_streamp strm = &(state->strm); + + /* fill output buffer up to end of deflate stream */ + had = strm->avail_out; + do { + /* get more input for inflate() */ + if (strm->avail_in == 0 && gz_avail(state) == -1) + return -1; + if (strm->avail_in == 0) { + gz_error(state, Z_DATA_ERROR, "unexpected end of file"); + return -1; + } + + /* decompress and handle errors */ + ret = inflate(strm, Z_NO_FLUSH); + if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { + gz_error(state, Z_STREAM_ERROR, + "internal error: inflate stream corrupt"); + return -1; + } + if (ret == Z_MEM_ERROR) { + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ + gz_error(state, Z_DATA_ERROR, + strm->msg == NULL ? "compressed data error" : strm->msg); + return -1; + } + } while (strm->avail_out && ret != Z_STREAM_END); + + /* update available output and crc check value */ + state->have = had - strm->avail_out; + state->next = strm->next_out - state->have; + strm->adler = crc32(strm->adler, state->next, state->have); + + /* check gzip trailer if at end of deflate stream */ + if (ret == Z_STREAM_END) { + if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) { + gz_error(state, Z_DATA_ERROR, "unexpected end of file"); + return -1; + } + if (crc != strm->adler) { + gz_error(state, Z_DATA_ERROR, "incorrect data check"); + return -1; + } + if (len != (strm->total_out & 0xffffffffL)) { + gz_error(state, Z_DATA_ERROR, "incorrect length check"); + return -1; + } + state->how = LOOK; /* ready for next stream, once have is 0 (leave + state->direct unchanged to remember how) */ + } + + /* good decompression */ + return 0; +} + +/* Make data and put in the output buffer. Assumes that state->have == 0. + Data is either copied from the input file or decompressed from the input + file depending on state->how. If state->how is LOOK, then a gzip header is + looked for (and skipped if found) to determine wither to copy or decompress. + Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY + or GZIP unless the end of the input file has been reached and all data has + been processed. */ +local int gz_make(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + + if (state->how == LOOK) { /* look for gzip header */ + if (gz_head(state) == -1) + return -1; + if (state->have) /* got some data from gz_head() */ + return 0; + } + if (state->how == COPY) { /* straight copy */ + if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1) + return -1; + state->next = state->out; + } + else if (state->how == GZIP) { /* decompress */ + strm->avail_out = state->size << 1; + strm->next_out = state->out; + if (gz_decomp(state) == -1) + return -1; + } + return 0; +} + +/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ +local int gz_skip(state, len) + gz_statep state; + z_off64_t len; +{ + unsigned n; + + /* skip over len bytes or reach end-of-file, whichever comes first */ + while (len) + /* skip over whatever is in output buffer */ + if (state->have) { + n = GT_OFF(state->have) || (z_off64_t)state->have > len ? + (unsigned)len : state->have; + state->have -= n; + state->next += n; + state->pos += n; + len -= n; + } + + /* output buffer empty -- return if we're at the end of the input */ + else if (state->eof && state->strm.avail_in == 0) + break; + + /* need more data to skip -- load up output buffer */ + else { + /* get more output, looking for header if required */ + if (gz_make(state) == -1) + return -1; + } + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzread(file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + unsigned got, n; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids the flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + return -1; + } + + /* if len is zero, avoid unnecessary operations */ + if (len == 0) + return 0; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return -1; + } + + /* get len bytes to buf, or less than len if at the end */ + got = 0; + do { + /* first just try copying data from the output buffer */ + if (state->have) { + n = state->have > len ? len : state->have; + memcpy(buf, state->next, n); + state->next += n; + state->have -= n; + } + + /* output buffer empty -- return if we're at the end of the input */ + else if (state->eof && strm->avail_in == 0) + break; + + /* need output data -- for small len or new stream load up our output + buffer */ + else if (state->how == LOOK || len < (state->size << 1)) { + /* get more output, looking for header if required */ + if (gz_make(state) == -1) + return -1; + continue; /* no progress yet -- go back to memcpy() above */ + /* the copy above assures that we will leave with space in the + output buffer, allowing at least one gzungetc() to succeed */ + } + + /* large len -- read directly into user buffer */ + else if (state->how == COPY) { /* read directly */ + if (gz_load(state, buf, len, &n) == -1) + return -1; + } + + /* large len -- decompress directly into user buffer */ + else { /* state->how == GZIP */ + strm->avail_out = len; + strm->next_out = buf; + if (gz_decomp(state) == -1) + return -1; + n = state->have; + state->have = 0; + } + + /* update progress */ + len -= n; + buf = (char *)buf + n; + got += n; + state->pos += n; + } while (len); + + /* return number of bytes read into user buffer (will fit in int) */ + return (int)got; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzgetc(file) + gzFile file; +{ + int ret; + unsigned char buf[1]; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* try output buffer (no need to check for skip request) */ + if (state->have) { + state->have--; + state->pos++; + return *(state->next)++; + } + + /* nothing there -- try gzread() */ + ret = gzread(file, buf, 1); + return ret < 1 ? -1 : buf[0]; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzungetc(c, file) + int c; + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return -1; + } + + /* can't push EOF */ + if (c < 0) + return -1; + + /* if output buffer empty, put byte at end (allows more pushing) */ + if (state->have == 0) { + state->have = 1; + state->next = state->out + (state->size << 1) - 1; + state->next[0] = c; + state->pos--; + return c; + } + + /* if no room, give up (must have already done a gzungetc()) */ + if (state->have == (state->size << 1)) { + gz_error(state, Z_BUF_ERROR, "out of room to push characters"); + return -1; + } + + /* slide output data if needed and insert byte before existing data */ + if (state->next == state->out) { + unsigned char *src = state->out + state->have; + unsigned char *dest = state->out + (state->size << 1); + while (src > state->out) + *--dest = *--src; + state->next = dest; + } + state->have++; + state->next--; + state->next[0] = c; + state->pos--; + return c; +} + +/* -- see zlib.h -- */ +char * ZEXPORT gzgets(file, buf, len) + gzFile file; + char *buf; + int len; +{ + unsigned left, n; + char *str; + unsigned char *eol; + gz_statep state; + + /* check parameters and get internal structure */ + if (file == NULL || buf == NULL || len < 1) + return NULL; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return NULL; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return NULL; + } + + /* copy output bytes up to new line or len - 1, whichever comes first -- + append a terminating zero to the string (we don't check for a zero in + the contents, let the user worry about that) */ + str = buf; + left = (unsigned)len - 1; + if (left) do { + /* assure that something is in the output buffer */ + if (state->have == 0) { + if (gz_make(state) == -1) + return NULL; /* error */ + if (state->have == 0) { /* end of file */ + if (buf == str) /* got bupkus */ + return NULL; + break; /* got something -- return it */ + } + } + + /* look for end-of-line in current output buffer */ + n = state->have > left ? left : state->have; + eol = memchr(state->next, '\n', n); + if (eol != NULL) + n = (unsigned)(eol - state->next) + 1; + + /* copy through end-of-line, or remainder if not found */ + memcpy(buf, state->next, n); + state->have -= n; + state->next += n; + state->pos += n; + left -= n; + buf += n; + } while (left && eol == NULL); + + /* found end-of-line or out of space -- terminate string and return it */ + buf[0] = 0; + return str; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzdirect(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + + /* check that we're reading */ + if (state->mode != GZ_READ) + return 0; + + /* if the state is not known, but we can find out, then do so (this is + mainly for right after a gzopen() or gzdopen()) */ + if (state->how == LOOK && state->have == 0) + (void)gz_head(state); + + /* return 1 if reading direct, 0 if decompressing a gzip stream */ + return state->direct; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzclose_r(file) + gzFile file; +{ + int ret; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + /* check that we're reading */ + if (state->mode != GZ_READ) + return Z_STREAM_ERROR; + + /* free memory and close file */ + if (state->size) { + inflateEnd(&(state->strm)); + free(state->out); + free(state->in); + } + gz_error(state, Z_OK, NULL); + free(state->path); + ret = close(state->fd); + free(state); + return ret ? Z_ERRNO : Z_OK; +} diff --git a/zlib-1.2.5/gzwrite.c b/zlib-1.2.5/gzwrite.c new file mode 100644 index 000000000..e8defc688 --- /dev/null +++ b/zlib-1.2.5/gzwrite.c @@ -0,0 +1,531 @@ +/* gzwrite.c -- zlib functions for writing gzip files + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* Local functions */ +local int gz_init OF((gz_statep)); +local int gz_comp OF((gz_statep, int)); +local int gz_zero OF((gz_statep, z_off64_t)); + +/* Initialize state for writing a gzip file. Mark initialization by setting + state->size to non-zero. Return -1 on failure or 0 on success. */ +local int gz_init(state) + gz_statep state; +{ + int ret; + z_streamp strm = &(state->strm); + + /* allocate input and output buffers */ + state->in = malloc(state->want); + state->out = malloc(state->want); + if (state->in == NULL || state->out == NULL) { + if (state->out != NULL) + free(state->out); + if (state->in != NULL) + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* allocate deflate memory, set up for gzip compression */ + strm->zalloc = Z_NULL; + strm->zfree = Z_NULL; + strm->opaque = Z_NULL; + ret = deflateInit2(strm, state->level, Z_DEFLATED, + 15 + 16, 8, state->strategy); + if (ret != Z_OK) { + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* mark state as initialized */ + state->size = state->want; + + /* initialize write buffer */ + strm->avail_out = state->size; + strm->next_out = state->out; + state->next = strm->next_out; + return 0; +} + +/* Compress whatever is at avail_in and next_in and write to the output file. + Return -1 if there is an error writing to the output file, otherwise 0. + flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, + then the deflate() state is reset to start a new gzip stream. */ +local int gz_comp(state, flush) + gz_statep state; + int flush; +{ + int ret, got; + unsigned have; + z_streamp strm = &(state->strm); + + /* allocate memory if this is the first time through */ + if (state->size == 0 && gz_init(state) == -1) + return -1; + + /* run deflate() on provided input until it produces no more output */ + ret = Z_OK; + do { + /* write out current buffer contents if full, or if flushing, but if + doing Z_FINISH then don't write until we get to Z_STREAM_END */ + if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && + (flush != Z_FINISH || ret == Z_STREAM_END))) { + have = (unsigned)(strm->next_out - state->next); + if (have && ((got = write(state->fd, state->next, have)) < 0 || + (unsigned)got != have)) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + if (strm->avail_out == 0) { + strm->avail_out = state->size; + strm->next_out = state->out; + } + state->next = strm->next_out; + } + + /* compress */ + have = strm->avail_out; + ret = deflate(strm, flush); + if (ret == Z_STREAM_ERROR) { + gz_error(state, Z_STREAM_ERROR, + "internal error: deflate stream corrupt"); + return -1; + } + have -= strm->avail_out; + } while (have); + + /* if that completed a deflate stream, allow another to start */ + if (flush == Z_FINISH) + deflateReset(strm); + + /* all done, no errors */ + return 0; +} + +/* Compress len zeros to output. Return -1 on error, 0 on success. */ +local int gz_zero(state, len) + gz_statep state; + z_off64_t len; +{ + int first; + unsigned n; + z_streamp strm = &(state->strm); + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return -1; + + /* compress len zeros (len guaranteed > 0) */ + first = 1; + while (len) { + n = GT_OFF(state->size) || (z_off64_t)state->size > len ? + (unsigned)len : state->size; + if (first) { + memset(state->in, 0, n); + first = 0; + } + strm->avail_in = n; + strm->next_in = state->in; + state->pos += n; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return -1; + len -= n; + } + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzwrite(file, buf, len) + gzFile file; + voidpc buf; + unsigned len; +{ + unsigned put = len; + unsigned n; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids the flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + return 0; + } + + /* if len is zero, avoid unnecessary operations */ + if (len == 0) + return 0; + + /* allocate memory if this is the first time through */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* for small len, copy to input buffer, otherwise compress directly */ + if (len < state->size) { + /* copy to input buffer, compress when full */ + do { + if (strm->avail_in == 0) + strm->next_in = state->in; + n = state->size - strm->avail_in; + if (n > len) + n = len; + memcpy(strm->next_in + strm->avail_in, buf, n); + strm->avail_in += n; + state->pos += n; + buf = (char *)buf + n; + len -= n; + if (len && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + } while (len); + } + else { + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* directly compress user buffer to file */ + strm->avail_in = len; + strm->next_in = (voidp)buf; + state->pos += len; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + } + + /* input was all buffered or compressed (put will fit in int) */ + return (int)put; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzputc(file, c) + gzFile file; + int c; +{ + unsigned char buf[1]; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return -1; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* try writing to input buffer for speed (state->size == 0 if buffer not + initialized) */ + if (strm->avail_in < state->size) { + if (strm->avail_in == 0) + strm->next_in = state->in; + strm->next_in[strm->avail_in++] = c; + state->pos++; + return c; + } + + /* no room in buffer or not initialized, use gz_write() */ + buf[0] = c; + if (gzwrite(file, buf, 1) != 1) + return -1; + return c; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzputs(file, str) + gzFile file; + const char *str; +{ + int ret; + unsigned len; + + /* write string */ + len = (unsigned)strlen(str); + ret = gzwrite(file, str, len); + return ret == 0 && len != 0 ? -1 : ret; +} + +#ifdef STDC +#include <stdarg.h> + +/* -- see zlib.h -- */ +int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) +{ + int size, len; + gz_statep state; + z_streamp strm; + va_list va; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* make sure we have some buffer space */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* do the printf() into the input buffer, put length in len */ + size = (int)(state->size); + state->in[size - 1] = 0; + va_start(va, format); +#ifdef NO_vsnprintf +# ifdef HAS_vsprintf_void + (void)vsprintf(state->in, format, va); + va_end(va); + for (len = 0; len < size; len++) + if (state->in[len] == 0) break; +# else + len = vsprintf(state->in, format, va); + va_end(va); +# endif +#else +# ifdef HAS_vsnprintf_void + (void)vsnprintf(state->in, size, format, va); + va_end(va); + len = strlen(state->in); +# else + len = vsnprintf((char *)(state->in), size, format, va); + va_end(va); +# endif +#endif + + /* check that printf() results fit in buffer */ + if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + return 0; + + /* update buffer and position, defer compression until needed */ + strm->avail_in = (unsigned)len; + strm->next_in = state->in; + state->pos += len; + return len; +} + +#else /* !STDC */ + +/* -- see zlib.h -- */ +int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) + gzFile file; + const char *format; + int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +{ + int size, len; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* make sure we have some buffer space */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* do the printf() into the input buffer, put length in len */ + size = (int)(state->size); + state->in[size - 1] = 0; +#ifdef NO_snprintf +# ifdef HAS_sprintf_void + sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + for (len = 0; len < size; len++) + if (state->in[len] == 0) break; +# else + len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#else +# ifdef HAS_snprintf_void + snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = strlen(state->in); +# else + len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#endif + + /* check that printf() results fit in buffer */ + if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + return 0; + + /* update buffer and position, defer compression until needed */ + strm->avail_in = (unsigned)len; + strm->next_in = state->in; + state->pos += len; + return len; +} + +#endif + +/* -- see zlib.h -- */ +int ZEXPORT gzflush(file, flush) + gzFile file; + int flush; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return Z_STREAM_ERROR; + + /* check flush parameter */ + if (flush < 0 || flush > Z_FINISH) + return Z_STREAM_ERROR; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* compress remaining data with requested flush */ + gz_comp(state, flush); + return state->err; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzsetparams(file, level, strategy) + gzFile file; + int level; + int strategy; +{ + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return Z_STREAM_ERROR; + + /* if no change is requested, then do nothing */ + if (level == state->level && strategy == state->strategy) + return Z_OK; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* change compression parameters for subsequent input */ + if (state->size) { + /* flush previous input with previous parameters before changing */ + if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1) + return state->err; + deflateParams(strm, level, strategy); + } + state->level = level; + state->strategy = strategy; + return Z_OK; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzclose_w(file) + gzFile file; +{ + int ret = 0; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + /* check that we're writing */ + if (state->mode != GZ_WRITE) + return Z_STREAM_ERROR; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + ret += gz_zero(state, state->skip); + } + + /* flush, free memory, and close file */ + ret += gz_comp(state, Z_FINISH); + (void)deflateEnd(&(state->strm)); + free(state->out); + free(state->in); + gz_error(state, Z_OK, NULL); + free(state->path); + ret += close(state->fd); + free(state); + return ret ? Z_ERRNO : Z_OK; +} diff --git a/zlib-1.2.5/infback.c b/zlib-1.2.5/infback.c new file mode 100644 index 000000000..af3a8c965 --- /dev/null +++ b/zlib-1.2.5/infback.c @@ -0,0 +1,632 @@ +/* infback.c -- inflate using a call-back interface + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + This code is largely copied from inflate.c. Normally either infback.o or + inflate.o would be linked into an application--not both. The interface + with inffast.c is retained so that optimized assembler-coded versions of + inflate_fast() can be used with either inflate.c or infback.c. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); + +/* + strm provides memory allocation functions in zalloc and zfree, or + Z_NULL to use the library memory allocation functions. + + windowBits is in the range 8..15, and window is a user-supplied + window and output buffer that is 2**windowBits bytes. + */ +int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) +z_streamp strm; +int windowBits; +unsigned char FAR *window; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL || window == Z_NULL || + windowBits < 8 || windowBits > 15) + return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *)ZALLOC(strm, 1, + sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->dmax = 32768U; + state->wbits = windowBits; + state->wsize = 1U << windowBits; + state->window = window; + state->wnext = 0; + state->whave = 0; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +/* Macros for inflateBack(): */ + +/* Load returned state from inflate_fast() */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Set state from registers for inflate_fast() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Assure that some input is available. If input is requested, but denied, + then return a Z_BUF_ERROR from inflateBack(). */ +#define PULL() \ + do { \ + if (have == 0) { \ + have = in(in_desc, &next); \ + if (have == 0) { \ + next = Z_NULL; \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflateBack() + with an error if there is no input available. */ +#define PULLBYTE() \ + do { \ + PULL(); \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflateBack() with + an error. */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Assure that some output space is available, by writing out the window + if it's full. If the write fails, return from inflateBack() with a + Z_BUF_ERROR. */ +#define ROOM() \ + do { \ + if (left == 0) { \ + put = state->window; \ + left = state->wsize; \ + state->whave = left; \ + if (out(out_desc, put, left)) { \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* + strm provides the memory allocation functions and window buffer on input, + and provides information on the unused input on return. For Z_DATA_ERROR + returns, strm will also provide an error message. + + in() and out() are the call-back input and output functions. When + inflateBack() needs more input, it calls in(). When inflateBack() has + filled the window with output, or when it completes with data in the + window, it calls out() to write out the data. The application must not + change the provided input until in() is called again or inflateBack() + returns. The application must not change the window/output buffer until + inflateBack() returns. + + in() and out() are called with a descriptor parameter provided in the + inflateBack() call. This parameter can be a structure that provides the + information required to do the read or write, as well as accumulated + information on the input and output such as totals and check values. + + in() should return zero on failure. out() should return non-zero on + failure. If either in() or out() fails, than inflateBack() returns a + Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it + was in() or out() that caused in the error. Otherwise, inflateBack() + returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format + error, or Z_MEM_ERROR if it could not allocate memory for the state. + inflateBack() can also return Z_STREAM_ERROR if the input parameters + are not correct, i.e. strm is Z_NULL or the state was not initialized. + */ +int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) +z_streamp strm; +in_func in; +void FAR *in_desc; +out_func out; +void FAR *out_desc; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + /* Check that the strm exists and that the state was initialized */ + if (strm == Z_NULL || strm->state == Z_NULL) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* Reset the state */ + strm->msg = Z_NULL; + state->mode = TYPE; + state->last = 0; + state->whave = 0; + next = strm->next_in; + have = next != Z_NULL ? strm->avail_in : 0; + hold = 0; + bits = 0; + put = state->window; + left = state->wsize; + + /* Inflate until end of block marked as last */ + for (;;) + switch (state->mode) { + case TYPE: + /* determine and dispatch block type */ + if (state->last) { + BYTEBITS(); + state->mode = DONE; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + + case STORED: + /* get and verify stored block length */ + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + + /* copy stored block from input to output */ + while (state->length != 0) { + copy = state->length; + PULL(); + ROOM(); + if (copy > have) copy = have; + if (copy > left) copy = left; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + + case TABLE: + /* get dynamic table entries descriptor */ + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + + /* get code length code lengths (not a typo) */ + state->have = 0; + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + + /* get length and distance code code lengths */ + state->have = 0; + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + NEEDBITS(here.bits); + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = (unsigned)(state->lens[state->have - 1]); + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { + RESTORE(); + if (state->whave < state->wsize) + state->whave = state->wsize - left; + inflate_fast(strm, state->wsize); + LOAD(); + break; + } + + /* get a literal, length, or end-of-block code */ + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + state->length = (unsigned)here.val; + + /* process literal */ + if (here.op == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + ROOM(); + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + } + + /* process end of block */ + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + + /* invalid code */ + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + + /* length code -- get extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + + /* get distance code */ + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + + /* get distance extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } + if (state->offset > state->wsize - (state->whave < state->wsize ? + left : 0)) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + + /* copy match from window to output */ + do { + ROOM(); + copy = state->wsize - state->offset; + if (copy < left) { + from = put + copy; + copy = left - copy; + } + else { + from = put - state->offset; + copy = left; + } + if (copy > state->length) copy = state->length; + state->length -= copy; + left -= copy; + do { + *put++ = *from++; + } while (--copy); + } while (state->length != 0); + break; + + case DONE: + /* inflate stream terminated properly -- write leftover output */ + ret = Z_STREAM_END; + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left)) + ret = Z_BUF_ERROR; + } + goto inf_leave; + + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + + default: /* can't happen, but makes compilers happy */ + ret = Z_STREAM_ERROR; + goto inf_leave; + } + + /* Return unused input */ + inf_leave: + strm->next_in = next; + strm->avail_in = have; + return ret; +} + +int ZEXPORT inflateBackEnd(strm) +z_streamp strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} diff --git a/zlib-1.2.5/inffast.c b/zlib-1.2.5/inffast.c new file mode 100644 index 000000000..2f1d60b43 --- /dev/null +++ b/zlib-1.2.5/inffast.c @@ -0,0 +1,340 @@ +/* inffast.c -- fast decoding + * Copyright (C) 1995-2008, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifndef ASMINF + +/* Allow machine dependent optimization for post-increment or pre-increment. + Based on testing to date, + Pre-increment preferred for: + - PowerPC G3 (Adler) + - MIPS R5000 (Randers-Pehrson) + Post-increment preferred for: + - none + No measurable difference: + - Pentium III (Anderson) + - M68060 (Nikl) + */ +#ifdef POSTINC +# define OFF 0 +# define PUP(a) *(a)++ +#else +# define OFF 1 +# define PUP(a) *++(a) +#endif + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state->mode == LEN + strm->avail_in >= 6 + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 + + On return, state->mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm->avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +void ZLIB_INTERNAL inflate_fast(strm, start) +z_streamp strm; +unsigned start; /* inflate()'s starting value for strm->avail_out */ +{ + struct inflate_state FAR *state; + unsigned char FAR *in; /* local strm->next_in */ + unsigned char FAR *last; /* while in < last, enough input available */ + unsigned char FAR *out; /* local strm->next_out */ + unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ + unsigned char FAR *end; /* while out < end, enough space available */ +#ifdef INFLATE_STRICT + unsigned dmax; /* maximum distance from zlib header */ +#endif + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ + unsigned long hold; /* local strm->hold */ + unsigned bits; /* local strm->bits */ + code const FAR *lcode; /* local strm->lencode */ + code const FAR *dcode; /* local strm->distcode */ + unsigned lmask; /* mask for first level of length codes */ + unsigned dmask; /* mask for first level of distance codes */ + code here; /* retrieved table entry */ + unsigned op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + unsigned len; /* match length, unused bytes */ + unsigned dist; /* match distance */ + unsigned char FAR *from; /* where to copy match from */ + + /* copy state to local variables */ + state = (struct inflate_state FAR *)strm->state; + in = strm->next_in - OFF; + last = in + (strm->avail_in - 5); + out = strm->next_out - OFF; + beg = out - (start - strm->avail_out); + end = out + (strm->avail_out - 257); +#ifdef INFLATE_STRICT + dmax = state->dmax; +#endif + wsize = state->wsize; + whave = state->whave; + wnext = state->wnext; + window = state->window; + hold = state->hold; + bits = state->bits; + lcode = state->lencode; + dcode = state->distcode; + lmask = (1U << state->lenbits) - 1; + dmask = (1U << state->distbits) - 1; + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + do { + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = lcode[hold & lmask]; + dolen: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op == 0) { /* literal */ + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + PUP(out) = (unsigned char)(here.val); + } + else if (op & 16) { /* length base */ + len = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + len += (unsigned)hold & ((1U << op) - 1); + hold >>= op; + bits -= op; + } + Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = dcode[hold & dmask]; + dodist: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op & 16) { /* distance base */ + dist = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + } + dist += (unsigned)hold & ((1U << op) - 1); +#ifdef INFLATE_STRICT + if (dist > dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + hold >>= op; + bits -= op; + Tracevv((stderr, "inflate: distance %u\n", dist)); + op = (unsigned)(out - beg); /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state->sane) { + strm->msg = + (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + if (len <= op - whave) { + do { + PUP(out) = 0; + } while (--len); + continue; + } + len -= op - whave; + do { + PUP(out) = 0; + } while (--op > whave); + if (op == 0) { + from = out - dist; + do { + PUP(out) = PUP(from); + } while (--len); + continue; + } +#endif + } + from = window - OFF; + if (wnext == 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = window - OFF; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + while (len > 2) { + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + else { + from = out - dist; /* copy direct from output */ + do { /* minimum length is three */ + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } while (len > 2); + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + } + else if ((op & 64) == 0) { /* 2nd level distance code */ + here = dcode[here.val + (hold & ((1U << op) - 1))]; + goto dodist; + } + else { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + } + else if ((op & 64) == 0) { /* 2nd level length code */ + here = lcode[here.val + (hold & ((1U << op) - 1))]; + goto dolen; + } + else if (op & 32) { /* end-of-block */ + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + else { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + } while (in < last && out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + in -= len; + bits -= len << 3; + hold &= (1U << bits) - 1; + + /* update state and return */ + strm->next_in = in + OFF; + strm->next_out = out + OFF; + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); + strm->avail_out = (unsigned)(out < end ? + 257 + (end - out) : 257 - (out - end)); + state->hold = hold; + state->bits = bits; + return; +} + +/* + inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): + - Using bit fields for code structure + - Different op definition to avoid & for extra bits (do & for table bits) + - Three separate decoding do-loops for direct, window, and wnext == 0 + - Special case for distance > 1 copies to do overlapped load and store copy + - Explicit branch predictions (based on measured branch probabilities) + - Deferring match copy and interspersed it with decoding subsequent codes + - Swapping literal/length else + - Swapping window/direct else + - Larger unrolled copy loops (three is about right) + - Moving len -= 3 statement into middle of loop + */ + +#endif /* !ASMINF */ diff --git a/zlib-1.2.5/inffast.h b/zlib-1.2.5/inffast.h new file mode 100644 index 000000000..e5c1aa4ca --- /dev/null +++ b/zlib-1.2.5/inffast.h @@ -0,0 +1,11 @@ +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-2003, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/zlib-1.2.5/inffixed.h b/zlib-1.2.5/inffixed.h new file mode 100644 index 000000000..75ed4b597 --- /dev/null +++ b/zlib-1.2.5/inffixed.h @@ -0,0 +1,94 @@ + /* inffixed.h -- table for decoding fixed codes + * Generated automatically by makefixed(). + */ + + /* WARNING: this file should *not* be used by applications. It + is part of the implementation of the compression library and + is subject to change. Applications should only use zlib.h. + */ + + static const code lenfix[512] = { + {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, + {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, + {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, + {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, + {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, + {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, + {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, + {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, + {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, + {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, + {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, + {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, + {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, + {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, + {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, + {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, + {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, + {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, + {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, + {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, + {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, + {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, + {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, + {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, + {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, + {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, + {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, + {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, + {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, + {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, + {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, + {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, + {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, + {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, + {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, + {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, + {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, + {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, + {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, + {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, + {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, + {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, + {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, + {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, + {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, + {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, + {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, + {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, + {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, + {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, + {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, + {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, + {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, + {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, + {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, + {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, + {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, + {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, + {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, + {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, + {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, + {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, + {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, + {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, + {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, + {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, + {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, + {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, + {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, + {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, + {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, + {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, + {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, + {0,9,255} + }; + + static const code distfix[32] = { + {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, + {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, + {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, + {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, + {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, + {22,5,193},{64,5,0} + }; diff --git a/zlib-1.2.5/inflate.c b/zlib-1.2.5/inflate.c new file mode 100644 index 000000000..a8431abea --- /dev/null +++ b/zlib-1.2.5/inflate.c @@ -0,0 +1,1480 @@ +/* inflate.c -- zlib decompression + * Copyright (C) 1995-2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * Change history: + * + * 1.2.beta0 24 Nov 2002 + * - First version -- complete rewrite of inflate to simplify code, avoid + * creation of window when not needed, minimize use of window when it is + * needed, make inffast.c even faster, implement gzip decoding, and to + * improve code readability and style over the previous zlib inflate code + * + * 1.2.beta1 25 Nov 2002 + * - Use pointers for available input and output checking in inffast.c + * - Remove input and output counters in inffast.c + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 + * - Remove unnecessary second byte pull from length extra in inffast.c + * - Unroll direct copy to three copies per loop in inffast.c + * + * 1.2.beta2 4 Dec 2002 + * - Change external routine names to reduce potential conflicts + * - Correct filename to inffixed.h for fixed tables in inflate.c + * - Make hbuf[] unsigned char to match parameter type in inflate.c + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) + * to avoid negation problem on Alphas (64 bit) in inflate.c + * + * 1.2.beta3 22 Dec 2002 + * - Add comments on state->bits assertion in inffast.c + * - Add comments on op field in inftrees.h + * - Fix bug in reuse of allocated window after inflateReset() + * - Remove bit fields--back to byte structure for speed + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths + * - Change post-increments to pre-increments in inflate_fast(), PPC biased? + * - Add compile time option, POSTINC, to use post-increments instead (Intel?) + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used + * - Use local copies of stream next and avail values, as well as local bit + * buffer and bit count in inflate()--for speed when inflate_fast() not used + * + * 1.2.beta4 1 Jan 2003 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings + * - Move a comment on output buffer sizes from inffast.c to inflate.c + * - Add comments in inffast.c to introduce the inflate_fast() routine + * - Rearrange window copies in inflate_fast() for speed and simplification + * - Unroll last copy for window match in inflate_fast() + * - Use local copies of window variables in inflate_fast() for speed + * - Pull out common wnext == 0 case for speed in inflate_fast() + * - Make op and len in inflate_fast() unsigned for consistency + * - Add FAR to lcode and dcode declarations in inflate_fast() + * - Simplified bad distance check in inflate_fast() + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new + * source file infback.c to provide a call-back interface to inflate for + * programs like gzip and unzip -- uses window as output buffer to avoid + * window copying + * + * 1.2.beta5 1 Jan 2003 + * - Improved inflateBack() interface to allow the caller to provide initial + * input in strm. + * - Fixed stored blocks bug in inflateBack() + * + * 1.2.beta6 4 Jan 2003 + * - Added comments in inffast.c on effectiveness of POSTINC + * - Typecasting all around to reduce compiler warnings + * - Changed loops from while (1) or do {} while (1) to for (;;), again to + * make compilers happy + * - Changed type of window in inflateBackInit() to unsigned char * + * + * 1.2.beta7 27 Jan 2003 + * - Changed many types to unsigned or unsigned short to avoid warnings + * - Added inflateCopy() function + * + * 1.2.0 9 Mar 2003 + * - Changed inflateBack() interface to provide separate opaque descriptors + * for the in() and out() functions + * - Changed inflateBack() argument and in_func typedef to swap the length + * and buffer address return values for the input function + * - Check next_in and next_out for Z_NULL on entry to inflate() + * + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifdef MAKEFIXED +# ifndef BUILDFIXED +# define BUILDFIXED +# endif +#endif + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); +local int updatewindow OF((z_streamp strm, unsigned out)); +#ifdef BUILDFIXED + void makefixed OF((void)); +#endif +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, + unsigned len)); + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + strm->total_in = strm->total_out = state->total = 0; + strm->msg = Z_NULL; + strm->adler = 1; /* to support ill-conceived Java test suite */ + state->mode = HEAD; + state->last = 0; + state->havedict = 0; + state->dmax = 32768U; + state->head = Z_NULL; + state->wsize = 0; + state->whave = 0; + state->wnext = 0; + state->hold = 0; + state->bits = 0; + state->lencode = state->distcode = state->next = state->codes; + state->sane = 1; + state->back = -1; + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +int ZEXPORT inflateReset2(strm, windowBits) +z_streamp strm; +int windowBits; +{ + int wrap; + struct inflate_state FAR *state; + + /* get the state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; +#ifdef GUNZIP + if (windowBits < 48) + windowBits &= 15; +#endif + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) + return Z_STREAM_ERROR; + if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { + ZFREE(strm, state->window); + state->window = Z_NULL; + } + + /* update state and reset the rest of it */ + state->wrap = wrap; + state->wbits = (unsigned)windowBits; + return inflateReset(strm); +} + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +const char *version; +int stream_size; +{ + int ret; + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL) return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *) + ZALLOC(strm, 1, sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->window = Z_NULL; + ret = inflateReset2(strm, windowBits); + if (ret != Z_OK) { + ZFREE(strm, state); + strm->state = Z_NULL; + } + return ret; +} + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ + return inflateInit2_(strm, DEF_WBITS, version, stream_size); +} + +int ZEXPORT inflatePrime(strm, bits, value) +z_streamp strm; +int bits; +int value; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (bits < 0) { + state->hold = 0; + state->bits = 0; + return Z_OK; + } + if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + value &= (1L << bits) - 1; + state->hold += value << state->bits; + state->bits += bits; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +#ifdef MAKEFIXED +#include <stdio.h> + +/* + Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also + defines BUILDFIXED, so the tables are built on the fly. makefixed() writes + those tables to stdout, which would be piped to inffixed.h. A small program + can simply call makefixed to do this: + + void makefixed(void); + + int main(void) + { + makefixed(); + return 0; + } + + Then that can be linked with zlib built with MAKEFIXED defined and run: + + a.out > inffixed.h + */ +void makefixed() +{ + unsigned low, size; + struct inflate_state state; + + fixedtables(&state); + puts(" /* inffixed.h -- table for decoding fixed codes"); + puts(" * Generated automatically by makefixed()."); + puts(" */"); + puts(""); + puts(" /* WARNING: this file should *not* be used by applications."); + puts(" It is part of the implementation of this library and is"); + puts(" subject to change. Applications should only use zlib.h."); + puts(" */"); + puts(""); + size = 1U << 9; + printf(" static const code lenfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 7) == 0) printf("\n "); + printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, + state.lencode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); + size = 1U << 5; + printf("\n static const code distfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 6) == 0) printf("\n "); + printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, + state.distcode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); +} +#endif /* MAKEFIXED */ + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +local int updatewindow(strm, out) +z_streamp strm; +unsigned out; +{ + struct inflate_state FAR *state; + unsigned copy, dist; + + state = (struct inflate_state FAR *)strm->state; + + /* if it hasn't been done already, allocate space for the window */ + if (state->window == Z_NULL) { + state->window = (unsigned char FAR *) + ZALLOC(strm, 1U << state->wbits, + sizeof(unsigned char)); + if (state->window == Z_NULL) return 1; + } + + /* if window not in use yet, initialize */ + if (state->wsize == 0) { + state->wsize = 1U << state->wbits; + state->wnext = 0; + state->whave = 0; + } + + /* copy state->wsize or less output bytes into the circular window */ + copy = out - strm->avail_out; + if (copy >= state->wsize) { + zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + state->wnext = 0; + state->whave = state->wsize; + } + else { + dist = state->wsize - state->wnext; + if (dist > copy) dist = copy; + zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); + copy -= dist; + if (copy) { + zmemcpy(state->window, strm->next_out - copy, copy); + state->wnext = copy; + state->whave = state->wsize; + } + else { + state->wnext += dist; + if (state->wnext == state->wsize) state->wnext = 0; + if (state->whave < state->wsize) state->whave += dist; + } + } + return 0; +} + +/* Macros for inflate(): */ + +/* check function to use adler32() for zlib or crc32() for gzip */ +#ifdef GUNZIP +# define UPDATE(check, buf, len) \ + (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) +#else +# define UPDATE(check, buf, len) adler32(check, buf, len) +#endif + +/* check macros for header crc */ +#ifdef GUNZIP +# define CRC2(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + check = crc32(check, hbuf, 2); \ + } while (0) + +# define CRC4(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + hbuf[2] = (unsigned char)((word) >> 16); \ + hbuf[3] = (unsigned char)((word) >> 24); \ + check = crc32(check, hbuf, 4); \ + } while (0) +#endif + +/* Load registers with state in inflate() for speed */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Restore state from registers in inflate() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflate() + if there is no input available. */ +#define PULLBYTE() \ + do { \ + if (have == 0) goto inf_leave; \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflate(). */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Reverse the bytes in a 32-bit value */ +#define REVERSE(q) \ + ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +/* + inflate() uses a state machine to process as much input data and generate as + much output data as possible before returning. The state machine is + structured roughly as follows: + + for (;;) switch (state) { + ... + case STATEn: + if (not enough input data or output space to make progress) + return; + ... make progress ... + state = STATEm; + break; + ... + } + + so when inflate() is called again, the same case is attempted again, and + if the appropriate resources are provided, the machine proceeds to the + next state. The NEEDBITS() macro is usually the way the state evaluates + whether it can proceed or should return. NEEDBITS() does the return if + the requested bits are not available. The typical use of the BITS macros + is: + + NEEDBITS(n); + ... do something with BITS(n) ... + DROPBITS(n); + + where NEEDBITS(n) either returns from inflate() if there isn't enough + input left to load n bits into the accumulator, or it continues. BITS(n) + gives the low n bits in the accumulator. When done, DROPBITS(n) drops + the low n bits off the accumulator. INITBITS() clears the accumulator + and sets the number of available bits to zero. BYTEBITS() discards just + enough bits to put the accumulator on a byte boundary. After BYTEBITS() + and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. + + NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return + if there is no input available. The decoding of variable length codes uses + PULLBYTE() directly in order to pull just enough bytes to decode the next + code, and no more. + + Some states loop until they get enough input, making sure that enough + state information is maintained to continue the loop where it left off + if NEEDBITS() returns in the loop. For example, want, need, and keep + would all have to actually be part of the saved state in case NEEDBITS() + returns: + + case STATEw: + while (want < need) { + NEEDBITS(n); + keep[want++] = BITS(n); + DROPBITS(n); + } + state = STATEx; + case STATEx: + + As shown above, if the next state is also the next case, then the break + is omitted. + + A state may also return if there is not enough output space available to + complete that state. Those states are copying stored data, writing a + literal byte, and copying a matching string. + + When returning, a "goto inf_leave" is used to update the total counters, + update the check value, and determine whether any progress has been made + during that inflate() call in order to return the proper return code. + Progress is defined as a change in either strm->avail_in or strm->avail_out. + When there is a window, goto inf_leave will update the window with the last + output written. If a goto inf_leave occurs in the middle of decompression + and there is no window currently, goto inf_leave will create one and copy + output to the window for the next call of inflate(). + + In this implementation, the flush parameter of inflate() only affects the + return code (per zlib.h). inflate() always writes as much as possible to + strm->next_out, given the space available and the provided input--the effect + documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers + the allocation of and copying into a sliding window until necessary, which + provides the effect documented in zlib.h for Z_FINISH when the entire input + stream available. So the only thing the flush parameter actually does is: + when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + will return Z_BUF_ERROR if it has not reached the end of the stream. + */ + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned in, out; /* save starting available input and output */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ +#ifdef GUNZIP + unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ +#endif + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0)) + return Z_STREAM_ERROR; + + state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ + LOAD(); + in = have; + out = left; + ret = Z_OK; + for (;;) + switch (state->mode) { + case HEAD: + if (state->wrap == 0) { + state->mode = TYPEDO; + break; + } + NEEDBITS(16); +#ifdef GUNZIP + if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + state->check = crc32(0L, Z_NULL, 0); + CRC2(state->check, hold); + INITBITS(); + state->mode = FLAGS; + break; + } + state->flags = 0; /* expect zlib header */ + if (state->head != Z_NULL) + state->head->done = -1; + if (!(state->wrap & 1) || /* check if zlib header allowed */ +#else + if ( +#endif + ((BITS(8) << 8) + (hold >> 8)) % 31) { + strm->msg = (char *)"incorrect header check"; + state->mode = BAD; + break; + } + if (BITS(4) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + DROPBITS(4); + len = BITS(4) + 8; + if (state->wbits == 0) + state->wbits = len; + else if (len > state->wbits) { + strm->msg = (char *)"invalid window size"; + state->mode = BAD; + break; + } + state->dmax = 1U << len; + Tracev((stderr, "inflate: zlib header ok\n")); + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = hold & 0x200 ? DICTID : TYPE; + INITBITS(); + break; +#ifdef GUNZIP + case FLAGS: + NEEDBITS(16); + state->flags = (int)(hold); + if ((state->flags & 0xff) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + if (state->flags & 0xe000) { + strm->msg = (char *)"unknown header flags set"; + state->mode = BAD; + break; + } + if (state->head != Z_NULL) + state->head->text = (int)((hold >> 8) & 1); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = TIME; + case TIME: + NEEDBITS(32); + if (state->head != Z_NULL) + state->head->time = hold; + if (state->flags & 0x0200) CRC4(state->check, hold); + INITBITS(); + state->mode = OS; + case OS: + NEEDBITS(16); + if (state->head != Z_NULL) { + state->head->xflags = (int)(hold & 0xff); + state->head->os = (int)(hold >> 8); + } + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); + state->length = (unsigned)(hold); + if (state->head != Z_NULL) + state->head->extra_len = (unsigned)hold; + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + } + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; + if (copy > have) copy = have; + if (copy) { + if (state->head != Z_NULL && + state->head->extra != Z_NULL) { + len = state->head->extra_len - state->length; + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); + } + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + state->length -= copy; + } + if (state->length) goto inf_leave; + } + state->length = 0; + state->mode = NAME; + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->name != Z_NULL && + state->length < state->head->name_max) + state->head->name[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->comment != Z_NULL && + state->length < state->head->comm_max) + state->head->comment[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); + if (hold != (state->check & 0xffff)) { + strm->msg = (char *)"header crc mismatch"; + state->mode = BAD; + break; + } + INITBITS(); + } + if (state->head != Z_NULL) { + state->head->hcrc = (int)((state->flags >> 9) & 1); + state->head->done = 1; + } + strm->adler = state->check = crc32(0L, Z_NULL, 0); + state->mode = TYPE; + break; +#endif + case DICTID: + NEEDBITS(32); + strm->adler = state->check = REVERSE(hold); + INITBITS(); + state->mode = DICT; + case DICT: + if (state->havedict == 0) { + RESTORE(); + return Z_NEED_DICT; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; + case TYPE: + if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + case TYPEDO: + if (state->last) { + BYTEBITS(); + state->mode = CHECK; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN_; /* decode codes */ + if (flush == Z_TREES) { + DROPBITS(2); + goto inf_leave; + } + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + case STORED: + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + state->mode = COPY_; + if (flush == Z_TREES) goto inf_leave; + case COPY_: + state->mode = COPY; + case COPY: + copy = state->length; + if (copy) { + if (copy > have) copy = have; + if (copy > left) copy = left; + if (copy == 0) goto inf_leave; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + break; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + case TABLE: + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + state->have = 0; + state->mode = LENLENS; + case LENLENS: + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + state->have = 0; + state->mode = CODELENS; + case CODELENS: + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + NEEDBITS(here.bits); + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = state->lens[state->have - 1]; + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN_; + if (flush == Z_TREES) goto inf_leave; + case LEN_: + state->mode = LEN; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); + inflate_fast(strm, out); + LOAD(); + if (state->mode == TYPE) + state->back = -1; + break; + } + state->back = 0; + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + state->length = (unsigned)here.val; + if ((int)(here.op) == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + state->mode = LIT; + break; + } + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->back = -1; + state->mode = TYPE; + break; + } + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + state->extra = (unsigned)(here.op) & 15; + state->mode = LENEXT; + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->was = state->length; + state->mode = DIST; + case DIST: + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + state->extra = (unsigned)(here.op) & 15; + state->mode = DISTEXT; + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } +#ifdef INFLATE_STRICT + if (state->offset > state->dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; + if (state->offset > copy) { /* copy from window */ + copy = state->offset - copy; + if (copy > state->whave) { + if (state->sane) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + Trace((stderr, "inflate.c too far\n")); + copy -= state->whave; + if (copy > state->length) copy = state->length; + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = 0; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; +#endif + } + if (copy > state->wnext) { + copy -= state->wnext; + from = state->window + (state->wsize - copy); + } + else + from = state->window + (state->wnext - copy); + if (copy > state->length) copy = state->length; + } + else { /* copy from output */ + from = put - state->offset; + copy = state->length; + } + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = *from++; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; + case LIT: + if (left == 0) goto inf_leave; + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + case CHECK: + if (state->wrap) { + NEEDBITS(32); + out -= left; + strm->total_out += out; + state->total += out; + if (out) + strm->adler = state->check = + UPDATE(state->check, put - out, out); + out = left; + if (( +#ifdef GUNZIP + state->flags ? hold : +#endif + REVERSE(hold)) != state->check) { + strm->msg = (char *)"incorrect data check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: check matches trailer\n")); + } +#ifdef GUNZIP + state->mode = LENGTH; + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); + if (hold != (state->total & 0xffffffffUL)) { + strm->msg = (char *)"incorrect length check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: length matches trailer\n")); + } +#endif + state->mode = DONE; + case DONE: + ret = Z_STREAM_END; + goto inf_leave; + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + default: + return Z_STREAM_ERROR; + } + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: + RESTORE(); + if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) + if (updatewindow(strm, out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + in -= strm->avail_in; + out -= strm->avail_out; + strm->total_in += in; + strm->total_out += out; + state->total += out; + if (state->wrap && out) + strm->adler = state->check = + UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 64 : 0) + + (state->mode == TYPE ? 128 : 0) + + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); + if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) + ret = Z_BUF_ERROR; + return ret; +} + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->window != Z_NULL) ZFREE(strm, state->window); + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) +z_streamp strm; +const Bytef *dictionary; +uInt dictLength; +{ + struct inflate_state FAR *state; + unsigned long id; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->wrap != 0 && state->mode != DICT) + return Z_STREAM_ERROR; + + /* check for correct dictionary id */ + if (state->mode == DICT) { + id = adler32(0L, Z_NULL, 0); + id = adler32(id, dictionary, dictLength); + if (id != state->check) + return Z_DATA_ERROR; + } + + /* copy dictionary to window */ + if (updatewindow(strm, strm->avail_out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + if (dictLength > state->wsize) { + zmemcpy(state->window, dictionary + dictLength - state->wsize, + state->wsize); + state->whave = state->wsize; + } + else { + zmemcpy(state->window + state->wsize - dictLength, dictionary, + dictLength); + state->whave = dictLength; + } + state->havedict = 1; + Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +int ZEXPORT inflateGetHeader(strm, head) +z_streamp strm; +gz_headerp head; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; + + /* save header structure */ + state->head = head; + head->done = 0; + return Z_OK; +} + +/* + Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found + or when out of input. When called, *have is the number of pattern bytes + found in order so far, in 0..3. On return *have is updated to the new + state. If on return *have equals four, then the pattern was found and the + return value is how many bytes were read including the last byte of the + pattern. If *have is less than four, then the pattern has not been found + yet and the return value is len. In the latter case, syncsearch() can be + called again with more data and the *have state. *have is initialized to + zero for the first call. + */ +local unsigned syncsearch(have, buf, len) +unsigned FAR *have; +unsigned char FAR *buf; +unsigned len; +{ + unsigned got; + unsigned next; + + got = *have; + next = 0; + while (next < len && got < 4) { + if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) + got++; + else if (buf[next]) + got = 0; + else + got = 4 - got; + next++; + } + *have = got; + return next; +} + +int ZEXPORT inflateSync(strm) +z_streamp strm; +{ + unsigned len; /* number of bytes to look at or looked at */ + unsigned long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + + /* check parameters */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; + + /* if first time, start search in bit buffer */ + if (state->mode != SYNC) { + state->mode = SYNC; + state->hold <<= state->bits & 7; + state->bits -= state->bits & 7; + len = 0; + while (state->bits >= 8) { + buf[len++] = (unsigned char)(state->hold); + state->hold >>= 8; + state->bits -= 8; + } + state->have = 0; + syncsearch(&(state->have), buf, len); + } + + /* search available input */ + len = syncsearch(&(state->have), strm->next_in, strm->avail_in); + strm->avail_in -= len; + strm->next_in += len; + strm->total_in += len; + + /* return no joy or set up to restart inflate() on a new block */ + if (state->have != 4) return Z_DATA_ERROR; + in = strm->total_in; out = strm->total_out; + inflateReset(strm); + strm->total_in = in; strm->total_out = out; + state->mode = TYPE; + return Z_OK; +} + +/* + Returns true if inflate is currently at the end of a block generated by + Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + implementation to provide an additional safety check. PPP uses + Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored + block. When decompressing, PPP checks that at the end of input packet, + inflate is waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + return state->mode == STORED && state->bits == 0; +} + +int ZEXPORT inflateCopy(dest, source) +z_streamp dest; +z_streamp source; +{ + struct inflate_state FAR *state; + struct inflate_state FAR *copy; + unsigned char FAR *window; + unsigned wsize; + + /* check input */ + if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)source->state; + + /* allocate space */ + copy = (struct inflate_state FAR *) + ZALLOC(source, 1, sizeof(struct inflate_state)); + if (copy == Z_NULL) return Z_MEM_ERROR; + window = Z_NULL; + if (state->window != Z_NULL) { + window = (unsigned char FAR *) + ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); + if (window == Z_NULL) { + ZFREE(source, copy); + return Z_MEM_ERROR; + } + } + + /* copy state */ + zmemcpy(dest, source, sizeof(z_stream)); + zmemcpy(copy, state, sizeof(struct inflate_state)); + if (state->lencode >= state->codes && + state->lencode <= state->codes + ENOUGH - 1) { + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + } + copy->next = copy->codes + (state->next - state->codes); + if (window != Z_NULL) { + wsize = 1U << state->wbits; + zmemcpy(window, state->window, wsize); + } + copy->window = window; + dest->state = (struct internal_state FAR *)copy; + return Z_OK; +} + +int ZEXPORT inflateUndermine(strm, subvert) +z_streamp strm; +int subvert; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + state->sane = !subvert; +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + return Z_OK; +#else + state->sane = 1; + return Z_DATA_ERROR; +#endif +} + +long ZEXPORT inflateMark(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + state = (struct inflate_state FAR *)strm->state; + return ((long)(state->back) << 16) + + (state->mode == COPY ? state->length : + (state->mode == MATCH ? state->was - state->length : 0)); +} diff --git a/zlib-1.2.5/inflate.h b/zlib-1.2.5/inflate.h new file mode 100644 index 000000000..95f4986d4 --- /dev/null +++ b/zlib-1.2.5/inflate.h @@ -0,0 +1,122 @@ +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY_, /* i/o: same as COPY below, but only first time in */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN_, /* i: same as LEN below, but only first time in */ + LEN, /* i: waiting for length/lit/eob code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ + LENGTH, /* i: waiting for 32-bit length (gzip) */ + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to BAD or MEM on error -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) or (raw) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> + HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + (raw) -> TYPEDO + Read deflate blocks: + TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK + STORED -> COPY_ -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN_ + LEN_ -> LEN + Read deflate codes in fixed or dynamic block: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 10K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + gz_headerp head; /* where to save gzip header information */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ + int sane; /* if false, allow invalid distance too far */ + int back; /* bits back of last unprocessed length/lit */ + unsigned was; /* initial length of match */ +}; diff --git a/zlib-1.2.5/inftrees.c b/zlib-1.2.5/inftrees.c new file mode 100644 index 000000000..11e9c52ac --- /dev/null +++ b/zlib-1.2.5/inftrees.c @@ -0,0 +1,330 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#define MAXBITS 15 + +const char inflate_copyright[] = + " inflate 1.2.5 Copyright 1995-2010 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* + Build a set of tables to decode the provided canonical Huffman code. + The code lengths are lens[0..codes-1]. The result starts at *table, + whose indices are 0..2^bits-1. work is a writable array of at least + lens shorts, which is used as a work area. type is the type of code + to be generated, CODES, LENS, or DISTS. On return, zero is success, + -1 is an invalid code, and +1 means that ENOUGH isn't enough. table + on return points to the next available entry's address. bits is the + requested root table index bits, and on return it is the actual root + table index bits. It will differ if the request is greater than the + longest code or if it is less than the shortest code. + */ +int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) +codetype type; +unsigned short FAR *lens; +unsigned codes; +code FAR * FAR *table; +unsigned FAR *bits; +unsigned short FAR *work; +{ + unsigned len; /* a code's length in bits */ + unsigned sym; /* index of code symbols */ + unsigned min, max; /* minimum and maximum code lengths */ + unsigned root; /* number of index bits for root table */ + unsigned curr; /* number of index bits for current table */ + unsigned drop; /* code bits to drop for sub-table */ + int left; /* number of prefix codes available */ + unsigned used; /* code entries in table used */ + unsigned huff; /* Huffman code */ + unsigned incr; /* for incrementing code, index */ + unsigned fill; /* index for replicating entries */ + unsigned low; /* low bits for current root entry */ + unsigned mask; /* mask for low root bits */ + code here; /* table entry for duplication */ + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ + int end; /* use base and extra for symbol > end */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + static const unsigned short lext[31] = { /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195}; + static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0}; + static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64}; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) + count[len] = 0; + for (sym = 0; sym < codes; sym++) + count[lens[sym]]++; + + /* bound code lengths, force root to be within code lengths */ + root = *bits; + for (max = MAXBITS; max >= 1; max--) + if (count[max] != 0) break; + if (root > max) root = max; + if (max == 0) { /* no symbols to code at all */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)1; + here.val = (unsigned short)0; + *(*table)++ = here; /* make a table to force an error */ + *(*table)++ = here; + *bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) + if (count[min] != 0) break; + if (root < min) root = min; + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) return -1; /* over-subscribed */ + } + if (left > 0 && (type == CODES || max != 1)) + return -1; /* incomplete set */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + count[len]; + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) + if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ + end = 19; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; + extra -= 257; + end = 256; + break; + default: /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize state for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = *table; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = (unsigned)(-1); /* trigger new sub-table when len > root */ + used = 1U << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + here.bits = (unsigned char)(len - drop); + if ((int)(work[sym]) < end) { + here.op = (unsigned char)0; + here.val = work[sym]; + } + else if ((int)(work[sym]) > end) { + here.op = (unsigned char)(extra[work[sym]]); + here.val = base[work[sym]]; + } + else { + here.op = (unsigned char)(32 + 64); /* end of block */ + here.val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1U << (len - drop); + fill = 1U << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + next[(huff >> drop) + fill] = here; + } while (fill != 0); + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + + /* go to next symbol, update count, len */ + sym++; + if (--(count[len]) == 0) { + if (len == max) break; + len = lens[work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) != low) { + /* if first time, transition to sub-tables */ + if (drop == 0) + drop = root; + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = (int)(1 << curr); + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) break; + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1U << curr; + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* point entry in root table to sub-table */ + low = huff & mask; + (*table)[low].op = (unsigned char)curr; + (*table)[low].bits = (unsigned char)root; + (*table)[low].val = (unsigned short)(next - *table); + } + } + + /* + Fill in rest of table for incomplete codes. This loop is similar to the + loop above in incrementing huff for table indices. It is assumed that + len is equal to curr + drop, so there is no loop needed to increment + through high index bits. When the current sub-table is filled, the loop + drops back to the root table to fill in any remaining entries there. + */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)(len - drop); + here.val = (unsigned short)0; + while (huff != 0) { + /* when done with sub-table, drop back to root table */ + if (drop != 0 && (huff & mask) != low) { + drop = 0; + len = root; + next = *table; + here.bits = (unsigned char)len; + } + + /* put invalid code marker in table */ + next[huff >> drop] = here; + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + } + + /* set return parameters */ + *table += used; + *bits = root; + return 0; +} diff --git a/zlib-1.2.5/inftrees.h b/zlib-1.2.5/inftrees.h new file mode 100644 index 000000000..baa53a0b1 --- /dev/null +++ b/zlib-1.2.5/inftrees.h @@ -0,0 +1,62 @@ +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of the dynamic table. The maximum number of code structures is + 1444, which is the sum of 852 for literal/length codes and 592 for distance + codes. These values were found by exhaustive searches using the program + examples/enough.c found in the zlib distribtution. The arguments to that + program are the number of symbols, the initial root table size, and the + maximum bit length of a code. "enough 286 9 15" for literal/length codes + returns returns 852, and "enough 30 6 15" for distance codes returns 592. + The initial root table size (9 or 6) is found in the fifth argument of the + inflate_table() calls in inflate.c and infback.c. If the root table size is + changed, then these maximum sizes would be need to be recalculated and + updated. */ +#define ENOUGH_LENS 852 +#define ENOUGH_DISTS 592 +#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) + +/* Type of code to build for inflate_table() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/zlib-1.2.5/minigzip.c b/zlib-1.2.5/minigzip.c new file mode 100644 index 000000000..9825ccc3a --- /dev/null +++ b/zlib-1.2.5/minigzip.c @@ -0,0 +1,440 @@ +/* minigzip.c -- simulate gzip using the zlib compression library + * Copyright (C) 1995-2006, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * minigzip is a minimal implementation of the gzip utility. This is + * only an example of using zlib and isn't meant to replace the + * full-featured gzip. No attempt is made to deal with file systems + * limiting names to 14 or 8+3 characters, etc... Error checking is + * very limited. So use minigzip only for testing; use gzip for the + * real thing. On MSDOS, use only on file names without extension + * or in pipe mode. + */ + +/* @(#) $Id$ */ + +#include "zlib.h" +#include <stdio.h> + +#ifdef STDC +# include <string.h> +# include <stdlib.h> +#endif + +#ifdef USE_MMAP +# include <sys/types.h> +# include <sys/mman.h> +# include <sys/stat.h> +#endif + +#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) +# include <fcntl.h> +# include <io.h> +# ifdef UNDER_CE +# include <stdlib.h> +# endif +# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) +#else +# define SET_BINARY_MODE(file) +#endif + +#ifdef VMS +# define unlink delete +# define GZ_SUFFIX "-gz" +#endif +#ifdef RISCOS +# define unlink remove +# define GZ_SUFFIX "-gz" +# define fileno(file) file->__file +#endif +#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include <unix.h> /* for fileno */ +#endif + +#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) +#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ + extern int unlink OF((const char *)); +#endif +#endif + +#if defined(UNDER_CE) +# include <windows.h> +# define perror(s) pwinerror(s) + +/* Map the Windows error number in ERROR to a locale-dependent error + message string and return a pointer to it. Typically, the values + for ERROR come from GetLastError. + + The string pointed to shall not be modified by the application, + but may be overwritten by a subsequent call to strwinerror + + The strwinerror function does not change the current setting + of GetLastError. */ + +static char *strwinerror (error) + DWORD error; +{ + static char buf[1024]; + + wchar_t *msgbuf; + DWORD lasterr = GetLastError(); + DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, + error, + 0, /* Default language */ + (LPVOID)&msgbuf, + 0, + NULL); + if (chars != 0) { + /* If there is an \r\n appended, zap it. */ + if (chars >= 2 + && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { + chars -= 2; + msgbuf[chars] = 0; + } + + if (chars > sizeof (buf) - 1) { + chars = sizeof (buf) - 1; + msgbuf[chars] = 0; + } + + wcstombs(buf, msgbuf, chars + 1); + LocalFree(msgbuf); + } + else { + sprintf(buf, "unknown win32 error (%ld)", error); + } + + SetLastError(lasterr); + return buf; +} + +static void pwinerror (s) + const char *s; +{ + if (s && *s) + fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ())); + else + fprintf(stderr, "%s\n", strwinerror(GetLastError ())); +} + +#endif /* UNDER_CE */ + +#ifndef GZ_SUFFIX +# define GZ_SUFFIX ".gz" +#endif +#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) + +#define BUFLEN 16384 +#define MAX_NAME_LEN 1024 + +#ifdef MAXSEG_64K +# define local static + /* Needed for systems with limitation on stack size. */ +#else +# define local +#endif + +char *prog; + +void error OF((const char *msg)); +void gz_compress OF((FILE *in, gzFile out)); +#ifdef USE_MMAP +int gz_compress_mmap OF((FILE *in, gzFile out)); +#endif +void gz_uncompress OF((gzFile in, FILE *out)); +void file_compress OF((char *file, char *mode)); +void file_uncompress OF((char *file)); +int main OF((int argc, char *argv[])); + +/* =========================================================================== + * Display error message and exit + */ +void error(msg) + const char *msg; +{ + fprintf(stderr, "%s: %s\n", prog, msg); + exit(1); +} + +/* =========================================================================== + * Compress input to output then close both files. + */ + +void gz_compress(in, out) + FILE *in; + gzFile out; +{ + local char buf[BUFLEN]; + int len; + int err; + +#ifdef USE_MMAP + /* Try first compressing with mmap. If mmap fails (minigzip used in a + * pipe), use the normal fread loop. + */ + if (gz_compress_mmap(in, out) == Z_OK) return; +#endif + for (;;) { + len = (int)fread(buf, 1, sizeof(buf), in); + if (ferror(in)) { + perror("fread"); + exit(1); + } + if (len == 0) break; + + if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); + } + fclose(in); + if (gzclose(out) != Z_OK) error("failed gzclose"); +} + +#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */ + +/* Try compressing the input file at once using mmap. Return Z_OK if + * if success, Z_ERRNO otherwise. + */ +int gz_compress_mmap(in, out) + FILE *in; + gzFile out; +{ + int len; + int err; + int ifd = fileno(in); + caddr_t buf; /* mmap'ed buffer for the entire input file */ + off_t buf_len; /* length of the input file */ + struct stat sb; + + /* Determine the size of the file, needed for mmap: */ + if (fstat(ifd, &sb) < 0) return Z_ERRNO; + buf_len = sb.st_size; + if (buf_len <= 0) return Z_ERRNO; + + /* Now do the actual mmap: */ + buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); + if (buf == (caddr_t)(-1)) return Z_ERRNO; + + /* Compress the whole file at once: */ + len = gzwrite(out, (char *)buf, (unsigned)buf_len); + + if (len != (int)buf_len) error(gzerror(out, &err)); + + munmap(buf, buf_len); + fclose(in); + if (gzclose(out) != Z_OK) error("failed gzclose"); + return Z_OK; +} +#endif /* USE_MMAP */ + +/* =========================================================================== + * Uncompress input to output then close both files. + */ +void gz_uncompress(in, out) + gzFile in; + FILE *out; +{ + local char buf[BUFLEN]; + int len; + int err; + + for (;;) { + len = gzread(in, buf, sizeof(buf)); + if (len < 0) error (gzerror(in, &err)); + if (len == 0) break; + + if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { + error("failed fwrite"); + } + } + if (fclose(out)) error("failed fclose"); + + if (gzclose(in) != Z_OK) error("failed gzclose"); +} + + +/* =========================================================================== + * Compress the given file: create a corresponding .gz file and remove the + * original. + */ +void file_compress(file, mode) + char *file; + char *mode; +{ + local char outfile[MAX_NAME_LEN]; + FILE *in; + gzFile out; + + if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { + fprintf(stderr, "%s: filename too long\n", prog); + exit(1); + } + + strcpy(outfile, file); + strcat(outfile, GZ_SUFFIX); + + in = fopen(file, "rb"); + if (in == NULL) { + perror(file); + exit(1); + } + out = gzopen(outfile, mode); + if (out == NULL) { + fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); + exit(1); + } + gz_compress(in, out); + + unlink(file); +} + + +/* =========================================================================== + * Uncompress the given file and remove the original. + */ +void file_uncompress(file) + char *file; +{ + local char buf[MAX_NAME_LEN]; + char *infile, *outfile; + FILE *out; + gzFile in; + size_t len = strlen(file); + + if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { + fprintf(stderr, "%s: filename too long\n", prog); + exit(1); + } + + strcpy(buf, file); + + if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { + infile = file; + outfile = buf; + outfile[len-3] = '\0'; + } else { + outfile = file; + infile = buf; + strcat(infile, GZ_SUFFIX); + } + in = gzopen(infile, "rb"); + if (in == NULL) { + fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); + exit(1); + } + out = fopen(outfile, "wb"); + if (out == NULL) { + perror(file); + exit(1); + } + + gz_uncompress(in, out); + + unlink(infile); +} + + +/* =========================================================================== + * Usage: minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...] + * -c : write to standard output + * -d : decompress + * -f : compress with Z_FILTERED + * -h : compress with Z_HUFFMAN_ONLY + * -r : compress with Z_RLE + * -1 to -9 : compression level + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + int copyout = 0; + int uncompr = 0; + gzFile file; + char *bname, outmode[20]; + + strcpy(outmode, "wb6 "); + + prog = argv[0]; + bname = strrchr(argv[0], '/'); + if (bname) + bname++; + else + bname = argv[0]; + argc--, argv++; + + if (!strcmp(bname, "gunzip")) + uncompr = 1; + else if (!strcmp(bname, "zcat")) + copyout = uncompr = 1; + + while (argc > 0) { + if (strcmp(*argv, "-c") == 0) + copyout = 1; + else if (strcmp(*argv, "-d") == 0) + uncompr = 1; + else if (strcmp(*argv, "-f") == 0) + outmode[3] = 'f'; + else if (strcmp(*argv, "-h") == 0) + outmode[3] = 'h'; + else if (strcmp(*argv, "-r") == 0) + outmode[3] = 'R'; + else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && + (*argv)[2] == 0) + outmode[2] = (*argv)[1]; + else + break; + argc--, argv++; + } + if (outmode[3] == ' ') + outmode[3] = 0; + if (argc == 0) { + SET_BINARY_MODE(stdin); + SET_BINARY_MODE(stdout); + if (uncompr) { + file = gzdopen(fileno(stdin), "rb"); + if (file == NULL) error("can't gzdopen stdin"); + gz_uncompress(file, stdout); + } else { + file = gzdopen(fileno(stdout), outmode); + if (file == NULL) error("can't gzdopen stdout"); + gz_compress(stdin, file); + } + } else { + if (copyout) { + SET_BINARY_MODE(stdout); + } + do { + if (uncompr) { + if (copyout) { + file = gzopen(*argv, "rb"); + if (file == NULL) + fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv); + else + gz_uncompress(file, stdout); + } else { + file_uncompress(*argv); + } + } else { + if (copyout) { + FILE * in = fopen(*argv, "rb"); + + if (in == NULL) { + perror(*argv); + } else { + file = gzdopen(fileno(stdout), outmode); + if (file == NULL) error("can't gzdopen stdout"); + + gz_compress(in, file); + } + + } else { + file_compress(*argv, outmode); + } + } + } while (argv++, --argc); + } + return 0; +} diff --git a/zlib-1.2.5/trees.c b/zlib-1.2.5/trees.c new file mode 100644 index 000000000..56e9bb1c1 --- /dev/null +++ b/zlib-1.2.5/trees.c @@ -0,0 +1,1244 @@ +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2010 Jean-loup Gailly + * detect_data_type() function provided freely by Cosmin Truta, 2006 + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id$ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef DEBUG +# include <ctype.h> +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +#define Buf_size (8 * 2*sizeof(char)) +/* Number of bits used within bi_buf. (bi_buf might be implemented on + * more than 16 bits on some systems.) + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* GEN_TREES_H */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +local static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Local (static) routines in this file. + */ + +local void tr_static_init OF((void)); +local void init_block OF((deflate_state *s)); +local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); +local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); +local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); +local void build_tree OF((deflate_state *s, tree_desc *desc)); +local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local int build_bl_tree OF((deflate_state *s)); +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, + int blcodes)); +local void compress_block OF((deflate_state *s, ct_data *ltree, + ct_data *dtree)); +local int detect_data_type OF((deflate_state *s)); +local unsigned bi_reverse OF((unsigned value, int length)); +local void bi_windup OF((deflate_state *s)); +local void bi_flush OF((deflate_state *s)); +local void copy_block OF((deflate_state *s, charf *buf, unsigned len, + int header)); + +#ifdef GEN_TREES_H +local void gen_trees_header OF((void)); +#endif + +#ifndef DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (ush)value << s->bi_valid; + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= (ush)value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = value;\ + s->bi_buf |= (ush)val << s->bi_valid;\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (ush)(value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* DEBUG */ + + +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init() +{ +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ +#ifdef NO_INIT_GLOBAL_POINTERS + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; +#endif + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1<<extra_lbits[code]); n++) { + _length_code[length++] = (uch)code; + } + } + Assert (length == 256, "tr_static_init: length != 256"); + /* Note that the length 255 (match length 258) can be represented + * in two different ways: code 284 + 5 bits or code 285, so we + * overwrite length_code[255] to use the best encoding: + */ + _length_code[length-1] = (uch)code; + + /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<<extra_dbits[code]); n++) { + _dist_code[dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: dist != 256"); + dist >>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Genererate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef DEBUG +# include <stdio.h> +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width)-1 ? ",\n" : ", ")) + +void gen_trees_header() +{ + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, + "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void ZLIB_INTERNAL _tr_init(s) + deflate_state *s; +{ + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; + s->last_eob_len = 8; /* enough lookahead for inflate */ +#ifdef DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(s) + deflate_state *s; +{ + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->last_lit = s->matches = 0; +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(s, tree, k) + deflate_state *s; + ct_data *tree; /* the tree to restore */ + int k; /* node to move down */ +{ + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n-base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (bits + xbits); + if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + } + if (overflow == 0) return; + + Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if ((unsigned) tree[m].Len != (unsigned) bits) { + Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((long)bits - (long)tree[m].Len) + *(long)tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes (tree, max_code, bl_count) + ct_data *tree; /* the tree to decorate */ + int max_code; /* largest code with non zero frequency */ + ushf *bl_count; /* number of codes at each bit length */ +{ + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + ush code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, + "inconsistent bit counts"); + Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); + + for (n = 0; n <= max_code; n++) { + int len = tree[n].Len; + if (len == 0) continue; + /* Now reverse the bits */ + tree[n].Code = bi_reverse(next_code[len]++, len); + + Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", + n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); + } +} + +/* =========================================================================== + * Construct one Huffman tree and assigns the code bit strings and lengths. + * Update the total bit length for the current block. + * IN assertion: the field freq is set for all tree elements. + * OUT assertions: the fields len and code are set to the optimal bit length + * and corresponding code. The length opt_len is updated; static_len is + * also updated if stree is not null. The field max_code is set. + */ +local void build_tree(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code+1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(s) + deflate_state *s; +{ + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*(max_blindex+1) + 5+5+4; + Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(s, lcodes, dcodes, blcodes) + deflate_state *s; + int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ +#ifdef DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; +#endif + copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + * The current inflate code requires 9 bits of lookahead. If the + * last two codes for the previous block (real code plus EOB) were coded + * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode + * the last real code. In this case we send two empty static blocks instead + * of one. (There are no problems if the previous block is stored or fixed.) + * To simplify the code, we assume the worst case of last real code encoded + * on one bit only. + */ +void ZLIB_INTERNAL _tr_align(s) + deflate_state *s; +{ + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); + /* Of the 10 bits for the empty block, we have already sent + * (10 - bi_valid) bits. The lookahead for the last real code (before + * the EOB of the previous block) was thus at least one plus the length + * of the EOB plus what we have just sent of the empty static block. + */ + if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; +#endif + bi_flush(s); + } + s->last_eob_len = 7; +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block, or NULL if too old */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is binary or text */ + if (s->strm->data_type == Z_UNKNOWN) + s->strm->data_type = detect_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len+4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + +#ifdef FORCE_STATIC + } else if (static_lenb >= 0) { /* force static trees */ +#else + } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { +#endif + send_bits(s, (STATIC_TREES<<1)+last, 3); + compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1)+last, 3); + send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, + max_blindex+1); + compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); +#ifdef DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int ZLIB_INTERNAL _tr_tally (s, dist, lc) + deflate_state *s; + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + s->d_buf[s->last_lit] = (ush)dist; + s->l_buf[s->last_lit++] = (uch)lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + +#ifdef TRUNCATE_BLOCK + /* Try to guess if it is profitable to stop the current block here */ + if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { + /* Compute an upper bound for the compressed length */ + ulg out_length = (ulg)s->last_lit*8L; + ulg in_length = (ulg)((long)s->strstart - s->block_start); + int dcode; + for (dcode = 0; dcode < D_CODES; dcode++) { + out_length += (ulg)s->dyn_dtree[dcode].Freq * + (5L+extra_dbits[dcode]); + } + out_length >>= 3; + Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", + s->last_lit, in_length, out_length, + 100L - out_length*100L/in_length)); + if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; + } +#endif + return (s->last_lit == s->lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(s, ltree, dtree) + deflate_state *s; + ct_data *ltree; /* literal tree */ + ct_data *dtree; /* distance tree */ +{ + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned lx = 0; /* running index in l_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->last_lit != 0) do { + dist = s->d_buf[lx]; + lc = s->l_buf[lx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + "pendingBuf overflow"); + + } while (lx < s->last_lit); + + send_code(s, END_BLOCK, ltree); + s->last_eob_len = ltree[END_BLOCK].Len; +} + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +local int detect_data_type(s) + deflate_state *s; +{ + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + unsigned long black_mask = 0xf3ffc07fUL; + int n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>= 1) + if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + return Z_BINARY; + + /* Check for textual ("white-listed") bytes. */ + if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 + || s->dyn_ltree[13].Freq != 0) + return Z_TEXT; + for (n = 32; n < LITERALS; n++) + if (s->dyn_ltree[n].Freq != 0) + return Z_TEXT; + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(code, len) + unsigned code; /* the value to invert */ + int len; /* its bit length */ +{ + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(s) + deflate_state *s; +{ + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(s) + deflate_state *s; +{ + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->bits_sent = (s->bits_sent+7) & ~7; +#endif +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +local void copy_block(s, buf, len, header) + deflate_state *s; + charf *buf; /* the input data */ + unsigned len; /* its length */ + int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + s->last_eob_len = 8; /* enough lookahead for inflate */ + + if (header) { + put_short(s, (ush)len); + put_short(s, (ush)~len); +#ifdef DEBUG + s->bits_sent += 2*16; +#endif + } +#ifdef DEBUG + s->bits_sent += (ulg)len<<3; +#endif + while (len--) { + put_byte(s, *buf++); + } +} diff --git a/zlib-1.2.5/trees.h b/zlib-1.2.5/trees.h new file mode 100644 index 000000000..d35639d82 --- /dev/null +++ b/zlib-1.2.5/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/zlib-1.2.5/uncompr.c b/zlib-1.2.5/uncompr.c new file mode 100644 index 000000000..ad98be3a5 --- /dev/null +++ b/zlib-1.2.5/uncompr.c @@ -0,0 +1,59 @@ +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; + + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + + err = inflateInit(&stream); + if (err != Z_OK) return err; + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + inflateEnd(&stream); + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; + } + *destLen = stream.total_out; + + err = inflateEnd(&stream); + return err; +} diff --git a/zlib-1.2.5/zconf.h b/zlib-1.2.5/zconf.h new file mode 100644 index 000000000..02ce56c43 --- /dev/null +++ b/zlib-1.2.5/zconf.h @@ -0,0 +1,428 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ + +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define uncompress z_uncompress +# define zError z_zError +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# define gzFile z_gzFile +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include <windows.h> + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef STDC +# include <sys/types.h> /* for off_t */ +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include <unistd.h> /* for SEEK_* and off_t */ +# ifdef VMS +# include <unixio.h> /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define z_off64_t off64_t +#else +# define z_off64_t z_off_t +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/zlib-1.2.5/zlib.h b/zlib-1.2.5/zlib.h new file mode 100644 index 000000000..bfbba83e8 --- /dev/null +++ b/zlib-1.2.5/zlib.h @@ -0,0 +1,1613 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.5, April 19th, 2010 + + Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.5" +#define ZLIB_VERNUM 0x1250 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 5 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use in the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). Some + output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed code + block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the stream + are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least the + value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect the + compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the + exact value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit() does not process any header information -- that is deferred + until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing will + resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all the uncompressed data. (The size + of the uncompressed data may have been saved by the compressor for this + purpose.) The next operation on this stream must be inflateEnd to deallocate + the decompression state. The use of Z_FINISH is never required, but can be + used to inform inflate that a faster approach may be used for the single + inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK or Z_TREES is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained, so applications that need that information should + instead use raw inflate, see inflateInit2() below, or inflateBack() and + perform their own processing of the gzip header and trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any call + of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. The + stream will keep the same compression level and any other attributes that + may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression level is changed, the input available so far is + compressed with the old level (and may be flushed); the new level will take + effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to be + compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if + strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been + found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the + success case, the application may save the current current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above or -1 << 16 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the normal + behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef voidp gzFile; /* opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) Also "a" + can be used instead of "w" to request that the gzip stream that will be + written be appended to the file. "+" will result in an error, since reading + and writing to the same gzip file is not supported. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Two buffers are allocated, either both of the specified size when + writing, or one of the specified size and the other twice that size when + reading. A larger buffer size of, for example, 64K or 128K bytes will + noticeably increase the speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file was not in gzip format, gzread copies the given number of + bytes into the buffer. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream, or failing that, reading the rest + of the input file directly without decompression. The entire input file + will be read if gzread is called until it returns less than the requested + len. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or 0 in case of error. The number of + uncompressed bytes written is limited to 8191, or one less than the buffer + size given to gzbuffer(). The caller should assure that this limit is not + exceeded. If it is exceeded, then gzprintf() will return an error (0) with + nothing written. In this case, there may also be a buffer overflow with + unpredictable consequences, which is possible only if zlib was compiled with + the insecure functions sprintf() or vsprintf() because the secure snprintf() + or vsnprintf() functions were not available. This can be determined using + zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatented gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. This state can change from + false to true while reading the input file if the end of a gzip stream is + reached, but is followed by data that is not another gzip stream. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the for the crc. Pre- and post-conditioning (one's + complement) is performed within this function so it shouldn't be done by the + application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# ifdef _LARGEFILE64_SOURCE + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +/* hack for buggy compilers */ +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; +#endif + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/zlib-1.2.5/zutil.c b/zlib-1.2.5/zutil.c new file mode 100644 index 000000000..898ed345b --- /dev/null +++ b/zlib-1.2.5/zutil.c @@ -0,0 +1,318 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +const char * const z_errmsg[10] = { +"need dictionary", /* Z_NEED_DICT 2 */ +"stream end", /* Z_STREAM_END 1 */ +"", /* Z_OK 0 */ +"file error", /* Z_ERRNO (-1) */ +"stream error", /* Z_STREAM_ERROR (-2) */ +"data error", /* Z_DATA_ERROR (-3) */ +"insufficient memory", /* Z_MEM_ERROR (-4) */ +"buffer error", /* Z_BUF_ERROR (-5) */ +"incompatible version",/* Z_VERSION_ERROR (-6) */ +""}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch ((int)(sizeof(uInt))) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch ((int)(sizeof(uLong))) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch ((int)(sizeof(voidpf))) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch ((int)(sizeof(z_off_t))) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#ifdef STDC +# ifdef NO_vsnprintf + flags += 1L << 25; +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf + flags += 1L << 25; +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef DEBUG + +# ifndef verbose +# define verbose 0 +# endif +int ZLIB_INTERNAL z_verbose = verbose; + +void ZLIB_INTERNAL z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void ZLIB_INTERNAL zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int ZLIB_INTERNAL zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void ZLIB_INTERNAL zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf = opaque; /* just to make some compilers happy */ + ulg bsize = (ulg)items*size; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + int n; + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + ptr = opaque; /* just to make some compilers happy */ + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + return _halloc((long)items, size); +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + if (opaque) items += size - size; /* make compiler happy */ + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void ZLIB_INTERNAL zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + free(ptr); + if (opaque) return; /* make compiler happy */ +} + +#endif /* MY_ZCALLOC */ diff --git a/zlib-1.2.5/zutil.h b/zlib-1.2.5/zutil.h new file mode 100644 index 000000000..258fa8879 --- /dev/null +++ b/zlib-1.2.5/zutil.h @@ -0,0 +1,274 @@ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include "zlib.h" + +#ifdef STDC +# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) +# include <stddef.h> +# endif +# include <string.h> +# include <stdlib.h> +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include <alloc.h> +# endif +# else /* MSC or DJGPP */ +# include <malloc.h> +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +# ifdef M_I86 +# include <malloc.h> +# endif +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include <unix.h> /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + +#if defined(__BORLANDC__) + #pragma warn -8004 + #pragma warn -8008 + #pragma warn -8066 +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) +# define vsnprintf _vsnprintf +# endif +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif +#ifdef VMS +# define NO_vsnprintf +#endif + +#if defined(pyr) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include <stdio.h> + extern int ZLIB_INTERNAL z_verbose; + extern void ZLIB_INTERNAL z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + + +voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, + unsigned size)); +void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +#endif /* ZUTIL_H */ |